As per RFC5048 we cannot blindly assume that FastAbort is used,
but rather have to negotiate it with the target. And only when
the negotiation has been successful we can switch it on.

Signed-off-by: Hannes Reinecke <h...@suse.de>
---
 usr/initiator.h |   17 +++++++++--------
 usr/login.c     |   19 +++++++++++++++++++
 usr/util.c      |    2 +-
 3 files changed, 29 insertions(+), 9 deletions(-)

diff --git a/usr/initiator.h b/usr/initiator.h
index 5bcf4d1..67e1e1e 100644
--- a/usr/initiator.h
+++ b/usr/initiator.h
@@ -290,14 +290,15 @@ extern int resolve_address(char *host, char *port, struct 
sockaddr_storage *ss);
 #define ISCSI_DIGEST_CRC32C_NONE 2     /* offer both, prefer CRC32C */
 #define ISCSI_DIGEST_NONE_CRC32C 3     /* offer both, prefer None */
 
-#define IRRELEVANT_MAXCONNECTIONS      0x01
-#define IRRELEVANT_INITIALR2T          0x02
-#define IRRELEVANT_IMMEDIATEDATA       0x04
-#define IRRELEVANT_MAXBURSTLENGTH      0x08
-#define IRRELEVANT_FIRSTBURSTLENGTH    0x10
-#define IRRELEVANT_MAXOUTSTANDINGR2T   0x20
-#define IRRELEVANT_DATAPDUINORDER      0x40
-#define IRRELEVANT_DATASEQUENCEINORDER 0x80
+#define IRRELEVANT_MAXCONNECTIONS      0x0001
+#define IRRELEVANT_INITIALR2T          0x0002
+#define IRRELEVANT_IMMEDIATEDATA       0x0004
+#define IRRELEVANT_MAXBURSTLENGTH      0x0008
+#define IRRELEVANT_FIRSTBURSTLENGTH    0x0010
+#define IRRELEVANT_MAXOUTSTANDINGR2T   0x0020
+#define IRRELEVANT_DATAPDUINORDER      0x0040
+#define IRRELEVANT_DATASEQUENCEINORDER 0x0080
+#define IRRELEVANT_TASKREPORTING       0x0100
 
 
 /*
diff --git a/usr/login.c b/usr/login.c
index 0235870..fd9c4fc 100644
--- a/usr/login.c
+++ b/usr/login.c
@@ -567,6 +567,17 @@ get_op_params_text_keys(iscsi_session_t *session, int cid,
                                                     strtoul(value, NULL, 0));
                }
                text = value_end;
+       } else if (iscsi_find_key_value("TaskReporting", text, end, &value,
+                                        &value_end)) {
+               if (session->type == ISCSI_SESSION_TYPE_NORMAL) {
+                       if (strstr(value, "FastAbort") != NULL)
+                               session->fast_abort = 1;
+                       else
+                               session->fast_abort = 0;
+               } else
+                       session->irrelevant_keys_bitmap |=
+                                               IRRELEVANT_TASKREPORTING;
+               text = value_end;
        } else if (iscsi_find_key_value ("X-com.cisco.protocol", text, end,
                                         &value, &value_end)) {
                if (strcmp(value, "NotUnderstood") &&
@@ -797,6 +808,9 @@ add_params_normal_session(iscsi_session_t *session, struct 
iscsi_hdr *pdu,
                            "FirstBurstLength", value))
                return 0;
 
+       if (!iscsi_add_text(pdu, data, max_data_length, "TaskReporting",
+                           session->fast_abort ? 
"RFC3720,ResponseFence,FastAbort" : "RFC3720,ResponseFence"))
+               return 0;
        /* these we must have */
        if (!iscsi_add_text(pdu, data, max_data_length,
                            "MaxOutstandingR2T", "1"))
@@ -895,6 +909,11 @@ check_irrelevant_keys(iscsi_session_t *session, struct 
iscsi_hdr *pdu,
                                    "DataSequenceInOrder", "Irrelevant"))
                        return 0;
 
+       if (session->irrelevant_keys_bitmap & IRRELEVANT_TASKREPORTING )
+               if (!iscsi_add_text(pdu, data, max_data_length,
+                                   "TaskReporting", "Irrelevant"))
+                       return 0;
+
        return 1;
 }
 
diff --git a/usr/util.c b/usr/util.c
index 5b31e89..6963471 100644
--- a/usr/util.c
+++ b/usr/util.c
@@ -287,7 +287,7 @@ void idbm_node_setup_defaults(node_rec_t *rec)
        rec->session.iscsi.MaxConnections = 1;
        rec->session.iscsi.MaxOutstandingR2T = 1;
        rec->session.iscsi.ERL = 0;
-       rec->session.iscsi.FastAbort = 1;
+       rec->session.iscsi.FastAbort = 0;
 
        for (i=0; i<ISCSI_CONN_MAX; i++) {
                rec->conn[i].startup = ISCSI_STARTUP_MANUAL;
-- 
1.6.0.2


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To post to this group, send email to open-iscsi@googlegroups.com
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~----------~----~----~----~------~----~------~--~---

Reply via email to