On 2020-08-06 17:28, Bart Van Assche wrote: > On 2020-08-06 14:58, Keith Busch wrote: >> A previous commit aligning splits to physical block sizes inadvertently >> modified one return case such that that it now returns 0 length splits >> when the number of sectors doesn't exceed the physical offset. This >> later hits a BUG in bio_split(). Restore the previous working behavior. >> >> Reported-by: Eric Deal <eric.deal@xxxxxxx> >> Cc: Bart Van Assche <bvanassche@xxxxxxx> >> Cc: stable@xxxxxxxxxxxxxxx >> Fixes: 9cc5169cd478b ("block: Improve physical block alignment of split bios") >> Signed-off-by: Keith Busch <kbusch@xxxxxxxxxx> >> --- >> block/blk-merge.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/block/blk-merge.c b/block/blk-merge.c >> index 5196dc145270..d7fef954d42f 100644 >> --- a/block/blk-merge.c >> +++ b/block/blk-merge.c >> @@ -154,7 +154,7 @@ static inline unsigned get_max_io_size(struct request_queue *q, >> if (max_sectors > start_offset) >> return max_sectors - start_offset; >> >> - return sectors & (lbs - 1); >> + return sectors & ~(lbs - 1); >> } > > I think we agree that get_max_io_size() should never return zero. However, the above > change seems wrong to me because it will cause get_max_io_size() to return zero if > the logical block size is larger than 512 bytes and if sectors < lbs. How about > changing the return statement as follows (untested): This should work better than what was mentioned in my previous email: - return sectors & (lbs - 1); + return sectors; Thanks, Bart.