]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
mdmon: allow --takeover when original was started with --offroot
authorNeilBrown <neilb@suse.de>
Mon, 20 Aug 2012 00:37:21 +0000 (10:37 +1000)
committerNeilBrown <neilb@suse.de>
Thu, 27 Sep 2012 06:57:43 +0000 (16:57 +1000)
As --offroot causes ARGV[0] to be changed, we need to be more
lenient when checking that the mdmon we are about to kill really
is mdmon.  i.e. allow name to be "@dmon" instead.

Signed-off-by: NeilBrown <neilb@suse.de>
mdmon.c

diff --git a/mdmon.c b/mdmon.c
index 2d0503d2e23bf34c64b78c2da2028a6fa225357c..54e12384d6b2c156cd8cf0cf182b82e9b604655d 100644 (file)
--- a/mdmon.c
+++ b/mdmon.c
@@ -184,7 +184,11 @@ static void try_kill_monitor(pid_t pid, char *devname, int sock)
        buf[sizeof(buf)-1] = 0;
        close(fd);
 
-       if (n < 0 || !strstr(buf, "mdmon"))
+       /* Note that if started with --offroot, the name
+        * might be "@dmon"
+        */
+       if (n < 0 || !(strstr(buf, "mdmon") ||
+                      strstr(buf, "@dmon")))
                return;
 
        kill(pid, SIGTERM);