Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 316779
b: refs/heads/master
c: 8e67ce6
h: refs/heads/master
i:
  316777: ed02504
  316775: 4178b86
v: v3
  • Loading branch information
Rob Evers authored and James Bottomley committed Jul 20, 2012
1 parent 4e2ca6e commit d563025
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3588c5a21aef8c8dcc3b30d72c62971e97af1322
refs/heads/master: 8e67ce6072a0ab7fcefbbd2913fa4eaf3fdd8d68
26 changes: 23 additions & 3 deletions trunk/drivers/scsi/device_handler/scsi_dh_alua.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ static int submit_vpd_inquiry(struct scsi_device *sdev, struct alua_dh_data *h)
* submit_rtpg - Issue a REPORT TARGET GROUP STATES command
* @sdev: sdev the command should be sent to
*/
static unsigned submit_rtpg(struct scsi_device *sdev, struct alua_dh_data *h)
static unsigned submit_rtpg(struct scsi_device *sdev, struct alua_dh_data *h,
bool rtpg_ext_hdr_req)
{
struct request *rq;
int err = SCSI_DH_RES_TEMP_UNAVAIL;
Expand All @@ -189,7 +190,10 @@ static unsigned submit_rtpg(struct scsi_device *sdev, struct alua_dh_data *h)

/* Prepare the command. */
rq->cmd[0] = MAINTENANCE_IN;
rq->cmd[1] = MI_REPORT_TARGET_PGS | MI_EXT_HDR_PARAM_FMT;
if (rtpg_ext_hdr_req)
rq->cmd[1] = MI_REPORT_TARGET_PGS | MI_EXT_HDR_PARAM_FMT;
else
rq->cmd[1] = MI_REPORT_TARGET_PGS;
rq->cmd[6] = (h->bufflen >> 24) & 0xff;
rq->cmd[7] = (h->bufflen >> 16) & 0xff;
rq->cmd[8] = (h->bufflen >> 8) & 0xff;
Expand Down Expand Up @@ -522,6 +526,7 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_dh_data *h)
int len, k, off, valid_states = 0;
unsigned char *ucp;
unsigned err;
bool rtpg_ext_hdr_req = 1;
unsigned long expiry, interval = 1000;
unsigned int tpg_desc_tbl_off;
unsigned char orig_transition_tmo;
Expand All @@ -532,14 +537,29 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_dh_data *h)
expiry = round_jiffies_up(jiffies + h->transition_tmo * HZ);

retry:
err = submit_rtpg(sdev, h);
err = submit_rtpg(sdev, h, rtpg_ext_hdr_req);

if (err == SCSI_DH_IO && h->senselen > 0) {
err = scsi_normalize_sense(h->sense, SCSI_SENSE_BUFFERSIZE,
&sense_hdr);
if (!err)
return SCSI_DH_IO;

/*
* submit_rtpg() has failed on existing arrays
* when requesting extended header info, and
* the array doesn't support extended headers,
* even though it shouldn't according to T10.
* The retry without rtpg_ext_hdr_req set
* handles this.
*/
if (rtpg_ext_hdr_req == 1 &&
sense_hdr.sense_key == ILLEGAL_REQUEST &&
sense_hdr.asc == 0x24 && sense_hdr.ascq == 0) {
rtpg_ext_hdr_req = 0;
goto retry;
}

err = alua_check_sense(sdev, &sense_hdr);
if (err == ADD_TO_MLQUEUE && time_before(jiffies, expiry))
goto retry;
Expand Down

0 comments on commit d563025

Please sign in to comment.