Discard on zvols should not exceed the length of a block

37f9dac592 replaced the end-start
calculation with a cached value, but neglected to update it on discard
operations. This can cause us to discard data not requested, causing
data loss on zvols.

Reported-by: Richard Connon <richard.connon@zynstra.com>
Signed-off-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #3798
This commit is contained in:
Richard Yao 2015-09-18 08:32:52 -04:00 committed by Brian Behlendorf
parent 7a27ad00ae
commit f52ebcb3eb
1 changed files with 1 additions and 0 deletions

View File

@ -662,6 +662,7 @@ zvol_discard(struct bio *bio)
if (!(bio->bi_rw & REQ_SECURE)) {
start = P2ROUNDUP(start, zv->zv_volblocksize);
end = P2ALIGN(end, zv->zv_volblocksize);
size = end - start;
}
#endif