2018-11-20 18:07:44 +01:00
|
|
|
From: Egbert Eich <eich@suse.com>
|
|
|
|
Date: Tue Nov 20 09:58:47 2018 +0100
|
|
|
|
Subject: slurmdbd uses xdaemon_* for systemd
|
|
|
|
Patch-mainline: Not yet
|
|
|
|
Git-commit: 8a286cbaf3fe7ebe009106675a4624a2272d616f
|
|
|
|
References: bsc#1084125
|
2018-04-12 18:42:36 +02:00
|
|
|
|
2018-11-20 18:07:44 +01:00
|
|
|
Signed-off-by: Egbert Eich <eich@suse.com>
|
2018-04-12 18:42:36 +02:00
|
|
|
---
|
2018-11-20 18:07:44 +01:00
|
|
|
slurm-18.08.3/src/slurmdbd/slurmdbd.c | 19 +++++++++++++------
|
|
|
|
1 file changed, 13 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/slurm-18.08.3/src/slurmdbd/slurmdbd.c b/slurm-18.08.3/src/slurmdbd/slurmdbd.c
|
|
|
|
index 471c724..8c7ea94 100644
|
2018-04-12 18:42:36 +02:00
|
|
|
--- 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;
|
|
|
|
|
2018-11-20 18:07:44 +01:00
|
|
|
@@ -139,8 +140,9 @@ int main(int argc, char **argv)
|
|
|
|
_update_nice();
|
2018-04-12 18:42:36 +02:00
|
|
|
|
|
|
|
_kill_old_slurmdbd();
|
|
|
|
- if (foreground == 0)
|
|
|
|
- _daemonize();
|
|
|
|
+ if (foreground == 0) {
|
|
|
|
+ pipefd = _daemonize_start();
|
|
|
|
+ }
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Need to create pidfile here in case we setuid() below
|
2018-11-20 18:07:44 +01:00
|
|
|
@@ -149,7 +151,9 @@ int main(int argc, char **argv)
|
2018-04-12 18:42:36 +02:00
|
|
|
* able to write a core dump.
|
|
|
|
*/
|
|
|
|
_init_pidfile();
|
2018-11-20 18:07:44 +01:00
|
|
|
-
|
2018-04-12 18:42:36 +02:00
|
|
|
+ if (foreground == 0) {
|
|
|
|
+ xdaemon_finish(pipefd);
|
|
|
|
+ }
|
2018-11-20 18:07:44 +01:00
|
|
|
/*
|
|
|
|
* Do plugin init's after _init_pidfile so systemd is happy as
|
|
|
|
* slurm_acct_storage_init() could take a long time to finish if running
|
|
|
|
@@ -598,11 +602,14 @@ static void _init_pidfile(void)
|
2018-04-12 18:42:36 +02:00
|
|
|
|
|
|
|
/* 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)
|