]> git.ipfire.org Git - thirdparty/libvirt.git/commit
leaseshelper: Wait to acquire PID file
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 11 Jun 2020 14:43:22 +0000 (16:43 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 24 Jun 2020 14:08:03 +0000 (16:08 +0200)
commit876211ef4a192df1603b45715044ec14567d7e9f
tree04e7862bd7ec8b8f829d37fdafdbfa033594eaa7
parent5331c4804f4f419b9e75741084f926e52413d3a1
leaseshelper: Wait to acquire PID file

On a DHCP transaction, dnsmasq runs our leases helper which
updates corresponding JSON files. While one dnsmasq won't run the
leaseshelper in parallel, two dnsmasqs (from two distinct
networks) might. To avoid corrupting JSON file, the leaseshelper
acquires PID file first. Well, the way it's acquiring it is not
ideal - it calls virPidFileAcquirePath(wait = false); which
means, that either it acquires the PID file instantly or returns
an error and does not touch the JSON at all. This in turn means
that there might be a leases record missing. With wait = true,
this won't happen.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1840307

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
src/network/leaseshelper.c