提交 5597cafc 编写于 作者: H Hannes Reinecke 提交者: Martin K. Petersen

scsi_dh_alua: return standard SCSI return codes in submit_rtpg

Fixup submit_rtpg() to always return a standard SCSI return code.
Signed-off-by: NHannes Reinecke <hare@suse.de>
Reviewed-by: NEwan Milne <emilne@redhat.com>
Reviewed-by: NJohannes Thumshirn <jthumshirn@suse.com>
Reviewed-by: NChristoph Hellwig <hch@lst.de>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
上级 80bd68d6
...@@ -138,11 +138,13 @@ static unsigned submit_rtpg(struct scsi_device *sdev, struct alua_dh_data *h, ...@@ -138,11 +138,13 @@ static unsigned submit_rtpg(struct scsi_device *sdev, struct alua_dh_data *h,
bool rtpg_ext_hdr_req) bool rtpg_ext_hdr_req)
{ {
struct request *rq; struct request *rq;
int err = SCSI_DH_RES_TEMP_UNAVAIL; int err = 0;
rq = get_alua_req(sdev, h->buff, h->bufflen, READ); rq = get_alua_req(sdev, h->buff, h->bufflen, READ);
if (!rq) if (!rq) {
err = DRIVER_BUSY << 24;
goto done; goto done;
}
/* Prepare the command. */ /* Prepare the command. */
rq->cmd[0] = MAINTENANCE_IN; rq->cmd[0] = MAINTENANCE_IN;
...@@ -160,13 +162,9 @@ static unsigned submit_rtpg(struct scsi_device *sdev, struct alua_dh_data *h, ...@@ -160,13 +162,9 @@ static unsigned submit_rtpg(struct scsi_device *sdev, struct alua_dh_data *h,
memset(rq->sense, 0, SCSI_SENSE_BUFFERSIZE); memset(rq->sense, 0, SCSI_SENSE_BUFFERSIZE);
rq->sense_len = 0; rq->sense_len = 0;
err = blk_execute_rq(rq->q, NULL, rq, 1); blk_execute_rq(rq->q, NULL, rq, 1);
if (err == -EIO) { if (rq->errors)
sdev_printk(KERN_INFO, sdev, err = rq->errors;
"%s: rtpg failed with %x\n",
ALUA_DH_NAME, rq->errors);
err = SCSI_DH_IO;
}
blk_put_request(rq); blk_put_request(rq);
done: done:
return err; return err;
...@@ -493,7 +491,7 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_dh_data *h, int wait_ ...@@ -493,7 +491,7 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_dh_data *h, int wait_
struct scsi_sense_hdr sense_hdr; struct scsi_sense_hdr sense_hdr;
int len, k, off, valid_states = 0; int len, k, off, valid_states = 0;
unsigned char *ucp; unsigned char *ucp;
unsigned err; unsigned err, retval;
bool rtpg_ext_hdr_req = 1; bool rtpg_ext_hdr_req = 1;
unsigned long expiry, interval = 0; unsigned long expiry, interval = 0;
unsigned int tpg_desc_tbl_off; unsigned int tpg_desc_tbl_off;
...@@ -505,12 +503,17 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_dh_data *h, int wait_ ...@@ -505,12 +503,17 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_dh_data *h, int wait_
expiry = round_jiffies_up(jiffies + h->transition_tmo * HZ); expiry = round_jiffies_up(jiffies + h->transition_tmo * HZ);
retry: retry:
err = submit_rtpg(sdev, h, rtpg_ext_hdr_req); retval = submit_rtpg(sdev, h, rtpg_ext_hdr_req);
if (retval) {
if (err == SCSI_DH_IO) {
if (!scsi_normalize_sense(h->sense, SCSI_SENSE_BUFFERSIZE, if (!scsi_normalize_sense(h->sense, SCSI_SENSE_BUFFERSIZE,
&sense_hdr)) &sense_hdr)) {
sdev_printk(KERN_INFO, sdev,
"%s: rtpg failed, result %d\n",
ALUA_DH_NAME, retval);
if (driver_byte(retval) == DRIVER_BUSY)
return SCSI_DH_DEV_TEMP_BUSY;
return SCSI_DH_IO; return SCSI_DH_IO;
}
/* /*
* submit_rtpg() has failed on existing arrays * submit_rtpg() has failed on existing arrays
...@@ -539,8 +542,6 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_dh_data *h, int wait_ ...@@ -539,8 +542,6 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_dh_data *h, int wait_
scsi_print_sense_hdr(sdev, ALUA_DH_NAME, &sense_hdr); scsi_print_sense_hdr(sdev, ALUA_DH_NAME, &sense_hdr);
return SCSI_DH_IO; return SCSI_DH_IO;
} }
if (err != SCSI_DH_OK)
return err;
len = (h->buff[0] << 24) + (h->buff[1] << 16) + len = (h->buff[0] << 24) + (h->buff[1] << 16) +
(h->buff[2] << 8) + h->buff[3] + 4; (h->buff[2] << 8) + h->buff[3] + 4;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册