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é <berrange(a)redhat.com>
---
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,
}
if ((bhyve_driver->lockFD =
- virPidFileAcquire(BHYVE_STATE_DIR, "driver", true, getpid())) < 0)
+ virPidFileAcquire(BHYVE_STATE_DIR, "driver", false, getpid())) <
0)
goto cleanup;
if (virDomainObjListLoadAllConfigs(bhyve_driver->domains,
diff --git a/src/interface/interface_backend_netcf.c
b/src/interface/interface_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,
}
if ((driver->lockFD =
- virPidFileAcquire(driver->stateDir, "driver", true, getpid())) <
0)
+ virPidFileAcquire(driver->stateDir, "driver", false, getpid()))
< 0)
goto error;
/* open netcf */
diff --git a/src/interface/interface_backend_udev.c
b/src/interface/interface_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,
}
if ((driver->lockFD =
- virPidFileAcquire(driver->stateDir, "driver", true, getpid())) <
0)
+ virPidFileAcquire(driver->stateDir, "driver", false, getpid()))
< 0)
goto cleanup;
driver->udev = 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,
}
if ((libxl_driver->lockFD =
- virPidFileAcquire(cfg->stateDir, "driver", true, getpid())) <
0)
+ virPidFileAcquire(cfg->stateDir, "driver", false, getpid())) <
0)
goto error;
if (!(libxl_driver->lockManager =
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,
}
if ((lxc_driver->lockFD =
- virPidFileAcquire(cfg->stateDir, "driver", true, getpid())) <
0)
+ virPidFileAcquire(cfg->stateDir, "driver", false, getpid())) <
0)
goto cleanup;
/* 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;
/* Try to claim the pidfile, exiting if we can't */
- if ((pid_file_fd = virPidFileAcquirePath(pid_file, true, getpid())) < 0)
+ if ((pid_file_fd = virPidFileAcquirePath(pid_file, false, getpid())) < 0)
goto cleanup;
/* 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_device_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,
}
if ((driver->lockFD =
- virPidFileAcquire(driver->stateDir, "driver", true, getpid())) <
0)
+ virPidFileAcquire(driver->stateDir, "driver", false, getpid()))
< 0)
goto failure;
if (!(driver->devs = virNodeDeviceObjListNew()))
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_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,
}
if ((driver->lockFD =
- virPidFileAcquire(driver->stateDir, "driver", true, getpid())) <
0)
+ virPidFileAcquire(driver->stateDir, "driver", false, getpid()))
< 0)
goto cleanup;
if (!(driver->devs = 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,
}
if ((driver->lockFD =
- virPidFileAcquire(driver->stateDir, "driver", true, getpid())) <
0)
+ virPidFileAcquire(driver->stateDir, "driver", false, getpid()))
< 0)
goto error;
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,
}
if ((qemu_driver->lockFD =
- virPidFileAcquire(cfg->stateDir, "driver", true, getpid())) <
0)
+ virPidFileAcquire(cfg->stateDir, "driver", false, getpid())) <
0)
goto error;
qemu_driver->qemuImgBinary = 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,
}
if ((driver->lockFD =
- virPidFileAcquire(driver->stateDir, "driver", true, getpid())) <
0)
+ virPidFileAcquire(driver->stateDir, "driver", false, getpid()))
< 0)
goto error;
if (!(driver->secrets = 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,
}
if ((vz_driver_lock_fd =
- virPidFileAcquire(VZ_STATEDIR, "driver", true, getpid())) < 0)
+ virPidFileAcquire(VZ_STATEDIR, "driver", false, getpid())) < 0)
return -1;
if (prlsdkInit() < 0) {
--
2.21.0