Hello community,

here is the log from the commit of package slurm for openSUSE:Factory checked 
in at 2018-04-16 12:49:00
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/slurm (Old)
 and      /work/SRC/openSUSE:Factory/.slurm.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "slurm"

Mon Apr 16 12:49:00 2018 rev:12 rq:596387 version:17.11.5

Changes:
--------
--- /work/SRC/openSUSE:Factory/slurm/slurm.changes      2018-03-29 
11:57:06.875116776 +0200
+++ /work/SRC/openSUSE:Factory/.slurm.new/slurm.changes 2018-04-16 
12:49:03.804950020 +0200
@@ -1,0 +2,34 @@
+Fri Apr 13 10:03:05 UTC 2018 - e...@suse.com
+
+- Add requires for slurm-sql to the slurmdbd package.
+
+-------------------------------------------------------------------
+Thu Apr 12 17:20:03 UTC 2018 - e...@suse.com
+
+- Package READMEs for pam and pam_slurm_adopt.
+- Use the new %%license directive for COPYING file.
+
+-------------------------------------------------------------------
+Thu Apr 12 16:40:44 UTC 2018 - e...@suse.com
+
+- Add:
+  * 
split-xdaemon-in-xdaemon_init-and-xdaemon_finish-for-systemd-compatibilty.patch
+  * slurmctld-uses-xdaemon_-for-systemd.patch
+  * slurmd-uses-xdaemon_-for-systemd.patch
+  * slurmdbd-uses-xdaemon_-for-systemd.patch
+  * removed-deprecated-xdaemon.patch
+  Fix interaction with systemd: systemd expects that a 
+  daemonizing process doesn't go away until the PID file
+  with it PID of the daemon has bee written (bsc#1084125).
+
+-------------------------------------------------------------------
+Wed Apr 11 11:27:31 UTC 2018 - e...@suse.com
+
+- Make sure systemd services get restarted only when all
+  packages are in a consistent state, not in the middle
+  of an 'update' transaction (bsc#1088693).
+  Since the %postun scripts that run on update are from
+  the old package they cannot be changed - thus we work
+  around the restart breakage.
+
+-------------------------------------------------------------------
@@ -7,2 +41 @@
-  (bsc#1086859)
-
+  (bsc#1086859).

New:
----
  removed-deprecated-xdaemon.patch
  slurmctld-uses-xdaemon_-for-systemd.patch
  slurmd-uses-xdaemon_-for-systemd.patch
  slurmdbd-uses-xdaemon_-for-systemd.patch
  
split-xdaemon-in-xdaemon_init-and-xdaemon_finish-for-systemd-compatibilty.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ slurm.spec ++++++
--- /var/tmp/diff_new_pack.9R1gb8/_old  2018-04-16 12:49:04.516924121 +0200
+++ /var/tmp/diff_new_pack.9R1gb8/_new  2018-04-16 12:49:04.520923975 +0200
@@ -67,6 +67,11 @@
 Patch0:         slurm-2.4.4-rpath.patch
 Patch1:         slurm-2.4.4-init.patch
 Patch2:         pam_slurm-Initialize-arrays-and-pass-sizes.patch
+Patch3:         
split-xdaemon-in-xdaemon_init-and-xdaemon_finish-for-systemd-compatibilty.patch
+Patch4:         slurmctld-uses-xdaemon_-for-systemd.patch
+Patch5:         slurmd-uses-xdaemon_-for-systemd.patch
+Patch6:         slurmdbd-uses-xdaemon_-for-systemd.patch
+Patch7:         removed-deprecated-xdaemon.patch
 Requires:       slurm-config = %{version}
 Requires:       slurm-node = %{version}
 %if 0%{?suse_version} <= 1140
@@ -200,6 +205,7 @@
 Group:          Productivity/Clustering/Computing
 Requires:       slurm-config = %{version}
 Requires:       slurm-plugins = %{version}
+Requires:       slurm-sql = %{version}
 %if 0%{?with_systemd}
 %{?systemd_requires}
 %else
@@ -314,6 +320,11 @@
 %patch0 -p1
 %patch1 -p1
 %patch2 -p1
+%patch3 -p1
+%patch4 -p1
+%patch5 -p1
+%patch6 -p1
+%patch7 -p1
 
 %build
 %configure --enable-shared \
@@ -366,6 +377,8 @@
 install -D -m755 contribs/sjstat %{buildroot}%{_bindir}/sjstat
 install -D -m755 contribs/sgather/sgather %{buildroot}%{_bindir}/sgather
 
+cp contribs/pam_slurm_adopt/README ../README.pam_slurm_adopt
+cp  contribs/pam/README ../README.pam_slurm
 %if 0%{?OHPC_BUILD}
 # change slurm.conf for our needs
 head -n -2 %{buildroot}/%{_sysconfdir}/%{name}/slurm.conf.example | grep -v 
ReturnToService > %{buildroot}/%{_sysconfdir}/%{name}/slurm.conf
@@ -467,7 +480,7 @@
 
 %postun
 %if 0%{?with_systemd}
-%service_del_postun slurmctld.service
+%service_del_postun -n slurmctld.service
 %else
 %insserv_cleanup
 %endif
@@ -493,7 +506,7 @@
 
 %postun slurmdbd
 %if 0%{?with_systemd}
-%service_del_postun slurmdbd.service
+%service_del_postun -n slurmdbd.service
 %else
 %restart_on_update slurmdbd
 %insserv_cleanup
@@ -518,7 +531,7 @@
 
 %postun node
 %if 0%{?with_systemd}
-%service_del_postun slurmd.service
+%service_del_postun -n slurmd.service
 %else
 %restart_on_update slurmd
 %insserv_cleanup
@@ -546,9 +559,41 @@
 %post -n  libpmi%{pmi_so} -p /sbin/ldconfig
 %postun -n  libpmi%{pmi_so} -p /sbin/ldconfig
 
+# On update the %%postun code of the old package restarts the
+# service. This breaks in case the ABI between slurm and its
+# plugins has changed as updates are not atomic. Since we cannot
+# fix the old scripts we need these macros as a workaround.
+# They should be removed at some point.
+%define _test_rest() %{?with_systemd:rm -f /run/%{1}.rst; systemctl status 
%{1} &>/dev/null && touch /run/%{1}.rst || :;}
+%define _rest() %{?with_systemd:[ -e /run/%{1}.rst ] && { systemctl status 
%{1} &>/dev/null || systemctl restart %{1}; }; rm -f /run/%{1}.rst;}
+# Until a posttrans macro has been added to macros.systemd, we need this
+%define _res_update() %{?with_systemd:%{expand:%%_restart_on_update %{?*}};}
+
+%pretrans
+%_test_rest slurmctld
+
+%pretrans node
+%_test_rest slurmd
+
+%pretrans slurmdbd
+%_test_rest slurmdbd
+
+%posttrans
+%_res_update slurmctld
+%_rest slurmctld
+
+%posttrans node
+%_res_update slurmd
+%_rest slurmd
+
+%posttrans slurmdbd
+%_res_update slurmdbd.service
+%_rest slurmdbd
+
 %files
 %defattr(-,root,root)
-%doc AUTHORS NEWS RELEASE_NOTES DISCLAIMER COPYING
+%doc AUTHORS NEWS RELEASE_NOTES DISCLAIMER
+%license COPYING
 %doc doc/html
 %{_bindir}/sacct
 %{_bindir}/sacctmgr
@@ -813,6 +858,7 @@
 
 %files pam_slurm
 %defattr(-,root,root)
+%doc ../README.pam_slurm ../README.pam_slurm_adopt
 /%_lib/security/pam_slurm.so
 /%_lib/security/pam_slurm_adopt.so
 

++++++ removed-deprecated-xdaemon.patch ++++++
From: Christian Goll <cg...@suse.de>
Date: Mon Apr 9 11:52:58 2018 +0200
Subject: removed deprecated xdaemon
Patch-mainline: Not yet
Git-repo: https://github.com/SchedMD/slurm
Git-commit: ca2921a03af842792810efd3d49fbdbfeccfd438
References: bsc#1084125


Signed-off-by: Egbert Eich <e...@suse.de>
---
 src/common/daemonize.c | 11 -----------
 src/common/daemonize.h |  7 -------
 2 files changed, 18 deletions(-)

diff --git a/src/common/daemonize.c b/src/common/daemonize.c
index 2987a40af0..32dc79c577 100644
--- a/src/common/daemonize.c
+++ b/src/common/daemonize.c
@@ -138,17 +138,6 @@ void xdaemon_finish(int fd)
        }
 }
 
-/* 
- * keep depercated api
- */
-
-int xdaemon(void)
-{
-       int ret_val;
-       ret_val= xdaemon_init();
-       xdaemon_finish(ret_val);
-       return ret_val;
-}
 
 /*
  * Read and return pid stored in pidfile.
diff --git a/src/common/daemonize.h b/src/common/daemonize.h
index c932d83f74..d0ab92e860 100644
--- a/src/common/daemonize.h
+++ b/src/common/daemonize.h
@@ -60,13 +60,6 @@ extern int xdaemon_init(void);
  */
 extern void xdaemon_finish(int fd);
 
-/*
- * Fork process into background and inherit new session.
- *
- * Returns -1 on error.
- */
-extern int xdaemon(void);
-
 /* Write pid into file pidfile if uid is not 0 change the owner of the
  * pidfile to that user.
  */
++++++ slurmctld-uses-xdaemon_-for-systemd.patch ++++++
From: Christian Goll <cg...@suse.de>
Date: Mon Apr 9 10:23:01 2018 +0200
Subject: slurmctld uses xdaemon_* for systemd
Patch-mainline: Not yet
Git-repo: https://github.com/SchedMD/slurm
Git-commit: b11aae54f69855084370aaf0af3e928f63c639b3
References: bsc#1084125


Signed-off-by: Egbert Eich <e...@suse.de>
---
 src/slurmctld/controller.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/slurmctld/controller.c b/src/slurmctld/controller.c
index 7867e1d479..dd5f3863b1 100644
--- a/src/slurmctld/controller.c
+++ b/src/slurmctld/controller.c
@@ -250,7 +250,7 @@ static bool         _wait_for_server_thread(void);
 /* main - slurmctld main function, start various threads and process RPCs */
 int main(int argc, char **argv)
 {
-       int cnt, error_code, i;
+       int cnt, error_code, i, fd;
        struct stat stat_buf;
        struct rlimit rlim;
        /* Locks: Write configuration, job, node, and partition */
@@ -298,7 +298,8 @@ int main(int argc, char **argv)
 
        if (daemonize) {
                slurmctld_config.daemonize = 1;
-               if (xdaemon())
+               fd = xdaemon_init();
+               if (fd == -1)
                        error("daemon(): %m");
                log_set_timefmt(slurmctld_conf.log_fmt);
                log_alter(log_opts, LOG_DAEMON,
@@ -318,6 +319,9 @@ int main(int argc, char **argv)
         */
        _init_pidfile();
        _become_slurm_user();
+       if (daemonize) {
+               xdaemon_finish(fd);
+       }
 
        /*
         * Create StateSaveLocation directory if necessary.
++++++ slurmd-uses-xdaemon_-for-systemd.patch ++++++
From: Christian Goll <cg...@suse.de>
Date: Mon Apr 9 10:59:57 2018 +0200
Subject: slurmd uses xdaemon_* for systemd
Patch-mainline: Not yet
Git-repo: https://github.com/SchedMD/slurm
Git-commit: a048f30f7e41089f9f2f014897ca2c02bc41abb5
References: bsc#1084125


Signed-off-by: Egbert Eich <e...@suse.de>
---
 src/slurmd/slurmd/slurmd.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/slurmd/slurmd/slurmd.c b/src/slurmd/slurmd/slurmd.c
index 09d3a7136b..299fe3a2a9 100644
--- a/src/slurmd/slurmd/slurmd.c
+++ b/src/slurmd/slurmd/slurmd.c
@@ -214,7 +214,7 @@ static void      _wait_for_all_threads(int secs);
 int
 main (int argc, char **argv)
 {
-       int i, pidfd;
+       int i, pidfd, pipefd;
        int blocked_signals[] = {SIGPIPE, 0};
        int cc;
        char *oom_value;
@@ -299,7 +299,8 @@ main (int argc, char **argv)
         * Become a daemon if desired.
         */
        if (conf->daemonize) {
-               if (xdaemon())
+               pipefd = xdaemon_init();
+               if (pipefd == -1)
                        error("Couldn't daemonize slurmd: %m");
        }
        test_core_limit();
@@ -355,6 +356,9 @@ main (int argc, char **argv)
 
        conf->pid = getpid();
        pidfd = create_pidfile(conf->pidfile, 0);
+       if (conf->daemonize) {
+               xdaemon_finish(pipefd);
+       }
 
        rfc2822_timestamp(time_stamp, sizeof(time_stamp));
        info("%s started on %s", slurm_prog_name, time_stamp);
++++++ slurmdbd-uses-xdaemon_-for-systemd.patch ++++++
From: Christian Goll <cg...@suse.de>
Date: Mon Apr 9 11:13:54 2018 +0200
Subject: slurmdbd uses xdaemon_* for systemd
Patch-mainline: Not yet
Git-repo: https://github.com/SchedMD/slurm
Git-commit: fde4321ead76bc2a419d37d09b2a9b8273e836de
References: bsc#1084125


Signed-off-by: Egbert Eich <e...@suse.de>
---
 src/slurmdbd/slurmdbd.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/slurmdbd/slurmdbd.c b/src/slurmdbd/slurmdbd.c
index d37cad28a7..6b523691bd 100644
--- a/src/slurmdbd/slurmdbd.c
+++ b/src/slurmdbd/slurmdbd.c
@@ -103,7 +103,7 @@ static List lft_rgt_list = NULL;
 static void  _become_slurm_user(void);
 static void  _commit_handler_cancel(void);
 static void *_commit_handler(void *no_data);
-static void  _daemonize(void);
+static int   _daemonize_start(void);
 static void  _default_sigaction(int sig);
 static void  _free_dbd_stats(void);
 static void  _init_config(void);
@@ -127,6 +127,7 @@ int main(int argc, char **argv)
 {
        char node_name_short[128];
        char node_name_long[128];
+       int pipefd;
        void *db_conn = NULL;
        assoc_init_args_t assoc_init_arg;
 
@@ -150,8 +151,9 @@ int main(int argc, char **argv)
        slurmdbd_defs_init(slurmdbd_conf->auth_info);
 
        _kill_old_slurmdbd();
-       if (foreground == 0)
-               _daemonize();
+       if (foreground == 0) {
+               pipefd = _daemonize_start();
+       }
 
        /*
         * Need to create pidfile here in case we setuid() below
@@ -160,6 +162,9 @@ int main(int argc, char **argv)
         * able to write a core dump.
         */
        _init_pidfile();
+       if (foreground == 0) {
+               xdaemon_finish(pipefd);
+       }
        _become_slurm_user();
        if (foreground == 0)
                _set_work_dir();
@@ -593,11 +598,14 @@ static void _init_pidfile(void)
 
 /* Become a daemon (child of init) and
  * "cd" to the LogFile directory (if one is configured) */
-static void _daemonize(void)
+static int _daemonize_start(void)
 {
-       if (xdaemon())
+       int retval;
+       retval = xdaemon_init();
+       if (retval == -1)
                error("daemon(): %m");
        log_alter(log_opts, LOG_DAEMON, slurmdbd_conf->log_file);
+       return retval;
 }
 
 static void _set_work_dir(void)
++++++ 
split-xdaemon-in-xdaemon_init-and-xdaemon_finish-for-systemd-compatibilty.patch 
++++++
From: Christian Goll <cg...@suse.de>
Date: Mon Apr 9 10:05:50 2018 +0200
Subject: split xdaemon in xdaemon_init and xdaemon_finish for systemd 
compatibilty
Patch-mainline: Not yet
Git-repo: https://github.com/SchedMD/slurm
Git-commit: 2bbe988c0ef133942d0d0077b0f064eff553e3a2
References: bsc#1084125


Signed-off-by: Egbert Eich <e...@suse.de>
---
 src/common/daemonize.c | 73 ++++++++++++++++++++++++++++++++++++++++++++------
 src/common/daemonize.h | 20 ++++++++++++++
 2 files changed, 85 insertions(+), 8 deletions(-)

diff --git a/src/common/daemonize.c b/src/common/daemonize.c
index e22a1d0a7f..2987a40af0 100644
--- a/src/common/daemonize.c
+++ b/src/common/daemonize.c
@@ -53,31 +53,75 @@
 #include "src/common/xassert.h"
 
 /*
- * Double-fork and go into background.
+ * Start daemonization with double-fork and go into background.
  * Caller is responsible for umasks
  */
-int xdaemon(void)
+int xdaemon_init(void)
 {
-       int devnull;
-
+       int fds [2];
+       int n;
+       signed char priority;
+       char ebuf [1024];
+       /*
+        * Create pipe in order to get signal from grand child to terminate
+        */
+       if (pipe (fds) < 0) {
+               error("Failed to create daemon pipe");
+       }
        switch (fork()) {
                case  0 : break;        /* child */
                case -1 : return -1;
-               default : _exit(0);     /* exit parent */
+               default : {
+                       if (close (fds[1]) < 0) {
+                               error("Failed to close write-pipe in parent 
process");
+                       }
+
+                       /*
+                        * get signal of grandchild to exit
+                        */
+                       if ((n = read (fds[0], &priority, sizeof (priority))) < 
0) {
+                           error("Failed to read status from grandchild 
process");
+                       }
+                       if ((n > 0) && (priority >= 0)) {
+                           if ((n = read (fds[0], ebuf, sizeof (ebuf))) < 0) {
+                               error("Failed to read err msg from grandchild 
process");
+                           }
+                           if ((n > 0) && (ebuf[0] != '\0')) {
+                               error("Error with forking and steeing up pipe: 
%s", ebuf);
+                           }
+                           return -1;
+                       }
+                       _exit(0);
+               }
        }
 
        if (setsid() < 0)
                return -1;
-
+       if (close (fds[0]) < 0) {
+               error("Failed to close read-pipe in child process");
+       }
        switch (fork()) {
                case 0 : break;         /* child */
                case -1: return -1;
                default: _exit(0);      /* exit parent */
        }
+       return (fds[1]);
+}
 
+/*
+ * finish daemonization after pidfile was written
+ */
+
+
+void xdaemon_finish(int fd)
+{
        /*
-        * dup stdin, stdout, and stderr onto /dev/null
+        * PID file was written, now do dup stdin, stdout, 
+        * and stderr onto /dev/null and close pipe
+        * so that systemd realizes we are daemonized
         */
+       int devnull;
+
        devnull = open("/dev/null", O_RDWR);
        if (devnull < 0)
                error("Unable to open /dev/null: %m");
@@ -89,8 +133,21 @@ int xdaemon(void)
                error("Unable to dup /dev/null onto stderr: %m");
        if (close(devnull) < 0)
                error("Unable to close /dev/null: %m");
+       if ((fd >= 0) && (close (fd) < 0)) {
+               error( "Failed to close write-pipe in grandchild process");
+       }
+}
+
+/* 
+ * keep depercated api
+ */
 
-       return 0;
+int xdaemon(void)
+{
+       int ret_val;
+       ret_val= xdaemon_init();
+       xdaemon_finish(ret_val);
+       return ret_val;
 }
 
 /*
diff --git a/src/common/daemonize.h b/src/common/daemonize.h
index 22a31f6ccf..c932d83f74 100644
--- a/src/common/daemonize.h
+++ b/src/common/daemonize.h
@@ -40,6 +40,26 @@
 #ifndef _HAVE_DAEMONIZE_H
 #define _HAVE_DAEMONIZE_H
 
+
+/*
+ * Fork process into background open a pipe to
+ * communicate status between parent and child.
+ * parent: wait until child has closed the pipe.
+ * child: return fd.
+ *
+ * Returns fd or -1 on error.
+ */
+extern int xdaemon_init(void);
+
+/*
+ * Finish child side of the fork:
+ * This needs to get called after the PID file
+ * has been written.
+ * Close STDIN, STDOUT and STDERR and inherit
+ * new session. Close pipe when done.
+ */
+extern void xdaemon_finish(int fd);
+
 /*
  * Fork process into background and inherit new session.
  *

Reply via email to