Re: [PATCH AUTOSEL 4.20 49/77] block: cover another queue enter recursion via BIO_QUEUE_ENTERED

From: Tetsuo Handa
Date: Thu Feb 14 2019 - 21:24:40 EST


This patch turned out to be wrong and was reverted. Please drop this patch.

commit 947b7ac135b16aa60f9141ff72bd494eda0edb5e
Author: Jens Axboe <axboe@xxxxxxxxx>
Date: Sun Jan 27 06:35:28 2019 -0700

Revert "block: cover another queue enter recursion via BIO_QUEUE_ENTERED"

We can't touch a bio after ->make_request_fn(), for all we know it could
already have been completed by the time this function returns.

This reverts commit 698cef173983b086977e633e46476e0f925ca01e.

Reported-by: syzbot+4df6ca820108fd248943@xxxxxxxxxxxxxxxxxxxxxxxxx
Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>

> From: Ming Lei <ming.lei@xxxxxxxxxx>
>
> [ Upstream commit 698cef173983b086977e633e46476e0f925ca01e ]
>
> Except for blk_queue_split(), bio_split() is used for splitting bio too,
> then the remained bio is often resubmit to queue via generic_make_request().
> So the same queue enter recursion exits in this case too. Unfortunatley
> commit cd4a4ae4683dc2 doesn't help this case.
>
> This patch covers the above case by setting BIO_QUEUE_ENTERED before calling
> q->make_request_fn.
>
> In theory the per-bio flag is used to simulate one stack variable, it is
> just fine to clear it after q->make_request_fn is returned. Especially
> the same bio can't be submitted from another context.
>
> Fixes: cd4a4ae4683dc2 ("block: don't use blocking queue entered for recursive bio submits")
> Cc: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx>
> Cc: NeilBrown <neilb@xxxxxxxx>
> Reviewed-by: Mike Snitzer <snitzer@xxxxxxxxxx>
> Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx>
> Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
> ---
> block/blk-core.c | 11 +++++++++++
> block/blk-merge.c | 10 ----------
> 2 files changed, 11 insertions(+), 10 deletions(-)