marsadm: fix race between fetch and primary --force

This commit is contained in:
Thomas Schoebel-Theuer 2020-02-27 13:55:58 +01:00
parent de036d0b52
commit c3e5df459f
1 changed files with 9 additions and 0 deletions

View File

@ -3941,6 +3941,13 @@ sub primary_phase0 {
lprint "all preconditions OK for resource '$res'\n";
}
# only for primary --force: wait until fetch has actually stopped
sub primary_phase0a {
my ($cmd, $res) = @_;
return unless $force;
wait_cond($cmd, $res, "is-fetch-off");
}
# only for systemd: wait that primary device is no longer open
sub primary_phase0b {
my ($cmd, $res) = @_;
@ -6762,6 +6769,8 @@ my %cmd_table =
\&primary_phase0,
"check preconditions",
"FORK",
\&primary_phase0a,
"conditionally wait for fetch off",
\&primary_phase0b,
"wait for systemd",
\&primary_phase1,