Skip to content

Commit

Permalink
lxd/image: Acquire image lock for uploaded images
Browse files Browse the repository at this point in the history
Fixes canonical#13855

This needs to happen late in the upload process because we need to verify
the uploaded image's fingerprint before acquiring a lock.

Signed-off-by: Wesley Hershberger <[email protected]>
  • Loading branch information
MggMuggins committed Sep 16, 2024
1 parent 6923a6c commit 42e58e1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lxd/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,13 @@ func getImgPostInfo(s *state.State, r *http.Request, builddir string, project st
return nil, err
}

unlock, err := imageOperationLock(info.Fingerprint)
if err != nil {
return nil, err
}

defer unlock()

imageMeta, imageType, err := getImageMetadata(imageTmpFilename)
if err != nil {
l.Error("Failed to get image metadata", logger.Ctx{"err": err})
Expand Down

0 comments on commit 42e58e1

Please sign in to comment.