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>
This commit is contained in:
Richard Yao 2015-09-18 08:32:52 -04:00 committed by Ned Bass
parent 7a27ad00ae
commit 0d00e812d9
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