aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/sd.c')
-rw-r--r--drivers/scsi/sd.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 69725f7c32c1..35a785609364 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -110,7 +110,7 @@ static int sd_suspend_runtime(struct device *);
110static int sd_resume(struct device *); 110static int sd_resume(struct device *);
111static void sd_rescan(struct device *); 111static void sd_rescan(struct device *);
112static int sd_done(struct scsi_cmnd *); 112static int sd_done(struct scsi_cmnd *);
113static int sd_eh_action(struct scsi_cmnd *, unsigned char *, int, int); 113static int sd_eh_action(struct scsi_cmnd *, int);
114static void sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer); 114static void sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer);
115static void scsi_disk_release(struct device *cdev); 115static void scsi_disk_release(struct device *cdev);
116static void sd_print_sense_hdr(struct scsi_disk *, struct scsi_sense_hdr *); 116static void sd_print_sense_hdr(struct scsi_disk *, struct scsi_sense_hdr *);
@@ -1551,23 +1551,23 @@ static const struct block_device_operations sd_fops = {
1551/** 1551/**
1552 * sd_eh_action - error handling callback 1552 * sd_eh_action - error handling callback
1553 * @scmd: sd-issued command that has failed 1553 * @scmd: sd-issued command that has failed
1554 * @eh_cmnd: The command that was sent during error handling
1555 * @eh_cmnd_len: Length of eh_cmnd in bytes
1556 * @eh_disp: The recovery disposition suggested by the midlayer 1554 * @eh_disp: The recovery disposition suggested by the midlayer
1557 * 1555 *
1558 * This function is called by the SCSI midlayer upon completion of 1556 * This function is called by the SCSI midlayer upon completion of an
1559 * an error handling command (TEST UNIT READY, START STOP UNIT, 1557 * error test command (currently TEST UNIT READY). The result of sending
1560 * etc.) The command sent to the device by the error handler is 1558 * the eh command is passed in eh_disp. We're looking for devices that
1561 * stored in eh_cmnd. The result of sending the eh command is 1559 * fail medium access commands but are OK with non access commands like
1562 * passed in eh_disp. 1560 * test unit ready (so wrongly see the device as having a successful
1561 * recovery)
1563 **/ 1562 **/
1564static int sd_eh_action(struct scsi_cmnd *scmd, unsigned char *eh_cmnd, 1563static int sd_eh_action(struct scsi_cmnd *scmd, int eh_disp)
1565 int eh_cmnd_len, int eh_disp)
1566{ 1564{
1567 struct scsi_disk *sdkp = scsi_disk(scmd->request->rq_disk); 1565 struct scsi_disk *sdkp = scsi_disk(scmd->request->rq_disk);
1568 1566
1569 if (!scsi_device_online(scmd->device) || 1567 if (!scsi_device_online(scmd->device) ||
1570 !scsi_medium_access_command(scmd)) 1568 !scsi_medium_access_command(scmd) ||
1569 host_byte(scmd->result) != DID_TIME_OUT ||
1570 eh_disp != SUCCESS)
1571 return eh_disp; 1571 return eh_disp;
1572 1572
1573 /* 1573 /*
@@ -1577,9 +1577,7 @@ static int sd_eh_action(struct scsi_cmnd *scmd, unsigned char *eh_cmnd,
1577 * process of recovering or has it suffered an internal failure 1577 * process of recovering or has it suffered an internal failure
1578 * that prevents access to the storage medium. 1578 * that prevents access to the storage medium.
1579 */ 1579 */
1580 if (host_byte(scmd->result) == DID_TIME_OUT && eh_disp == SUCCESS && 1580 sdkp->medium_access_timed_out++;
1581 eh_cmnd_len && eh_cmnd[0] == TEST_UNIT_READY)
1582 sdkp->medium_access_timed_out++;
1583 1581
1584 /* 1582 /*
1585 * If the device keeps failing read/write commands but TEST UNIT 1583 * If the device keeps failing read/write commands but TEST UNIT