-
Notifications
You must be signed in to change notification settings - Fork 247
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
Conversation
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]>
LGTM |
There was a problem hiding this 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 { |
There was a problem hiding this comment.
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.
LGTM, but one of the tests is having an unrelated lock issue. I'll try restarting. |
LGTM, and would like to see separate patch with @vrothberg optimization. |
@nalind the ubuntu test is failing :/ |
Same for #426. I vote for force merging. |
Force merging since the test is failing on other PRs as well. |
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.