summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMike Christie <michaelc@cs.wisc.edu>2013-03-06 08:40:24 +0400
committerJames Bottomley <JBottomley@Parallels.com>2013-04-10 07:55:21 +0400
commit27db682bf07fdc105af38827dbbd67d6f0a4ae04 (patch)
treea7339c6e87cabfcd5fa27b0a47611cae93588074 /drivers
parent4f0e359c939e4c217aea3a294b7356d60c351e35 (diff)
downloadlinux-27db682bf07fdc105af38827dbbd67d6f0a4ae04.tar.xz
[SCSI] scsi_dh_alua: fix stpg sense handling
For the stpg_endio path we are not evaluating the sense. The bug is that 1. The error value is set to -EIO when there is sense, so we hit the first error check and always return SCSI_DH_IO. 2. h->senselen is set to zero in submit_stpg. It is not later set to req->sense_len like in the synchrounous exection paths, so we must check the req->sense_len field. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/device_handler/scsi_dh_alua.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c
index 6f4d8e6f32f1..6648ffbb121a 100644
--- a/drivers/scsi/device_handler/scsi_dh_alua.c
+++ b/drivers/scsi/device_handler/scsi_dh_alua.c
@@ -232,13 +232,13 @@ static void stpg_endio(struct request *req, int error)
struct scsi_sense_hdr sense_hdr;
unsigned err = SCSI_DH_OK;
- if (error || host_byte(req->errors) != DID_OK ||
- msg_byte(req->errors) != COMMAND_COMPLETE) {
+ if (host_byte(req->errors) != DID_OK ||
+ msg_byte(req->errors) != COMMAND_COMPLETE) {
err = SCSI_DH_IO;
goto done;
}
- if (h->senselen > 0) {
+ if (req->sense_len > 0) {
err = scsi_normalize_sense(h->sense, SCSI_SENSE_BUFFERSIZE,
&sense_hdr);
if (!err) {
@@ -255,7 +255,9 @@ static void stpg_endio(struct request *req, int error)
ALUA_DH_NAME, sense_hdr.sense_key,
sense_hdr.asc, sense_hdr.ascq);
err = SCSI_DH_IO;
- }
+ } else if (error)
+ err = SCSI_DH_IO;
+
if (err == SCSI_DH_OK) {
h->state = TPGS_STATE_OPTIMIZED;
sdev_printk(KERN_INFO, h->sdev,