1 Star 0 Fork 28

zero/open-iscsi

forked from src-openEuler/open-iscsi 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0005-do-not-sync-session-when-a-session-is-already-created.patch 1.89 KB
一键复制 编辑 原始数据 按行查看 历史
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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wubo009/open-iscsi.git
git@gitee.com:wubo009/open-iscsi.git
wubo009
open-iscsi
open-iscsi
master

搜索帮助