All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH]SCSI:Do not block suspend for abandoned devices
@ 2010-10-05 15:21 Oliver Neukum
  2010-10-05 17:19 ` James Bottomley
  0 siblings, 1 reply; 3+ messages in thread
From: Oliver Neukum @ 2010-10-05 15:21 UTC (permalink / raw)
  To: James E.J. Bottomley, linux-scsi, Alan Stern, hare

>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




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH]SCSI:Do not block suspend for abandoned devices
  2010-10-05 15:21 [PATCH]SCSI:Do not block suspend for abandoned devices Oliver Neukum
@ 2010-10-05 17:19 ` James Bottomley
  2010-10-06  7:22   ` Oliver Neukum
  0 siblings, 1 reply; 3+ messages in thread
From: James Bottomley @ 2010-10-05 17:19 UTC (permalink / raw)
  To: Oliver Neukum; +Cc: linux-scsi, Alan Stern, hare

On Tue, 2010-10-05 at 17:21 +0200, Oliver Neukum wrote:
> 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.

So this clarifies what you're trying to do; thanks.  However, I still
think the premise is wrong: if we get a failure for any reason (whether
memory allocation or disk) we probably haven't flushed the disk cache
and our next action in suspend (whether to ram or disk) will power the
drive down and lose the cache data.  I really don't think blocking
suspend and informing the user is inappropriate here.

James



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH]SCSI:Do not block suspend for abandoned devices
  2010-10-05 17:19 ` James Bottomley
@ 2010-10-06  7:22   ` Oliver Neukum
  0 siblings, 0 replies; 3+ messages in thread
From: Oliver Neukum @ 2010-10-06  7:22 UTC (permalink / raw)
  To: James Bottomley; +Cc: linux-scsi, Alan Stern, hare

Am Dienstag, 5. Oktober 2010, 19:19:46 schrieb James Bottomley:
> On Tue, 2010-10-05 at 17:21 +0200, Oliver Neukum wrote:
> > 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.
> 
> So this clarifies what you're trying to do; thanks.  However, I still
> think the premise is wrong: if we get a failure for any reason (whether
> memory allocation or disk) we probably haven't flushed the disk cache
> and our next action in suspend (whether to ram or disk) will power the
> drive down and lose the cache data.  I really don't think blocking
> suspend and informing the user is inappropriate here.

I see. It seems to me that this is true for SDEV_OFFLINE only.

	Regards
		Oliver

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-10-06  7:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-05 15:21 [PATCH]SCSI:Do not block suspend for abandoned devices Oliver Neukum
2010-10-05 17:19 ` James Bottomley
2010-10-06  7:22   ` Oliver Neukum

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.