X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=mdmon.c;h=ff985d291ee9045ede3daf68c1184af3ee0384eb;hb=8e41153c91cdce696618c527906648625217470c;hp=e4b73d96b96c6482df7915daeb03b67b580f93fd;hpb=50d72ed4298618c679efd43647dd055527e59b10;p=thirdparty%2Fmdadm.git diff --git a/mdmon.c b/mdmon.c index e4b73d96..ff985d29 100644 --- a/mdmon.c +++ b/mdmon.c @@ -171,6 +171,7 @@ static void try_kill_monitor(pid_t pid, char *devname, int sock) int fd; int n; long fl; + int rv; /* first rule of survival... don't off yourself */ if (pid == getpid()) @@ -201,9 +202,16 @@ static void try_kill_monitor(pid_t pid, char *devname, int sock) fl &= ~O_NONBLOCK; fcntl(sock, F_SETFL, fl); n = read(sock, buf, 100); - /* Ignore result, it is just the wait that - * matters - */ + + /* If there is I/O going on it might took some time to get to + * clean state. Wait for monitor to exit fully to avoid races. + * Ping it with SIGUSR1 in case that it is sleeping */ + for (n = 0; n < 25; n++) { + rv = kill(pid, SIGUSR1); + if (rv < 0) + break; + usleep(200000); + } } void remove_pidfile(char *devname) @@ -408,10 +416,6 @@ static int mdmon(char *devnm, int must_fork, int takeover) pr_err("%s: %s\n", devnm, strerror(errno)); return 1; } - if (md_get_version(mdfd) < 0) { - pr_err("%s: Not an md device\n", devnm); - return 1; - } /* Fork, and have the child tell us when they are ready */ if (must_fork) { @@ -580,11 +584,6 @@ int restore_stripes(int *dest, unsigned long long *offsets, return 1; } -void abort_reshape(struct mdinfo *sra) -{ - return; -} - int save_stripes(int *source, unsigned long long *offsets, int raid_disks, int chunk_size, int level, int layout, int nwrites, int *dest,