[SCSI] iscsi_tcp: don't fire conn error if pdu init fails

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Saturday, May 2, 2009 - 5:01 pm

Gitweb:     http://git.kernel.org/linus/9a6510eb3f030cedba32664498a610dc6d084d46
Commit:     9a6510eb3f030cedba32664498a610dc6d084d46
Parent:     70932935b61ee3dcc5a419ec4c367feb2ff808e4
Author:     Mike Christie <michaelc@cs.wisc.edu>
AuthorDate: Tue Apr 21 15:32:31 2009 -0500
Committer:  James Bottomley <James.Bottomley@HansenPartnership.com>
CommitDate: Mon Apr 27 10:09:51 2009 -0500

    [SCSI] iscsi_tcp: don't fire conn error if pdu init fails
    
    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>
---
 drivers/scsi/iscsi_tcp.c    |    2 +-
 drivers/scsi/libiscsi_tcp.c |    5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index b3e5e08..f97fc7e 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -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;
diff --git a/drivers/scsi/libiscsi_tcp.c b/drivers/scsi/libiscsi_tcp.c
index 91f8ce4..b579ca9 100644
--- a/drivers/scsi/libiscsi_tcp.c
+++ b/drivers/scsi/libiscsi_tcp.c
@@ -1036,8 +1036,11 @@ flush:
 
 	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;
 }
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[SCSI] iscsi_tcp: don't fire conn error if pdu init fails, Linux Kernel Mailing ..., (Sat May 2, 5:01 pm)