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

Fix locking bugs #1400

Merged
merged 2 commits into from
Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion images.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ func (r *imageStore) startWritingWithReload(canReload bool) error {
// startWriting makes sure the store is fresh, and locks it for writing.
// If this succeeds, the caller MUST call stopWriting().
func (r *imageStore) startWriting() error {
return r.startWritingWithReload(false)
return r.startWritingWithReload(true)
}

// stopWriting releases locks obtained by startWriting.
Expand Down
2 changes: 1 addition & 1 deletion layers.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ func (r *layerStore) startWritingWithReload(canReload bool) error {
// startWriting makes sure the store is fresh, and locks it for writing.
// If this succeeds, the caller MUST call stopWriting().
func (r *layerStore) startWriting() error {
return r.startWritingWithReload(false)
return r.startWritingWithReload(true)
}

// stopWriting releases locks obtained by startWriting.
Expand Down
2 changes: 1 addition & 1 deletion store.go
Original file line number Diff line number Diff line change
Expand Up @@ -1445,7 +1445,7 @@ func (s *store) CreateContainer(id string, names []string, image, layer, metadat
if err := store.startReading(); err != nil {
return nil, err
}
store.stopReading()
defer store.stopReading()
}
if err := istore.startWriting(); err != nil {
return nil, err
Expand Down