This repository was archived by the owner on Nov 19, 2026. It is now read-only.
Repository navigation
API break: Remove Lockfile.Locked - #1399
Merged
Merged
Conversation
mtrmac
added a commit
to mtrmac/buildah
that referenced
this pull request
Oct 18, 2022
Signed-off-by: Miloslav Trmač <[email protected]>
Collaborator
Author
|
This should very slightly improve efficiency because we no longer take the lock’s state mutex to determine if we can write to the store. |
mtrmac
added a commit
to mtrmac/buildah
that referenced
this pull request
Oct 19, 2022
Signed-off-by: Miloslav Trmač <[email protected]>
mtrmac
added a commit
to mtrmac/buildah
that referenced
this pull request
Oct 19, 2022
Signed-off-by: Miloslav Trmač <[email protected]>
tyler92
reviewed
Oct 19, 2022
| if needSave { | ||
| if !lockedForWriting { | ||
| // Eventually, the callers should be modified to retry with a write lock, instead. | ||
| return errors.New("container store is inconsistent and the current caller does not hold a write lock") |
Contributor
There was a problem hiding this comment.
How can callers know when they need to try again? I mean how to distinguish this error (which requires retry) from any other? I see ErrDuplicateImageNames in layerStore.Load()
Collaborator
Author
There was a problem hiding this comment.
They can’t, currently.
I plan to add that (“try again”, instead of callers hard-coding specific error values) both to load and the callers simultaneously.
Collaborator
Author
mtrmac
marked this pull request as draft
October 19, 2022 21:16
mtrmac
added a commit
to mtrmac/buildah
that referenced
this pull request
Oct 19, 2022
Signed-off-by: Miloslav Trmač <[email protected]>
mtrmac
added a commit
to mtrmac/libpod
that referenced
this pull request
Oct 19, 2022
DO NOT MERGE: Vendor podman-container-tools/buildah#4350 Remove uses of Lockfile.Locked(): One of them is entirely unnecessary, and the other one is avoidable. [NO NEW TESTS NEEDED] Signed-off-by: Miloslav Trmač <[email protected]>
mtrmac
added a commit
to mtrmac/buildah
that referenced
this pull request
Oct 20, 2022
Signed-off-by: Miloslav Trmač <[email protected]>
Collaborator
Author
|
Buildah tests succeeded; Podman failures seem unrelated. |
mtrmac
marked this pull request as ready for review
October 20, 2022 18:03
This will replace Lockfile.Locked for the sanity-checking purposes. It is, just like Locked never was, NOT a way for a caller to check the current state. Hence the panic() instead of an error return. Signed-off-by: Miloslav Trmač <[email protected]>
.Locked() will be going away. These are just smoke-tests, so use the .Assert* methods (which are not usable with other concurrent users). The AssertLockedForWriting() tests probably don't work on Windows, but that was the case previously as well. Signed-off-by: Miloslav Trmač <[email protected]>
Instead, have the callers of ReloadIfChanged provide the locking state. Signed-off-by: Miloslav Trmač <[email protected]>
Instead, have the callers of ReloadIfChanged provide the locking state. Signed-off-by: Miloslav Trmač <[email protected]>
Instead, have the callers of ReloadIfChanged provide the locking state. Signed-off-by: Miloslav Trmač <[email protected]>
It is fundamentally incorrect, and no users are remaining. Signed-off-by: Miloslav Trmač <[email protected]>
mtrmac
added a commit
to mtrmac/buildah
that referenced
this pull request
Oct 21, 2022
Signed-off-by: Miloslav Trmač <[email protected]>
Member
This was referenced Nov 1, 2022
This was referenced Jan 2, 2023
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
As detailed in #1388,
Lockfile.Locked()does not return the right values if there are multiple users of the same lock within a single process.So, replace the users by callers correctly tracking locking state; and add
LockFile.AssertLockedandLockfile.AssertLockedForWritingpurely for diagnostic purposes. These functions can trigger a panic in clearly invalid situations, but can’t be used by callers to avoid tracking state correctly. That’s a bit risky, so I’ll at least trigger Buildah and Podman CI runs with this changeFollowing the precedent of #1376 , this removes the
Lockedmethod, breaking API of c/storage.See individual commit messages for details.
Fixes #1388 (and makes another small step towards fixing #1136; the relevant places are now annotated).