[packages/dlm] Startup notification for dlm_controld

jajcus jajcus at pld-linux.org
Fri Nov 2 13:21:59 CET 2012


commit 0a090e00e3fc33d461ce99263c685d93adadee1a
Author: Jacek Konieczny <jkonieczny at eggsoft.pl>
Date:   Fri Nov 2 12:19:30 2012 +0000

    Startup notification for dlm_controld
    
    This allows services depending on the DLM subsystem to be delayed
    until dlm_controld finishes initialization.

 dlm-startup_notify.patch | 94 ++++++++++++++++++++++++++++++++++++++++++++++++
 dlm.spec                 |  3 ++
 2 files changed, 97 insertions(+)
---
diff --git a/dlm.spec b/dlm.spec
index a51a2a0..7a4ada2 100644
--- a/dlm.spec
+++ b/dlm.spec
@@ -21,10 +21,12 @@ Patch3:		%{name}-mem_init.patch
 Patch4:		%{name}-signals.patch
 Patch5:		0003-dlm_controld-remove-fence_all-from-cli.patch
 Patch6:		dlm_stonith_reboot.patch
+Patch7:		dlm-startup_notify.patch
 URL:		http://sources.redhat.com/cluster/dlm/
 BuildRequires:	corosync-devel >= 2.0
 %{?with_dlm_stonith:BuildRequires:	pacemaker-devel >= 1.1}
 BuildRequires:	rpmbuild(macros) >= 1.644
+BuildRequires:	systemd-devel
 Requires:	%{name}-libs = %{version}-%{release}
 Requires:	rc-scripts
 Requires:	systemd-units >= 38
@@ -77,6 +79,7 @@ Pliki nagłówkowe i dokumentacja programisty dla DLM-a.
 %patch4 -p1
 %patch5 -p1
 %patch6 -p1
+%patch7 -p1
 
 %build
 %{__make} \
diff --git a/dlm-startup_notify.patch b/dlm-startup_notify.patch
new file mode 100644
index 0000000..6dfa5a8
--- /dev/null
+++ b/dlm-startup_notify.patch
@@ -0,0 +1,94 @@
+diff -dur dlm-3.99.5.orig/dlm_controld/Makefile dlm-3.99.5/dlm_controld/Makefile
+--- dlm-3.99.5.orig/dlm_controld/Makefile	2012-11-02 12:02:11.000000000 +0000
++++ dlm-3.99.5/dlm_controld/Makefile	2012-11-02 12:06:11.064225240 +0000
+@@ -62,7 +62,7 @@
+ all: $(LIB_TARGET) $(BIN_TARGET)
+ 
+ $(BIN_TARGET): $(BIN_SOURCE)
+-	$(CC) $(BIN_SOURCE) $(BIN_CFLAGS) $(BIN_LDFLAGS) -o $@ -L.
++	$(CC) $(BIN_SOURCE) $(BIN_CFLAGS) $(BIN_LDFLAGS) -o $@ -L. `pkg-config --cflags --libs libsystemd-daemon`
+ 
+ $(LIB_TARGET): $(LIB_SOURCE)
+ 	$(CC) $^ $(LIB_CFLAGS) $(LIB_LDFLAGS) -shared -fPIC -o $@ -Wl,-soname=$(LIB_SMAJOR)
+diff -dur dlm-3.99.5.orig/dlm_controld/dlm_controld.8 dlm-3.99.5/dlm_controld/dlm_controld.8
+--- dlm-3.99.5.orig/dlm_controld/dlm_controld.8	2012-06-21 21:53:56.000000000 +0000
++++ dlm-3.99.5/dlm_controld/dlm_controld.8	2012-11-02 12:06:38.448225240 +0000
+@@ -23,6 +23,9 @@
+ .B --daemon_debug | -D
+         enable debugging to stderr and don't fork
+ 
++.B --foreground
++        don't fork
++
+ .B --log_debug | -K
+         enable kernel dlm debugging messages
+ 
+diff -dur dlm-3.99.5.orig/dlm_controld/dlm_daemon.h dlm-3.99.5/dlm_controld/dlm_daemon.h
+--- dlm-3.99.5.orig/dlm_controld/dlm_daemon.h	2012-11-02 12:02:11.000000000 +0000
++++ dlm-3.99.5/dlm_controld/dlm_daemon.h	2012-11-02 12:08:31.937225240 +0000
+@@ -109,6 +109,7 @@
+         enable_quorum_lockspace_ind,
+         help_ind,
+         version_ind,
++        foreground_ind,
+         dlm_options_max,
+ };
+ 
+diff -dur dlm-3.99.5.orig/dlm_controld/main.c dlm-3.99.5/dlm_controld/main.c
+--- dlm-3.99.5.orig/dlm_controld/main.c	2012-11-02 12:02:11.000000000 +0000
++++ dlm-3.99.5/dlm_controld/main.c	2012-11-02 12:08:51.384225241 +0000
+@@ -13,6 +13,7 @@
+ #include <linux/netlink.h>
+ #include <linux/genetlink.h>
+ #include <linux/dlm_netlink.h>
++#include <systemd/sd-daemon.h>
+ 
+ #include "copyright.cf"
+ #include "version.cf"
+@@ -1012,6 +1013,8 @@
+ 	plock_fd = rv;
+ 	plock_ci = client_add(rv, process_plocks, NULL);
+ 
++	sd_notify(0, "READY=1");
++
+ 	for (;;) {
+ 		rv = poll(pollfd, client_maxi + 1, poll_timeout);
+ 		if (rv == -1 && errno == EINTR) {
+@@ -1245,6 +1248,11 @@
+ 			0, NULL,
+ 			"enable debugging to stderr and don't fork");
+ 
++	set_opt_default(foreground_ind,
++			"foreground", '\0', no_arg,
++			0, NULL,
++			"don't fork");
++
+ 	set_opt_default(log_debug_ind,
+ 			"log_debug", 'K', no_arg,
+ 			0, NULL,
+@@ -1562,7 +1570,7 @@
+ 	INIT_LIST_HEAD(&fs_register_list);
+ 	init_daemon();
+ 
+-	if (!opt(daemon_debug_ind)) {
++	if (!opt(daemon_debug_ind) && !opt(foreground_ind)) {
+ 		if (daemon(0, 0) < 0) {
+ 			perror("daemon error");
+ 			exit(EXIT_FAILURE);
+diff -dur dlm-3.99.5.orig/init/dlm.service dlm-3.99.5/init/dlm.service
+--- dlm-3.99.5.orig/init/dlm.service	2012-11-02 12:02:11.000000000 +0000
++++ dlm-3.99.5/init/dlm.service	2012-11-02 12:03:28.498225239 +0000
+@@ -3,10 +3,11 @@
+ After=syslog.target network.target corosync.service sys-kernel-config.mount
+ 
+ [Service]
+-Type=forking
++Type=notify
++NotifyAccess=main
+ EnvironmentFile=/etc/sysconfig/dlm
+ ExecStartPre=/sbin/modprobe dlm 
+-ExecStart=/usr/sbin/dlm_controld $DLM_CONTROLD_OPTS
++ExecStart=/usr/sbin/dlm_controld --foreground $DLM_CONTROLD_OPTS
+ #ExecStopPost=/sbin/modprobe -r dlm
+ 
+ [Install]
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/dlm.git/commitdiff/0a090e00e3fc33d461ce99263c685d93adadee1a



More information about the pld-cvs-commit mailing list