[Pkg-iscsi-maintainers] [SCM] Debian Open-iSCSI Packaging branch, upstream-mnc, updated. 2.0-872-193-gde2c0e7

Mike Christie michaelc at cs.wisc.edu
Sat Apr 7 15:43:31 UTC 2012


The following commit has been merged in the upstream-mnc branch:
commit 3a89146c42863b7e06c52d914fb7c612b203f4c0
Author: Jim Ramsay <jim_ramsay at dell.com>
Date:   Fri Jun 3 11:19:59 2011 -0400

    Add support for multiple sessions per iface to iscsid
    
    This introduces a new 'multiple' flag to the session_rec_t, which if set
    instructs iscsid to bypass the check which would normally prevent
    multiple sessions from a single iface record, allowing multiple sessions
    to be created.
    
    The commandline syntax to actually set this flag will be introduced in a
    later commit.
    
    Signed-off-by: Jim Ramsay <jim_ramsay at dell.com>

diff --git a/usr/config.h b/usr/config.h
index dcc862d..e361d7c 100644
--- a/usr/config.h
+++ b/usr/config.h
@@ -195,6 +195,11 @@ typedef struct session_rec {
 	struct iscsi_session_operational_config	iscsi;
 	struct session_info			*info;
 	unsigned                                sid;
+	/*
+	 * This is a flag passed to iscsid.  If set, multiple sessions are
+	 * allowed to be initiated on this record
+	 */
+	unsigned char                           multiple;
 } session_rec_t;
 
 #define ISCSI_TRANSPORT_NAME_MAXLEN 16
diff --git a/usr/idbm.c b/usr/idbm.c
index 4965819..551d724 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -2414,6 +2414,7 @@ void idbm_node_setup_defaults(node_rec_t *rec)
 	rec->session.timeo.replacement_timeout = DEF_REPLACEMENT_TIMEO;
 	rec->session.info = NULL;
 	rec->session.sid = 0;
+	rec->session.multiple = 0;
 	idbm_setup_session_defaults(&rec->session.iscsi);
 
 	for (i=0; i<ISCSI_CONN_MAX; i++) {
diff --git a/usr/initiator.c b/usr/initiator.c
index c004406..823c3ce 100644
--- a/usr/initiator.c
+++ b/usr/initiator.c
@@ -1644,8 +1644,12 @@ session_login_task(node_rec_t *rec, queue_task_t *qtask)
 	struct iscsi_transport *t;
 	int rc;
 
-	if (session_is_running(rec))
-		return ISCSI_ERR_SESS_EXISTS;
+	if (session_is_running(rec)) {
+		if (rec->session.multiple)
+			log_debug(2, "Adding a copy of an existing session");
+		else
+			return ISCSI_ERR_SESS_EXISTS;
+	}
 
 	t = iscsi_sysfs_get_transport_by_name(rec->iface.transport_name);
 	if (!t)
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
index 937b99e..45b4c00 100644
--- a/usr/iscsiadm.c
+++ b/usr/iscsiadm.c
@@ -522,7 +522,7 @@ static int login_portals(struct node_rec *pattern_rec)
 	rc = err;
 	/* if there is an err but some recs then try to login to what we have */
 
-	err = iscsi_login_portals(NULL, &nr_found, 1, &rec_list,
+	err = iscsi_login_portals(pattern_rec, &nr_found, 1, &rec_list,
 				  iscsi_login_portal);
 	if (err)
 		log_error("Could not log into all portals");
diff --git a/usr/session_mgmt.c b/usr/session_mgmt.c
index 0bfa205..afdd077 100644
--- a/usr/session_mgmt.c
+++ b/usr/session_mgmt.c
@@ -94,7 +94,8 @@ static int iscsid_login_reqs_wait(struct list_head *list)
 
 /**
  * iscsi_login_portal - request iscsid to login to portal
- * @data: Unused. Only needed so this can be used in iscsi_login_portals
+ * @data: If set, copies the session.multiple value to the portal record
+ *        so it is propagated to iscsid.
  * @list: If async, list to add session to
  * @rec: portal rec to log into
  */
@@ -103,9 +104,15 @@ int iscsi_login_portal(void *data, struct list_head *list, struct node_rec *rec)
 	struct iscsid_async_req *async_req = NULL;
 	int rc = 0, fd;
 
-	log_info("Logging in to [iface: %s, target: %s, portal: %s,%d]",
+	if (data) {
+		struct node_rec *pattern_rec = data;
+		rec->session.multiple = pattern_rec->session.multiple;
+	}
+
+	log_info("Logging in to [iface: %s, target: %s, portal: %s,%d]%s",
 		 rec->iface.name, rec->name, rec->conn[0].address,
-		 rec->conn[0].port);
+		 rec->conn[0].port,
+		 (rec->session.multiple ? " (multiple)" : ""));
 
 	if (list) {
 		async_req = calloc(1, sizeof(*async_req));

-- 
Debian Open-iSCSI Packaging



More information about the Pkg-iscsi-maintainers mailing list