runstate: don't move to prelaunch on reset if postmigrate
PATCH 1/1 runstate: don't move to prelaunch on reset if postmigrate
As comment says, runstate can change in parallel. We check for FINISH_MIGRATE, but actually migration may proceed up to POSTMIGRATE.
We should check for POSTMIGRATE as well, otherwise there is a race, if reset is in progress, and source may finish migration in PRELAUNCH state, which is unexpected for user.
Seems correct to handle POSTMIGRATE the same way as FINISH_MIGRATE in this logic, as POSTMIGRATE is continuation for FINISH_MIGRATE.
--- system/runstate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
system/runstate.c +2 -1
@@ -921,7 +921,8 @@ static bool main_loop_should_exit(int *status)*/ if (!runstate_check (RUN_STATE_RUNNING ) && !runstate_check (RUN_STATE_INMIGRATE ) && - !runstate_check (RUN_STATE_FINISH_MIGRATE )) { + !runstate_check (RUN_STATE_FINISH_MIGRATE ) && + !runstate_check (RUN_STATE_POSTMIGRATE )) {runstate_set (RUN_STATE_PRELAUNCH ); } }
Signature · 1 line
2.43.0
Quoted 4 lines · Vladimir Sementsov-Ogievskiy
As comment says, runstate can change in parallel. We check for
FINISH_MIGRATE, but actually migration may proceed up to POSTMIGRATE.
Quoted 8 lines
We should check for POSTMIGRATE as well, otherwise there is a race, if reset is in progress, and source may finish migration in PRELAUNCH state, which is unexpected for user.
Seems correct to handle POSTMIGRATE the same way as
FINISH_MIGRATEin this logic, as POSTMIGRATE is continuation forFINISH_MIGRATE.Signed-off-by Vladimir Sementsov-Ogievskiy <[email protected]>
Signature · 1 line
Peter Xu