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 rsalvaterra@gmail.com Cc: Rui Salvaterra rsalvaterra@gmail.com Cc: stable@vger.kernel.org Cc: Mike Snitzer snitzer@redhat.com Cc: Christoph Hellwig hch@lst.de Cc: Xiao Ni xni@redhat.com Cc: Mariusz Dabrowski mariusz.dabrowski@intel.com Signed-off-by: Ming Lei ming.lei@redhat.com --- 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;