All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@steeleye.com>
To: Mike Anderson <andmike@us.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>,
	SCSI Mailing List <linux-scsi@vger.kernel.org>
Subject: Re: Calling sd_shutdown when in state SDEV_DEL
Date: 02 Apr 2004 18:33:04 -0500	[thread overview]
Message-ID: <1080948785.1830.157.camel@mulgrave> (raw)
In-Reply-To: <20040325014859.GA3040@beaverton.ibm.com>

On Wed, 2004-03-24 at 20:48, Mike Anderson wrote:
> James Bottomley [James.Bottomley@SteelEye.com] wrote:
> > On Wed, 2004-03-24 at 12:04, Mike Anderson wrote:
> > > Why setting CANCEL on the device? Future plans for the CANCEL state?
> > > You are setting the state to cancel, but not going through
> > > scsi_device_cancel as you want IO to still flow.
> > 
> > Mainly because it was there.  Using CANCEL instead of DEL is appealing
> > since it will still allow special I/O.  Would there be an issue with
> > refusing new device references in the CANCEL state?
> 
> I think this should be ok as this is our (scsi core) own internal
> solution to keep ref counts from increasing for the purpose of
> eventually allowing everything to cleanup. 

So can we agree on this as the final patch?

James

===== drivers/scsi/scsi.c 1.140 vs edited =====
--- 1.140/drivers/scsi/scsi.c	Tue Mar 16 20:10:09 2004
+++ edited/drivers/scsi/scsi.c	Fri Apr  2 15:36:08 2004
@@ -977,7 +977,7 @@
  */
 int scsi_device_get(struct scsi_device *sdev)
 {
-	if (sdev->sdev_state == SDEV_DEL)
+	if (sdev->sdev_state == SDEV_DEL || sdev->sdev_state == SDEV_CANCEL)
 		return -ENXIO;
 	if (!get_device(&sdev->sdev_gendev))
 		return -ENXIO;
===== drivers/scsi/scsi_sysfs.c 1.44 vs edited =====
--- 1.44/drivers/scsi/scsi_sysfs.c	Tue Mar 16 10:00:19 2004
+++ edited/drivers/scsi/scsi_sysfs.c	Fri Apr  2 17:31:06 2004
@@ -502,18 +502,19 @@
  **/
 void scsi_remove_device(struct scsi_device *sdev)
 {
-	if (sdev->sdev_state == SDEV_RUNNING || sdev->sdev_state == SDEV_CANCEL) {
-		scsi_device_set_state(sdev, SDEV_DEL);
-		class_device_unregister(&sdev->sdev_classdev);
-		if (sdev->transport_classdev.class)
-			class_device_unregister(&sdev->transport_classdev);
-		device_del(&sdev->sdev_gendev);
-		if (sdev->host->hostt->slave_destroy)
-			sdev->host->hostt->slave_destroy(sdev);
-		if (sdev->host->transportt->cleanup)
-			sdev->host->transportt->cleanup(sdev);
-		put_device(&sdev->sdev_gendev);
-	}
+	if (scsi_device_set_state(sdev, SDEV_CANCEL) != 0)
+		return;
+
+	class_device_unregister(&sdev->sdev_classdev);
+	if (sdev->transport_classdev.class)
+		class_device_unregister(&sdev->transport_classdev);
+	device_del(&sdev->sdev_gendev);
+	scsi_device_set_state(sdev, SDEV_DEL);
+	if (sdev->host->hostt->slave_destroy)
+		sdev->host->hostt->slave_destroy(sdev);
+	if (sdev->host->transportt->cleanup)
+		sdev->host->transportt->cleanup(sdev);
+	put_device(&sdev->sdev_gendev);
 }
 
 int scsi_register_driver(struct device_driver *drv)


  reply	other threads:[~2004-04-02 23:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-24 15:03 Calling sd_shutdown when in state SDEV_DEL Heiko Carstens
2004-03-24 15:35 ` James Bottomley
2004-03-24 16:28   ` Heiko Carstens
2004-03-24 17:04   ` Mike Anderson
2004-03-24 20:09     ` James Bottomley
2004-03-25  1:48       ` Mike Anderson
2004-04-02 23:33         ` James Bottomley [this message]
2004-03-24 16:46 ` Mike Anderson

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=1080948785.1830.157.camel@mulgrave \
    --to=james.bottomley@steeleye.com \
    --cc=andmike@us.ibm.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    /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.