Skip to content

Commit

Permalink
storage: use race-free AddNames instead of SetNames
Browse files Browse the repository at this point in the history
Commits from parallel builds using `SetNames` removes `names` from
storage for other builds.

Use race-free atomic `AddNames` to prevent breaking of parallel builds.

Signed-off-by: Aditya R <arajan@redhat.com>
  • Loading branch information
flouthoc committed Feb 24, 2022
1 parent 4508306 commit 1eaae7e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion storage/storage_image.go
Expand Up @@ -1207,7 +1207,7 @@ func (s *storageImageDestination) Commit(ctx context.Context, unparsedToplevel t
if len(oldNames) > 0 {
names = append(names, oldNames...)
}
if err := s.imageRef.transport.store.SetNames(img.ID, names); err != nil {
if err := s.imageRef.transport.store.AddNames(img.ID, names); err != nil {
logrus.Debugf("error setting names %v on image %q: %v", names, img.ID, err)
return errors.Wrapf(err, "setting names %v on image %q", names, img.ID)
}
Expand Down

0 comments on commit 1eaae7e

Please sign in to comment.