]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Discard on zvols should not exceed the length of a block
authorRichard Yao <ryao@gentoo.org>
Fri, 18 Sep 2015 12:32:52 +0000 (08:32 -0400)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Sat, 19 Sep 2015 21:00:14 +0000 (14:00 -0700)
37f9dac592bf5889c3efb305c48ac39b4c7dd140 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

module/zfs/zvol.c

index bcdd8e8def6db9c6325a3fc05c9ab61836c8046d..37c39d19ad58a5fecaf4d9a6ac2cd6875374ee02 100644 (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