[PATCH 1/3] block: make sure discard bio is aligned with logical block size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
Cc: Rui Salvaterra <rsalvaterra@xxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
Cc: Mike Snitzer <snitzer@xxxxxxxxxx>
Cc: Christoph Hellwig <hch@xxxxxx>
Cc: Xiao Ni <xni@xxxxxxxxxx>
Cc: Mariusz Dabrowski <mariusz.dabrowski@xxxxxxxxx>
Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx>
---
 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




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux