summaryrefslogtreecommitdiffstats
path: root/mdmon.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2008-10-02 22:26:00 -0700
committerDan Williams <dan.j.williams@intel.com>2008-10-15 14:43:57 -0700
commit8aae4219a2668acb88ad2777dacf69de941e7e07 (patch)
tree533acdffcee795e26334ae60dbd35ef2989173b6 /mdmon.c
parent27dec8fae303ab356aa786e20414f89d60be08a4 (diff)
downloadmdadm-8aae4219a2668acb88ad2777dacf69de941e7e07.tar.gz
mdadm-8aae4219a2668acb88ad2777dacf69de941e7e07.tar.xz
mdadm-8aae4219a2668acb88ad2777dacf69de941e7e07.zip
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>
Diffstat (limited to 'mdmon.c')
-rw-r--r--mdmon.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/mdmon.c b/mdmon.c
index d6b99a2..32805a8 100644
--- a/mdmon.c
+++ b/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);