From nobody Sat May 11 02:34:39 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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 170.10.129.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=1678206733; cv=none; d=zohomail.com; s=zohoarc; b=Vfbn2Vf2eoa6IYvDEWeH/zmvwSEzoGys3+gDw9PlkFlxKW8jddzTRIKxFZY4NczlYSJOVHwVhAh1sQAbQROam7z2nVu8MIiZj0aN0pvCrH9c4Wl/hyhgM5lfrKW/5NrT/rdNTj4/trIy5uHTnYKok+W5wJWZt/1UPkrHXJPJDQY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678206733; 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=JjcshGbmNRSBqNDMuxZVHd5yGBJMqOjDF+47uaQxiL8=; b=PteUt+ZWGyhBldxCtiurAlwET4fbIGxBMkXYjhlq4iBNGjUgJULgBd2WXgTp46t/vmXQd+0EN+lYbOH39eY+42+90F1cf/marIuO/B8/cv09cC3oxLk342eIwAclh/MSYjZFedpYt9+jL++Koz3icDFr+HHWyVWhfZbf/uv5us4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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 [170.10.129.124]) by mx.zohomail.com with SMTPS id 1678206733626551.0084264750551; Tue, 7 Mar 2023 08:32:13 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-249-3BCqBYC1OPe-xCZNtTLy0w-1; Tue, 07 Mar 2023 11:25:22 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AE1F88EF3A3; Tue, 7 Mar 2023 16:16:07 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id EEEB3C16024; Tue, 7 Mar 2023 16:16:06 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 9EAEE19466DF; Tue, 7 Mar 2023 16:16:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id AA9C119465A4 for ; Tue, 7 Mar 2023 16:16:04 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 8D3F614171B6; Tue, 7 Mar 2023 16:16:04 +0000 (UTC) Received: from fedora.. (unknown [10.43.2.118]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3491A14171C3 for ; Tue, 7 Mar 2023 16:16:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678206732; 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=JjcshGbmNRSBqNDMuxZVHd5yGBJMqOjDF+47uaQxiL8=; b=MTUopBR3yQn2dty70JOzmuHCsvUqCplEu8NKB3Mt90iOLxxdftt8co9wB1IGWtspiGSw9u aLX3hd8iGUdO97aM9/lUEUyeXPFUBNkm1NDZgEQQVG3kM02xq63lyrm8DK0vO2CgiiBaYV j2vpI51G6xrZxD8F8Mn9RkihGlJ1RxQ= X-MC-Unique: 3BCqBYC1OPe-xCZNtTLy0w-1 X-Original-To: libvir-list@listman.corp.redhat.com From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 1/6] util: remove waitForLock from virPidFileAcquire Date: Tue, 7 Mar 2023 17:15:57 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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: 1678206736160100001 The parameter was added for consistency with virPidFileAcquirePath. However, all callers of virPidFileAcquire pass false. Remove the argument. Partially-reverts: 2250a2b5d21c3b3529727f38a99cba22f84024f7 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Martin Kletzander --- src/bhyve/bhyve_driver.c | 2 +- src/interface/interface_backend_netcf.c | 2 +- src/interface/interface_backend_udev.c | 2 +- src/libxl/libxl_driver.c | 2 +- src/lxc/lxc_driver.c | 2 +- src/network/bridge_driver.c | 3 +-- src/node_device/node_device_udev.c | 2 +- src/nwfilter/nwfilter_driver.c | 2 +- src/qemu/qemu_driver.c | 2 +- src/secret/secret_driver.c | 2 +- src/storage/storage_driver.c | 3 +-- src/util/virpidfile.c | 3 +-- src/util/virpidfile.h | 1 - src/vz/vz_driver.c | 2 +- 14 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index d100adeb8f..e7d9c2adf3 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -1247,7 +1247,7 @@ bhyveStateInitialize(bool privileged, } =20 if ((bhyve_driver->lockFD =3D - virPidFileAcquire(BHYVE_STATE_DIR, "driver", false, getpid())) < = 0) + virPidFileAcquire(BHYVE_STATE_DIR, "driver", getpid())) < 0) goto cleanup; =20 if (virDomainObjListLoadAllConfigs(bhyve_driver->domains, diff --git a/src/interface/interface_backend_netcf.c b/src/interface/interf= ace_backend_netcf.c index 5964720e0f..7bd3e7e1e2 100644 --- a/src/interface/interface_backend_netcf.c +++ b/src/interface/interface_backend_netcf.c @@ -123,7 +123,7 @@ netcfStateInitialize(bool privileged, } =20 if ((driver->lockFD =3D - virPidFileAcquire(driver->stateDir, "driver", false, getpid())) <= 0) + virPidFileAcquire(driver->stateDir, "driver", getpid())) < 0) goto error; =20 /* open netcf */ diff --git a/src/interface/interface_backend_udev.c b/src/interface/interfa= ce_backend_udev.c index 54b43fb999..cba14f91f8 100644 --- a/src/interface/interface_backend_udev.c +++ b/src/interface/interface_backend_udev.c @@ -1136,7 +1136,7 @@ udevStateInitialize(bool privileged, } =20 if ((driver->lockFD =3D - virPidFileAcquire(driver->stateDir, "driver", false, getpid())) <= 0) + virPidFileAcquire(driver->stateDir, "driver", getpid())) < 0) goto cleanup; =20 driver->udev =3D udev_new(); diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index c8bcde2612..04e74086e6 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -751,7 +751,7 @@ libxlStateInitialize(bool privileged, } =20 if ((libxl_driver->lockFD =3D - virPidFileAcquire(cfg->stateDir, "driver", false, getpid())) < 0) + virPidFileAcquire(cfg->stateDir, "driver", getpid())) < 0) goto error; =20 if (!(libxl_driver->lockManager =3D diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 0f7687a221..b1d53659d7 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -1505,7 +1505,7 @@ static int lxcStateInitialize(bool privileged, } =20 if ((lxc_driver->lockFD =3D - virPidFileAcquire(cfg->stateDir, "driver", false, getpid())) < 0) + virPidFileAcquire(cfg->stateDir, "driver", getpid())) < 0) goto cleanup; =20 /* Get all the running persistent or transient configs first */ diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index a5973e26cd..3fa56bfc09 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -608,8 +608,7 @@ networkStateInitialize(bool privileged, goto error; =20 if ((network_driver->lockFD =3D - virPidFileAcquire(cfg->stateDir, "driver", - false, getpid())) < 0) + virPidFileAcquire(cfg->stateDir, "driver", getpid())) < 0) goto error; =20 /* if this fails now, it will be retried later with networkDnsmasqCaps= Refresh() */ diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_devi= ce_udev.c index 2454cab8f8..5782aa43c8 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -2278,7 +2278,7 @@ nodeStateInitialize(bool privileged, } =20 if ((driver->lockFD =3D - virPidFileAcquire(driver->stateDir, "driver", false, getpid())) <= 0) + virPidFileAcquire(driver->stateDir, "driver", getpid())) < 0) goto cleanup; =20 if (!(driver->devs =3D virNodeDeviceObjListNew()) || diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c index 8e45096eaa..3803850e26 100644 --- a/src/nwfilter/nwfilter_driver.c +++ b/src/nwfilter/nwfilter_driver.c @@ -254,7 +254,7 @@ nwfilterStateInitialize(bool privileged, } =20 if ((driver->lockFD =3D - virPidFileAcquire(driver->stateDir, "driver", false, getpid())) <= 0) + virPidFileAcquire(driver->stateDir, "driver", getpid())) < 0) goto error; =20 if (virNWFilterIPAddrMapInit() < 0) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index c546e35953..fd8136be37 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -678,7 +678,7 @@ qemuStateInitialize(bool privileged, } =20 if ((qemu_driver->lockFD =3D - virPidFileAcquire(cfg->stateDir, "driver", false, getpid())) < 0) + virPidFileAcquire(cfg->stateDir, "driver", getpid())) < 0) goto error; =20 qemu_driver->qemuImgBinary =3D virFindFileInPath("qemu-img"); diff --git a/src/secret/secret_driver.c b/src/secret/secret_driver.c index c38cd6f651..43d2a0c05a 100644 --- a/src/secret/secret_driver.c +++ b/src/secret/secret_driver.c @@ -536,7 +536,7 @@ secretStateInitialize(bool privileged, } =20 if ((driver->lockFD =3D - virPidFileAcquire(driver->stateDir, "driver", false, getpid())) <= 0) + virPidFileAcquire(driver->stateDir, "driver", getpid())) < 0) goto error; =20 if (!(driver->secrets =3D virSecretObjListNew())) diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index d90c1c9ee8..308704f1c8 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -289,8 +289,7 @@ storageStateInitialize(bool privileged, } =20 if ((driver->lockFD =3D - virPidFileAcquire(driver->stateDir, "driver", - false, getpid())) < 0) + virPidFileAcquire(driver->stateDir, "driver", getpid())) < 0) goto error; =20 if (virStoragePoolObjLoadAllState(driver->pools, diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c index bfd967c1af..5448a8652d 100644 --- a/src/util/virpidfile.c +++ b/src/util/virpidfile.c @@ -447,7 +447,6 @@ int virPidFileAcquirePath(const char *path, =20 int virPidFileAcquire(const char *dir, const char *name, - bool waitForLock, pid_t pid) { g_autofree char *pidfile =3D NULL; @@ -458,7 +457,7 @@ int virPidFileAcquire(const char *dir, if (!(pidfile =3D virPidFileBuildPath(dir, name))) return -ENOMEM; =20 - return virPidFileAcquirePath(pidfile, waitForLock, pid); + return virPidFileAcquirePath(pidfile, false, pid); } =20 =20 diff --git a/src/util/virpidfile.h b/src/util/virpidfile.h index e84542f298..ff4d31c9fd 100644 --- a/src/util/virpidfile.h +++ b/src/util/virpidfile.h @@ -61,7 +61,6 @@ int virPidFileAcquirePath(const char *path, pid_t pid) G_GNUC_WARN_UNUSED_RESULT; int virPidFileAcquire(const char *dir, const char *name, - bool waitForLock, pid_t pid) G_GNUC_WARN_UNUSED_RESULT; =20 int virPidFileReleasePath(const char *path, diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c index 327704b375..4a7b14997f 100644 --- a/src/vz/vz_driver.c +++ b/src/vz/vz_driver.c @@ -4097,7 +4097,7 @@ vzStateInitialize(bool privileged, } =20 if ((vz_driver_lock_fd =3D - virPidFileAcquire(VZ_STATEDIR, "driver", false, getpid())) < 0) + virPidFileAcquire(VZ_STATEDIR, "driver", getpid())) < 0) return VIR_DRV_STATE_INIT_ERROR; =20 if (prlsdkInit() < 0) { --=20 2.39.2 From nobody Sat May 11 02:34:39 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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=1678206161; cv=none; d=zohomail.com; s=zohoarc; b=hIxxYkD5r6rh6rXmYyltGkwDXjvEe/OrPMRqGmmqOS9zfS3hMaevwMNi8GybrAqyYvirtHRaaBBRWVwwM7I5mJNVgGWldoav3uLpGxxsH9FyzO9EtUOQQOXVdP0ZWl+1hs5NggNmr1GOJdh80rnVKRnPWc7xyepCoBj8IX5icqw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678206161; 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=qgPD4wipG1+SphbayRlMSYaprzPjkIQPCrLJx0dMA0I=; b=WypYYgMkAA+fOWVOZCPvpkM2zVYR9vbZGnkZq9xlK4iNWh+8KcWBM59br7V8D2jFEqGD72ZsVQwI7GdXpKC+mkB7CcIVQEzIfOYcFqgCQnNIKF0OFJ3GkIlzy0N9I8YA6VALrNNX2eKoJtgT5YvGwn5gjVhqUDl4l9t2zCdjWOI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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 [170.10.133.124]) by mx.zohomail.com with SMTPS id 1678206161100868.3915794054568; Tue, 7 Mar 2023 08:22:41 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-512-U5iR2XQsN6-0y1HLbxLsIg-1; Tue, 07 Mar 2023 11:20:36 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AE653916103; Tue, 7 Mar 2023 16:16:07 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4A01340BC781; Tue, 7 Mar 2023 16:16:07 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D67C319465B1; Tue, 7 Mar 2023 16:16:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 45CD619465A4 for ; Tue, 7 Mar 2023 16:16:05 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 2934214171C3; Tue, 7 Mar 2023 16:16:05 +0000 (UTC) Received: from fedora.. (unknown [10.43.2.118]) by smtp.corp.redhat.com (Postfix) with ESMTP id C4A6B14171B6 for ; Tue, 7 Mar 2023 16:16:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678206160; 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=qgPD4wipG1+SphbayRlMSYaprzPjkIQPCrLJx0dMA0I=; b=JqGZpoaC0YOTOf3mfTIJt1IhPp3VWh2lLq3TZ9SfS+SL0yg4bULYcQ4t0oVGMUjxaZQFJ4 Nt1CwHfoJQIbjL3bqn4UIE35zD7Xa6HXSSU4K12Kjl/j5E9kkPOq7SVAPVmmXHUprNeE4S QY688pH012m+G1gB/NF5o++N+s2Cam4= X-MC-Unique: U5iR2XQsN6-0y1HLbxLsIg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 2/6] util: introduce virPidFileAcquirePathFull Date: Tue, 7 Mar 2023 17:15:58 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: 1678206161711100001 For now, add the 'Full' suffix to virPidFileAcquirePath and make virPidFileAcquirePath a 'wrapper' around it. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Martin Kletzander --- src/libvirt_private.syms | 1 + src/util/virpidfile.c | 14 +++++++++++--- src/util/virpidfile.h | 3 +++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index d5b1b9cb72..4959dcec67 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -3126,6 +3126,7 @@ virPerfReadEvent; # util/virpidfile.h virPidFileAcquire; virPidFileAcquirePath; +virPidFileAcquirePathFull; virPidFileBuildPath; virPidFileConstructPath; virPidFileDelete; diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c index 5448a8652d..742531379e 100644 --- a/src/util/virpidfile.c +++ b/src/util/virpidfile.c @@ -362,9 +362,9 @@ int virPidFileDelete(const char *dir, return virPidFileDeletePath(pidfile); } =20 -int virPidFileAcquirePath(const char *path, - bool waitForLock, - pid_t pid) +int virPidFileAcquirePathFull(const char *path, + bool waitForLock, + pid_t pid) { int fd =3D -1; char pidstr[VIR_INT64_STR_BUFLEN]; @@ -445,6 +445,14 @@ int virPidFileAcquirePath(const char *path, } =20 =20 +int virPidFileAcquirePath(const char *path, + bool waitForLock, + pid_t pid) +{ + return virPidFileAcquirePathFull(path, waitForLock, pid); +} + + int virPidFileAcquire(const char *dir, const char *name, pid_t pid) diff --git a/src/util/virpidfile.h b/src/util/virpidfile.h index ff4d31c9fd..8c70f883be 100644 --- a/src/util/virpidfile.h +++ b/src/util/virpidfile.h @@ -56,6 +56,9 @@ int virPidFileDelete(const char *dir, const char *name); =20 =20 +int virPidFileAcquirePathFull(const char *path, + bool waitForLock, + pid_t pid) G_GNUC_WARN_UNUSED_RESULT; int virPidFileAcquirePath(const char *path, bool waitForLock, pid_t pid) G_GNUC_WARN_UNUSED_RESULT; --=20 2.39.2 From nobody Sat May 11 02:34:39 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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 170.10.129.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=1678206942; cv=none; d=zohomail.com; s=zohoarc; b=EH212PVrabg6MgRuFwg5UlFWblL+HKthGkVCBiJvT8+8VTyLaGPx/0dZKJY1RBrkmjSlogjirGGS2QrfLJhV++0G7uOQC49NBFOKg8OQk5pqC62kZtU4RUNW4N+x3cytN27LZBlwfbWEzmSPl13lad1vtHBIdwUc6TrE8Jsa3+k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678206942; 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=RLhYCCiHZtQ/iyuNDpPC49pH8Vqp32X2o+abSJD5X/s=; b=MzBr/xOU53FvZ+W5i5hhHcpAydP2PKGdgjXSpsLvzf+iOyPc1nSxy7uTsy+CuUCKEfG05ytISKNA+phBbtnwNYP0PqQzQc/s6W+/WFWN/vS3U/Z4dWXdM1aEPsODxfXcMALsAnaZaybUcFCU9x7wVI0QCp2jf/lXA90mcwKWC0g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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 [170.10.129.124]) by mx.zohomail.com with SMTPS id 1678206942318258.7382770818192; Tue, 7 Mar 2023 08:35:42 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-343-khiOlI95P0iNlWuk660mmg-1; Tue, 07 Mar 2023 11:29:56 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E55051C29AC4; Tue, 7 Mar 2023 16:16:07 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id CE30D40168BC; Tue, 7 Mar 2023 16:16:07 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id EFE4D1946A52; Tue, 7 Mar 2023 16:16:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id C39291946A4A for ; Tue, 7 Mar 2023 16:16:05 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id B702E14171C3; Tue, 7 Mar 2023 16:16:05 +0000 (UTC) Received: from fedora.. (unknown [10.43.2.118]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5FAEB14171B6 for ; Tue, 7 Mar 2023 16:16:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678206938; 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=RLhYCCiHZtQ/iyuNDpPC49pH8Vqp32X2o+abSJD5X/s=; b=Gek+/KIZ6Z+hf9boa/7sbRsPLTcvvBmIRsGwZG4qN3fpJMTyhrQI7d+5lXZhDK12CTRShu a+7gks4ti4czCkSCZwQwguBLQCr1S0vTQwbf5OWbzE/duFO5xwx/6W1etqLoXDCwTudkP7 s/OSPknrAr58+WApXCJbc78WkdAsLcY= X-MC-Unique: khiOlI95P0iNlWuk660mmg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 3/6] leaseshelper: use virPidFileAcquirePathFull Date: Tue, 7 Mar 2023 17:15:59 +0100 Message-Id: <8117d62511f3ec2f7c8ffd850a675b0e41279c93.1678205730.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: 1678206943298100001 The only caller that actually wants to wait for the lock. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Martin Kletzander --- src/network/leaseshelper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/leaseshelper.c b/src/network/leaseshelper.c index ed1bc49346..b1ce313e6a 100644 --- a/src/network/leaseshelper.c +++ b/src/network/leaseshelper.c @@ -159,7 +159,7 @@ main(int argc, char **argv) pid_file =3D g_strdup(RUNSTATEDIR "/leaseshelper.pid"); =20 /* Try to claim the pidfile, exiting if we can't */ - if ((pid_file_fd =3D virPidFileAcquirePath(pid_file, true, getpid())) = < 0) { + if ((pid_file_fd =3D virPidFileAcquirePathFull(pid_file, true, getpid(= ))) < 0) { fprintf(stderr, _("Unable to acquire PID file: %s\n errno=3D%d"), pid_file, errno); --=20 2.39.2 From nobody Sat May 11 02:34:39 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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 170.10.129.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=1678206661; cv=none; d=zohomail.com; s=zohoarc; b=k1PtvPviMRoGZqoD/T67AkueM1mPIR2SW67/IIAh1STdmBvJMsKlQ4OH0xjGJHlfmjoVLwJElfXDxGfA299poLDjlq9QWF5vmT21BfxusgTAqJ1Z8VIW5eP6WYYh2jqoQ0Qsd7fNvFHpyr7BJWlClnRtuQUZjT+MJOhPPWsrIls= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678206661; 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=Tp57s8fxd5b2KSoDUvF3Zd+9Y9kPGAR9J8m073RHeuI=; b=FCJvkVybZXiAcx0znkjLyi2nnHZFckU9SBSUeHmcwpEG+lzQNoDCWm2oMEsMEjIPyVKVl3lt5fQD1iHHo1ZLxmFWvShF8REtKtCdDFwT+DJ0+Iec413Gyz5YsmCqWWhJJbOuCSfUHI72DKsMTPWPzwWmpd9SfbKfKkzZBPRuI+M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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 [170.10.129.124]) by mx.zohomail.com with SMTPS id 167820666128318.64555249415173; Tue, 7 Mar 2023 08:31:01 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-297-hS07xF5sOtaNWKhyPDsABA-1; Tue, 07 Mar 2023 11:25:24 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 42EFA10A2D84; Tue, 7 Mar 2023 16:16:08 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2E623218CC2B; Tue, 7 Mar 2023 16:16:08 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 26EF51946A6E; Tue, 7 Mar 2023 16:16:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 6E8BA19465A4 for ; Tue, 7 Mar 2023 16:16:06 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 51D5314171C3; Tue, 7 Mar 2023 16:16:06 +0000 (UTC) Received: from fedora.. (unknown [10.43.2.118]) by smtp.corp.redhat.com (Postfix) with ESMTP id EE2F914171B6 for ; Tue, 7 Mar 2023 16:16:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678206656; 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=Tp57s8fxd5b2KSoDUvF3Zd+9Y9kPGAR9J8m073RHeuI=; b=AUJ05ds6v25icKb8bHs4UrIurCmMDBfDpbFwZRKVVArc8x2S2D7EZVL/jANzYIJzBf/gEk FL/gF9mORu8BOQaK8YNU6xQeeSwPSWW3fWgs1HsvEUBirSzEJpA2+l2rzYSWVzx2SiriUR w8f8iMpCIzYWMSyy3q7u7SPdNk9mkv0= X-MC-Unique: hS07xF5sOtaNWKhyPDsABA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 4/6] util: virPidFileAcquirePath: remove waitForLock argument Date: Tue, 7 Mar 2023 17:16:00 +0100 Message-Id: <2cd16e2c150fa94eb072057520028b000c63b230.1678205730.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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: 1678206661789100001 None of the callers need it anymore. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Martin Kletzander --- src/locking/lock_daemon.c | 4 ++-- src/logging/log_daemon.c | 4 ++-- src/remote/remote_daemon.c | 2 +- src/util/vircommand.c | 2 +- src/util/virpidfile.c | 7 +++---- src/util/virpidfile.h | 1 - 6 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c index 5eed6b7c26..6b0a8220e5 100644 --- a/src/locking/lock_daemon.c +++ b/src/locking/lock_daemon.c @@ -648,7 +648,7 @@ virLockDaemonPostExecRestart(const char *state_file, =20 /* Re-claim PID file now as we will not be daemonizing */ if (pid_file && - (*pid_file_fd =3D virPidFileAcquirePath(pid_file, false, getpid())= ) < 0) + (*pid_file_fd =3D virPidFileAcquirePath(pid_file, getpid())) < 0) return -1; =20 if (!(lockDaemon =3D virLockDaemonNewPostExecRestart(object, privilege= d))) @@ -1000,7 +1000,7 @@ int main(int argc, char **argv) { } =20 /* If we have a pidfile set, claim it now, exiting if already take= n */ - if ((pid_file_fd =3D virPidFileAcquirePath(pid_file, false, getpid= ())) < 0) { + if ((pid_file_fd =3D virPidFileAcquirePath(pid_file, getpid())) < = 0) { ret =3D VIR_DAEMON_ERR_PIDFILE; goto cleanup; } diff --git a/src/logging/log_daemon.c b/src/logging/log_daemon.c index 8025245350..b4db585810 100644 --- a/src/logging/log_daemon.c +++ b/src/logging/log_daemon.c @@ -468,7 +468,7 @@ virLogDaemonPostExecRestart(const char *state_file, =20 /* Re-claim PID file now as we will not be daemonizing */ if (pid_file && - (*pid_file_fd =3D virPidFileAcquirePath(pid_file, false, getpid())= ) < 0) + (*pid_file_fd =3D virPidFileAcquirePath(pid_file, getpid())) < 0) return -1; =20 if (!(logDaemon =3D virLogDaemonNewPostExecRestart(object, @@ -803,7 +803,7 @@ int main(int argc, char **argv) { } =20 /* If we have a pidfile set, claim it now, exiting if already take= n */ - if ((pid_file_fd =3D virPidFileAcquirePath(pid_file, false, getpid= ())) < 0) { + if ((pid_file_fd =3D virPidFileAcquirePath(pid_file, getpid())) < = 0) { ret =3D VIR_DAEMON_ERR_PIDFILE; goto cleanup; } diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c index dd9344168b..4f14187bef 100644 --- a/src/remote/remote_daemon.c +++ b/src/remote/remote_daemon.c @@ -990,7 +990,7 @@ int main(int argc, char **argv) { } =20 /* Try to claim the pidfile, exiting if we can't */ - if ((pid_file_fd =3D virPidFileAcquirePath(pid_file, false, getpid()))= < 0) { + if ((pid_file_fd =3D virPidFileAcquirePath(pid_file, getpid())) < 0) { ret =3D VIR_DAEMON_ERR_PIDFILE; goto cleanup; } diff --git a/src/util/vircommand.c b/src/util/vircommand.c index 0917bc9cfb..1144dfb597 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -828,7 +828,7 @@ virExec(virCommand *cmd) int pidfilefd =3D -1; char c; =20 - pidfilefd =3D virPidFileAcquirePath(cmd->pidfile, false, pid); + pidfilefd =3D virPidFileAcquirePath(cmd->pidfile, pid); if (pidfilefd < 0) goto fork_error; if (virSetInherit(pidfilefd, true) < 0) { diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c index 742531379e..252100cdc3 100644 --- a/src/util/virpidfile.c +++ b/src/util/virpidfile.c @@ -446,10 +446,9 @@ int virPidFileAcquirePathFull(const char *path, =20 =20 int virPidFileAcquirePath(const char *path, - bool waitForLock, pid_t pid) { - return virPidFileAcquirePathFull(path, waitForLock, pid); + return virPidFileAcquirePathFull(path, false, pid); } =20 =20 @@ -465,7 +464,7 @@ int virPidFileAcquire(const char *dir, if (!(pidfile =3D virPidFileBuildPath(dir, name))) return -ENOMEM; =20 - return virPidFileAcquirePath(pidfile, false, pid); + return virPidFileAcquirePath(pidfile, pid); } =20 =20 @@ -566,7 +565,7 @@ virPidFileForceCleanupPathFull(const char *path, bool g= roup) if (virPidFileReadPath(path, &pid) < 0) return -1; =20 - fd =3D virPidFileAcquirePath(path, false, 0); + fd =3D virPidFileAcquirePath(path, 0); if (fd < 0) { virResetLastError(); =20 diff --git a/src/util/virpidfile.h b/src/util/virpidfile.h index 8c70f883be..6db0fb843f 100644 --- a/src/util/virpidfile.h +++ b/src/util/virpidfile.h @@ -60,7 +60,6 @@ int virPidFileAcquirePathFull(const char *path, bool waitForLock, pid_t pid) G_GNUC_WARN_UNUSED_RESULT; int virPidFileAcquirePath(const char *path, - bool waitForLock, pid_t pid) G_GNUC_WARN_UNUSED_RESULT; int virPidFileAcquire(const char *dir, const char *name, --=20 2.39.2 From nobody Sat May 11 02:34:39 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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 170.10.129.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=1678206845; cv=none; d=zohomail.com; s=zohoarc; b=OqSWzXD+LIyLGj/LNQLctGd9LXtMRheT3pXkhAX2p/eFIWjVkYa+r/Ezlqgwb2yLkXZzCMFOe+gIWvAWRw3vCtKhJ7HQ1VhH7/8hcbtqX+AJiK6fk/MDPbuIe2LKX+QJYcMSe4r4nTWzPBsbA2VrVWqHImhsJt/QvMGBhZXkoQA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678206845; 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=SRRlTOMal4/vEIaih2rI0uith7/IBNFZQcDqVkkBc2M=; b=ETT5f4l1L78qqAEPTk974RECoLuQfC1/uQ3cNvN0jxJCdzqv4zoIld0GXpJFE9sBDn2tOjf5H1/MdvrHLPD+c1BcCIy9V7qTnpsn3bIkYtcfAZxVKDf9d/GDpjvLjsTLE0cjXMtf74+2TfZ8dP1HoeayUXeHPglh2Bm4VA3QBH0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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 [170.10.129.124]) by mx.zohomail.com with SMTPS id 1678206845831827.2373207929248; Tue, 7 Mar 2023 08:34:05 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-161-sDx2ZLznPiSzhh4NktICdA-1; Tue, 07 Mar 2023 11:29:53 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8E8481C2C4F4; Tue, 7 Mar 2023 16:16:09 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7586AC16025; Tue, 7 Mar 2023 16:16:09 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 625B419465B8; Tue, 7 Mar 2023 16:16:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id EC12619465B6 for ; Tue, 7 Mar 2023 16:16:06 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id E0AD31401C32; Tue, 7 Mar 2023 16:16:06 +0000 (UTC) Received: from fedora.. (unknown [10.43.2.118]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8957E1402641 for ; Tue, 7 Mar 2023 16:16:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678206843; 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=SRRlTOMal4/vEIaih2rI0uith7/IBNFZQcDqVkkBc2M=; b=d90qTqFSU7Myn4nV0StRXQYI+WVZiivbG13rg0ypnBW40Nz6krXCLse9ucVE6+OsYiijUp VaOC+Mb3kk8Whg3anPRq+A2dBjCGTwdcWYrPeglPwxr5SqlQtt3uvPz2OzCTboxyNNazJD nXfT671HL77iSEj+/x6IDk5qMdYbgbg= X-MC-Unique: sDx2ZLznPiSzhh4NktICdA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 5/6] util: add quiet parameter to virPidFileAcquirePathFull Date: Tue, 7 Mar 2023 17:16:01 +0100 Message-Id: <879d4a7bcb97b4fe84fc3399f8d767f68b285f42.1678205730.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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: 1678206846295100001 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Martin Kletzander --- src/network/leaseshelper.c | 2 +- src/util/virpidfile.c | 51 ++++++++++++++++++++++++-------------- src/util/virpidfile.h | 1 + 3 files changed, 34 insertions(+), 20 deletions(-) diff --git a/src/network/leaseshelper.c b/src/network/leaseshelper.c index b1ce313e6a..9ee42045d9 100644 --- a/src/network/leaseshelper.c +++ b/src/network/leaseshelper.c @@ -159,7 +159,7 @@ main(int argc, char **argv) pid_file =3D g_strdup(RUNSTATEDIR "/leaseshelper.pid"); =20 /* Try to claim the pidfile, exiting if we can't */ - if ((pid_file_fd =3D virPidFileAcquirePathFull(pid_file, true, getpid(= ))) < 0) { + if ((pid_file_fd =3D virPidFileAcquirePathFull(pid_file, true, false, = getpid())) < 0) { fprintf(stderr, _("Unable to acquire PID file: %s\n errno=3D%d"), pid_file, errno); diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c index 252100cdc3..05d19100c6 100644 --- a/src/util/virpidfile.c +++ b/src/util/virpidfile.c @@ -364,6 +364,7 @@ int virPidFileDelete(const char *dir, =20 int virPidFileAcquirePathFull(const char *path, bool waitForLock, + bool quiet, pid_t pid) { int fd =3D -1; @@ -375,32 +376,40 @@ int virPidFileAcquirePathFull(const char *path, while (1) { struct stat a, b; if ((fd =3D open(path, O_WRONLY|O_CREAT, 0644)) < 0) { - virReportSystemError(errno, - _("Failed to open pid file '%s'"), - path); + if (!quiet) { + virReportSystemError(errno, + _("Failed to open pid file '%s'"), + path); + } return -1; } =20 if (virSetCloseExec(fd) < 0) { - virReportSystemError(errno, - _("Failed to set close-on-exec flag '%s'"= ), - path); + if (!quiet) { + virReportSystemError(errno, + _("Failed to set close-on-exec flag '= %s'"), + path); + } VIR_FORCE_CLOSE(fd); return -1; } =20 if (fstat(fd, &b) < 0) { - virReportSystemError(errno, - _("Unable to check status of pid file '%s= '"), - path); + if (!quiet) { + virReportSystemError(errno, + _("Unable to check status of pid file= '%s'"), + path); + } VIR_FORCE_CLOSE(fd); return -1; } =20 if (virFileLock(fd, false, 0, 1, waitForLock) < 0) { - virReportSystemError(errno, - _("Failed to acquire pid file '%s'"), - path); + if (!quiet) { + virReportSystemError(errno, + _("Failed to acquire pid file '%s'"), + path); + } VIR_FORCE_CLOSE(fd); return -1; } @@ -427,17 +436,21 @@ int virPidFileAcquirePathFull(const char *path, g_snprintf(pidstr, sizeof(pidstr), "%lld", (long long) pid); =20 if (ftruncate(fd, 0) < 0) { - virReportSystemError(errno, - _("Failed to truncate pid file '%s'"), - path); + if (!quiet) { + virReportSystemError(errno, + _("Failed to truncate pid file '%s'"), + path); + } VIR_FORCE_CLOSE(fd); return -1; } =20 if (safewrite(fd, pidstr, strlen(pidstr)) < 0) { - virReportSystemError(errno, - _("Failed to write to pid file '%s'"), - path); + if (!quiet) { + virReportSystemError(errno, + _("Failed to write to pid file '%s'"), + path); + } VIR_FORCE_CLOSE(fd); } =20 @@ -448,7 +461,7 @@ int virPidFileAcquirePathFull(const char *path, int virPidFileAcquirePath(const char *path, pid_t pid) { - return virPidFileAcquirePathFull(path, false, pid); + return virPidFileAcquirePathFull(path, false, false, pid); } =20 =20 diff --git a/src/util/virpidfile.h b/src/util/virpidfile.h index 6db0fb843f..5d31f02702 100644 --- a/src/util/virpidfile.h +++ b/src/util/virpidfile.h @@ -58,6 +58,7 @@ int virPidFileDelete(const char *dir, =20 int virPidFileAcquirePathFull(const char *path, bool waitForLock, + bool quiet, pid_t pid) G_GNUC_WARN_UNUSED_RESULT; int virPidFileAcquirePath(const char *path, pid_t pid) G_GNUC_WARN_UNUSED_RESULT; --=20 2.39.2 From nobody Sat May 11 02:34:39 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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 170.10.129.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=1678206628; cv=none; d=zohomail.com; s=zohoarc; b=XudoNMOxk4vckiTrc7Re9Hqg3Qbjebar9QrHdxYZR94LUB+s6jSiANk2BGZ0lZwFKlXTNu8k+xctBKaIJwJHfMx99u5iPQPXPW5fjj33jiQEvJEN6eA1aV8CdkUfHisGca+gfp0xWHTjTSzZTNxDNim5Shc2jL3VEzt+828tGHI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678206628; 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=0d9MiJoTHInDdmq2x/8Q99hU7C5pCaUrztYqn1DhoJQ=; b=ZT9AU+CDs2XuDN68P7XO3Bs2jvS0bEOp0y5224RTv7aKpnVJ6paC9OAW7m9fAc4xXhym3OU55ta1oTwiqvwILFdrSTNCFFPJLVBrDkkbxvur5MwcF9e8vMaP4gvU10cGXMYFb0Hq9B3ye266IjqUYUo3wdVF2Xh9yw+Mgoaw3mI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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 [170.10.129.124]) by mx.zohomail.com with SMTPS id 1678206628041986.0947913241497; Tue, 7 Mar 2023 08:30:28 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-341-wKM-rR2kNvOFuID-K87UjQ-1; Tue, 07 Mar 2023 11:27:38 -0500 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 711A73C0DDB2; Tue, 7 Mar 2023 16:16:09 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5E52A492C3E; Tue, 7 Mar 2023 16:16:09 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 4492119465A8; Tue, 7 Mar 2023 16:16:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 90D921946A43 for ; Tue, 7 Mar 2023 16:16:07 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 7ED3714171C8; Tue, 7 Mar 2023 16:16:07 +0000 (UTC) Received: from fedora.. (unknown [10.43.2.118]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2480214171C3 for ; Tue, 7 Mar 2023 16:16:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678206627; 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=0d9MiJoTHInDdmq2x/8Q99hU7C5pCaUrztYqn1DhoJQ=; b=bI55Pka9//XOissqghOr7iORz488BODvrJGiOs9E4b4AqqJjumA7x455dtbJJBKVq05Id1 15uYUIS7BytANozIm3x14WAIfdaK98y86o2NoQJAIAiNkxMnSPjCbkrnjb8GoBIG+/rnIu ThZ7ii/6gth8ok/katft+OdubYzYw1c= X-MC-Unique: wKM-rR2kNvOFuID-K87UjQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 6/6] util: do not report errors in virPidFileForceCleanupPathFull Date: Tue, 7 Mar 2023 17:16:02 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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: 1678206629484100001 Use the quiet version of virPidFileAcquirePath and remove the error reset, since there's nothing to reset anymore. https://bugzilla.redhat.com/show_bug.cgi?id=3D2171973 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Martin Kletzander --- src/util/virpidfile.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c index 05d19100c6..4693aaaf78 100644 --- a/src/util/virpidfile.c +++ b/src/util/virpidfile.c @@ -578,10 +578,8 @@ virPidFileForceCleanupPathFull(const char *path, bool = group) if (virPidFileReadPath(path, &pid) < 0) return -1; =20 - fd =3D virPidFileAcquirePath(path, 0); + fd =3D virPidFileAcquirePathFull(path, false, true, 0); if (fd < 0) { - virResetLastError(); - if (pid > 1 && group) pid =3D virProcessGroupGet(pid); =20 --=20 2.39.2