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:
parent
7a27ad00ae
commit
f52ebcb3eb
|
@ -662,6 +662,7 @@ zvol_discard(struct bio *bio)
|
||||||
if (!(bio->bi_rw & REQ_SECURE)) {
|
if (!(bio->bi_rw & REQ_SECURE)) {
|
||||||
start = P2ROUNDUP(start, zv->zv_volblocksize);
|
start = P2ROUNDUP(start, zv->zv_volblocksize);
|
||||||
end = P2ALIGN(end, zv->zv_volblocksize);
|
end = P2ALIGN(end, zv->zv_volblocksize);
|
||||||
|
size = end - start;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue