aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2011-05-18 13:12:24 +0200
committerHannes Reinecke <hare@suse.de>2011-05-18 13:21:38 +0200
commit6cda789a0351a777ca5f7a0ba21de0537e965013 (patch)
treea8e4b46c6cb7482c1d171fb2dbd40856ebab02c0
parent44c3a8f98e247cd453d386be82baf1de36d9b2a9 (diff)
downloadmultipath-tools-6cda789a0351a777ca5f7a0ba21de0537e965013.tar.gz
Update pid file handling
As we now have a shutdown CLI command we don't actually need the pid file anymore. So any errors on creation can be ignored. Signed-off-by: Hannes Reinecke <hare@suse.de>
-rw-r--r--multipathd/main.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/multipathd/main.c b/multipathd/main.c
index 9eb534f..082f851 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -1491,12 +1491,6 @@ child (void * param)
}
- if (pidfile_create(DEFAULT_PIDFILE, getpid())) {
- if (logsink)
- log_thread_stop();
-
- exit(1);
- }
signal_init();
setscheduler();
set_oom_adj(-16);
@@ -1550,12 +1544,10 @@ child (void * param)
pthread_mutex_lock(&exit_mutex);
/* Startup complete, create logfile */
- if (pidfile_create(DEFAULT_PIDFILE, getpid())) {
- if (logsink)
- log_thread_stop();
+ if (pidfile_create(DEFAULT_PIDFILE, getpid()))
+ /* Ignore errors, we can live without */
+ condlog(1, "failed to create pidfile");
- exit(1);
- }
running_state = DAEMON_RUNNING;
pthread_cond_wait(&exit_cond, &exit_mutex);
@@ -1597,16 +1589,18 @@ child (void * param)
cleanup_checkers();
cleanup_prio();
+ dm_lib_release();
+ dm_lib_exit();
+
+ /* We're done here */
+ condlog(3, "unlink pidfile");
+ unlink(DEFAULT_PIDFILE);
+
condlog(2, "--------shut down-------");
if (logsink)
log_thread_stop();
- dm_lib_release();
- dm_lib_exit();
-
- cleanup_prio();
- cleanup_checkers();
/*
* Freeing config must be done after condlog() and dm_lib_exit(),
* because logging functions like dlog() and dm_write_log()