linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Keith Busch <keith.busch@intel.com>
To: Bart Van Assche <bart.vanassche@gmail.com>
Cc: Jens Axboe <axboe@kernel.dk>,
	"jianchao.wang" <jianchao.w.wang@oracle.com>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	Ming Lei <ming.lei@redhat.com>
Subject: Re: Regression caused by f5bbbbe4d635
Date: Mon, 24 Sep 2018 14:00:41 -0600	[thread overview]
Message-ID: <20180924200040.GA9777@localhost.localdomain> (raw)
In-Reply-To: <1537818667.195115.22.camel@gmail.com>

On Mon, Sep 24, 2018 at 12:51:07PM -0700, Bart Van Assche wrote:
> On Mon, 2018-09-24 at 13:13 -0600, Keith Busch wrote:
> > diff --git a/block/blk-mq.c b/block/blk-mq.c
> > index 85a1c1a59c72..28d128450621 100644
> > --- a/block/blk-mq.c
> > +++ b/block/blk-mq.c
> > @@ -848,22 +848,6 @@ static void blk_mq_timeout_work(struct work_struct *work)
> > 	struct blk_mq_hw_ctx *hctx;
> > 	int i;
> >  
> > -	/* A deadlock might occur if a request is stuck requiring a
> > -	 * timeout at the same time a queue freeze is waiting
> > -	 * completion, since the timeout code would not be able to
> > -	 * acquire the queue reference here.
> > -	 *
> > -	 * That's why we don't use blk_queue_enter here; instead, we use
> > -	 * percpu_ref_tryget directly, because we need to be able to
> > -	 * obtain a reference even in the short window between the queue
> > -	 * starting to freeze, by dropping the first reference in
> > -	 * blk_freeze_queue_start, and the moment the last request is
> > -	 * consumed, marked by the instant q_usage_counter reaches
> > -	 * zero.
> > -	 */
> > -	if (!percpu_ref_tryget(&q->q_usage_counter))
> > -		return;
> > -
> > 	blk_mq_queue_tag_busy_iter(q, blk_mq_check_expired, &next);
> >  
> > 	if (next != 0) {
> > @@ -881,7 +865,6 @@ static void blk_mq_timeout_work(struct work_struct *work)
> > 				blk_mq_tag_idle(hctx);
> > 		}
> > 	}
> > -	blk_queue_exit(q);
> >  }
> 
> Hi Keith,
> 
> The above introduces a behavior change: if the percpu_ref_tryget() call inside
> blk_mq_queue_tag_busy_iter() fails then blk_mq_timeout_work() will now call
> blk_mq_tag_idle(). I think that's wrong if the percpu_ref_tryget() call fails
> due to the queue having been frozen. Please make blk_mq_queue_tag_busy_iter()
> return a bool that indicates whether or not it has iterated over the request
> queue.

Good point, thanks for the feedback.

      reply	other threads:[~2018-09-24 20:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-24 18:44 Regression caused by f5bbbbe4d635 Jens Axboe
2018-09-24 19:13 ` Keith Busch
2018-09-24 19:51   ` Bart Van Assche
2018-09-24 20:00     ` Keith Busch [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=20180924200040.GA9777@localhost.localdomain \
    --to=keith.busch@intel.com \
    --cc=axboe@kernel.dk \
    --cc=bart.vanassche@gmail.com \
    --cc=jianchao.w.wang@oracle.com \
    --cc=linux-block@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).