SCSI:sd: sd_start_stop_device() error handling
PATCH 3/3 SCSI:sd: sd_start_stop_device() error handling
Quoted 1 line
From
63cd566f7e63bc1592e2652b95b53cf7aaa7dcb3Mon Sep 17 00:00:00 2001
From: Oliver Neukum <[email protected]>
Date: Mon, 25 Oct 2010 15:36:27 +0200
Subject: [PATCH 3/3] SCSI:sd: sd_start_stop_device() error handling
- ignore failure of sd_start_stop_device() due to medium removal
- do not abort a system suspension due to a failure in sd_start_stop_device()
Signed-off-by Oliver Neukum <[email protected]>
--- drivers/scsi/sd.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/scsi/sd.c +8 -0
@@ -2569,6 +2569,10 @@ static int sd_start_stop_device(struct scsi_disk *sdkp, int start)sd_print_result (sdkp, res);if (driver_byte (res) &DRIVER_SENSE )sd_print_sense_hdr (sdkp, &sshdr); +if ((scsi_sense_valid (&sshdr) && +/* 0x3a is medium not present */ + sshdr.asc ==0x3a )) + res =0 ; }/* SCSI error codes must not go to the generic layer */
@@ -2621,6 +2625,10 @@ static int sd_suspend(struct device *dev, pm_message_t mesg)if ((mesg.event &PM_EVENT_SLEEP ) && sdkp->device->manage_start_stop) {sd_printk (KERN_NOTICE , sdkp,"Stopping disk\n" ); ret =sd_start_stop_device (sdkp,0 ); + +/* an error is not worth aborting a system sleep */ +if (!(mesg.event &PM_EVENT_AUTO )) + ret =0 ; } done:
Signature · 1 line
1.7.1