mdmon: suicide prevention
mdmon cannot remove the pidfile at shutdown becuase it needs to stay running across the "mount -o remount,ro /" event. When it relaunches after a reboot there is a good chance that the pid will match what was there previously. The result is that the "take over for unresponsive mdmon" logic results in self termination. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
parent
27dec8fae3
commit
8aae4219a2
4
mdmon.c
4
mdmon.c
|
@ -139,6 +139,10 @@ static void try_kill_monitor(char *devname)
|
|||
close(fd);
|
||||
pid = strtoul(buf, NULL, 10);
|
||||
|
||||
/* first rule of survival... don't off yourself */
|
||||
if (pid == getpid())
|
||||
return;
|
||||
|
||||
/* kill this process if it is mdmon */
|
||||
sprintf(buf, "/proc/%lu/cmdline", (unsigned long) pid);
|
||||
fd = open(buf, O_RDONLY);
|
||||
|
|
Loading…
Reference in New Issue