All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Jens Axboe <axboe@kernel.dk>
Cc: Christoph Hellwig <hch@lst.de>, Ming Lei <ming.lei@redhat.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	linux-block@vger.kernel.org, linux-nvme@lists.infradead.org,
	linux-scsi@vger.kernel.org, Laibin Qiu <qiulaibin@huawei.com>,
	Ming Lei <ming.lei@rehdat.com>
Subject: Re: [PATCH V2 04/13] block/wbt: fix negative inflight counter when remove scsi device
Date: Thu, 17 Feb 2022 08:45:02 +0100	[thread overview]
Message-ID: <20220217074502.GA1333@lst.de> (raw)
In-Reply-To: <20220122111054.1126146-5-ming.lei@redhat.com>

Jens, can you pick this up for the block-5.17 tree?

On Sat, Jan 22, 2022 at 07:10:45PM +0800, Ming Lei wrote:
> From: Laibin Qiu <qiulaibin@huawei.com>
> 
> Now that we disable wbt by set WBT_STATE_OFF_DEFAULT in
> wbt_disable_default() when switch elevator to bfq. And when
> we remove scsi device, wbt will be enabled by wbt_enable_default.
> If it become false positive between wbt_wait() and wbt_track()
> when submit write request.
> 
> The following is the scenario that triggered the problem.
> 
> T1                          T2                           T3
>                             elevator_switch_mq
>                             bfq_init_queue
>                             wbt_disable_default <= Set
>                             rwb->enable_state (OFF)
> Submit_bio
> blk_mq_make_request
> rq_qos_throttle
> <= rwb->enable_state (OFF)
>                                                          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 move wbt_enable_default() from elv_unregister to
> bfq_exit_queue(). Only re-enable wbt when bfq exit.
> 
> Fixes: 76a8040817b4b ("blk-wbt: make sure throttle is enabled properly")
> 
> Remove oneline stale comment, and kill one oneshot local variable.
> 
> Signed-off-by: Ming Lei <ming.lei@rehdat.com>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> Link: https://lore.kernel.org/linux-block/20211214133103.551813-1-qiulaibin@huawei.com/
> Signed-off-by: Laibin Qiu <qiulaibin@huawei.com>
> ---
>  block/bfq-iosched.c | 2 ++
>  block/elevator.c    | 2 --
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
> index 0c612a911696..36a66e97e3c2 100644
> --- a/block/bfq-iosched.c
> +++ b/block/bfq-iosched.c
> @@ -7018,6 +7018,8 @@ static void bfq_exit_queue(struct elevator_queue *e)
>  	spin_unlock_irq(&bfqd->lock);
>  #endif
>  
> +	wbt_enable_default(bfqd->queue);
> +
>  	kfree(bfqd);
>  }
>  
> diff --git a/block/elevator.c b/block/elevator.c
> index ec98aed39c4f..482df2a350fc 100644
> --- a/block/elevator.c
> +++ b/block/elevator.c
> @@ -525,8 +525,6 @@ void elv_unregister_queue(struct request_queue *q)
>  		kobject_del(&e->kobj);
>  
>  		e->registered = 0;
> -		/* Re-enable throttling in case elevator disabled it */
> -		wbt_enable_default(q);
>  	}
>  }
>  
> -- 
> 2.31.1
---end quoted text---

  reply	other threads:[~2022-02-17  7:45 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-22 11:10 [PATCH V2 00/13] block: don't drain file system I/O on del_gendisk Ming Lei
2022-01-22 11:10 ` [PATCH V2 01/13] block: declare blkcg_[init|exit]_queue in private header Ming Lei
2022-01-24 12:59   ` Christoph Hellwig
2022-01-22 11:10 ` [PATCH V2 02/13] block: move initialization of q->blkg_list into blkcg_init_queue Ming Lei
2022-01-24 13:00   ` Christoph Hellwig
2022-01-24 18:32   ` Bart Van Assche
2022-01-22 11:10 ` [PATCH V2 03/13] block: move blkcg initialization/destroy into disk allocation/release handler Ming Lei
2022-01-24 13:02   ` Christoph Hellwig
2022-01-22 11:10 ` [PATCH V2 04/13] block/wbt: fix negative inflight counter when remove scsi device Ming Lei
2022-02-17  7:45   ` Christoph Hellwig [this message]
2022-02-17 14:53     ` Jens Axboe
2022-01-22 11:10 ` [PATCH V2 05/13] block: only account passthrough IO from userspace Ming Lei
2022-01-24 13:05   ` Christoph Hellwig
2022-01-24 23:09     ` Ming Lei
2022-01-25  6:16       ` Christoph Hellwig
2022-01-25  7:19         ` Christoph Hellwig
2022-01-25  8:35           ` Ming Lei
2022-01-25  9:09           ` Ming Lei
2022-01-26  5:50             ` Christoph Hellwig
2022-01-26  7:21               ` Ming Lei
2022-01-26  8:10                 ` Christoph Hellwig
2022-01-26  8:33                   ` Ming Lei
2022-01-26  8:49                     ` Christoph Hellwig
2022-01-26  9:59                       ` Ming Lei
2022-01-26 16:37                         ` Christoph Hellwig
2022-01-22 11:10 ` [PATCH V2 06/13] block: don't remove hctx debugfs dir from blk_mq_exit_queue Ming Lei
2022-01-24 13:06   ` Christoph Hellwig
2022-01-22 11:10 ` [PATCH V2 07/13] block: move q_usage_counter release into blk_queue_release Ming Lei
2022-01-24 13:09   ` Christoph Hellwig
2022-01-24 19:06   ` Bart Van Assche
2022-01-22 11:10 ` [PATCH V2 08/13] block: export __blk_mq_unfreeze_queue Ming Lei
2022-01-24 13:11   ` Christoph Hellwig
2022-01-22 11:10 ` [PATCH V2 09/13] scsi: force unfreezing queue into atomic mode Ming Lei
2022-01-24 13:15   ` Christoph Hellwig
2022-01-24 23:21     ` Ming Lei
2022-01-25  7:27       ` Christoph Hellwig
2022-01-25  8:54         ` Ming Lei
2022-01-26  8:15           ` Christoph Hellwig
2022-01-22 11:10 ` [PATCH V2 10/13] block: add helper of disk_release_queue for release queue data for disk Ming Lei
2022-01-24 13:16   ` Christoph Hellwig
2022-01-24 23:27     ` Ming Lei
2022-01-25  6:17       ` Christoph Hellwig
2022-01-22 11:10 ` [PATCH V2 11/13] block: move blk_exit_queue into disk_release Ming Lei
2022-01-24 13:22   ` Christoph Hellwig
2022-01-24 23:38     ` Ming Lei
2022-01-22 11:10 ` [PATCH V2 12/13] block: move rq_qos_exit() into disk_release() Ming Lei
2022-01-24 13:28   ` Christoph Hellwig
2022-01-22 11:10 ` [PATCH V2 13/13] block: don't drain file system I/O on del_gendisk Ming Lei
2022-01-24 13:39   ` Christoph Hellwig

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=20220217074502.GA1333@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=ming.lei@redhat.com \
    --cc=ming.lei@rehdat.com \
    --cc=qiulaibin@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.