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
parent f793b28dfd
commit 8f76626fd6

View File

@ -668,7 +668,8 @@ func (q *qemu) setupVirtiofsd(ctx context.Context) (err error) {
func (q *qemu) stopVirtiofsd(ctx context.Context) (err error) {
if q.state.VirtiofsdPid == 0 {
return errors.New("invalid virtiofsd PID(0)")
q.Logger().Warn("The virtiofsd had stopped")
return nil
}
err = q.virtiofsd.Stop(ctx)
@ -975,6 +976,10 @@ func (q *qemu) stopSandbox(ctx context.Context, waitOnly bool) error {
}
}
if err := q.stopVirtiofsd(ctx); err != nil {
return err
}
return nil
}