aboutsummaryrefslogtreecommitdiff
path: root/lib/test_overflow.c
diff options
context:
space:
mode:
authorMing Lei <[email protected]>2020-08-17 18:01:30 +0800
committerJens Axboe <[email protected]>2020-08-17 06:58:36 -0700
commitbcb21c8cc9947286211327d663ace69f07d37a76 (patch)
tree37bafa8348d4fbbddcdbc024c57202022fa222a6 /lib/test_overflow.c
parentd7d8535f377e9ba87edbf7fbbd634ac942f3f54f (diff)
block: loop: set discard granularity and alignment for block device backed loop
In case of block device backend, if the backend supports write zeros, the loop device will set queue flag of QUEUE_FLAG_DISCARD. However, limits.discard_granularity isn't setup, and this way is wrong, see the following description in Documentation/ABI/testing/sysfs-block: A discard_granularity of 0 means that the device does not support discard functionality. Especially 9b15d109a6b2 ("block: improve discard bio alignment in __blkdev_issue_discard()") starts to take q->limits.discard_granularity for computing max discard sectors. And zero discard granularity may cause kernel oops, or fail discard request even though the loop queue claims discard support via QUEUE_FLAG_DISCARD. Fix the issue by setup discard granularity and alignment. Fixes: c52abf563049 ("loop: Better discard support for block devices") Signed-off-by: Ming Lei <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Acked-by: Coly Li <[email protected]> Cc: Hannes Reinecke <[email protected]> Cc: Xiao Ni <[email protected]> Cc: Martin K. Petersen <[email protected]> Cc: Evan Green <[email protected]> Cc: Gwendal Grignou <[email protected]> Cc: Chaitanya Kulkarni <[email protected]> Cc: Andrzej Pietrasiewicz <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
Diffstat (limited to 'lib/test_overflow.c')
0 files changed, 0 insertions, 0 deletions