[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [Qemu-trivial] [PATCH] keep the PID file locked for the
From: |
Daniel P. Berrange |
Subject: |
Re: [Qemu-devel] [Qemu-trivial] [PATCH] keep the PID file locked for the lifetime of the process |
Date: |
Fri, 27 Jan 2012 10:26:06 +0000 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Fri, Jan 27, 2012 at 06:36:39AM +0000, Stefan Hajnoczi wrote:
> On Thu, Jan 26, 2012 at 10:36:41PM +0100, Laszlo Ersek wrote:
> > The lockf() call in qemu_create_pidfile() aims at ensuring mutual
> > exclusion. We shouldn't close the pidfile on success, because that drops
> > the lock as well [1]:
> >
> > "File locks shall be released on first close by the locking process
> > of any file descriptor for the file."
> >
> > Coverity may complain again about the leaked file descriptor; let's
> > worry about that later.
> >
> > [1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/lockf.html
> >
> > Signed-off-by: Laszlo Ersek <address@hidden>
> > ---
>
> Isn't the normal way to do pidfiles O_CREAT | O_EXCL? It may not work
> on all NFS versions but putting the pidfile on NFS doesn't really make
> sense.
>
> Then we can drop the lockf(3) completely.
IMHO it is preferable to use lockf because that makes sure you are crash
safe, so you don't get later bogus startup failures due to stale pidfiles
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|