public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Martin Wilck <mwilck@suse.com>
To: Bart Van Assche <bvanassche@acm.org>,
	"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 v5 4/7] scsi: don't wait for quiesce in scsi_stop_queue()
Date: Tue, 13 Jun 2023 12:57:41 +0200	[thread overview]
Message-ID: <44762b9e1626ad7d77daf93bfa764e5d18256901.camel@suse.com> (raw)
In-Reply-To: <9887b6c0-04ef-a2c7-94be-d8558cdc44df@acm.org>

On Mon, 2023-06-12 at 11:02 -0700, Bart Van Assche wrote:
> On 6/12/23 09:50, mwilck@suse.com wrote:
> > @@ -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);
> >   
> >         WARN_ONCE(err, "__scsi_internal_device_block_nowait(%s)
> > failed: err = %d\n",
> >                   dev_name(&sdev->sdev_gendev), err);
> 
> 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.

This code is just an intermediate stage. The double mutex_unlock() is
converted back to a single one in the subsequent patch. As Christoph
has already ack'd it, unless it's really important to you, I'd like to
keep this patch as-is.

Thanks,
Martin


  reply	other threads:[~2023-06-13 10:57 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-12 16:50 [PATCH v5 0/7] scsi: fixes for targets with many LUNs, and scsi_target_block rework mwilck
2023-06-12 16:50 ` [PATCH v5 1/7] bsg: increase number of devices mwilck
2023-06-12 16:50 ` [PATCH v5 2/7] scsi: sg: " mwilck
2023-06-12 16:50 ` [PATCH v5 3/7] scsi: merge scsi_internal_device_block() and device_block() mwilck
2023-06-12 18:00   ` Bart Van Assche
2023-06-13 10:42     ` Martin Wilck
2023-06-12 16:50 ` [PATCH v5 4/7] scsi: don't wait for quiesce in scsi_stop_queue() mwilck
2023-06-12 18:02   ` Bart Van Assche
2023-06-13 10:57     ` Martin Wilck [this message]
2023-06-13  4:33   ` Christoph Hellwig
2023-06-12 16:50 ` [PATCH v5 5/7] scsi: don't wait for quiesce in scsi_device_block() mwilck
2023-06-12 18:03   ` Bart Van Assche
2023-06-13  4:34   ` Christoph Hellwig
2023-06-12 16:50 ` [PATCH v5 6/7] scsi: replace scsi_target_block() by scsi_block_targets() mwilck
2023-06-12 18:09   ` Bart Van Assche
2023-06-13  4:36   ` Christoph Hellwig
2023-06-12 16:50 ` [PATCH v5 7/7] scsi: improve warning message in scsi_device_block() mwilck
2023-06-12 18:11   ` Bart Van Assche
2023-06-13  4:36   ` Christoph Hellwig
2023-06-13  6:10   ` 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=44762b9e1626ad7d77daf93bfa764e5d18256901.camel@suse.com \
    --to=mwilck@suse.com \
    --cc=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 \
    /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