]> git.baikalelectronics.ru Git - kernel.git/commit
dm thin: do not send discards to shared blocks
authorMikulas Patocka <mpatocka@redhat.com>
Fri, 20 Jul 2012 13:25:05 +0000 (14:25 +0100)
committerAlasdair G Kergon <agk@redhat.com>
Fri, 20 Jul 2012 13:25:05 +0000 (14:25 +0100)
commitbc6e02fdf792f033f2ca1d6588e81d8556def05d
tree586e7da8f7bd3e895b52514bb4bd1ff1f1400181
parentd20f67520cf5dbce90bdfdf62a669b664ab2ce5f
dm thin: do not send discards to shared blocks

When process_discard receives a partial discard that doesn't cover a
full block, it sends this discard down to that block. Unfortunately, the
block can be shared and the discard would corrupt the other snapshots
sharing this block.

This patch detects block sharing and ends the discard with success when
sending it to the shared block.

The above change means that if the device supports discard it can't be
guaranteed that a discard request zeroes data. Therefore, we set
ti->discard_zeroes_data_unsupported.

Thin target discard support with this bug arrived in commit
b9d78a392ce92d7f5e280d52669e70b2ed9cce92 (dm thin: support discards).

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@kernel.org
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
drivers/md/dm-thin.c