diff options
author | Mike Christie <michaelc@cs.wisc.edu> | 2013-03-05 23:40:24 -0500 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2013-04-09 23:55:21 -0400 |
commit | 27db682bf07fdc105af38827dbbd67d6f0a4ae04 (patch) | |
tree | a7339c6e87cabfcd5fa27b0a47611cae93588074 | |
parent | 4f0e359c939e4c217aea3a294b7356d60c351e35 (diff) |
[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>
-rw-r--r-- | drivers/scsi/device_handler/scsi_dh_alua.c | 10 |
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) | |||
232 | struct scsi_sense_hdr sense_hdr; | 232 | struct scsi_sense_hdr sense_hdr; |
233 | unsigned err = SCSI_DH_OK; | 233 | unsigned err = SCSI_DH_OK; |
234 | 234 | ||
235 | if (error || host_byte(req->errors) != DID_OK || | 235 | if (host_byte(req->errors) != DID_OK || |
236 | msg_byte(req->errors) != COMMAND_COMPLETE) { | 236 | msg_byte(req->errors) != COMMAND_COMPLETE) { |
237 | err = SCSI_DH_IO; | 237 | err = SCSI_DH_IO; |
238 | goto done; | 238 | goto done; |
239 | } | 239 | } |
240 | 240 | ||
241 | if (h->senselen > 0) { | 241 | if (req->sense_len > 0) { |
242 | err = scsi_normalize_sense(h->sense, SCSI_SENSE_BUFFERSIZE, | 242 | err = scsi_normalize_sense(h->sense, SCSI_SENSE_BUFFERSIZE, |
243 | &sense_hdr); | 243 | &sense_hdr); |
244 | if (!err) { | 244 | if (!err) { |
@@ -255,7 +255,9 @@ static void stpg_endio(struct request *req, int error) | |||
255 | ALUA_DH_NAME, sense_hdr.sense_key, | 255 | ALUA_DH_NAME, sense_hdr.sense_key, |
256 | sense_hdr.asc, sense_hdr.ascq); | 256 | sense_hdr.asc, sense_hdr.ascq); |
257 | err = SCSI_DH_IO; | 257 | err = SCSI_DH_IO; |
258 | } | 258 | } else if (error) |
259 | err = SCSI_DH_IO; | ||
260 | |||
259 | if (err == SCSI_DH_OK) { | 261 | if (err == SCSI_DH_OK) { |
260 | h->state = TPGS_STATE_OPTIMIZED; | 262 | h->state = TPGS_STATE_OPTIMIZED; |
261 | sdev_printk(KERN_INFO, h->sdev, | 263 | sdev_printk(KERN_INFO, h->sdev, |