From 0f7a54adf3c83b47046aba1ab058abd3eb9d0e01 Mon Sep 17 00:00:00 2001 From: "fupan.lfp" Date: Sat, 10 Jul 2021 11:21:54 +0800 Subject: [PATCH] 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 --- src/runtime/virtcontainers/qemu.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/runtime/virtcontainers/qemu.go b/src/runtime/virtcontainers/qemu.go index 9e1c4af5a1..d69f4dbb1c 100644 --- a/src/runtime/virtcontainers/qemu.go +++ b/src/runtime/virtcontainers/qemu.go @@ -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 }