Obviously the created discard bio has to be aligned with logical block
size.
Fixes: 744889b7cbb56a6 ("block: don't deal with discard limit in
blkdev_issue_discard()")
Reported-by: Rui Salvaterra <[email protected]>
Cc: Rui Salvaterra <[email protected]>
Cc: [email protected]
Cc: Mike Snitzer <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Cc: Xiao Ni <[email protected]>
Cc: Mariusz Dabrowski <[email protected]>
Signed-off-by: Ming Lei <[email protected]>
---
block/blk-lib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/blk-lib.c b/block/blk-lib.c
index bbd44666f2b5..aa3944946b2f 100644
--- a/block/blk-lib.c
+++ b/block/blk-lib.c
@@ -59,7 +59,7 @@ int __blkdev_issue_discard(struct block_device *bdev,
sector_t sector,
if (!req_sects)
goto fail;
if (req_sects > UINT_MAX >> 9)
- req_sects = UINT_MAX >> 9;
+ req_sects = (UINT_MAX >> 9) & ~bs_mask;
end_sect = sector + req_sects;
--
2.9.5