From: Ming Lei <ming.lei@redhat.com>
To: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
"Martin K . Petersen" <martin.petersen@oracle.com>,
=Oleksandr Natalenko <oleksandr@natalenko.name>,
Hannes Reinecke <hare@suse.com>,
Johannes Thumshirn <jthumshirn@suse.de>
Subject: Re: [PATCH v4 5/7] scsi: Reduce suspend latency
Date: Wed, 27 Sep 2017 06:23:28 +0800 [thread overview]
Message-ID: <20170926222322.GA8050@ming.t460p> (raw)
In-Reply-To: <20170925202924.16603-6-bart.vanassche@wdc.com>
On Mon, Sep 25, 2017 at 01:29:22PM -0700, Bart Van Assche wrote:
> Avoid that it can take 200 ms too long to wait for requests to
> finish. Note: blk_mq_freeze_queue() uses a wait queue to wait
> for ongoing requests to finish.
>
> Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
> Cc: Martin K. Petersen <martin.petersen@oracle.com>
> Cc: Ming Lei <ming.lei@redhat.com>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Hannes Reinecke <hare@suse.com>
> Cc: Johannes Thumshirn <jthumshirn@suse.de>
> ---
> drivers/scsi/scsi_lib.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index 62f905b22821..c261498606c4 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -2927,6 +2927,7 @@ static void scsi_wait_for_queuecommand(struct scsi_device *sdev)
> int
> scsi_device_quiesce(struct scsi_device *sdev)
> {
> + struct request_queue *q = sdev->request_queue;
> int err;
>
> mutex_lock(&sdev->state_mutex);
> @@ -2936,11 +2937,8 @@ scsi_device_quiesce(struct scsi_device *sdev)
> if (err)
> return err;
>
> - scsi_run_queue(sdev->request_queue);
> - while (atomic_read(&sdev->device_busy)) {
> - msleep_interruptible(200);
> - scsi_run_queue(sdev->request_queue);
> - }
> + blk_mq_freeze_queue(q);
> + blk_mq_unfreeze_queue(q);
> return 0;
I see the serious issue now with this patch, and it should have
been found much earlier, just because the setting quiesce isn't
shown in the patch. Sorry for finding it so late.
Once the patch is applied, scsi_device_quiesce() becomes
the following shape:
mutex_lock(&sdev->state_mutex);
err = scsi_device_set_state(sdev, SDEV_QUIESCE);
if (err == 0)
blk_set_preempt_only(q, true);
mutex_unlock(&sdev->state_mutex);
if (err)
return err;
blk_mq_freeze_queue(q);
blk_mq_unfreeze_queue(q);
Any requests allocated before scsi_device_set_state() and
dispatched after scsi_device_set_state() can't be drained up
any more, then blk_mq_freeze_queue() will wait forever for the
drain up, so not only this patchset can't fix the current quiesce
issue, but also introduces new I/O hang in scsi_device_quiesce().
Now this approach looks broken fundamentally.
NAK.
--
Ming
next prev parent reply other threads:[~2017-09-26 22:23 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-25 20:29 [PATCH v4 0/7] Make suspend and resume safe for md-on-SCSI Bart Van Assche
2017-09-25 20:29 ` [PATCH v4 1/7] md: Make md resync and reshape threads freezable Bart Van Assche
2017-09-25 23:04 ` Ming Lei
2017-09-25 23:09 ` Bart Van Assche
2017-09-25 23:09 ` Bart Van Assche
2017-09-26 4:01 ` Ming Lei
2017-09-26 8:13 ` Ming Lei
2017-09-26 14:40 ` Bart Van Assche
2017-09-26 14:40 ` Bart Van Assche
2017-09-26 15:02 ` Ming Lei
2017-09-26 6:06 ` Hannes Reinecke
2017-09-26 11:17 ` Ming Lei
2017-09-26 14:42 ` Bart Van Assche
2017-09-26 14:42 ` Bart Van Assche
2017-09-26 14:59 ` Ming Lei
2017-09-27 3:12 ` Bart Van Assche
2017-09-27 3:12 ` Bart Van Assche
2017-09-27 11:00 ` Ming Lei
2017-10-02 15:39 ` Bart Van Assche
2017-10-02 15:39 ` Bart Van Assche
2017-10-02 13:26 ` Christoph Hellwig
2017-09-25 20:29 ` [PATCH v4 2/7] block: Make q_usage_counter also track legacy requests Bart Van Assche
2017-09-26 6:05 ` Hannes Reinecke
2017-09-26 8:34 ` Ming Lei
2017-10-02 13:29 ` Christoph Hellwig
2017-09-25 20:29 ` [PATCH v4 3/7] block: Convert RQF_PREEMPT into REQ_PREEMPT Bart Van Assche
2017-10-02 13:42 ` Christoph Hellwig
2017-10-02 13:43 ` Christoph Hellwig
2017-09-25 20:29 ` [PATCH v4 4/7] block: Add the QUEUE_FLAG_PREEMPT_ONLY request queue flag Bart Van Assche
2017-10-02 13:47 ` Christoph Hellwig
2017-10-02 15:56 ` Bart Van Assche
2017-10-02 16:14 ` hch
2017-09-25 20:29 ` [PATCH v4 5/7] scsi: Reduce suspend latency Bart Van Assche
2017-09-26 22:23 ` Ming Lei [this message]
2017-09-27 3:43 ` Bart Van Assche
2017-09-27 5:37 ` Ming Lei
2017-09-25 20:29 ` [PATCH v4 6/7] scsi: Set QUEUE_FLAG_PREEMPT_ONLY while quiesced Bart Van Assche
2017-10-02 13:53 ` Christoph Hellwig
2017-09-25 20:29 ` [PATCH v4 7/7] block: Make SCSI device suspend and resume work reliably Bart Van Assche
2017-09-25 22:59 ` Ming Lei
2017-09-25 23:13 ` Bart Van Assche
2017-09-26 8:32 ` Ming Lei
2017-09-26 14:44 ` Bart Van Assche
2017-09-26 9:15 ` [PATCH v4 0/7] Make suspend and resume safe for md-on-SCSI Ming Lei
2017-09-26 14:29 ` Bart Van Assche
2017-09-26 14:54 ` Ming Lei
2017-09-26 20:17 ` Bart Van Assche
2017-09-26 22:47 ` Ming Lei
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=20170926222322.GA8050@ming.t460p \
--to=ming.lei@redhat.com \
--cc=axboe@kernel.dk \
--cc=bart.vanassche@wdc.com \
--cc=hare@suse.com \
--cc=hch@lst.de \
--cc=jthumshirn@suse.de \
--cc=linux-block@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=oleksandr@natalenko.name \
/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.