public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: "linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	Stephen Smith <stephenmsmith@blueyonder.co.uk>
Subject: Re: [PATCH] block: fix missing queue put in error path
Date: Tue, 16 Nov 2021 07:57:46 +0800	[thread overview]
Message-ID: <YZLz+t+ZiSpkV31B@T590> (raw)
In-Reply-To: <f39193ff-bc6b-53fa-dc05-3127012d70c5@kernel.dk>

On Mon, Nov 15, 2021 at 02:35:09PM -0700, Jens Axboe wrote:
> If we fail the submission queue checks, we don't put the queue afterwards.
> This can cause various issues like stalls on scheduler switch or failure
> to remove the device, or like in the original bug report, timeout waiting
> for the device on reboot/restart.
> 
> While in there, fix a few whitespace discrepancies in the surrounding
> code.
> 
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=215039
> Fixes: b637108a4022 ("blk-mq: fix filesystem I/O request allocation")
> Reported-and-tested-by: Stephen Smith <stephenmsmith@blueyonder.co.uk>
> Signed-off-by: Jens Axboe <axboe@kernel.dk>
> 
> ---
> 
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index 3ab34c4f20da..5e1c9fd99353 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -2543,8 +2543,7 @@ static struct request *blk_mq_get_new_requests(struct request_queue *q,
>  	return NULL;
>  }
>  
> -static inline bool blk_mq_can_use_cached_rq(struct request *rq,
> -		struct bio *bio)
> +static inline bool blk_mq_can_use_cached_rq(struct request *rq, struct bio *bio)
>  {
>  	if (blk_mq_get_hctx_type(bio->bi_opf) != rq->mq_hctx->type)
>  		return false;
> @@ -2565,7 +2564,6 @@ static inline struct request *blk_mq_get_request(struct request_queue *q,
>  	bool checked = false;
>  
>  	if (plug) {
> -
>  		rq = rq_list_peek(&plug->cached_rq);
>  		if (rq && rq->q == q) {
>  			if (unlikely(!submit_bio_checks(bio)))
> @@ -2587,12 +2585,14 @@ static inline struct request *blk_mq_get_request(struct request_queue *q,
>  fallback:
>  	if (unlikely(bio_queue_enter(bio)))
>  		return NULL;
> -	if (!checked && !submit_bio_checks(bio))
> -		return NULL;
> +	if (unlikely(!checked && !submit_bio_checks(bio)))
> +		goto out_put;
>  	rq = blk_mq_get_new_requests(q, plug, bio, nsegs, same_queue_rq);
> -	if (!rq)
> -		blk_queue_exit(q);
> -	return rq;
> +	if (rq)
> +		return rq;
> +out_put:
> +	blk_queue_exit(q);
> +	return NULL;

Reviewed-by: Ming Lei <ming.lei@redhat.com>

-- 
Ming


      reply	other threads:[~2021-11-16  0:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-15 21:35 [PATCH] block: fix missing queue put in error path Jens Axboe
2021-11-15 23:57 ` Ming Lei [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YZLz+t+ZiSpkV31B@T590 \
    --to=ming.lei@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=stephenmsmith@blueyonder.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox