summaryrefslogtreecommitdiff
path: root/mdstat.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 /mdstat.c
parentb5c727dc1a55323f02e5f60a50bcecb866dd51ea (diff)
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 'mdstat.c')
-rw-r--r--mdstat.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/mdstat.c b/mdstat.c
index 4b3f6fec..4a9f3700 100644
--- a/mdstat.c
+++ b/mdstat.c
@@ -266,7 +266,7 @@ void mdstat_wait(int seconds)
select(maxfd + 1, NULL, NULL, &fds, &tm);
}
-void mdstat_wait_fd(int fd, int fd2, const sigset_t *sigmask)
+void mdstat_wait_fd(int fd, const sigset_t *sigmask)
{
fd_set fds, rfds;
int maxfd = 0;
@@ -276,10 +276,7 @@ void mdstat_wait_fd(int fd, int fd2, const sigset_t *sigmask)
if (mdstat_fd >= 0)
FD_SET(mdstat_fd, &fds);
- if (fd < 0)
- fd = fd2, fd2 = -1;
-
- while (fd >= 0) {
+ if (fd >= 0) {
struct stat stb;
fstat(fd, &stb);
if ((stb.st_mode & S_IFMT) == S_IFREG)
@@ -294,8 +291,6 @@ void mdstat_wait_fd(int fd, int fd2, const sigset_t *sigmask)
if (fd > maxfd)
maxfd = fd;
- fd = fd2;
- fd2 = -1;
}
if (mdstat_fd > maxfd)
maxfd = mdstat_fd;