All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oliver Neukum <oneukum@suse.de>
To: "James E.J. Bottomley" <James.Bottomley@suse.de>,
	linux-scsi@vger.kernel.org,
	Alan Stern <stern@rowland.harvard.edu>,
	hare@suse.de
Subject: [PATCH]SCSI:Do not block suspend for abandoned devices
Date: Tue, 5 Oct 2010 17:21:25 +0200	[thread overview]
Message-ID: <201010051721.25431.oneukum@suse.de> (raw)

>From d0e0b88a5b271a45f00ab8ae9f22b992d5d090ba Mon Sep 17 00:00:00 2001
From: Oliver Neukum <oliver@neukum.org>
Date: Tue, 5 Oct 2010 17:06:46 +0200
Subject: [PATCH] SCSI:Do not block suspend for abandoned devices

If a device becomes inaccessible while a suspension
is carried out, the device is gone anyhow. There's
no need to block the suspension, as we'd ignore the
devices on later attempts anyway.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
---
 drivers/scsi/scsi_pm.c |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/scsi_pm.c b/drivers/scsi/scsi_pm.c
index d70e91a..396a60c 100644
--- a/drivers/scsi/scsi_pm.c
+++ b/drivers/scsi/scsi_pm.c
@@ -17,16 +17,28 @@
 static int scsi_dev_type_suspend(struct device *dev, pm_message_t msg)
 {
 	struct device_driver *drv;
-	int err;
+	struct scsi_device *sdev;
+	int err, state;
 
-	err = scsi_device_quiesce(to_scsi_device(dev));
+	sdev = to_scsi_device(dev);
+	err = scsi_device_quiesce(sdev);
 	if (err == 0) {
 		drv = dev->driver;
 		if (drv && drv->suspend)
 			err = drv->suspend(dev, msg);
 	}
 	dev_dbg(dev, "scsi suspend: %d\n", err);
-	return err;
+	
+	state = sdev->sdev_state;
+	switch (state) {
+	case SDEV_OFFLINE:
+	case SDEV_CANCEL:
+	case SDEV_DEL:
+		/* the device is dead, we can ignore the problem */
+		return 0;
+	default:
+		return err;
+	}
 }
 
 static int scsi_dev_type_resume(struct device *dev)
-- 
1.7.1




             reply	other threads:[~2010-10-05 15:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-05 15:21 Oliver Neukum [this message]
2010-10-05 17:19 ` [PATCH]SCSI:Do not block suspend for abandoned devices James Bottomley
2010-10-06  7:22   ` Oliver Neukum

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=201010051721.25431.oneukum@suse.de \
    --to=oneukum@suse.de \
    --cc=James.Bottomley@suse.de \
    --cc=hare@suse.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /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.