Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 33559
b: refs/heads/master
c: 7ea8b82
h: refs/heads/master
i:
  33557: 4125d6a
  33555: b9a3b9c
  33551: 3a5eaaa
v: v3
  • Loading branch information
Mike Christie authored and James Bottomley committed Jul 28, 2006
1 parent 57348ac commit da75aa6
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 26 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: 275fd7d129fdd16d1dc0ec6a8d60bd6b72a76e31
refs/heads/master: 7ea8b82847293c2311cf08fc3ed31ab0e452a27e
71 changes: 46 additions & 25 deletions trunk/drivers/scsi/libiscsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,25 @@ static int iscsi_scsi_cmd_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
return rc;
}

static void iscsi_tmf_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr)
{
struct iscsi_tm_rsp *tmf = (struct iscsi_tm_rsp *)hdr;

conn->exp_statsn = be32_to_cpu(hdr->statsn) + 1;
conn->tmfrsp_pdus_cnt++;

if (conn->tmabort_state != TMABORT_INITIAL)
return;

if (tmf->response == ISCSI_TMF_RSP_COMPLETE)
conn->tmabort_state = TMABORT_SUCCESS;
else if (tmf->response == ISCSI_TMF_RSP_NO_TASK)
conn->tmabort_state = TMABORT_NOT_FOUND;
else
conn->tmabort_state = TMABORT_FAILED;
wake_up(&conn->ehwait);
}

/**
* __iscsi_complete_pdu - complete pdu
* @conn: iscsi conn
Expand Down Expand Up @@ -361,16 +380,7 @@ int __iscsi_complete_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
break;
}

conn->exp_statsn = be32_to_cpu(hdr->statsn) + 1;
conn->tmfrsp_pdus_cnt++;
if (conn->tmabort_state == TMABORT_INITIAL) {
conn->tmabort_state =
((struct iscsi_tm_rsp *)hdr)->
response == ISCSI_TMF_RSP_COMPLETE ?
TMABORT_SUCCESS:TMABORT_FAILED;
/* unblock eh_abort() */
wake_up(&conn->ehwait);
}
iscsi_tmf_rsp(conn, hdr);
break;
case ISCSI_OP_NOOP_IN:
if (hdr->ttt != ISCSI_RESERVED_TAG) {
Expand Down Expand Up @@ -1029,12 +1039,13 @@ static void fail_command(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask,
{
struct scsi_cmnd *sc;

conn->session->tt->cleanup_cmd_task(conn, ctask);
iscsi_ctask_mtask_cleanup(ctask);

sc = ctask->sc;
if (!sc)
return;

conn->session->tt->cleanup_cmd_task(conn, ctask);
iscsi_ctask_mtask_cleanup(ctask);

sc->result = err;
sc->resid = sc->request_bufflen;
iscsi_complete_command(conn->session, ctask);
Expand Down Expand Up @@ -1062,8 +1073,11 @@ int iscsi_eh_abort(struct scsi_cmnd *sc)
goto failed;

/* ctask completed before time out */
if (!ctask->sc)
goto success;
if (!ctask->sc) {
spin_unlock_bh(&session->lock);
debug_scsi("sc completed while abort in progress\n");
goto success_rel_mutex;
}

/* what should we do here ? */
if (conn->ctask == ctask) {
Expand All @@ -1073,33 +1087,39 @@ int iscsi_eh_abort(struct scsi_cmnd *sc)
}

if (ctask->state == ISCSI_TASK_PENDING)
goto success;
goto success_cleanup;

conn->tmabort_state = TMABORT_INITIAL;

spin_unlock_bh(&session->lock);
rc = iscsi_exec_abort_task(sc, ctask);
spin_lock_bh(&session->lock);

iscsi_ctask_mtask_cleanup(ctask);
if (rc || sc->SCp.phase != session->age ||
session->state != ISCSI_STATE_LOGGED_IN)
goto failed;
iscsi_ctask_mtask_cleanup(ctask);

/* ctask completed before tmf abort response */
if (!ctask->sc) {
debug_scsi("sc completed while abort in progress\n");
goto success;
}

if (conn->tmabort_state != TMABORT_SUCCESS) {
switch (conn->tmabort_state) {
case TMABORT_SUCCESS:
goto success_cleanup;
case TMABORT_NOT_FOUND:
if (!ctask->sc) {
/* ctask completed before tmf abort response */
spin_unlock_bh(&session->lock);
debug_scsi("sc completed while abort in progress\n");
goto success_rel_mutex;
}
/* fall through */
default:
/* timedout or failed */
spin_unlock_bh(&session->lock);
iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED);
spin_lock_bh(&session->lock);
goto failed;
}

success:
success_cleanup:
debug_scsi("abort success [sc %lx itt 0x%x]\n", (long)sc, ctask->itt);
spin_unlock_bh(&session->lock);

Expand All @@ -1113,6 +1133,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc)
spin_unlock(&session->lock);
write_unlock_bh(conn->recv_lock);

success_rel_mutex:
mutex_unlock(&conn->xmitmutex);
return SUCCESS;

Expand Down
1 change: 1 addition & 0 deletions trunk/include/scsi/libiscsi.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ struct iscsi_nopin;
#define TMABORT_SUCCESS 0x1
#define TMABORT_FAILED 0x2
#define TMABORT_TIMEDOUT 0x3
#define TMABORT_NOT_FOUND 0x4

/* Connection suspend "bit" */
#define ISCSI_SUSPEND_BIT 1
Expand Down

0 comments on commit da75aa6

Please sign in to comment.