Send TERM/KILL to virtiofsd and its child processes too and do not exit until they are all dead. https://bugzilla.redhat.com/show_bug.cgi?id=1940276 Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx> --- src/qemu/qemu_virtiofs.c | 2 +- src/util/virpidfile.c | 7 ++++++- src/util/virprocess.c | 5 ++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_virtiofs.c b/src/qemu/qemu_virtiofs.c index edaedf0304..15c05479c8 100644 --- a/src/qemu/qemu_virtiofs.c +++ b/src/qemu/qemu_virtiofs.c @@ -281,7 +281,7 @@ qemuVirtioFSStop(virQEMUDriver *driver G_GNUC_UNUSED, if (!(pidfile = qemuVirtioFSCreatePidFilename(vm, fs->info.alias))) goto cleanup; - if (virPidFileForceCleanupPath(pidfile) < 0) { + if (virPidFileForceCleanupPathFull(pidfile, true) < 0) { VIR_WARN("Unable to kill virtiofsd process"); } else { if (QEMU_DOMAIN_FS_PRIVATE(fs)->vhostuser_fs_sock) diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c index b75f441008..7069f8343d 100644 --- a/src/util/virpidfile.c +++ b/src/util/virpidfile.c @@ -529,10 +529,15 @@ virPidFileForceCleanupPathFull(const char *path, bool group) if (fd < 0) { virResetLastError(); + if (pid > 1 && group) + pid = virProcessGroupGet(pid); + /* Only kill the process if the pid is valid one. 0 means * there is somebody else doing the same pidfile cleanup * machinery. */ - if (pid) + if (group) + virProcessKillPainfullyDelay(pid, true, 0, true); + else if (pid) virProcessKillPainfully(pid, true); if (virPidFileDeletePath(path) < 0) diff --git a/src/util/virprocess.c b/src/util/virprocess.c index a92aa8aac9..d946ac37f4 100644 --- a/src/util/virprocess.c +++ b/src/util/virprocess.c @@ -449,7 +449,10 @@ virProcessKillPainfullyDelay(pid_t pid, bool force, unsigned int extradelay, boo signum = 0; /* Just check for existence */ } - rc = virProcessKill(pid, signum); + if (group) + rc = virProcessGroupKill(pid, signum); + else + rc = virProcessKill(pid, signum); if (rc < 0) { if (errno != ESRCH) { -- 2.31.1