Skip to content

Commit

Permalink
Discard on zvols should not exceed the length of a block
Browse files Browse the repository at this point in the history
37f9dac 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
  • Loading branch information
ryao authored and behlendorf committed Sep 19, 2015
1 parent 7a27ad0 commit f52ebcb
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions module/zfs/zvol.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit f52ebcb

Please sign in to comment.