All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <Bart.VanAssche@wdc.com>
To: "ming.lei@redhat.com" <ming.lei@redhat.com>
Cc: "linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	"jthumshirn@suse.de" <jthumshirn@suse.de>,
	"hch@lst.de" <hch@lst.de>,
	"martin.petersen@oracle.com" <martin.petersen@oracle.com>,
	"axboe@kernel.dk" <axboe@kernel.dk>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"oleksandr@natalenko.name" <oleksandr@natalenko.name>,
	"hare@suse.com" <hare@suse.com>
Subject: Re: [PATCH v9 09/10] block, scsi: Make SCSI quiesce and resume work reliably
Date: Tue, 17 Oct 2017 20:08:18 +0000	[thread overview]
Message-ID: <1508270897.3457.7.camel@wdc.com> (raw)
In-Reply-To: <20171017004319.GB15996@ming.t460p>

T24gVHVlLCAyMDE3LTEwLTE3IGF0IDA4OjQzICswODAwLCBNaW5nIExlaSB3cm90ZToNCj4gT24g
TW9uLCBPY3QgMTYsIDIwMTcgYXQgMDQ6Mjk6MDRQTSAtMDcwMCwgQmFydCBWYW4gQXNzY2hlIHdy
b3RlOg0KPiA+IFsgLi4uIF0NCj4gPiAgaW50DQo+ID4gIHNjc2lfZGV2aWNlX3F1aWVzY2Uoc3Ry
dWN0IHNjc2lfZGV2aWNlICpzZGV2KQ0KPiA+ICB7DQo+ID4gKwlzdHJ1Y3QgcmVxdWVzdF9xdWV1
ZSAqcSA9IHNkZXYtPnJlcXVlc3RfcXVldWU7DQo+ID4gIAlpbnQgZXJyOw0KPiA+ICANCj4gPiAr
CS8qDQo+ID4gKwkgKiBJdCBpcyBhbGxvd2VkIHRvIGNhbGwgc2NzaV9kZXZpY2VfcXVpZXNjZSgp
IG11bHRpcGxlIHRpbWVzIGZyb20NCj4gPiArCSAqIHRoZSBzYW1lIGNvbnRleHQgYnV0IGNvbmN1
cnJlbnQgc2NzaV9kZXZpY2VfcXVpZXNjZSgpIGNhbG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-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	"jthumshirn@suse.de" <jthumshirn@suse.de>,
	"hch@lst.de" <hch@lst.de>,
	"martin.petersen@oracle.com" <martin.petersen@oracle.com>,
	"axboe@kernel.dk" <axboe@kernel.dk>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"oleksandr@natalenko.name" <oleksandr@natalenko.name>,
	"hare@suse.com" <hare@suse.com>
Subject: Re: [PATCH v9 09/10] block, scsi: Make SCSI quiesce and resume work reliably
Date: Tue, 17 Oct 2017 20:08:18 +0000	[thread overview]
Message-ID: <1508270897.3457.7.camel@wdc.com> (raw)
In-Reply-To: <20171017004319.GB15996@ming.t460p>

On Tue, 2017-10-17 at 08:43 +0800, Ming Lei wrote:
> On Mon, Oct 16, 2017 at 04:29:04PM -0700, Bart Van Assche wrote:
> > [ ... ]
> >  int
> >  scsi_device_quiesce(struct scsi_device *sdev)
> >  {
> > +	struct request_queue *q = sdev->request_queue;
> >  	int err;
> >  
> > +	/*
> > +	 * It is allowed to call scsi_device_quiesce() multiple times from
> > +	 * the same context but concurrent scsi_device_quiesce() calls are
> > +	 * not allowed.
> > +	 */
> > +	WARN_ON_ONCE(sdev->quiesced_by && sdev->quiesced_by != current);
> 
> If the above line and comment is removed, everything is still fine,
> either nested calling or concurrent calling, isn't it?

If scsi_device_quiesce() is called concurrently from two different threads
then the first scsi_device_resume() call will resume I/O for *both* contexts.
That's not what the callers expect. If scsi_device_quiesce() and
scsi_device_resume() are called concurrently that would be even worse. I think
we *really* should know whether callers serialize scsi_device_quiesce() and
scsi_device_resume() calls properly. Hence the WARN_ON_ONCE() statement.

Bart.

  reply	other threads:[~2017-10-17 20:08 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-16 23:28 [PATCH v9 00/10] block, scsi, md: Improve suspend and resume Bart Van Assche
2017-10-16 23:28 ` [PATCH v9 01/10] md: Rename md_notifier into md_reboot_notifier Bart Van Assche
2017-10-17  6:23   ` Hannes Reinecke
2017-10-16 23:28 ` [PATCH v9 02/10] md: Introduce md_stop_all_writes() Bart Van Assche
2017-10-17  6:23   ` Hannes Reinecke
2017-10-16 23:28 ` [PATCH v9 03/10] md: Neither resync nor reshape while the system is frozen Bart Van Assche
2017-10-17  6:24   ` Hannes Reinecke
2017-10-16 23:28 ` [PATCH v9 04/10] block: Make q_usage_counter also track legacy requests Bart Van Assche
2017-10-17  6:25   ` Hannes Reinecke
2017-10-16 23:29 ` [PATCH v9 05/10] block: Introduce blk_get_request_flags() Bart Van Assche
2017-10-17  6:26   ` Hannes Reinecke
2017-10-16 23:29 ` [PATCH v9 06/10] block: Introduce BLK_MQ_REQ_PREEMPT Bart Van Assche
2017-10-17  6:26   ` Hannes Reinecke
2017-10-16 23:29 ` [PATCH v9 07/10] ide, scsi: Tell the block layer at request allocation time about preempt requests Bart Van Assche
2017-10-17  4:12   ` Martin K. Petersen
2017-10-17  6:27   ` Hannes Reinecke
2017-10-16 23:29 ` [PATCH v9 08/10] block: Add the QUEUE_FLAG_PREEMPT_ONLY request queue flag Bart Van Assche
2017-10-17  6:27   ` Hannes Reinecke
2017-10-16 23:29 ` [PATCH v9 09/10] block, scsi: Make SCSI quiesce and resume work reliably Bart Van Assche
2017-10-17  0:43   ` Ming Lei
2017-10-17 20:08     ` Bart Van Assche [this message]
2017-10-17 20:08       ` Bart Van Assche
2017-10-17  4:17   ` Martin K. Petersen
2017-10-17  6:33   ` Hannes Reinecke
2017-10-17 10:43     ` Ming Lei
2017-10-17 20:18     ` Bart Van Assche
2017-10-17 20:18       ` Bart Van Assche
2017-10-18  5:58       ` Hannes Reinecke
2017-10-16 23:29 ` [PATCH v9 10/10] block, nvme: Introduce blk_mq_req_flags_t Bart Van Assche
2017-10-17  6:34   ` Hannes Reinecke
2017-10-17  6:34     ` 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=1508270897.3457.7.camel@wdc.com \
    --to=bart.vanassche@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=hare@suse.com \
    --cc=hch@lst.de \
    --cc=jthumshirn@suse.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=ming.lei@redhat.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.