Skip to contentSkip to conversation

LVM2 ./WHATS_NEW ./WHATS_NEW_DM ./configure ./ ...

PATCH [email protected] 1 participant 1 message Jul 13, 2010

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: fabbione at sourceware.org 2010-07-13 13:51:03

Modified files:
. : WHATS_NEW WHATS_NEW_DM configure configure.in
daemons/clvmd : clvmd.c
daemons/cmirrord: clogd.c
daemons/dmeventd: dmeventd.c dmeventd.h
lib/misc : configure.h.in
libdm : libdevmapper.h libdm-file.c

Log message:
Add dm_create_lockfile to libdm to handle pidfiles for all daemons. Switch dmeventd to use dm_create_lockfile and drop duplicate code. Allow clvmd pidfile to be configurable.
Switch cmirrord and clvmd to use dm_create_lockfile.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1665&r2=1.1666
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.394&r2=1.395
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/configure.diff?cvsroot=lvm2&r1=1.134&r2=1.135
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/configure.in.diff?cvsroot=lvm2&r1=1.145&r2=1.146
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd.c.diff?cvsroot=lvm2&r1=1.72&r2=1.73
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/cmirrord/clogd.c.diff?cvsroot=lvm2&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/dmeventd.c.diff?cvsroot=lvm2&r1=1.63&r2=1.64
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/dmeventd/dmeventd.h.diff?cvsroot=lvm2&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/configure.h.in.diff?cvsroot=lvm2&r1=1.24&r2=1.25
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.120&r2=1.121
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-file.c.diff?cvsroot=lvm2&r1=1.10&r2=1.11

WHATS_NEW +2 -0
@@ -1,5 +1,7 @@
 Version 2.02.71 -
 ===============================
+  Switch cmirrord and clvmd to use dm_create_lockfile.
+  Allow clvmd pidfile to be configurable.
   Update comments about memory handling in lvm2app.h.
   Add more verbose messages while checking volume_list and hosttags settings.
   Add log_error when strdup fails in {vg|lv}_change_tag().
WHATS_NEW_DM +2 -0
@@ -1,5 +1,7 @@
 Version 1.02.53 -
 ===============================
+  Switch dmeventd to use dm_create_lockfile and drop duplicate code.
+  Add dm_create_lockfile to libdm to handle pidfiles for all daemons.
   Use "nowatch" udev rule for inappropriate devices.
 
 Version 1.02.52 - 6th July 2010
configure +62 -77

396 lines not on this page · raw message

configure.in +12 -0
@@ -601,6 +601,18 @@
 fi
 
 ################################################################################
+dnl -- clvmd pidfile
+if test "x$CLVMD" != xnone; then
+	AC_ARG_WITH(clvmd-pidfile,
+		    AC_HELP_STRING([--with-clvmd-pidfile=PATH],
+				   [clvmd pidfile [[/var/run/clvmd.pid]]]),
+		    CLVMD_PIDFILE=$withval,
+		    CLVMD_PIDFILE="/var/run/clvmd.pid")
+	AC_DEFINE_UNQUOTED(CLVMD_PIDFILE, ["$CLVMD_PIDFILE"],
+			   [Path to clvmd pidfile.])
+fi
+
+################################################################################
 dnl -- Build cluster mirror log daemon
 AC_MSG_CHECKING(whether to build cluster mirror log daemon)
 AC_ARG_ENABLE(cmirrord,
daemons/clvmd/clvmd.c +13 -0
@@ -271,6 +271,11 @@
 	return buf;
 }
 
+static void remove_lockfile(void)
+{
+	unlink(CLVMD_PIDFILE);
+}
+
 int main(int argc, char *argv[])
 {
 	int local_sock;
@@ -370,6 +375,14 @@
 		be_daemon(start_timeout);
 	}
 
+	/* Create pidfile */
+	if (dm_create_lockfile(CLVMD_PIDFILE) == 0) {
+		DEBUGLOG("clvmd: unable to create lockfile\n");
+		exit(1);
+	}
+
+	atexit(remove_lockfile);
+
 	DEBUGLOG("CLVMD started\n");
 
 	/* Open the Unix socket we listen for commands on.
daemons/cmirrord/clogd.c +8 -44

72 lines not on this page · raw message

daemons/dmeventd/dmeventd.c +9 -42

83 lines not on this page · raw message

daemons/dmeventd/dmeventd.h +2 -2
@@ -56,10 +56,10 @@
 
 /*      EXIT_SUCCESS             0 -- stdlib.h */
 /*      EXIT_FAILURE             1 -- stdlib.h */
-#define EXIT_LOCKFILE_INUSE      2
+/*      EXIT_LOCKFILE_INUSE      2 -- obsoleted */
 #define EXIT_DESC_CLOSE_FAILURE  3
 #define EXIT_DESC_OPEN_FAILURE   4
-#define EXIT_OPEN_PID_FAILURE    5
+/*      EXIT_OPEN_PID_FAILURE    5 -- obsoleted */
 #define EXIT_FIFO_FAILURE        6
 #define EXIT_CHDIR_FAILURE       7
 
lib/misc/configure.h.in +3 -0
@@ -9,6 +9,9 @@
 /* Path to clvmd binary. */
 #undef CLVMD_PATH
 
+/* Path to clvmd pidfile. */
+#undef CLVMD_PIDFILE
+
 /* Path to cmirrord pidfile. */
 #undef CMIRRORD_PIDFILE
 
libdm/libdevmapper.h +8 -0
@@ -980,6 +980,14 @@
 int dm_asprintf(char **buf, const char *format, ...)
     __attribute__ ((format(printf, 2, 3)));
 
+/*
+ * create lockfile (pidfile) - create and lock a lock file
+ * @lockfile: location of lock file
+ *
+ * Returns: 1 on success, 0 otherwise, errno is handled internally
+ */
+int dm_create_lockfile(const char* lockfile);
+
 /*********************
  * regular expressions
  *********************/
libdm/libdm-file.c +82 -0

85 lines not on this page · raw message