[PATCH]SCSI:Do not block suspend for abandoned devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>From d0e0b88a5b271a45f00ab8ae9f22b992d5d090ba Mon Sep 17 00:00:00 2001
From: Oliver Neukum <oliver@xxxxxxxxxx>
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@xxxxxxx>
---
 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



--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux