Compare commits
10 Commits
af50ceb24d
...
3b46ae8082
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3b46ae8082 | ||
|
|
278a7ef832 | ||
|
|
0ff2600885 | ||
|
|
20f4e79640 | ||
|
|
df881c7e89 | ||
|
|
19318edb36 | ||
|
|
a321e0a62b | ||
|
|
1f6b252bc4 | ||
|
|
0292f0fa58 | ||
|
|
a8da8d9002 |
@ -1,46 +0,0 @@
|
||||
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
|
||||
|
||||
@ -0,0 +1,59 @@
|
||||
From 88fa76cec740cc44b7c4b9b384a87ef6c1288174 Mon Sep 17 00:00:00 2001
|
||||
From: Wenchao Hao <haowenchao@huawei.com>
|
||||
Date: Tue, 8 Feb 2022 10:40:33 +0800
|
||||
Subject: [PATCH] iscsid: Check session id before start sync a thread
|
||||
|
||||
If session id has already been synced just return ISCSI_ERR_SESS_EXISTS.
|
||||
|
||||
A same session id would make two MGMT_IPC_SESSION_SYNC requests in
|
||||
following scenario:
|
||||
|
||||
iscsid.socket is enabled, and iscsid did not handle previous
|
||||
MGMT_IPC_SESSION_SYNC due to abnormal exit. This MGMT_IPC_SESSION_SYNC
|
||||
request would left unhandled, when iscsid restart again, newly started
|
||||
iscsid can get this MGMT_IPC_SESSION_SYNC request.
|
||||
|
||||
While the newly started iscsid would make a MGMT_IPC_SESSION_SYNC
|
||||
request for same session id too.
|
||||
|
||||
So here should check if the session id has already been synced.
|
||||
|
||||
Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
|
||||
---
|
||||
usr/initiator.c | 4 ++++
|
||||
usr/iscsid.c | 3 +++
|
||||
2 files changed, 7 insertions(+)
|
||||
|
||||
diff --git a/usr/initiator.c b/usr/initiator.c
|
||||
index 684647c..4ec00b0 100644
|
||||
--- a/usr/initiator.c
|
||||
+++ b/usr/initiator.c
|
||||
@@ -2012,6 +2012,10 @@ iscsi_sync_session(node_rec_t *rec, queue_task_t *qtask, uint32_t sid)
|
||||
struct iscsi_transport *t;
|
||||
int err;
|
||||
|
||||
+ session = session_find_by_sid(sid);
|
||||
+ if (session != NULL)
|
||||
+ return ISCSI_ERR_SESS_EXISTS;
|
||||
+
|
||||
t = iscsi_sysfs_get_transport_by_name(rec->iface.transport_name);
|
||||
if (!t)
|
||||
return ISCSI_ERR_TRANS_NOT_FOUND;
|
||||
diff --git a/usr/iscsid.c b/usr/iscsid.c
|
||||
index 478c83d..e5bd1f5 100644
|
||||
--- a/usr/iscsid.c
|
||||
+++ b/usr/iscsid.c
|
||||
@@ -289,7 +289,10 @@ retry:
|
||||
retries++;
|
||||
sleep(1);
|
||||
goto retry;
|
||||
+ } else if (rc == ISCSI_ERR_SESS_EXISTS) {
|
||||
+ log_debug(1, "sync session %d returned ISCSI_ERR_SESS_EXISTS", info->sid);
|
||||
}
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
--
|
||||
2.27.0
|
||||
|
||||
56
0024-Remove-session-info-password-print.patch
Normal file
56
0024-Remove-session-info-password-print.patch
Normal file
@ -0,0 +1,56 @@
|
||||
From fe6458547a2e6dd6c7dd8246738e0c8a73478171 Mon Sep 17 00:00:00 2001
|
||||
From: Wenchao Hao <haowenchao@huawei.com>
|
||||
Date: Tue, 25 Jan 2022 19:36:35 +0800
|
||||
Subject: [PATCH] Remove session info password print
|
||||
|
||||
In consideration of security, password should not be printed
|
||||
in log, so this patch remove password printing in code.
|
||||
|
||||
Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
|
||||
---
|
||||
usr/session_info.c | 16 +++-------------
|
||||
1 file changed, 3 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/usr/session_info.c b/usr/session_info.c
|
||||
index 0dae82f..b9c406f 100644
|
||||
--- a/usr/session_info.c
|
||||
+++ b/usr/session_info.c
|
||||
@@ -268,7 +268,6 @@ void session_info_print_tree(struct iscsi_session **ses, uint32_t se_count,
|
||||
int32_t tgt_reset_tmo = -1;
|
||||
int32_t lu_reset_tmo = -1;
|
||||
int32_t abort_tmo = -1;
|
||||
- const char *pass = NULL;
|
||||
|
||||
for (i = 0; i < se_count; ++i) {
|
||||
curr = ses[i];
|
||||
@@ -403,24 +402,15 @@ void session_info_print_tree(struct iscsi_session **ses, uint32_t se_count,
|
||||
if (!do_show)
|
||||
printf("%s\t\tpassword: %s\n", prefix,
|
||||
"********");
|
||||
- else {
|
||||
- pass = iscsi_session_password_get(curr);
|
||||
+ else
|
||||
printf("%s\t\tpassword: %s\n", prefix,
|
||||
- strlen(pass) ? pass : UNKNOWN_VALUE);
|
||||
- }
|
||||
+ "********");
|
||||
|
||||
printf("%s\t\tusername_in: %s\n", prefix,
|
||||
strlen(iscsi_session_username_in_get(curr)) ?
|
||||
iscsi_session_username_in_get(curr) :
|
||||
UNKNOWN_VALUE);
|
||||
- if (!do_show)
|
||||
- printf("%s\t\tpassword_in: %s\n", prefix,
|
||||
- "********");
|
||||
- else {
|
||||
- pass = iscsi_session_password_in_get(curr);
|
||||
- printf("%s\t\tpassword: %s\n", prefix,
|
||||
- strlen(pass) ? pass : UNKNOWN_VALUE);
|
||||
- }
|
||||
+ printf("%s\t\tpassword_in: %s\n", prefix,"********");
|
||||
}
|
||||
|
||||
if (flags & SESSION_INFO_ISCSI_PARAMS)
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
114
0025-iscsid-iscsiuio-fix-OOM-adjustment-377.patch
Normal file
114
0025-iscsid-iscsiuio-fix-OOM-adjustment-377.patch
Normal file
@ -0,0 +1,114 @@
|
||||
From a64d26f81ce084a59c36e15b1adb87434e3858ea Mon Sep 17 00:00:00 2001
|
||||
From: Lee Duncan <lduncan@suse.com>
|
||||
Date: Fri, 14 Oct 2022 10:56:59 -0700
|
||||
Subject: [PATCH] iscsid/iscsiuio: fix OOM adjustment (#377)
|
||||
|
||||
* iscsid/iscsiuio: fix OOM adjustment
|
||||
|
||||
For both the iscsid and iscsiuio daemons, they try to modify
|
||||
nice value and OOM adjustment value, so they have priority
|
||||
and will not be killed by the OOM-killer.
|
||||
|
||||
But the code incorrectly set the value to "-17" for modern
|
||||
linux systems, when the maximum is actually "-1000". While
|
||||
making the changes, use "/proc/self/..." instead of
|
||||
"/proc/<PID>/...", so we don't have to use getpid() nor
|
||||
print out the pathname. Now we either write "-16" to
|
||||
the old interface, "-1000" to the new interface, or we
|
||||
print a warning.
|
||||
|
||||
Several "log_debug()" calls that should have been warnings
|
||||
are changed to "log_warning()" calls in iscsid.
|
||||
|
||||
* iscsid/iscsiuio: fix OOM adjustment value for older systems
|
||||
|
||||
On older linux system, "-17" is the maximum, not "-16".
|
||||
---
|
||||
usr/iscsi_util.c | 47 +++++++++++++++++++++++++++--------------------
|
||||
usr/iscsid.c | 2 +-
|
||||
2 files changed, 28 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/usr/iscsi_util.c b/usr/iscsi_util.c
|
||||
index fd8fc0c..3e0528f 100644
|
||||
--- a/usr/iscsi_util.c
|
||||
+++ b/usr/iscsi_util.c
|
||||
@@ -65,36 +65,43 @@ void daemon_init(void)
|
||||
close(fd);
|
||||
}
|
||||
|
||||
-#define ISCSI_OOM_PATH_LEN 48
|
||||
-
|
||||
+/*
|
||||
+ * make a best effort at ajusting our nice
|
||||
+ * score and our OOM score, but it's not considered
|
||||
+ * fatal if either adjustment fails
|
||||
+ *
|
||||
+ * return 0 on success of OOM adjustment
|
||||
+ */
|
||||
int oom_adjust(void)
|
||||
{
|
||||
int fd;
|
||||
- char path[ISCSI_OOM_PATH_LEN];
|
||||
- struct stat statb;
|
||||
+ int res = 0;
|
||||
|
||||
errno = 0;
|
||||
if (nice(-10) == -1 && errno != 0)
|
||||
- log_debug(1, "Could not increase process priority: %s",
|
||||
+ log_warning("Could not increase process priority: %s",
|
||||
strerror(errno));
|
||||
|
||||
- snprintf(path, ISCSI_OOM_PATH_LEN, "/proc/%d/oom_score_adj", getpid());
|
||||
- if (stat(path, &statb)) {
|
||||
- /* older kernel so use old oom_adj file */
|
||||
- snprintf(path, ISCSI_OOM_PATH_LEN, "/proc/%d/oom_adj",
|
||||
- getpid());
|
||||
- }
|
||||
- fd = open(path, O_WRONLY);
|
||||
- if (fd < 0)
|
||||
+ /*
|
||||
+ * try the modern method of adjusting our OOM score,
|
||||
+ * then try the old one, if that fails
|
||||
+ */
|
||||
+ if ((fd = open("/proc/self/oom_score_adj", O_WRONLY)) >= 0) {
|
||||
+ if ((res = write(fd, "-1000", 5)) < 0)
|
||||
+ log_warning("Could not set /proc/self/oom_score_adj to -1000: %s",
|
||||
+ strerror(errno));
|
||||
+ } else if ((fd = open("/proc/self/oom_adj", O_WRONLY)) >= 0) {
|
||||
+ if ((res = write(fd, "-17", 3)) < 0)
|
||||
+ log_warning("Could not set /proc/self/oom_adj to -16: %s",
|
||||
+ strerror(errno));
|
||||
+ } else
|
||||
return -1;
|
||||
- if (write(fd, "-16", 3) < 0) /* for 2.6.11 */
|
||||
- log_debug(1, "Could not set oom score to -16: %s",
|
||||
- strerror(errno));
|
||||
- if (write(fd, "-17", 3) < 0) /* for Andrea's patch */
|
||||
- log_debug(1, "Could not set oom score to -17: %s",
|
||||
- strerror(errno));
|
||||
+
|
||||
close(fd);
|
||||
- return 0;
|
||||
+ if (res < 0)
|
||||
+ return res;
|
||||
+ else
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
char*
|
||||
diff --git a/usr/iscsid.c b/usr/iscsid.c
|
||||
index 138e6b7..b2bfac7 100644
|
||||
--- a/usr/iscsid.c
|
||||
+++ b/usr/iscsid.c
|
||||
@@ -592,7 +592,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* oom-killer will not kill us at the night... */
|
||||
if (oom_adjust())
|
||||
- log_debug(1, "can not adjust oom-killer's pardon");
|
||||
+ log_warning("Cannot adjust oom-killer's pardon");
|
||||
|
||||
/* we don't want our active sessions to be paged out... */
|
||||
if (mlockall(MCL_CURRENT | MCL_FUTURE)) {
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
|
||||
Name: open-iscsi
|
||||
Version: 2.1.1
|
||||
Release: 10
|
||||
Release: 14
|
||||
Summary: ISCSI software initiator daemon and utility programs
|
||||
License: GPLv2+ and BSD
|
||||
URL: http://www.open-iscsi.com
|
||||
@ -16,7 +16,7 @@ Patch4: 0004-not-send-stop-message-if-iscsid-absent.patch
|
||||
Patch5: 0005-iscsid-SIGTERM-syncprocess-hang.patch
|
||||
Patch6: 0006-restart-log-daemon-when-exited-abnormally.patch
|
||||
Patch7: 0007-check-initiator-name-out-of-range.patch
|
||||
Patch8: 0008-do-not-sync-session-when-a-session-is-already-created.patch
|
||||
Patch8: 0008-iscsid-Check-session-id-before-start-sync-a-thread.patch
|
||||
Patch9: 0009-fix-default-file-corrupt.patch
|
||||
Patch10: 0010-iscsiadm-fix-infinite-loop-while-recv-returns-0.patch
|
||||
Patch11: 0011-fix-iscsiadm-logout-timeout.patch
|
||||
@ -32,6 +32,8 @@ Patch20: 0020-check-for-header-length-underflow-during-checksum-ca.patch
|
||||
Patch21: 0021-check-for-u8-overflow-when-processing-TCP-options.patch
|
||||
Patch22: 0022-check-for-TCP-urgent-pointer-past-end-of-frame.patch
|
||||
Patch23: 0023-fix-iscsiadm-op-new-report-to-cannot-rename-error.patch
|
||||
patch24: 0024-Remove-session-info-password-print.patch
|
||||
patch25: 0025-iscsid-iscsiuio-fix-OOM-adjustment-377.patch
|
||||
|
||||
BuildRequires: flex bison doxygen kmod-devel systemd-units gcc git isns-utils-devel systemd-devel
|
||||
BuildRequires: autoconf automake libtool libmount-devel openssl-devel pkg-config gdb
|
||||
@ -41,8 +43,8 @@ Provides: iscsi-initiator-utils
|
||||
Obsoletes: iscsi-initiator-utils
|
||||
Provides: iscsi-initiator-utils-iscsiuio
|
||||
Obsoletes: iscsi-initiator-utils-iscsiuio
|
||||
Provides: libbopeniscsiusr
|
||||
Obsoletes: libbopeniscsiusr
|
||||
Provides: libopeniscsiusr
|
||||
Obsoletes: libopeniscsiusr
|
||||
%{?systemd_requires}
|
||||
|
||||
%description
|
||||
@ -165,6 +167,18 @@ fi
|
||||
%{_mandir}/man8/*
|
||||
|
||||
%changelog
|
||||
* Tue Feb 20 2024 jiangjianjun <jiangjianjun3@huawei.com> - 2.1.1-14
|
||||
- update open-iscsi.spec provides information
|
||||
|
||||
* Fri Dec 2 2022 haowenchao <haowenchao@huawei.com> - 2.1.1-13
|
||||
- Backport bugfix patches from mainline
|
||||
|
||||
* Tue Sep 27 2022 haowenchao <haowenchao@huawei.com> - 2.1.1-12
|
||||
- Substitute self-developed patch with mainline patch
|
||||
|
||||
* Thu Oct 21 2021 haowenchao <haowenchao@huawei.com> - 2.1.1-11
|
||||
- Remove password print in session info display
|
||||
|
||||
* Thu Oct 21 2021 haowenchao <haowenchao@huawei.com> - 2.1.1-10
|
||||
- Update URL
|
||||
|
||||
@ -182,10 +196,10 @@ fi
|
||||
* Thu Apr 8 2021 haowenchao <haowenchao@huawei.com> - 2.1.1-6
|
||||
- Fix file residual files after open-iscsi removed
|
||||
|
||||
* Tue Mon 22 2021 haowenchao <haowenchao@huawei.com> - 2.1.1-5
|
||||
* Mon Feb 22 2021 haowenchao <haowenchao@huawei.com> - 2.1.1-5
|
||||
- Fix iscsiadm op new report to cannot rename error
|
||||
|
||||
* Tue Mon 22 2021 haowenchao <haowenchao@huawei.com> - 2.1.1-4
|
||||
* Mon Feb 22 2021 haowenchao <haowenchao@huawei.com> - 2.1.1-4
|
||||
- Fix CVE-2020-13987 CVE-2020-13988 CVE-2020-17437
|
||||
|
||||
* Tue Dec 15 2020 haowenchao <haowenchao@huawei.com> - 2.1.1-3
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user