Skip to content

Commit

Permalink
IB/srp: Avoid sending a task management function needlessly
Browse files Browse the repository at this point in the history
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: Bart Van Assche <bvanassche@acm.org>
Acked-by: David Dillow <dave@thedillows.org>
Cc: <stable@vger.kernel.org> # 3.8
Signed-off-by: Roland Dreier <roland@purestorage.com>
  • Loading branch information
Bart Van Assche authored and Roland Dreier committed Feb 25, 2013
1 parent e1b2f13 commit 3780d1f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/infiniband/ulp/srp/ib_srp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1695,6 +1695,9 @@ static int srp_send_tsk_mgmt(struct srp_target_port *target,
struct srp_iu *iu;
struct srp_tsk_mgmt *tsk_mgmt;

if (!target->connected || target->qp_in_error)
return -1;

init_completion(&target->tsk_mgmt_done);

spin_lock_irq(&target->lock);
Expand Down Expand Up @@ -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");

if (target->qp_in_error)
return FAILED;
if (srp_send_tsk_mgmt(target, SRP_TAG_NO_REQ, scmnd->device->lun,
SRP_TSK_LUN_RESET))
return FAILED;
Expand Down

0 comments on commit 3780d1f

Please sign in to comment.