Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 343673
b: refs/heads/master
c: 09be70a
h: refs/heads/master
i:
  343671: bad4ca1
v: v3
  • Loading branch information
Bart Van Assche authored and Roland Dreier committed Dec 1, 2012
1 parent 5d72072 commit 684fd37
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 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: c9b03c1ae55decc721310b79d8f50d44fbb37dc7
refs/heads/master: 09be70a238005cc33f2a52b0aeae52f117e81582
25 changes: 14 additions & 11 deletions trunk/drivers/infiniband/ulp/srp/ib_srp.c
Original file line number Diff line number Diff line change
Expand Up @@ -646,30 +646,33 @@ static void srp_reset_req(struct srp_target_port *target, struct srp_request *re

static int srp_reconnect_target(struct srp_target_port *target)
{
struct Scsi_Host *shost = target->scsi_host;
struct ib_qp_attr qp_attr;
struct ib_wc wc;
int i, ret;

if (!srp_change_state(target, SRP_TARGET_LIVE, SRP_TARGET_CONNECTING))
if (target->state != SRP_TARGET_LIVE)
return -EAGAIN;

scsi_target_block(&shost->shost_gendev);

srp_disconnect_target(target);
/*
* Now get a new local CM ID so that we avoid confusing the
* target in case things are really fouled up.
*/
ret = srp_new_cm_id(target);
if (ret)
goto err;
goto unblock;

qp_attr.qp_state = IB_QPS_RESET;
ret = ib_modify_qp(target->qp, &qp_attr, IB_QP_STATE);
if (ret)
goto err;
goto unblock;

ret = srp_init_qp(target, target->qp);
if (ret)
goto err;
goto unblock;

while (ib_poll_cq(target->recv_cq, 1, &wc) > 0)
; /* nothing */
Expand All @@ -688,11 +691,15 @@ static int srp_reconnect_target(struct srp_target_port *target)

target->qp_in_error = 0;
ret = srp_connect_target(target);

unblock:
scsi_target_unblock(&shost->shost_gendev, ret == 0 ? SDEV_RUNNING :
SDEV_TRANSPORT_OFFLINE);

if (ret)
goto err;

if (!srp_change_state(target, SRP_TARGET_CONNECTING, SRP_TARGET_LIVE))
ret = -EAGAIN;
shost_printk(KERN_INFO, target->scsi_host, PFX "reconnect succeeded\n");

return ret;

Expand All @@ -710,7 +717,7 @@ static int srp_reconnect_target(struct srp_target_port *target)
* the flush_scheduled_work() in srp_remove_one().
*/
spin_lock_irq(&target->lock);
if (target->state == SRP_TARGET_CONNECTING) {
if (target->state == SRP_TARGET_LIVE) {
target->state = SRP_TARGET_DEAD;
INIT_WORK(&target->work, srp_remove_work);
queue_work(ib_wq, &target->work);
Expand Down Expand Up @@ -1311,9 +1318,6 @@ static int srp_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd)
unsigned long flags;
int len;

if (target->state == SRP_TARGET_CONNECTING)
goto err;

if (target->state == SRP_TARGET_DEAD ||
target->state == SRP_TARGET_REMOVED) {
scmnd->result = DID_BAD_TARGET << 16;
Expand Down Expand Up @@ -1377,7 +1381,6 @@ static int srp_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd)
err_unlock:
spin_unlock_irqrestore(&target->lock, flags);

err:
return SCSI_MLQUEUE_HOST_BUSY;
}

Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/infiniband/ulp/srp/ib_srp.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ enum {

enum srp_target_state {
SRP_TARGET_LIVE,
SRP_TARGET_CONNECTING,
SRP_TARGET_DEAD,
SRP_TARGET_REMOVED
};
Expand Down

0 comments on commit 684fd37

Please sign in to comment.