From nobody Sun Feb 8 23:41:06 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=1624016908; cv=none; d=zohomail.com; s=zohoarc; b=WTDCux+hrWZ3Ml5129v1u9y8G0Q+fddKefA2CDIhKgESYBRgZkhTqZ/dSrshffTa5Naw0uUPllaz0uFIcxoEaMP7FHo990WL7eLePfdz8Q7cDsjPuwBNJ/ObnIeX9+cdb/zxxVk3/IhTbjpW1vkkvoUUX/N0XBjQM/C1t8n8qUs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624016908; 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=3EB781+fEq/K8Tk3flcjgqjOPCoTcGG3iq7qzLnr+NI=; b=QweMezm0G0WvEqrwUL9OQ//9sBiPaIJO/KLcdO2i0GH//IMtkVoZgFPtHLwtCp4Jhgaz2Em2460ZBqci1ue9UPfZSVTZlayBY3gKyou3iIJkRPG4wQ0iH/Qn0+yFOkTrjnMSk5eH+anuSm3zAXu6rZHvv+1WpIszI0xudhjImsE= 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 1624016908098634.2976870974587; Fri, 18 Jun 2021 04:48:28 -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-217-jJN8BvypOF6u40UrXhe-5w-1; Fri, 18 Jun 2021 07:48:24 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E875C100C609; Fri, 18 Jun 2021 11:48:18 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C9414604CC; Fri, 18 Jun 2021 11:48:18 +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 37FB81809CAC; Fri, 18 Jun 2021 11:48:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 15IBjR6Y024832 for ; Fri, 18 Jun 2021 07:45:27 -0400 Received: by smtp.corp.redhat.com (Postfix) id A391418EC5; Fri, 18 Jun 2021 11:45:27 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.43.2.210]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2FFEE60C58 for ; Fri, 18 Jun 2021 11:45:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624016906; 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=3EB781+fEq/K8Tk3flcjgqjOPCoTcGG3iq7qzLnr+NI=; b=R1cKoRXi6/aKFBL/MsVFpqQPMOBsfNkrPveyKFPHxmYQW2Fmkwf2beykz5wQwfPnqi5q/r /WCJVNCelXIB79I2/Cw1iiBW1OKGUdNkpkv420wjHlfGUrZKNhIACuPkqbPWr+3qsyFijV a0R+Fgy6F4KkmiwpDwa+YAeOVulflAQ= X-MC-Unique: jJN8BvypOF6u40UrXhe-5w-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 1/3] Introduce virPidFileForceCleanupPathDelay Date: Fri, 18 Jun 2021 13:45:17 +0200 Message-Id: <19db305a269f248c3cef032ee2418498261c948b.1624016585.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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.11 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) Add a version of virPidFileForceCleanupPath with an extradelay parameter for processes where the default timeout is not enough. Signed-off-by: J=C3=A1n Tomko --- src/libvirt_private.syms | 1 + src/util/virpidfile.c | 16 +++++++++++++++- src/util/virpidfile.h | 2 ++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 2efa787664..dc25dd6ac0 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -3027,6 +3027,7 @@ virPidFileConstructPath; virPidFileDelete; virPidFileDeletePath; virPidFileForceCleanupPath; +virPidFileForceCleanupPathDelay; virPidFileRead; virPidFileReadIfAlive; virPidFileReadPath; diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c index c6389c1869..6c3d869460 100644 --- a/src/util/virpidfile.c +++ b/src/util/virpidfile.c @@ -511,10 +511,14 @@ virPidFileConstructPath(bool privileged, * called multiple times with the same path, be it in threads or * processes. This function does not raise any errors. * + * If @extradelay (in seconds) is specified, we wait for + * 15 + extradelay seconds more. + * * Returns 0 if the pidfile was successfully cleaned up, -1 otherwise. */ int -virPidFileForceCleanupPath(const char *path) +virPidFileForceCleanupPathDelay(const char *path, + unsigned int extradelay) { pid_t pid =3D 0; int fd =3D -1; @@ -532,6 +536,9 @@ virPidFileForceCleanupPath(const char *path) /* Only kill the process if the pid is valid one. 0 means * there is somebody else doing the same pidfile cleanup * machinery. */ + if (extradelay && + virProcessKillPainfullyDelay(pid, false, extradelay) >=3D 0) + pid =3D 0; if (pid) virProcessKillPainfully(pid, true); =20 @@ -544,3 +551,10 @@ virPidFileForceCleanupPath(const char *path) =20 return 0; } + + +int +virPidFileForceCleanupPath(const char *path) +{ + return virPidFileForceCleanupPathDelay(path, 0); +} diff --git a/src/util/virpidfile.h b/src/util/virpidfile.h index 370a59892e..ef26377375 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 virPidFileForceCleanupPathDelay(const char *path, + unsigned int extradelay) ATTRIBUTE_NON= NULL(1); int virPidFileForceCleanupPath(const char *path) ATTRIBUTE_NONNULL(1); --=20 2.31.1