Repository navigation
fix: report a failed release of the state-root lock - #89
Merged
Merged
Conversation
`RootLock.release` ignored a failed `fcntl(F_SETLK, F_UNLCK)` or `flock(LOCK_UN)`, so the caller exited successfully. The Python reference closes both descriptors and then lets the `OSError` out. `release` returns `sys.Error!void` and does the same: both descriptors are closed whatever either lock call returns, and the first error is returned after the second close. `sys.last_errno` is restored to the errno of that first error, so `sys.describe` names the call whose error is returned. The `rootlock` mode of the filesystem parity probe reports a failed release in its status, and the API reference lists `sys.Error` for `release`, the set its signature names.
The case uses `state.lock_ops` to make the `fcntl` release fail, the `flock` release fail, and both fail at once, each with its own errno. It then checks three things. `release` returns the record lock's error first. Neither descriptor stays open. The state root can be locked again. `sys.last_errno` and `sys.describe` must name the errno of the returned error, `.IO` when both fail.
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.
Closes #71.
RootLock.release now returns sys.Error!void, so a failed release of the state-root lock is reported instead of being ignored. A new test checks that a failed lock call comes back as an error.
This changes the public signature: the next zig-common pin bump needs follow-ups in eb-local and eb-staged-rebuild.