Improve shutdown for container-based arrays.
1/ close a race where multiple arrays disappear at once and monitor isn't woken up to find out that the last one has gone. 2/ "mdadm -Ss" needs to pause briefly for mdmon to exit.
This commit is contained in:
parent
c7c149300b
commit
48561b0142
|
@ -159,6 +159,7 @@ static void remove_old(void)
|
|||
if (pending_discard == discard_this)
|
||||
pending_discard = NULL;
|
||||
discard_this = NULL;
|
||||
wakeup_monitor();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -174,7 +175,6 @@ static void replace_array(struct supertype *container,
|
|||
*/
|
||||
remove_old();
|
||||
while (pending_discard) {
|
||||
wakeup_monitor();
|
||||
while (discard_this == NULL)
|
||||
sleep(1);
|
||||
remove_old();
|
||||
|
|
10
mdadm.c
10
mdadm.c
|
@ -1257,6 +1257,16 @@ int main(int argc, char *argv[])
|
|||
|
||||
put_md_name(name);
|
||||
}
|
||||
/* This is a bit of a hack.
|
||||
* When we stop an array in a container, it
|
||||
* takes a moment for mdmon to let go.
|
||||
* So just pause briefly incase that is
|
||||
* happening. Maybe we should do something
|
||||
* more deterministic via the socket.
|
||||
*/
|
||||
if (progress && err)
|
||||
usleep(50000);
|
||||
|
||||
} while (!last && err);
|
||||
if (err) rv |= 1;
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue