From c141fe1c44123da834446630d361acfca53b690f Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Mon, 10 Jan 2011 19:31:02 +0000 Subject: [PATCH] Avoid cookie sharing between forked processes Before fork, ensure cookie is reset so it's not shared between processes. --- WHATS_NEW | 1 + lib/misc/lvm-exec.c | 2 ++ tools/polldaemon.c | 2 ++ 3 files changed, 5 insertions(+) diff --git a/WHATS_NEW b/WHATS_NEW index 1e66f42c5..4a5382325 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.81 - =================================== + Fix cookie sharing between forked lvm processes (2.02.80). Version 2.02.80 - 10th January 2011 =================================== diff --git a/lib/misc/lvm-exec.c b/lib/misc/lvm-exec.c index 5cad79eb2..6dde265c6 100644 --- a/lib/misc/lvm-exec.c +++ b/lib/misc/lvm-exec.c @@ -54,6 +54,8 @@ int exec_cmd(struct cmd_context *cmd, const char *const argv[], int *rstatus) log_verbose("Executing: %s", _verbose_args(argv, buf, sizeof(buf))); + fs_unlock(); /* Flush oops and ensure cookie is not shared */ + if ((pid = fork()) == -1) { log_error("fork failed: %s", strerror(errno)); return 0; diff --git a/tools/polldaemon.c b/tools/polldaemon.c index 4da27fed7..0ee7a8c59 100644 --- a/tools/polldaemon.c +++ b/tools/polldaemon.c @@ -42,6 +42,8 @@ static int _become_daemon(struct cmd_context *cmd) sigaction(SIGCHLD, &act, NULL); + fs_unlock(); /* Flush oops and ensure cookie is not shared */ + if ((pid = fork()) == -1) { log_error("fork failed: %s", strerror(errno)); return -1; -- 2.43.5