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_ram...@dell.com> --- usr/config.h | 5 +++++ usr/idbm.c | 1 + usr/initiator.c | 8 ++++++-- usr/iscsiadm.c | 2 +- usr/session_mgmt.c | 13 ++++++++++--- 5 files changed, 23 insertions(+), 6 deletions(-) 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..185324c 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 new multiple 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)); -- 1.7.5.3 -- 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?hl=en.