47 lines
1.9 KiB
Diff
47 lines
1.9 KiB
Diff
From 93d217ce22e7668abfc5e6dbc015b37b20174b09 Mon Sep 17 00:00:00 2001
|
|
From: huangkaibin <huangkaibin@huawei.com>
|
|
Date: Fri, 19 Jan 2018 03:00:17 +0800
|
|
Subject: [PATCH] iscsid: Do not sync session when a session is already created
|
|
for a remote device
|
|
|
|
Do not sync session when a session is already created for a remote device
|
|
1. In the following scenarios, two or more sessions will be created and open for one remote device
|
|
a) two or more sync sessions are requested from the sync process for the same remote device.
|
|
this may occur when iscsid is restarted, one is requested by the previous started sync process but not handled, and another
|
|
is requested by the newly started sync process.
|
|
b) one is created in sync session, the other is created in __session_login_task.
|
|
2. If two or more sessions are created for one remote device, and there are connection problems on the remote device,
|
|
these sessions will be reopen again, and will cause one to close the connection while the other to set param for the remote device
|
|
in kernel, and will cause kernel to panic.
|
|
3. this patch fix this problem by not sync session when a session is already created for a remote device
|
|
---
|
|
usr/initiator.c | 7 +++++++
|
|
1 file changed, 7 insertions(+)
|
|
|
|
diff --git a/usr/initiator.c b/usr/initiator.c
|
|
index 60bd2b7..4a48bf5 100644
|
|
--- a/usr/initiator.c
|
|
+++ b/usr/initiator.c
|
|
@@ -2097,11 +2097,18 @@ iscsi_sync_session(node_rec_t *rec, queue_task_t *qtask, uint32_t sid)
|
|
iscsi_session_t *session;
|
|
struct iscsi_transport *t;
|
|
int err;
|
|
+ int nr_found;
|
|
|
|
t = iscsi_sysfs_get_transport_by_name(rec->iface.transport_name);
|
|
if (!t)
|
|
return ISCSI_ERR_TRANS_NOT_FOUND;
|
|
|
|
+ nr_found = session_find_by_rec(rec);
|
|
+ if(nr_found > 0) {
|
|
+ log_error("session is already created. sid: %d, name: %s.\n", sid, rec->name);
|
|
+ return ISCSI_ERR_SESS_EXISTS;
|
|
+ }
|
|
+
|
|
session = __session_create(rec, t, &err);
|
|
if (!session)
|
|
return ISCSI_ERR_LOGIN;
|
|
--
|
|
1.8.3.1
|
|
|