From: Lennart Poettering <lennart@poettering.net>
To: linux-hotplug@vger.kernel.org
Subject: Re: [PATCH] race between util_create_path() and util_delete_path()?
Date: Sun, 06 Sep 2009 12:41:28 +0000 [thread overview]
Message-ID: <20090906124127.GA7431@tango.0pointer.de> (raw)
In-Reply-To: <20090904192743.GO4363@florz.florz.dyndns.org>
On Sat, 05.09.09 19:11, Florian Zumbiehl (florz@florz.de) wrote:
> > All Unix locking APIs are broken in one way or the other. But if you
> > use one then at least use fcntl(F_SETLK) which is the least broken.
>
> What exactly is broken in flock() (that affects this use)?
The simple fact that fcntl() style locks are the ones that are least
broken and using everything else is confusing since the different lock
styles are independant of each other.
So if you do use locking then use fcntl.
Now, fcntl is broken in many ways. For example it is unusable for
files that are accessible for other users. It is bound to a process
and not to an fd, and hence useless in threads, and in libraries. The
first close() breaks all locks of a process on a file even if it has
more fds open to it.
In this case you might be able to get away with a lot, but still
that leaves that fcntl is POSIX and the least broken and is the only
flavour of locking that should be used these days.
Lennart
--
Lennart Poettering Red Hat, Inc.
lennart [at] poettering [dot] net
http://0pointer.net/lennart/ GnuPG 0x1A015CC4
next prev parent reply other threads:[~2009-09-06 12:41 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-04 19:27 [PATCH] race between util_create_path() and util_delete_path()? Florian Zumbiehl
2009-09-05 8:19 ` Lennart Poettering
2009-09-05 10:28 ` Alan Jenkins
2009-09-05 17:11 ` Florian Zumbiehl
2009-09-06 12:41 ` Lennart Poettering [this message]
2009-09-07 5:15 ` Florian Zumbiehl
2009-09-07 14:34 ` Alan Jenkins
2009-09-07 14:54 ` Alan Jenkins
2009-09-07 17:27 ` Florian Zumbiehl
2009-09-07 19:39 ` Kay Sievers
2009-09-07 20:13 ` Florian Zumbiehl
2009-09-07 20:23 ` Florian Zumbiehl
2009-09-07 20:36 ` Kay Sievers
2009-09-07 20:44 ` Kay Sievers
2009-09-07 21:37 ` Florian Zumbiehl
2009-09-08 12:12 ` Alan Jenkins
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=20090906124127.GA7431@tango.0pointer.de \
--to=lennart@poettering.net \
--cc=linux-hotplug@vger.kernel.org \
/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).