qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: qemu-trivial@nongnu.org, Laszlo Ersek <lersek@redhat.com>,
	qemu-devel@nongnu.org
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	[thread overview]
Message-ID: <20120127102606.GC6522@redhat.com> (raw)
In-Reply-To: <20120127063639.GA22748@stefanha-thinkpad.localdomain>

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 <lersek@redhat.com>
> > ---
> 
> 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 :|

  parent reply	other threads:[~2012-01-27 10:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-26 21:36 [Qemu-devel] [PATCH] keep the PID file locked for the lifetime of the process Laszlo Ersek
2012-01-27  6:36 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
2012-01-27  8:56   ` Laszlo Ersek
2012-01-27 10:26   ` Daniel P. Berrange [this message]
2012-01-27 13:17 ` [Qemu-devel] " Markus Armbruster
2012-01-27 13:34   ` [Qemu-devel] [PATCH v2] " Laszlo Ersek
2012-01-27 14:48     ` Markus Armbruster
2012-02-03 17:21     ` Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120127102606.GC6522@redhat.com \
    --to=berrange@redhat.com \
    --cc=lersek@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=stefanha@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).