}
-static int get_resync_start(struct active_array *a)
+int get_resync_start(struct active_array *a)
{
char buf[30];
int n;
if (a->curr_state <= inactive &&
a->prev_state > inactive) {
/* array has been stopped */
+ get_resync_start(a);
a->container->ss->set_array_state(a, 1);
a->next_state = clear;
deactivate = 1;
* readonly ???
*/
get_resync_start(a);
- printf("Found a readonly array at %llu\n", a->resync_start);
+// printf("Found a readonly array at %llu\n", a->resync_start);
if (a->resync_start == ~0ULL)
a->next_state = read_auto; /* array is clean */
else {
}
}
- 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
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
+ */
for (mdi = a->info.devs ; mdi ; mdi = mdi->next) {
a->container->ss->set_disk(a, mdi->disk.raid_disk,
mdi->curr_state);
}
#endif
+int monitor_loop_cnt;
+
static int wait_and_act(struct supertype *container, int nowait)
{
fd_set rfds;
if (fd >= 0 || errno != EBUSY) {
/* OK, we are safe to leave */
dprintf("no arrays to monitor... exiting\n");
+ remove_pidfile(container->devname);
exit_now = 1;
signal_manager();
- remove_pidfile(container->devname);
exit(0);
}
}
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