public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: mwilck@suse.com,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Christoph Hellwig <hch@lst.de>, Ming Lei <ming.lei@redhat.com>
Cc: James Bottomley <jejb@linux.vnet.ibm.com>,
	linux-scsi@vger.kernel.org, linux-block@vger.kernel.org,
	Hannes Reinecke <hare@suse.de>
Subject: Re: [PATCH v4 4/6] scsi: don't wait for quiesce in scsi_stop_queue()
Date: Mon, 12 Jun 2023 08:40:07 -0700	[thread overview]
Message-ID: <c0908f1d-58e9-6ecb-7f4c-c0bf4659a17f@acm.org> (raw)
In-Reply-To: <20230612150309.18103-5-mwilck@suse.com>

On 6/12/23 08:03, mwilck@suse.com wrote:
> -	 * However, we still need to wait until quiesce is done
> -	 * in case that queue has been stopped.
> +	 * After return, we still need to wait until quiesce is done.

The above comment would be more clear if "After return, we still need" 
would be changed into "The caller needs".

> @@ -2800,9 +2792,17 @@ static void scsi_device_block(struct scsi_device *sdev, void *data)
>   
>   	mutex_lock(&sdev->state_mutex);
>   	err = __scsi_internal_device_block_nowait(sdev);
> -	if (err == 0)
> -		scsi_stop_queue(sdev, false);
> -	mutex_unlock(&sdev->state_mutex);
> +	if (err == 0) {
> +		/*
> +		 * scsi_stop_queue() must be called with the state_mutex
> +		 * held. Otherwise a simultaneous scsi_start_queue() call
> +		 * might unquiesce the queue before we quiesce it.
> +		 */
> +		scsi_stop_queue(sdev);
> +		mutex_unlock(&sdev->state_mutex);
> +		blk_mq_wait_quiesce_done(sdev->request_queue->tag_set);
> +	} else
> +		mutex_unlock(&sdev->state_mutex);

Has it been considered to modify the above code such that there is a 
single mutex_unlock() call instead of two? I wouldn't mind if 
blk_mq_wait_quiesce_done() would be called if err != 0 since performance 
is not that important if this function fails.

Thanks,

Bart.


  reply	other threads:[~2023-06-12 15:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-12 15:03 [PATCH v4 0/6] scsi: fixes for targets with many LUNs, and scsi_target_block rework mwilck
2023-06-12 15:03 ` [PATCH v4 1/6] bsg: increase number of devices mwilck
2023-06-12 15:03 ` [PATCH v4 2/6] scsi: sg: " mwilck
2023-06-12 15:03 ` [PATCH v4 3/6] scsi: merge scsi_internal_device_block() and device_block() mwilck
2023-06-12 15:35   ` Bart Van Assche
2023-06-12 16:06     ` Martin Wilck
2023-06-12 15:03 ` [PATCH v4 4/6] scsi: don't wait for quiesce in scsi_stop_queue() mwilck
2023-06-12 15:40   ` Bart Van Assche [this message]
2023-06-12 15:03 ` [PATCH v4 5/6] scsi: don't wait for quiesce in scsi_device_block() mwilck
2023-06-12 15:03 ` [PATCH v4 6/6] scsi: replace scsi_target_block() by scsi_block_targets() mwilck
2023-06-12 15:49   ` Bart Van Assche
     [not found] <20230612145638.16999-1-mwilck@suse.com>
     [not found] ` <20230612145638.16999-5-mwilck@suse.com>
2023-06-12 15:42   ` [PATCH v4 4/6] scsi: don't wait for quiesce in scsi_stop_queue() Hannes Reinecke

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=c0908f1d-58e9-6ecb-7f4c-c0bf4659a17f@acm.org \
    --to=bvanassche@acm.org \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=ming.lei@redhat.com \
    --cc=mwilck@suse.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