mdmon: allow --takeover when original was started with --offroot

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>
This commit is contained in:
NeilBrown 2012-08-20 10:37:21 +10:00
parent bcd2b4485a
commit a99d346971
1 changed files with 5 additions and 1 deletions

View File

@ -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);