Backport bugfix patches from mainline
Reference:https://github.com/open-iscsi/open-iscsi/commit/fd0b3973 https://github.com/open-iscsi/open-iscsi/commit/8c6d7bc2 Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
This commit is contained in:
parent
ab5ffaf7d0
commit
c3202a63a1
@ -0,0 +1,31 @@
|
||||
From bf9f8bc774fbd4f7a1bb79452645aac2c82d950b Mon Sep 17 00:00:00 2001
|
||||
From: shugaley <54910986+shugaley@users.noreply.github.com>
|
||||
Date: Thu, 28 Jul 2022 21:57:37 +0300
|
||||
Subject: [PATCH 1/2] Fix a possible passing null pointer in usr/iface.c (#356)
|
||||
|
||||
---
|
||||
usr/iface.c | 8 +++++---
|
||||
1 file changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/usr/iface.c b/usr/iface.c
|
||||
index 9db73c3..3fed236 100644
|
||||
--- a/usr/iface.c
|
||||
+++ b/usr/iface.c
|
||||
@@ -1013,9 +1013,11 @@ static bool ipaddr_is_ipv6(char *ipaddr)
|
||||
(second_colon != first_colon))
|
||||
res = true;
|
||||
}
|
||||
- }
|
||||
- log_debug(8, "%s(%s) -> %u",
|
||||
- __FUNCTION__, ipaddr, res);
|
||||
+ log_debug(8, "%s(%s) -> %u",
|
||||
+ __FUNCTION__, ipaddr, res);
|
||||
+ } else
|
||||
+ log_debug(8, "%s(nil) -> %u",
|
||||
+ __FUNCTION__, res);
|
||||
return res;
|
||||
}
|
||||
|
||||
--
|
||||
2.27.0
|
||||
|
||||
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 2cf0c28b12ab04f5a198f1638c7e2cf8ca7d725b Mon Sep 17 00:00:00 2001
|
||||
From: Lee Duncan <lduncan@suse.com>
|
||||
Date: Fri, 14 Oct 2022 10:56:59 -0700
|
||||
Subject: [PATCH 2/2] 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 db1dc37..2f1de3e 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 04ab667..61ef08f 100644
|
||||
--- a/usr/iscsid.c
|
||||
+++ b/usr/iscsid.c
|
||||
@@ -615,7 +615,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.5
|
||||
Release: 9
|
||||
Release: 10
|
||||
Summary: ISCSI software initiator daemon and utility programs
|
||||
License: GPLv2+ and BSD
|
||||
URL: http://www.open-iscsi.com
|
||||
@ -32,6 +32,9 @@ patch20: 0020-Fix-more-issues-discovered-by-gcc12.patch
|
||||
patch21: 0021-actor-enhanced-print-error-log-when-init-a-initilize.patch
|
||||
patch22: 0022-initiator_common-make-set-operational-parameter-log-.patch
|
||||
patch23: 0023-Remove-unused-fwparam_ibft.-ch-files-in-fwparam_ibft.patch
|
||||
patch24: 0024-Fix-a-possible-passing-null-pointer-in-usr-iface.c-3.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
|
||||
@ -158,6 +161,9 @@ fi
|
||||
%{_mandir}/man8/*
|
||||
|
||||
%changelog
|
||||
* Fri Dec 2 2022 haowenchao <haowenchao@huawei.com> - 2.1.5-10
|
||||
- Backport bugfix patches from mainline
|
||||
|
||||
* Tue Sep 27 2022 haowenchao <haowenchao@huawei.com> - 2.1.5-9
|
||||
- Substitute self-developed patch with mainline patch
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user