Commit 3780d1f0 authored by Bart Van Assche's avatar Bart Van Assche Committed by Roland Dreier

IB/srp: Avoid sending a task management function needlessly

Do not send a task management function if sending will fail anyway
because either there is no RDMA/RC connection or the QP is in the
error state.
Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
Acked-by: default avatarDavid Dillow <dave@thedillows.org>
Cc: <stable@vger.kernel.org> # 3.8
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
parent e1b2f13a
...@@ -1695,6 +1695,9 @@ static int srp_send_tsk_mgmt(struct srp_target_port *target, ...@@ -1695,6 +1695,9 @@ static int srp_send_tsk_mgmt(struct srp_target_port *target,
struct srp_iu *iu; struct srp_iu *iu;
struct srp_tsk_mgmt *tsk_mgmt; struct srp_tsk_mgmt *tsk_mgmt;
if (!target->connected || target->qp_in_error)
return -1;
init_completion(&target->tsk_mgmt_done); init_completion(&target->tsk_mgmt_done);
spin_lock_irq(&target->lock); spin_lock_irq(&target->lock);
...@@ -1754,8 +1757,6 @@ static int srp_reset_device(struct scsi_cmnd *scmnd) ...@@ -1754,8 +1757,6 @@ static int srp_reset_device(struct scsi_cmnd *scmnd)
shost_printk(KERN_ERR, target->scsi_host, "SRP reset_device called\n"); shost_printk(KERN_ERR, target->scsi_host, "SRP reset_device called\n");
if (target->qp_in_error)
return FAILED;
if (srp_send_tsk_mgmt(target, SRP_TAG_NO_REQ, scmnd->device->lun, if (srp_send_tsk_mgmt(target, SRP_TAG_NO_REQ, scmnd->device->lun,
SRP_TSK_LUN_RESET)) SRP_TSK_LUN_RESET))
return FAILED; return 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