Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More small locking fixes #1430

Merged
merged 6 commits into from
Nov 14, 2022

Conversation

mtrmac
Copy link
Collaborator

@mtrmac mtrmac commented Nov 12, 2022

  • Don’t write to BigDataDigests and BigDataSizes in methods that only have a read lock — either avoid that, or use a write lock
  • Stop using type checks to see if an image store is primary, or read-write; it just doesn’t work like that.

*Grumble* I’m getting increasingly desperate for #1389 . Staring at locking code trying to not make a mistake feels like writing C memory allocation code manually — however good a human can get at it, machines do it faster, and they never get tired or inattentive.

This could, hypothetically, make the functions readers that are safe
to use concurrently with other readers.

Well, except for the SetBigData call...

So it's just a microoptimization.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
It requires a WRITE lock.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
It requires a WRITE lock.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This makes the functions pure readers that can be used concurrently
with other readers.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Move the createMappedLayer logic completely inside this
function, to make it self-contained.

Passing the rwImageStore will remove the need for a cast
and clarify the logic.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
They don't, as the code assumes, test whether the store
is writable; they return true for read-only stores as well.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Copy link
Member

@rhatdan rhatdan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vrothberg vrothberg merged commit ec1968e into containers:main Nov 14, 2022
@mtrmac mtrmac deleted the locking-fixes-will-this-ever-end branch November 14, 2022 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants