Skip to contentSkip to conversation

LVM2 ./WHATS_NEW daemons/clvmd/clvmd.c

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

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: prajnoha at sourceware.org 2010-12-13 10:49:03

Modified files:
. : WHATS_NEW
daemons/clvmd : clvmd.c

Log message:
Create /var/run/lvm directory during clvmd initialisation if missing.

We need to be sure that /var/run and /var/lock is always there. (E.g. these two directories could be using tmpfs which then loose all the content after reboot.)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1836&r2=1.1837
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd.c.diff?cvsroot=lvm2&r1=1.87&r2=1.88

WHATS_NEW +1 -0
@@ -1,5 +1,6 @@
 Version 2.02.79 -  
 ===================================
+  Create /var/run/lvm directory during clvmd initialisation if missing.
   Use new dm_prepare_selinux_context instead of dm_set_selinux_context.
   Avoid revalidating the label cache immediately after scanning.
   Support scanning for a single VG in independent mdas.
daemons/clvmd/clvmd.c +11 -0
@@ -324,6 +324,7 @@
 	int using_gulm = 0;
 	int debug_opt = 0;
 	int clusterwide_opt = 0;
+	mode_t old_mask;
 
 	/* Deal with command-line arguments */
 	opterr = 0;
@@ -413,6 +414,16 @@
 		be_daemon(start_timeout);
 	}
 
+        dm_prepare_selinux_context(DEFAULT_RUN_DIR, S_IFDIR);
+        old_mask = umask(0077);
+        if (dm_create_dir(DEFAULT_RUN_DIR) == 0) {
+                DEBUGLOG("clvmd: unable to create %s directory\n",
+                          DEFAULT_RUN_DIR);
+                umask(old_mask);
+                exit(1);
+        }
+        umask(old_mask);
+
 	/* Create pidfile */
 	(void) dm_prepare_selinux_context(CLVMD_PIDFILE, S_IFREG);
 	if (dm_create_lockfile(CLVMD_PIDFILE) == 0) {