[packages/lvm2] Do not daemonize clvmd for systemd

jajcus jajcus at pld-linux.org
Thu Nov 1 18:40:11 CET 2012


commit 7d8cfaa5a143f5383d1a7a07316139673b50c452
Author: Jacek Konieczny <j.konieczny at eggsoft.pl>
Date:   Thu Nov 1 18:38:37 2012 +0100

    Do not daemonize clvmd for systemd
    
    systemd can't handle re-exec of a forking process
    
    startup status notification is re-implemented using st_notify(3)

 clvmd.service        |  3 ++-
 lvm2-sd_notify.patch | 32 ++++++++++++++++++++++++++++++++
 lvm2.spec            |  3 +++
 3 files changed, 37 insertions(+), 1 deletion(-)
---
diff --git a/lvm2.spec b/lvm2.spec
index 51cfa32..0dd9cde 100644
--- a/lvm2.spec
+++ b/lvm2.spec
@@ -50,6 +50,7 @@ Patch3:		%{name}-pld_init.patch
 Patch4:		dl-dlsym.patch
 Patch5:		%{name}-wrapper.patch
 Patch6:		%{name}-lvm_path.patch
+Patch7:		%{name}-sd_notify.patch
 URL:		http://sources.redhat.com/lvm2/
 BuildRequires:	autoconf >= 2.61
 BuildRequires:	automake
@@ -75,6 +76,7 @@ BuildConflicts:	device-mapper-dietlibc
 %if %{with cluster}
 BuildRequires:	corosync-devel
 BuildRequires:	dlm-devel >= 3.99.5
+BuildRequires:	systemd-devel
 %endif
 Requires(post,preun,postun):	systemd-units >= 38
 Requires:	device-mapper >= %{version}-%{release}
@@ -259,6 +261,7 @@ potrzeby initrd.
 %patch4 -p1
 %patch5 -p1
 %patch6 -p1
+%patch7 -p1
 
 # do not force --export-symbol linker option for e.g. statically linked executables
 # -rdynamic compiler option drives linker in the right way.
diff --git a/clvmd.service b/clvmd.service
index 4c63055..061c425 100644
--- a/clvmd.service
+++ b/clvmd.service
@@ -4,7 +4,8 @@ After=syslog.target network.target corosync.service dlm.service
 Requires=dlm.service
 
 [Service]
-Type=forking
+Type=notify
+NotifyAccess=main
 EnvironmentFile=/etc/sysconfig/clvmd
 ExecStart=/usr/sbin/clvmd $CLVMDOPTS
 ExecReload=/usr/sbin/clvmd -R
diff --git a/lvm2-sd_notify.patch b/lvm2-sd_notify.patch
new file mode 100644
index 0000000..144523b
--- /dev/null
+++ b/lvm2-sd_notify.patch
@@ -0,0 +1,32 @@
+diff -dur LVM2.2.02.98.orig/daemons/clvmd/Makefile.in LVM2.2.02.98/daemons/clvmd/Makefile.in
+--- LVM2.2.02.98.orig/daemons/clvmd/Makefile.in	2012-10-15 16:24:58.000000000 +0200
++++ LVM2.2.02.98/daemons/clvmd/Makefile.in	2012-11-01 18:35:19.000000000 +0100
+@@ -90,6 +90,8 @@
+ DEFS += -D_REENTRANT
+ CFLAGS += -fno-strict-aliasing
+ 
++LIBS += `pkg-config --libs libsystemd-daemon`
++
+ INSTALL_TARGETS = \
+ 	install_clvmd
+ 
+diff -dur LVM2.2.02.98.orig/daemons/clvmd/clvmd.c LVM2.2.02.98/daemons/clvmd/clvmd.c
+--- LVM2.2.02.98.orig/daemons/clvmd/clvmd.c	2012-10-15 16:24:58.000000000 +0200
++++ LVM2.2.02.98/daemons/clvmd/clvmd.c	2012-11-01 18:34:20.000000000 +0100
+@@ -41,6 +41,8 @@
+ #include <sys/un.h>
+ #include <sys/utsname.h>
+ 
++#include <systemd/sd-daemon.h>
++
+ #ifndef TRUE
+ #define TRUE 1
+ #endif
+@@ -599,6 +601,7 @@
+ 		clops->cluster_init_completed();
+ 
+ 	DEBUGLOG("clvmd ready for work\n");
++	sd_notify(0, "READY=1");
+ 	child_init_signal(SUCCESS);
+ 
+ 	/* Try to shutdown neatly */
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/lvm2.git/commitdiff/7d8cfaa5a143f5383d1a7a07316139673b50c452



More information about the pld-cvs-commit mailing list