Commit 55d29bf0 authored by Brian King's avatar Brian King Committed by James Bottomley

[SCSI] ibmvfc: Send cancel when link is down

If attempting to abort requests due to a fail fail timeout
or error handling while the link is down, we cannot send
an abort out on the fabric. We can, however, send a cancel
to the VIOS. This fixes ibmvfc to send a cancel in this
case to prevent error handling from failing and/or
escalating.
Signed-off-by: default avatarBrian King <brking@linux.vnet.ibm.com>
Acked-by: default avatarRobert Jennings <rcj@linux.vnet.ibm.com>
Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
parent 93631b4a
...@@ -2179,7 +2179,7 @@ static int ibmvfc_cancel_all(struct scsi_device *sdev, int type) ...@@ -2179,7 +2179,7 @@ static int ibmvfc_cancel_all(struct scsi_device *sdev, int type)
return 0; return 0;
} }
if (vhost->state == IBMVFC_ACTIVE) { if (vhost->logged_in) {
evt = ibmvfc_get_event(vhost); evt = ibmvfc_get_event(vhost);
ibmvfc_init_event(evt, ibmvfc_sync_completion, IBMVFC_MAD_FORMAT); ibmvfc_init_event(evt, ibmvfc_sync_completion, IBMVFC_MAD_FORMAT);
...@@ -2190,7 +2190,10 @@ static int ibmvfc_cancel_all(struct scsi_device *sdev, int type) ...@@ -2190,7 +2190,10 @@ static int ibmvfc_cancel_all(struct scsi_device *sdev, int type)
tmf->common.length = sizeof(*tmf); tmf->common.length = sizeof(*tmf);
tmf->scsi_id = rport->port_id; tmf->scsi_id = rport->port_id;
int_to_scsilun(sdev->lun, &tmf->lun); int_to_scsilun(sdev->lun, &tmf->lun);
tmf->flags = (type | IBMVFC_TMF_LUA_VALID); if (vhost->state == IBMVFC_ACTIVE)
tmf->flags = (type | IBMVFC_TMF_LUA_VALID);
else
tmf->flags = IBMVFC_TMF_LUA_VALID;
tmf->cancel_key = (unsigned long)sdev->hostdata; tmf->cancel_key = (unsigned long)sdev->hostdata;
tmf->my_cancel_key = (unsigned long)starget->hostdata; tmf->my_cancel_key = (unsigned long)starget->hostdata;
...@@ -2389,7 +2392,7 @@ static int ibmvfc_eh_abort_handler(struct scsi_cmnd *cmd) ...@@ -2389,7 +2392,7 @@ static int ibmvfc_eh_abort_handler(struct scsi_cmnd *cmd)
{ {
struct scsi_device *sdev = cmd->device; struct scsi_device *sdev = cmd->device;
struct ibmvfc_host *vhost = shost_priv(sdev->host); struct ibmvfc_host *vhost = shost_priv(sdev->host);
int cancel_rc, block_rc, abort_rc = 0; int cancel_rc, block_rc;
int rc = FAILED; int rc = FAILED;
ENTER; ENTER;
...@@ -2397,11 +2400,11 @@ static int ibmvfc_eh_abort_handler(struct scsi_cmnd *cmd) ...@@ -2397,11 +2400,11 @@ static int ibmvfc_eh_abort_handler(struct scsi_cmnd *cmd)
ibmvfc_wait_while_resetting(vhost); ibmvfc_wait_while_resetting(vhost);
if (block_rc != FAST_IO_FAIL) { if (block_rc != FAST_IO_FAIL) {
cancel_rc = ibmvfc_cancel_all(sdev, IBMVFC_TMF_ABORT_TASK_SET); cancel_rc = ibmvfc_cancel_all(sdev, IBMVFC_TMF_ABORT_TASK_SET);
abort_rc = ibmvfc_abort_task_set(sdev); ibmvfc_abort_task_set(sdev);
} else } else
cancel_rc = ibmvfc_cancel_all(sdev, 0); cancel_rc = ibmvfc_cancel_all(sdev, 0);
if (!cancel_rc && !abort_rc) if (!cancel_rc)
rc = ibmvfc_wait_for_ops(vhost, sdev, ibmvfc_match_lun); rc = ibmvfc_wait_for_ops(vhost, sdev, ibmvfc_match_lun);
if (block_rc == FAST_IO_FAIL && rc != FAILED) if (block_rc == FAST_IO_FAIL && rc != FAILED)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment