SCSI:Do not block suspend for abandoned devices
PATCH 1/1 SCSI:Do not block suspend for abandoned devices
Quoted 1 line
From
d0e0b88a5b271a45f00ab8ae9f22b992d5d090baMon Sep 17 00:00:00 2001
From: Oliver Neukum <[email protected]>
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.
--- drivers/scsi/scsi_pm.c | 18 +++++++++++++++--- 1 files changed, 15 insertions(+), 3 deletions(-)
drivers/scsi/scsi_pm.c +15 -3
@@ -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)
Signature · 1 line
1.7.1
Quoted 9 lines · Oliver Neukum
From
d0e0b88a5b271a45f00ab8ae9f22b992d5d090baMon Sep 17 00:00:00 2001
From: Oliver Neukum <[email protected]>
Date: Tue, 5 Oct 2010 17:06:46 +0200
Subject: [PATCH] SCSI:Do not block suspend for abandoned devicesIf 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
Am Dienstag, 5. Oktober 2010, 19:19:46 schrieb James Bottomley:
Quoted 11 lines · Oliver Neukum
Quoted 9 lines
From
d0e0b88a5b271a45f00ab8ae9f22b992d5d090baMon Sep 17 00:00:00 2001
From: Oliver Neukum <[email protected]>
Date: Tue, 5 Oct 2010 17:06:46 +0200
Subject: [PATCH] SCSI:Do not block suspend for abandoned devicesIf 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.
Quoted 6 lines
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