On Sun, 16 Feb 2014 03:27:05 -0500 Mike Frysinger <vapier@xxxxxxxxxx> wrote: > On Tuesday, February 11, 2014 14:03:54 Jeff Layton wrote: > > I've been working on a set of patches to add a new type file record lock > > to the Linux kernel that have less troublesome semantics on close and > > that are usable by threaded applications. > > > > I have a blog post here with more details: > > > > > > http://jtlayton.wordpress.com/2014/01/07/file-private-posix-locks-aka-un-po > > six-locks/ > > > > ...and the latest kernel patchset is here: > > > > https://lkml.org/lkml/2014/1/14/554 > > > > This patchset represents a set of corresponding updates for glibc. It > > just adds the new cmd values to fcntl.h, and a manual update that > > discusses how to use the new locks. > > > > I'm currently shooting for a merge in v3.15 kernel so I'm posting this > > as an RFC for now. > > disclaimer: haven't read the kernel patches. just the patch summary and your > blog post. > > looks like the new API manipulates the existing POSIX lock only -- flock based > locks are still parallel. too crazy to have the new API grab both since > you're bringing proper semantics that cover both ? > Correct, at least in the Linux implementation. The basic idea is that these *are* POSIX locks, they just have different behavior wrt inheritance and on close. We should note that on BSD, flock() and fcntl() based locks do conflict. If they end up implementing file-private locks on BSD, then they may also conflict with flock() locks just like classic POSIX locks do there. > a good summary of Linux locking from the perspective of userspace was posted > here sometime ago: > http://0pointer.de/blog/projects/locking.html > random notes/limitations/bugs are also in the various man pages like fcntl(2) > would be nice if we could cover as many known limitations as possible with the > new api so as to not need yet another in the future ;) > -mike Yep, I've seen Lennart's summary. I think that the only thing this doesn't approach doesn't address is his comment about using locks on world-readable files. I don't see that there's much we can do about that. -- Jeff Layton <jlayton@xxxxxxxxxx>
Attachment:
signature.asc
Description: PGP signature