POSIX Locking (some pointers for those not already scared)

Andrew Bartlett abartlet at samba.org
Fri Mar 2 03:24:39 UTC 2018


G'Day,

I've been working to understand locking, fork() and tdb as we move
Samba to LMDB.  I had some fears before I realised that an fcntl() lock
is not kept across fork(), so the stupid behaviour on close() doesn't
matter if it is in the child.

It also doesn't matter that tdb_reopen_all() keeps the FD, as while the
file offset is shared (we work around this), the locks are not.

Others may not be aware of the standard rant about POSIX locking,
specifically:

https://www.samba.org/samba/news/articles/low_point/tale_two_stds_os2.html
http://0pointer.de/blog/projects/locking.html
http://0pointer.de/blog/projects/locking2

It is worth a read if you don't mind putting your brain though a
blender.

Thanks,

Andrew Bartlett
-- 
Andrew Bartlett
https://samba.org/~abartlet/
Authentication Developer, Samba Team         https://samba.org
Samba Development and Support, Catalyst IT   
https://catalyst.net.nz/services/samba







More information about the samba-technical mailing list