]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - monitor.c
mdmon: ping will wait for manage_mon to catch up.
[thirdparty/mdadm.git] / monitor.c
index 955b53f723ffbfb219c951069ab27d352794cd91..e29d023a4c756c9ad1599b5c283988ad1c479f00 100644 (file)
--- a/monitor.c
+++ b/monitor.c
@@ -48,7 +48,7 @@ static int read_attr(char *buf, int len, int fd)
 }
 
 
-static int get_resync_start(struct active_array *a)
+int get_resync_start(struct active_array *a)
 {
        char buf[30];
        int n;
@@ -251,7 +251,8 @@ static int read_and_act(struct active_array *a)
                }
        }
 
-       if (a->curr_action == idle &&
+       if (!deactivate &&
+           a->curr_action == idle &&
            a->prev_action == resync) {
                /* A resync has finished.  The endpoint is recorded in
                 * 'sync_start'.  We don't update the metadata
@@ -263,7 +264,8 @@ static int read_and_act(struct active_array *a)
                check_degraded = 1;
        }
 
-       if (a->curr_action == idle &&
+       if (!deactivate &&
+           a->curr_action == idle &&
            a->prev_action == recover) {
                /* A recovery has finished.  Some disks may be in sync now,
                 * and the array may no longer be degraded
@@ -403,6 +405,8 @@ static void dprint_wake_reasons(fd_set *fds)
 }
 #endif
 
+int monitor_loop_cnt;
+
 static int wait_and_act(struct supertype *container, int nowait)
 {
        fd_set rfds;
@@ -460,7 +464,9 @@ static int wait_and_act(struct supertype *container, int nowait)
                sigset_t set;
                sigprocmask(SIG_UNBLOCK, NULL, &set);
                sigdelset(&set, SIGUSR1);
+               monitor_loop_cnt |= 1;
                rv = pselect(maxfd+1, &rfds, NULL, NULL, NULL, &set);
+               monitor_loop_cnt += 1;
                if (rv == -1 && errno == EINTR)
                        rv = 0;
                #ifdef DEBUG