]> sourceware.org Git - lvm2.git/commitdiff
Use execvp for clvmd restart
authorZdenek Kabelac <zkabelac@redhat.com>
Mon, 26 Sep 2011 07:51:23 +0000 (07:51 +0000)
committerZdenek Kabelac <zkabelac@redhat.com>
Mon, 26 Sep 2011 07:51:23 +0000 (07:51 +0000)
Since execve passed only NULL as environ, we had lost all environment vars on
restart - thus actually running  'different' clvmd then the one at start.

Preserving environ allows to restart clvmd with the same settings
(i.e. LD_LIBRARY_PATH)

Add test for second restart.

WHATS_NEW
daemons/clvmd/clvmd-command.c
test/t-clvmd-restart.sh

index 94570e1d858c9ffe9ec762bcdb04d4ba44da6ddf..301f716cb323c2b81203b6e4d3953fb94266f773 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
 Version 2.02.89 - 
 ==================================
+  Use execvp for CLVMD restart to preserve environment settings.
   Restart CLVMD with same cluster manager.
   Fix log_error() usage in raid and unknown segtype initialisation.
   Improve testing Makefile.
index c1ee673f0abcbb02443d741868370dd1435e0fa3..6d0506f7a3041c7278f230ce7b1dae90b64859c2 100644 (file)
@@ -418,7 +418,7 @@ static int restart_clvmd(void)
        for (argc = 1; argv[argc]; argc++) DEBUGLOG("--- %d: %s\n", argc, argv[argc]);
 
        /* NOTE: This will fail when downgrading! */
-       execve(clvmd, (char **)argv, NULL);
+       execvp(clvmd, (char **)argv);
 out:
        /* We failed */
        DEBUGLOG("Restart of clvmd failed.\n");
index 9a5b1b9d5e61bd76759cb9f98ed0be2c06eb4446..690fc583537acc229917f4e4c5097d8105a35143 100644 (file)
@@ -9,13 +9,15 @@
 # along with this program; if not, write to the Free Software Foundation,
 # Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-export LVM_CLVMD_BINARY="lib/clvmd"
-export LVM_BINARY="lib/lvm"
+# set before test's clvmd is started, so it's passed in environ
+export LVM_CLVMD_BINARY=clvmd
+export LVM_BINARY=lvm
 
 . lib/test
 
 # only clvmd based test, skip otherwise
 test -e LOCAL_CLVMD || skip
+read LOCAL_CLVMD < LOCAL_CLVMD
 
 aux prepare_devs 1
 
@@ -30,15 +32,22 @@ lvchange -aey $vg/$lv2
 
 "$LVM_CLVMD_BINARY" -S
 sleep .2
-# restarted clvmd has the same PID (no fork, only execve)
+# restarted clvmd has the same PID (no fork, only execvp)
+NEW_LOCAL_CLVMD=$(pgrep clvmd)
+test "$LOCAL_CLVMD" -eq "$NEW_LOCAL_CLVMD"
+
+# try restart once more
+
+"$LVM_CLVMD_BINARY" -S
+sleep .2
+# restarted clvmd has the same PID (no fork, only execvp)
 NEW_LOCAL_CLVMD=$(pgrep clvmd)
-read LOCAL_CLVMD < LOCAL_CLVMD
 test "$LOCAL_CLVMD" -eq "$NEW_LOCAL_CLVMD"
 
 # FIXME: Hmm - how could we test exclusivity is preserved in singlenode ?
 lvchange -an $vg/$lv1
 lvchange -ay $vg/$lv1
 
-lib/clvmd -R
+"$LVM_CLVMD_BINARY" -R
 
 vgremove -ff $vg
This page took 0.040939 seconds and 5 git commands to generate.