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

layerStore.Load(): avoid double-locking the mounts list for Save #425

Merged
merged 2 commits into from
Sep 11, 2019

Conversation

nalind
Copy link
Member

@nalind nalind commented Sep 10, 2019

If we need to re-save the layers list when we've loaded it, to either solve a duplicate name issue or to clean up a partially-constructed layer, don't make the mistake of attempting to take another lock on the mounts list.

If we need to re-save the layers list when we've loaded it, to either
solve a duplicate name issue or to clean up a partially-constructed
layer, don't make the mistake of attempting to take another lock on the
mounts list.

Signed-off-by: Nalin Dahyabhai <[email protected]>
Signed-off-by: Nalin Dahyabhai <[email protected]>
@umohnani8
Copy link
Member

LGTM
@rhatdan @mrunalp PTAL

@mrunalp
Copy link
Contributor

mrunalp commented Sep 11, 2019

LGTM

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. Just a suggestion for further optimizations.

r.mountsLockfile.Lock()
defer r.mountsLockfile.Unlock()
defer r.mountsLockfile.Touch()
if err := r.saveLayers(); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

We could move the call to saveLayers() before acquiring the mountsLockfile (i.e., to line 419). It would further shorten the critical section.

@TomSweeneyRedHat
Copy link
Member

LGTM, but one of the tests is having an unrelated lock issue. I'll try restarting.

@rhatdan
Copy link
Member

rhatdan commented Sep 11, 2019

LGTM, and would like to see separate patch with @vrothberg optimization.

@umohnani8
Copy link
Member

@nalind the ubuntu test is failing :/

@vrothberg
Copy link
Member

Same for #426. I vote for force merging.

@umohnani8
Copy link
Member

Force merging since the test is failing on other PRs as well.

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.

6 participants