Skip to content
  • Laurent Vivier's avatar
    ddad81bd
    runstate: ignore finishmigrate -> prelaunch transition · ddad81bd
    Laurent Vivier authored
    
    
    Commit 1bd71dce tries to prevent a finishmigrate -> prelaunch
    transition by exiting at the beginning of the main_loop_should_exit()
    function if the state is already finishmigrate.
    
    As the finishmigrate state is set in the migration thread it can
    happen concurrently to the function. The migration thread and the
    function are normally protected by the iothread mutex and thus the
    state should no evolve between the start of the function and its end.
    
    Unfortunately during the function life the lock is released by
    pause_all_vcpus() just before the point we need to be sure we are
    not in finishmigrate state and if the migration thread is waiting
    for the lock it will take the opportunity to change the state
    to finishmigrate.
    
    The only way to be sure we are not in the finishmigrate state when
    we need is to check the state after the pause_all_vcpus() function.
    
    Fixes: 1bd71dce ("runstate: ignore exit request in finish migrate state")
    Signed-off-by: default avatarLaurent Vivier <lvivier@redhat.com>
    Signed-off-by: default avatarJuan Quintela <quintela@redhat.com>
    ddad81bd
    runstate: ignore finishmigrate -> prelaunch transition
    Laurent Vivier authored
    
    
    Commit 1bd71dce tries to prevent a finishmigrate -> prelaunch
    transition by exiting at the beginning of the main_loop_should_exit()
    function if the state is already finishmigrate.
    
    As the finishmigrate state is set in the migration thread it can
    happen concurrently to the function. The migration thread and the
    function are normally protected by the iothread mutex and thus the
    state should no evolve between the start of the function and its end.
    
    Unfortunately during the function life the lock is released by
    pause_all_vcpus() just before the point we need to be sure we are
    not in finishmigrate state and if the migration thread is waiting
    for the lock it will take the opportunity to change the state
    to finishmigrate.
    
    The only way to be sure we are not in the finishmigrate state when
    we need is to check the state after the pause_all_vcpus() function.
    
    Fixes: 1bd71dce ("runstate: ignore exit request in finish migrate state")
    Signed-off-by: default avatarLaurent Vivier <lvivier@redhat.com>
    Signed-off-by: default avatarJuan Quintela <quintela@redhat.com>
Loading