From nobody Wed May 1 05:51:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1563192010; cv=none; d=zoho.com; s=zohoarc; b=lUVMt9fpeyoj1y/wRe5D0NxAHffuoR09SgEd3aMVJtJpux9xlApLquM8OMMUCiERkEeYI1Hru6F42yMgQT2KZ5+Tou8Wzyooma473PhJ5G2+2rWIIC5z/XXi/Fsf6nQaZFvg80FW8BEiY309FZ6fnFGGSfmIVmf7c9CviVDwbD0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563192010; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=lJMe8A9jy28b8bjk1WZCvXfwOfxznuBeZIhRKguTjbI=; b=EOpVfO0z1lganB1nT5UEHatjRANhvshd+0P95idOVHuvvjc2inrt6DaqMBzyIesoDFTF40pMAnhIwwOKk8dig6M8kCU8EaGvILNSvJR8lfXUAOQfVZAsC+/zV4FrSibU2WEIT96Mfxs8WU3Wc3l2eMwS4rmBgOkoPIeGfgGd9cY= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1563192010901316.3354641189271; Mon, 15 Jul 2019 05:00:10 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D30BCC01F28C; Mon, 15 Jul 2019 12:00:05 +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 6183A5C57D; Mon, 15 Jul 2019 12:00:05 +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 DE0A8C842; Mon, 15 Jul 2019 12:00:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6FC01k0012818 for ; Mon, 15 Jul 2019 08:00:01 -0400 Received: by smtp.corp.redhat.com (Postfix) id A32191001DC5; Mon, 15 Jul 2019 12:00:01 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-60.ams2.redhat.com [10.36.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 982E11001DC8; Mon, 15 Jul 2019 11:59:56 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Mon, 15 Jul 2019 12:59:52 +0100 Message-Id: <20190715115952.6223-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] all: don't wait for driver lock during startup 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 15 Jul 2019 12:00:07 +0000 (UTC) When the drivers acquire their pidfile lock we don't want to wait if the lock is already held. We need the driver to immediately report error, causing the daemon to exit. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Erik Skultety --- 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/leaseshelper.c | 2 +- src/node_device/node_device_hal.c | 2 +- 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/vz/vz_driver.c | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index cfcf4e1fba..5387ac5570 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -1280,7 +1280,7 @@ bhyveStateInitialize(bool privileged, } =20 if ((bhyve_driver->lockFD =3D - virPidFileAcquire(BHYVE_STATE_DIR, "driver", true, getpid())) < 0) + virPidFileAcquire(BHYVE_STATE_DIR, "driver", false, 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 868e49c56e..f575768c4c 100644 --- a/src/interface/interface_backend_netcf.c +++ b/src/interface/interface_backend_netcf.c @@ -120,7 +120,7 @@ netcfStateInitialize(bool privileged, } =20 if ((driver->lockFD =3D - virPidFileAcquire(driver->stateDir, "driver", true, getpid())) < = 0) + virPidFileAcquire(driver->stateDir, "driver", false, 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 fcd7f1c04a..2feaeb95b7 100644 --- a/src/interface/interface_backend_udev.c +++ b/src/interface/interface_backend_udev.c @@ -1199,7 +1199,7 @@ udevStateInitialize(bool privileged, } =20 if ((driver->lockFD =3D - virPidFileAcquire(driver->stateDir, "driver", true, getpid())) < = 0) + virPidFileAcquire(driver->stateDir, "driver", false, 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 a99c7471bb..492028c487 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -747,7 +747,7 @@ libxlStateInitialize(bool privileged, } =20 if ((libxl_driver->lockFD =3D - virPidFileAcquire(cfg->stateDir, "driver", true, getpid())) < 0) + virPidFileAcquire(cfg->stateDir, "driver", false, 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 3982c24f34..d0b6703101 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -1607,7 +1607,7 @@ static int lxcStateInitialize(bool privileged, } =20 if ((lxc_driver->lockFD =3D - virPidFileAcquire(cfg->stateDir, "driver", true, getpid())) < 0) + virPidFileAcquire(cfg->stateDir, "driver", false, getpid())) < 0) goto cleanup; =20 /* Get all the running persistent or transient configs first */ diff --git a/src/network/leaseshelper.c b/src/network/leaseshelper.c index 89d9a003e2..2a10fbf33a 100644 --- a/src/network/leaseshelper.c +++ b/src/network/leaseshelper.c @@ -164,7 +164,7 @@ main(int argc, char **argv) goto cleanup; =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 virPidFileAcquirePath(pid_file, false, getpid()))= < 0) goto cleanup; =20 /* Since interfaces can be hot plugged, we need to make sure that the diff --git a/src/node_device/node_device_hal.c b/src/node_device/node_devic= e_hal.c index 1920f4566e..1f3f867599 100644 --- a/src/node_device/node_device_hal.c +++ b/src/node_device/node_device_hal.c @@ -637,7 +637,7 @@ nodeStateInitialize(bool privileged ATTRIBUTE_UNUSED, } =20 if ((driver->lockFD =3D - virPidFileAcquire(driver->stateDir, "driver", true, getpid())) < = 0) + virPidFileAcquire(driver->stateDir, "driver", false, getpid())) <= 0) goto failure; =20 if (!(driver->devs =3D virNodeDeviceObjListNew())) diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_devi= ce_udev.c index d883462948..8bc63c506c 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -1848,7 +1848,7 @@ nodeStateInitialize(bool privileged, } =20 if ((driver->lockFD =3D - virPidFileAcquire(driver->stateDir, "driver", true, getpid())) < = 0) + virPidFileAcquire(driver->stateDir, "driver", false, 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 43561241f6..530e4f5872 100644 --- a/src/nwfilter/nwfilter_driver.c +++ b/src/nwfilter/nwfilter_driver.c @@ -215,7 +215,7 @@ nwfilterStateInitialize(bool privileged, } =20 if ((driver->lockFD =3D - virPidFileAcquire(driver->stateDir, "driver", true, getpid())) < = 0) + virPidFileAcquire(driver->stateDir, "driver", false, getpid())) <= 0) goto error; =20 if (virNWFilterIPAddrMapInit() < 0) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index fc0d12c335..d3a144aabd 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -677,7 +677,7 @@ qemuStateInitialize(bool privileged, } =20 if ((qemu_driver->lockFD =3D - virPidFileAcquire(cfg->stateDir, "driver", true, getpid())) < 0) + virPidFileAcquire(cfg->stateDir, "driver", false, 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 9344948db4..0af2bcef96 100644 --- a/src/secret/secret_driver.c +++ b/src/secret/secret_driver.c @@ -504,7 +504,7 @@ secretStateInitialize(bool privileged, } =20 if ((driver->lockFD =3D - virPidFileAcquire(driver->stateDir, "driver", true, getpid())) < = 0) + virPidFileAcquire(driver->stateDir, "driver", false, getpid())) <= 0) goto error; =20 if (!(driver->secrets =3D virSecretObjListNew())) diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c index 75430fb0d9..f5d05a7f43 100644 --- a/src/vz/vz_driver.c +++ b/src/vz/vz_driver.c @@ -4129,7 +4129,7 @@ vzStateInitialize(bool privileged, } =20 if ((vz_driver_lock_fd =3D - virPidFileAcquire(VZ_STATEDIR, "driver", true, getpid())) < 0) + virPidFileAcquire(VZ_STATEDIR, "driver", false, getpid())) < 0) return -1; =20 if (prlsdkInit() < 0) { --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list