All of lore.kernel.org
 help / color / mirror / Atom feed
From: QiuLaibin <qiulaibin@huawei.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: <axboe@kernel.dk>, <yi.zhang@huawei.com>,
	<linux-block@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -next] block/wbt: fix negative inflight counter when remove scsi device
Date: Tue, 14 Dec 2021 12:25:07 +0800	[thread overview]
Message-ID: <41632d62-2bb2-fcf1-ed84-5a63733459d1@huawei.com> (raw)
In-Reply-To: <YbeAAyWbkh5frMGc@infradead.org>


On 2021/12/14 1:16, Christoph Hellwig wrote:
> On Mon, Dec 13, 2021 at 12:09:07PM +0800, Laibin Qiu wrote:
>> Submit_bio
>>                                                           scsi_remove_device
>>                                                           sd_remove
>>                                                           del_gendisk
>>                                                           blk_unregister_queue
>>                                                           elv_unregister_queue
>>                                                           wbt_enable_default
>>                                                           <= Set rwb->enable_state (ON)
>> q_qos_track
>> <= rwb->enable_state (ON)
>> ^^^^^^ this request will mark WBT_TRACKED without inflight add and will
>> lead to drop rqw->inflight to -1 in wbt_done() which will trigger IO hung.
>>
>> Fix this by judge whether QUEUE_FLAG_REGISTERED is marked to distinguish
>> scsi remove scene.
>> Fixes: 76a8040817b4b ("blk-wbt: make sure throttle is enabled properly")
>> Signed-off-by: Laibin Qiu <qiulaibin@huawei.com>
>> ---
>>   block/blk-wbt.c | 8 ++++----
>>   1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/block/blk-wbt.c b/block/blk-wbt.c
>> index 3ed71b8da887..537f77bb1365 100644
>> --- a/block/blk-wbt.c
>> +++ b/block/blk-wbt.c
>> @@ -637,6 +637,10 @@ void wbt_enable_default(struct request_queue *q)
>>   {
>>   	struct rq_qos *rqos = wbt_rq_qos(q);
>>   
>> +	/* Queue not registered? Maybe shutting down... */
>> +	if (!blk_queue_registered(q))
>> +		return;
> 
> Wouldn't it make more sense to simply not call wbt_enable_default from
> elv_unregister_queue?
> .
> 

Refer to your opinion, I will post another version of V2.
Please take a look again.

      parent reply	other threads:[~2021-12-14  4:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-13  4:09 [PATCH -next] block/wbt: fix negative inflight counter when remove scsi device Laibin Qiu
2021-12-13 17:16 ` Christoph Hellwig
2021-12-14  1:13   ` Ming Lei
2021-12-14  8:07     ` Christoph Hellwig
2021-12-14  4:25   ` QiuLaibin [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=41632d62-2bb2-fcf1-ed84-5a63733459d1@huawei.com \
    --to=qiulaibin@huawei.com \
    --cc=axboe@kernel.dk \
    --cc=hch@infradead.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yi.zhang@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.