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 openzfs#3798
  • Loading branch information
ryao committed Oct 6, 2015
1 parent b6c8fcd commit 52a744f
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 @@ -637,6 +637,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 52a744f

Please sign in to comment.