qemu: stop the virtiofsd specifically

We'd better stop the virtiofsd specifically after stop qemu,
instead of depending on the qemu's termination to notify virtiofsd
to exit.

Fixes: #2211

Signed-off-by: fupan.lfp <fupan.lfp@antgroup.com>
This commit is contained in:
fupan.lfp 2021-07-10 11:21:54 +08:00 committed by Snir Sheriber
parent f3cf46a621
commit 0f7a54adf3

View File

@ -716,7 +716,8 @@ func (q *qemu) stopVirtiofsd(ctx context.Context) (err error) {
// kill virtiofsd
if q.state.VirtiofsdPid == 0 {
return errors.New("invalid virtiofsd PID(0)")
q.Logger().Warn("The virtiofsd had stopped")
return nil
}
err = syscall.Kill(q.state.VirtiofsdPid, syscall.SIGKILL)
@ -1018,6 +1019,10 @@ func (q *qemu) stopSandbox(ctx context.Context, waitOnly bool) error {
}
}
if err := q.stopVirtiofsd(ctx); err != nil {
return err
}
return nil
}