From nobody Sun Feb 8 14:30:30 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1628009443; cv=none; d=zohomail.com; s=zohoarc; b=mu9BBDvMoKKb0sJY6BNP/LazWj7NSL+gEcwkOPmOVlEqtyiDRTqCNUWxhcA/9aEMJv5ofdHdOfYm4iVIer10aGE1W8iKkv4PHyIM/H0p/hNVD1/08c/v/4BYdFUWMib0yZrsx3iocJi+0FKNoz095+i3a2hTZTAq+lYIH73ajXs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628009443; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Kit7l7zVVNCa4TmNrUV1DLC245SM29mUMsSETkPXChw=; b=h1YZWwgh51Q5ceqZfioSIagWC5p9I113gpL/7YE24fGymLxkPh4tt1PwclFCU0MMW5ORDf31KShZ5Y+js7WT+GkSvr00cGsb+hVddIfbb27mvbXm9UtJeOJ33XmFDNe1j9XQEtEiUigswzgFzjtFc7/Yf8qHRbAZi3Pv4mpAjck= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1628009443896270.4665537298963; Tue, 3 Aug 2021 09:50:43 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-527-13AX4lguP_2TURiaDcj6mg-1; Tue, 03 Aug 2021 12:47:37 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 638BF100F781; Tue, 3 Aug 2021 16:47:28 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4449B175B6; Tue, 3 Aug 2021 16:47:28 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 0FA7B50045; Tue, 3 Aug 2021 16:47:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 173FDtGE011135 for ; Tue, 3 Aug 2021 11:13:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6E5614536; Tue, 3 Aug 2021 15:13:55 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.43.2.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id ECA5019C44 for ; Tue, 3 Aug 2021 15:13:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628009442; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Kit7l7zVVNCa4TmNrUV1DLC245SM29mUMsSETkPXChw=; b=BeZj4BvYF2Z3mpd+OWHF0ANOJJmELFLiu9sC0YHBHlfjENtz174q4ToZ0tUMWqJZ0iIfIL AzuplTQJBhv8VeAey/rHqZ12kgNKP2COZ2LYDGylk8IeelwrAmpmkgEdRy56WsXDhwfdoJ NT8T4NZZn1A6ZU/xvG4jX+pjDqF6lpw= X-MC-Unique: 13AX4lguP_2TURiaDcj6mg-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 4/6] util: virPidFileForceCleanupPath: add group argument Date: Tue, 3 Aug 2021 17:13:43 +0200 Message-Id: <5ef1080f78bc11dc010a25f00ddf770fc63b6d66.1628003420.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1628009444944100001 Add a version of virPidFileForceCleanupPath that takes a 'group' bool argument and propagate it all the way down to virProcessKillPainfullyDelay. Signed-off-by: J=C3=A1n Tomko --- src/libvirt_private.syms | 1 + src/qemu/qemu_process.c | 3 ++- src/util/virpidfile.c | 8 +++++++- src/util/virpidfile.h | 2 ++ src/util/virprocess.c | 8 ++++---- src/util/virprocess.h | 3 ++- 6 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 6961cdb137..e2e4c9482d 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -3038,6 +3038,7 @@ virPidFileConstructPath; virPidFileDelete; virPidFileDeletePath; virPidFileForceCleanupPath; +virPidFileForceCleanupPathFull; virPidFileRead; virPidFileReadIfAlive; virPidFileReadPath; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 521fda57da..6ef8ebd83e 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7700,7 +7700,8 @@ qemuProcessKill(virDomainObj *vm, unsigned int flags) * to be safe against stalls by the kernel freeing up the resources */ return virProcessKillPainfullyDelay(vm->pid, !!(flags & VIR_QEMU_PROCESS_KILL_F= ORCE), - vm->def->nhostdevs * 2); + vm->def->nhostdevs * 2, + false); } =20 =20 diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c index c6389c1869..b75f441008 100644 --- a/src/util/virpidfile.c +++ b/src/util/virpidfile.c @@ -514,7 +514,7 @@ virPidFileConstructPath(bool privileged, * Returns 0 if the pidfile was successfully cleaned up, -1 otherwise. */ int -virPidFileForceCleanupPath(const char *path) +virPidFileForceCleanupPathFull(const char *path, bool group) { pid_t pid =3D 0; int fd =3D -1; @@ -544,3 +544,9 @@ virPidFileForceCleanupPath(const char *path) =20 return 0; } + +int +virPidFileForceCleanupPath(const char *path) +{ + return virPidFileForceCleanupPathFull(path, false); +} diff --git a/src/util/virpidfile.h b/src/util/virpidfile.h index 370a59892e..fd8013c41e 100644 --- a/src/util/virpidfile.h +++ b/src/util/virpidfile.h @@ -73,4 +73,6 @@ int virPidFileConstructPath(bool privileged, const char *progname, char **pidfile); =20 +int virPidFileForceCleanupPathFull(const char *path, + bool group) ATTRIBUTE_NONNULL(1); int virPidFileForceCleanupPath(const char *path) ATTRIBUTE_NONNULL(1); diff --git a/src/util/virprocess.c b/src/util/virprocess.c index bbfa4dbdf0..a92aa8aac9 100644 --- a/src/util/virprocess.c +++ b/src/util/virprocess.c @@ -406,15 +406,15 @@ pid_t virProcessGroupGet(pid_t pid) * wait longer than the default. */ int -virProcessKillPainfullyDelay(pid_t pid, bool force, unsigned int extradela= y) +virProcessKillPainfullyDelay(pid_t pid, bool force, unsigned int extradela= y, bool group) { size_t i; /* This is in 1/5th seconds since polling is on a 0.2s interval */ unsigned int polldelay =3D (force ? 200 : 75) + (extradelay*5); const char *signame =3D "TERM"; =20 - VIR_DEBUG("vpid=3D%lld force=3D%d extradelay=3D%u", - (long long)pid, force, extradelay); + VIR_DEBUG("vpid=3D%lld force=3D%d extradelay=3D%u group=3D%d", + (long long)pid, force, extradelay, group); =20 /* This loop sends SIGTERM, then waits a few iterations (10 seconds) * to see if it dies. If the process still hasn't exited, and @@ -474,7 +474,7 @@ virProcessKillPainfullyDelay(pid_t pid, bool force, uns= igned int extradelay) =20 int virProcessKillPainfully(pid_t pid, bool force) { - return virProcessKillPainfullyDelay(pid, force, 0); + return virProcessKillPainfullyDelay(pid, force, 0, false); } =20 #if WITH_SCHED_GETAFFINITY diff --git a/src/util/virprocess.h b/src/util/virprocess.h index 9d7c0f479a..9910331a0c 100644 --- a/src/util/virprocess.h +++ b/src/util/virprocess.h @@ -58,7 +58,8 @@ pid_t virProcessGroupGet(pid_t pid); int virProcessKillPainfully(pid_t pid, bool force); int virProcessKillPainfullyDelay(pid_t pid, bool force, - unsigned int extradelay); + unsigned int extradelay, + bool group); =20 int virProcessSetAffinity(pid_t pid, virBitmap *map, bool quiet); =20 --=20 2.31.1