mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-30 04:34:27 +00:00
clh: fast exit from isClhRunning if the process was stopped
Use atomic operations instead of acquiring a mutex in isClhRunning. This stops isClhRunning from generating a deadlock by trying to reacquire an already-acquired lock when called via StopVM->terminate. Signed-off-by: Alexandru Matei <alexandru.matei@uipath.com>
This commit is contained in:
parent
2631b08ff1
commit
9ef68e0c7a
@ -1401,6 +1401,10 @@ func (clh *cloudHypervisor) isClhRunning(timeout uint) (bool, error) {
|
|||||||
|
|
||||||
pid := clh.state.PID
|
pid := clh.state.PID
|
||||||
|
|
||||||
|
if atomic.LoadInt32(&clh.stopped) != 0 {
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
|
||||||
if err := syscall.Kill(pid, syscall.Signal(0)); err != nil {
|
if err := syscall.Kill(pid, syscall.Signal(0)); err != nil {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user