diff options
author | Ming Lei <[email protected]> | 2020-08-17 17:52:40 +0800 |
---|---|---|
committer | Jens Axboe <[email protected]> | 2020-08-17 06:59:41 -0700 |
commit | af822aa68fbdf0a480a17462ed70232998127453 (patch) | |
tree | ab7651acb496d12ef007108e8005c3fd07864d87 /lib/test_overflow.c | |
parent | 943b40c832beb71115e38a1c4d99b640b5342738 (diff) |
block: virtio_blk: fix handling single range discard request
1f23816b8eb8 ("virtio_blk: add discard and write zeroes support") starts
to support multi-range discard for virtio-blk. However, the virtio-blk
disk may report max discard segment as 1, at least that is exactly what
qemu is doing.
So far, block layer switches to normal request merge if max discard segment
limit is 1, and multiple bios can be merged to single segment. This way may
cause memory corruption in virtblk_setup_discard_write_zeroes().
Fix the issue by handling single max discard segment in straightforward
way.
Fixes: 1f23816b8eb8 ("virtio_blk: add discard and write zeroes support")
Signed-off-by: Ming Lei <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Cc: Changpeng Liu <[email protected]>
Cc: Daniel Verkamp <[email protected]>
Cc: Michael S. Tsirkin <[email protected]>
Cc: Stefan Hajnoczi <[email protected]>
Cc: Stefano Garzarella <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
Diffstat (limited to 'lib/test_overflow.c')
0 files changed, 0 insertions, 0 deletions