fanotify for flock release
Hi Jan and Amir, (cc Christian)
There has been a wish from systemd to be able to be notified on flock(2) releases.[1] I've been looking at the locks.c code (I really wish requests were decoupled from locks... :) ) and the fanotify code, and this seems to be a rather straightforward expansion of existing fanotify functionality. Before sending a patch up, are there any objections to this? If we implement this should we also do POSIX locks notifications? And what about lock taking?
Best,
Jori.
Quoted 8 lines · Jori Koolstra
Hi Jan and Amir, (cc Christian)
There has been a wish from systemd to be able to be notified on flock(2) releases.[1] I've been looking at the
locks.ccode (I really wish requests were decoupled from locks... :) ) and the fanotify code, and this seems to be a rather straightforward expansion of existing fanotify functionality. Before sending a patch up, are there any objections to this? If we implement this should we also do POSIX locks notifications? And what about lock taking?
Random comment: any sort of feature like this probably has to interact really weirdly with remote filesystems that do non-trivial things for their flocking. Like NFS, ceph, 9pfs, etc.
I'm definitely not saying that this is a blocker for the functionality, but it is worth keeping in mind that any sort of expectation from userspace will be met with inconsistency across filesystems.
There's also another gotcha when it comes to block devices I think. systemd wants to be notified of block device locking, but block devices also have their own innate way of locking other users out (by O_EXCL). I don't know if this is worth considering for systemd and other potential users of this.
Signature · 1 line
Pedro
Quoted 2 lines · Jori Koolstra
Hi Jan and Amir, (cc Christian)
cc Jeff Layton
Quoted 7 lines
There has been a wish from systemd to be able to be notified on flock(2) releases.[1] I've been looking at the
locks.ccode (I really wish requests were decoupled from locks... :) ) and the fanotify code, and this seems to be a rather straightforward expansion of existing fanotify functionality. Before sending a patch up, are there any objections to this? If we implement this should we also do POSIX locks notifications? And what about lock taking?
An event on funlock is very specific.
Maybe if you can come up with some more generic semantics.
TBH it feels like functionality that could be added to flock() - waiting for resources to be available without actually taking the lock. Sounds like something that would be easy to implement, but arguing over UAPI is never ending fun...
Thanks,
Amir.
Quoted 13 lines · Amir Goldstein
Quoted 2 lines · Jori Koolstra
Hi Jan and Amir, (cc Christian)
cc Jeff Layton
Quoted 7 lines
There has been a wish from systemd to be able to be notified on flock(2) releases.[1] I've been looking at the
locks.ccode (I really wish requests were decoupled from locks... :) ) and the fanotify code, and this seems to be a rather straightforward expansion of existing fanotify functionality. Before sending a patch up, are there any objections to this? If we implement this should we also do POSIX locks notifications? And what about lock taking?
Quoted 8 lines
An event on funlock is very specific.
Maybe if you can come up with some more generic semantics.TBH it feels like functionality that could be added to
flock()- waiting for resources to be available without actually taking the lock. Sounds like something that would be easy to implement, but arguing over UAPI is never ending fun...
I've no objection to Jori's idea in principle, but I'd also ask:
Why release and not also lock acquisition? Also, why only flock() and not POSIX locks? Would leases or layouts also be interesting?
I don't really understand the use-case though, so I'm not sure what to suggest as far as a uAPI or backend implementation.
Signature · 1 line
Jeff Layton <[email protected]>