Open-file-description lock
An open-file-description lock is a byte-range file lock owned by an open file description rather than by a process.
Linux supports the fcntl F_OFD_* operations from 3.15. Duplicated descriptors share ownership; independent opens can conflict. Automatic release occurs on the last close of that description, unlike traditional process-owned record locks, which a close of any descriptor for the file can release. Explicit unlocking is separate. Although flock() also has open-description ownership on Linux, it is not this byte-range API. [1] In Hesela's local Linux observation, a duplicate could reapply the held lock, closing the initial holder did not release it while the duplicate stayed open, and explicit unlock through the duplicate released it. These are ownership observations, not crash tests. [3]
Relations
- related
- advisory-file-lock, open-file-description, atomic-rename, process-associated-record-lock
Limitations
- Conflicting traditional fcntl and OFD record locks interact, even within one process. [1]
- Hesela exercised nonblocking calls in one Linux process; this does not validate fork inheritance, thread scheduling, network filesystems or other platforms. [3]