summaryrefslogtreecommitdiffstats
path: root/managemon.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2010-02-08 14:12:46 +1100
committerNeilBrown <neilb@suse.de>2010-02-08 17:26:18 +1100
commit58a4ba2a6b66ac14fa0ebaf0ce40326582d31429 (patch)
tree888e17d468d13b4bd542da83c7bb8da5f79174b6 /managemon.c
parentb5c727dc1a55323f02e5f60a50bcecb866dd51ea (diff)
downloadmdadm-58a4ba2a6b66ac14fa0ebaf0ce40326582d31429.tar.gz
mdadm-58a4ba2a6b66ac14fa0ebaf0ce40326582d31429.tar.xz
mdadm-58a4ba2a6b66ac14fa0ebaf0ce40326582d31429.zip
mdmon: don't monitor /proc/mounts to decide when to create .pid file.
Monitoring /proc/mounts and creating a .pid file as soon as /var/run is writable is racy. Most distros clean all non-directories from /var/run early in boot and if mdmon races with this it could lose the files as soon as they are created. Instead require that "mdmon --takeover" be run after /var is writable. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'managemon.c')
-rw-r--r--managemon.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/managemon.c b/managemon.c
index 2a73d4b..e01d13b 100644
--- a/managemon.c
+++ b/managemon.c
@@ -677,14 +677,12 @@ void do_manager(struct supertype *container)
{
struct mdstat_ent *mdstat;
sigset_t set;
- int proc_fd;
sigprocmask(SIG_UNBLOCK, NULL, &set);
sigdelset(&set, SIGUSR1);
sigdelset(&set, SIGHUP);
sigdelset(&set, SIGALRM);
sigdelset(&set, SIGTERM);
- proc_fd = open("/proc/mounts", O_RDONLY);
do {
@@ -711,10 +709,6 @@ void do_manager(struct supertype *container)
char *dir = ALT_RUN;
if (mkdir(dir, 0600) < 0 && errno != EEXIST)
dir = NULL;
- } else {
- if (proc_fd >= 0)
- close(proc_fd);
- proc_fd = -1;
}
if (dir && !sigterm &&
(container->sock < 0 ||
@@ -742,7 +736,7 @@ void do_manager(struct supertype *container)
wakeup_monitor();
if (update_queue == NULL)
- mdstat_wait_fd(container->sock, proc_fd, &set);
+ mdstat_wait_fd(container->sock, &set);
else
/* If an update is happening, just wait for signal */
pselect(0, NULL, NULL, NULL, NULL, &set);