Skip to content

Commit

Permalink
[SCSI] iscsi_tcp: don't fire conn error if pdu init fails
Browse files Browse the repository at this point in the history
If a command's scsi cmd pdu setup fails then we can just fail
the IO to the scsi layer. If a DATA_OUT for a R2T fails then
we will want to drop the session, because it means we got a
bad request from the target (iscsi protocol error).

This patch has us propogate the error upwards so libiscsi_tcp
or libiscsi can decide what the best action is to take. It
also fixes a bug where we could try to grab the session lock
while holding it, because if iscsi_tcp drops the session in the
pdu setup callout the session lock is held when setting up the
scsi cmd pdu.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
  • Loading branch information
Mike Christie authored and James Bottomley committed Apr 27, 2009
1 parent 7093293 commit 9a6510e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/scsi/iscsi_tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ static int iscsi_sw_tcp_pdu_init(struct iscsi_task *task,
}

if (err) {
iscsi_conn_failure(conn, err);
/* got invalid offset/len */
return -EIO;
}
return 0;
Expand Down
5 changes: 4 additions & 1 deletion drivers/scsi/libiscsi_tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1036,8 +1036,11 @@ int iscsi_tcp_task_xmit(struct iscsi_task *task)

rc = conn->session->tt->init_pdu(task, r2t->data_offset + r2t->sent,
r2t->data_count);
if (rc)
if (rc) {
iscsi_conn_failure(conn, ISCSI_ERR_XMIT_FAILED);
return rc;
}

r2t->sent += r2t->data_count;
goto flush;
}
Expand Down

0 comments on commit 9a6510e

Please sign in to comment.