mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bob Liu <bob.liu@oracle.com>
To: Bart Van Assche <bvanassche@acm.org>, linux-block@vger.kernel.org
Cc: shirley.ma@oracle.com, martin.petersen@oracle.com,
	Roman Pen <roman.penyaev@profitbricks.com>,
	Akinobu Mita <akinobu.mita@gmail.com>, Tejun Heo <tj@kernel.org>,
	Jens Axboe <axboe@kernel.dk>, Christoph Hellwig <hch@lst.de>,
	linux-kernel@vger.kernel.org
Subject: Re: [RESEND PATCH] blk-mq: fix hang caused by freeze/unfreeze sequence
Date: Sun, 14 Apr 2019 21:09:43 +0800	[thread overview]
Message-ID: <9ca4314d-fe45-9b24-8ba0-44d80f790502@oracle.com> (raw)
In-Reply-To: <0763cb5a-5598-69e3-e5ac-765989aab5b1@acm.org>

On 4/13/19 11:42 AM, Bart Van Assche wrote:
> On 4/9/19 2:08 AM, Bob Liu wrote:
>>  void blk_freeze_queue_start(struct request_queue *q)
>>  {
>> -	int freeze_depth;
>> -
>> -	freeze_depth = atomic_inc_return(&q->mq_freeze_depth);
>> -	if (freeze_depth == 1) {
>> +	mutex_lock(&q->mq_freeze_lock);
>> +	if (++q->mq_freeze_depth == 1) {
>>  		percpu_ref_kill(&q->q_usage_counter);
>> +		mutex_unlock(&q->mq_freeze_lock);
>>  		if (queue_is_mq(q))
>>  			blk_mq_run_hw_queues(q, false);
>> +	} else {
>> +		mutex_unlock(&q->mq_freeze_lock);
>>  	}
>>  }
> Have you considered to move the mutex_unlock() call to the end of the function
> such that there is only one mutex_unlock() call instead of two? In case you> would be worried about holding the mutex around the code that runs the queue,
> how about changing the blk_mq_run_hw_queues() call such that the queues are
> run async?
>
 
Yes, but this bug is difficult to reproduce. I'd prefer keep the change minimum.

  reply	other threads:[~2019-04-14 13:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-09  9:08 Bob Liu
2019-04-09  9:29 ` Jinpu Wang
2019-04-13  0:36   ` Bob Liu
2019-04-09 11:27 ` Dongli Zhang
2019-04-13  3:42 ` Bart Van Assche
2019-04-14 13:09   ` Bob Liu [this message]
2019-04-15  9:46   ` Roman Penyaev
2019-04-17  4:06     ` Bob Liu

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=9ca4314d-fe45-9b24-8ba0-44d80f790502@oracle.com \
    --to=bob.liu@oracle.com \
    --cc=akinobu.mita@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=roman.penyaev@profitbricks.com \
    --cc=shirley.ma@oracle.com \
    --cc=tj@kernel.org \
    /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

all inboxes | Powered by JetHome®