Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package open-iscsi for openSUSE:Factory checked in at 2022-11-17 17:23:31 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/open-iscsi (Old) and /work/SRC/openSUSE:Factory/.open-iscsi.new.1597 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "open-iscsi" Thu Nov 17 17:23:31 2022 rev:122 rq:1036275 version:unknown Changes: -------- --- /work/SRC/openSUSE:Factory/open-iscsi/open-iscsi.changes 2022-10-01 17:42:38.057613093 +0200 +++ /work/SRC/openSUSE:Factory/.open-iscsi.new.1597/open-iscsi.changes 2022-11-17 17:23:32.120757819 +0100 @@ -1,0 +2,6 @@ +Wed Nov 16 17:14:36 UTC 2022 - Lee Duncan <ldun...@suse.com> + +- Updated to latest upstream. Changes: + * scsid/iscsiuio: fix OOM adjustment (github issue #377) + +------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ open-iscsi-SUSE-latest.diff.bz2 ++++++ --- /var/tmp/diff_new_pack.ma5OPh/_old 2022-11-17 17:23:32.672760739 +0100 +++ /var/tmp/diff_new_pack.ma5OPh/_new 2022-11-17 17:23:32.676760760 +0100 @@ -1,3 +1,163 @@ - -(No newline at EOF) +diff --git a/iscsiuio/src/unix/main.c b/iscsiuio/src/unix/main.c +index 0c9ad49441d1..9a2a60cdb721 100644 +--- a/iscsiuio/src/unix/main.c ++++ b/iscsiuio/src/unix/main.c +@@ -201,35 +201,43 @@ static void daemon_init() + 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; + +- if (nice(-10) < 0) ++ errno = 0; ++ if (nice(-10) == -1 && errno != 0) + LOG_DEBUG("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_DEBUG("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_DEBUG("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("Could not set oom score to -16: %s", +- strerror(errno)); +- if (write(fd, "-17", 3) < 0) /* for Andrea's patch */ +- LOG_DEBUG("Could not set oom score to -17: %s", +- strerror(errno)); ++ + close(fd); +- return 0; ++ if (res < 0) ++ return res; ++ else ++ return 0; + } + + +diff --git a/meson_options.txt b/meson_options.txt +index b76f044d628b..07fd7c0c5c14 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -3,8 +3,6 @@ option('systemddir', type: 'string', value: '/usr/lib/systemd', + description: 'Systemd directory [/usr/lib/systemd], if systemd used') + option('no_systemd', type: 'boolean', value: false, + description: 'Do not use systemd') +-option('source_date_epoch', type: 'string', value: 'NONE', +- description: 'Set the Build Source Date (for iscsiuio), for repeatable builds') + # these are in the 'sysconfigdir' (/etc by default) unless overridden + option('homedir', type: 'string', value: 'iscsi', + description: 'Set the HOME directory [/etc/iscsi]') +diff --git a/usr/iscsi_util.c b/usr/iscsi_util.c +index db1dc377727f..2f1de3e61dc3 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 8441037042f3..0cf2368a7f39 100644 +--- a/usr/iscsid.c ++++ b/usr/iscsid.c +@@ -621,7 +621,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)) {