Repository navigation
linux: Add open file descriptor locks - #1731
Open
alexlarsson wants to merge 1 commit into
Open
alexlarsson wants to merge 1 commit into
alexlarsson wants to merge 1 commit into
Conversation
This adds support for fnctl locks using F_OFD_SETLK/F_OFD_GETLK. These are linux-only fcntls similar to (and compatible with) normal fcntl locks but thy have nicer semantics relative to fd closing. Signed-off-by: Alexander Larsson <alexl@redhat.com>
Author
|
Not sure why the mac CI run was cancelled. But it should not be affected by this change. |
alexlarsson
added a commit
to composefs/composefs-rs
that referenced
this pull request
Nov 9, 2026
containers/storage uses POSIX fcntl record locks, not flock. Use Linux open-file-description locks, which conflict with those record locks but retain independent guard lifetimes when other descriptors for the same inode close. NOTE: This uses libc to access this, because rustix doesn't support it. Upstream MR to add it: bytecodealliance/rustix#1731 Assisted-by: AI Signed-off-by: Alexander Larsson <alexl@redhat.com>
cgwalters
reviewed
Nov 9, 2026
cgwalters
left a comment
Contributor
There was a problem hiding this comment.
I only superficially skimmed this, but looks sane
| fcntl_lock_impl(fd, operation, c::F_OFD_SETLK, c::F_OFD_SETLKW) | ||
| } | ||
|
|
||
| #[cfg(not(any( |
Contributor
There was a problem hiding this comment.
Aren't OFD locks Linux specific?
EDIT: Sorry I see this is just a generic helper.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds support for fnctl locks using F_OFD_SETLK/F_OFD_GETLK. These are linux-only fcntls similar to (and compatible with) normal fcntl locks but thy have nicer semantics relative to fd closing.