Re: [BUG bisect] kernel BUG at block/bio.c:1833 and fail to mount disk

From: Ming Lei
Date: Thu Jan 17 2019 - 05:27:44 EST


On Wed, Jan 16, 2019 at 09:54:05AM +0100, Krzysztof Kozlowski wrote:
> On Wed, 16 Jan 2019 at 09:52, Krzysztof Kozlowski <krzk@xxxxxxxxxx> wrote:
> >
> > Hi,
> >
> > On today's next-20190116 I see a bug during boot:
> > [ 6.843308] kernel BUG at ../block/bio.c:1833!
> > [ 6.847723] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
> > ...
> > [ 7.543824] [<c044c144>] (bio_split) from [<00000000>] ( (null))
> > [ 7.549881] Code: 13833b01 11c630bc e1a00006 e8bd8070 (e7f001f2)
> >
> > (not much in the calltrace)
> > On all my boards. Also QEMU-arm fails.
> >
>
> I forgot the bisect commit:
>
> 258cfdfaf7bd729e759a0a91fd00ac9794796ad3 is the first bad commit
> commit 258cfdfaf7bd729e759a0a91fd00ac9794796ad3
> Author: Ming Lei <ming.lei@xxxxxxxxxx>
> Date: Fri Jan 11 19:01:15 2019 +0800
>
> block: use bio_for_each_bvec() to compute multi-page bvec count
>
> :040000 040000 d79b2e71d308650df4764ff644f29d3a24dbab96
> 0a5d624843b805ee0c9fd9a7e2d5163f5b15b167 M block

It should be one 32-bit arch specific issue, I guess.

The following patch should fix this issue:

diff --git a/block/blk-merge.c b/block/blk-merge.c
index dc4877eaf9f9..4dd7183de849 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -166,6 +166,9 @@ static unsigned get_max_segment_size(struct request_queue *q,
{
unsigned long mask = queue_segment_boundary(q);

+ if (mask == BLK_SEG_BOUNDARY_MASK)
+ return queue_max_segment_size(q);
+
return min_t(unsigned long, mask - (mask & offset) + 1,
queue_max_segment_size(q));
}

Thanks,
Ming