1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-18 10:04:20 +03:00

lvmlockd: improve systemd service file

use notify type so the daemon is ready
immediately after start.
This commit is contained in:
David Teigland 2018-09-13 09:52:39 -05:00
parent 1365f0d4c8
commit 297f6d5122
3 changed files with 19 additions and 6 deletions

View File

@ -15,6 +15,8 @@ srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
USE_SD_NOTIFY=yes
SOURCES = lvmlockd-core.c
ifeq ("@BUILD_LOCKDSANLOCK@", "yes")
@ -40,6 +42,12 @@ INCLUDES += -I$(top_srcdir)/libdaemon/server
LDFLAGS += -L$(top_builddir)/libdaemon/server $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS)
LIBS += $(RT_LIBS) $(DAEMON_LIBS) $(PTHREAD_LIBS)
ifeq ($(USE_SD_NOTIFY),yes)
CFLAGS += $(shell pkg-config --cflags libsystemd) -DUSE_SD_NOTIFY
LDFLAGS += $(shell pkg-config --libs libsystemd)
endif
lvmlockd: $(OBJECTS) $(top_builddir)/libdaemon/client/libdaemonclient.a \
$(top_builddir)/libdaemon/server/libdaemonserver.a
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJECTS) $(LOCK_LIBS) -ldaemonserver $(INTERNAL_LIBS) $(LIBS)

View File

@ -35,6 +35,10 @@
#include <sys/utsname.h>
#include <sys/un.h>
#ifdef USE_SD_NOTIFY
#include <systemd/sd-daemon.h>
#endif
#define EXTERN
#include "lvmlockd-internal.h"
@ -5786,6 +5790,10 @@ static int main_loop(daemon_state *ds_arg)
setup_worker_thread();
setup_restart();
#ifdef USE_SD_NOTIFY
sd_notify(0, "READY=1");
#endif
/*
* Attempt to rejoin lockspaces and adopt locks from a previous
* instance of lvmlockd that left behind lockspaces/locks.

View File

@ -1,13 +1,10 @@
[Unit]
Description=LVM2 lock daemon
Description=LVM lock daemon
Documentation=man:lvmlockd(8)
After=lvm2-lvmetad.service
[Service]
Type=simple
NonBlocking=true
ExecStart=@SBINDIR@/lvmlockd -f
Environment=SD_ACTIVATION=1
Type=notify
ExecStart=@SBINDIR@/lvmlockd --foreground
PIDFile=@LVMLOCKD_PIDFILE@
SendSIGKILL=no