Skip to content

Commit

Permalink
podman mount: fix storage/libpod ctr race
Browse files Browse the repository at this point in the history
When we create a container we first create it in the storage then in the
libpod db so there is a tiny window where it is seen as storage ctr but
then by the time we mount it we see it was a libpod container.

Fixes #23637

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
  • Loading branch information
Luap99 committed Aug 16, 2024
1 parent 8c132cc commit 7a7aec3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/domain/infra/abi/containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -1392,7 +1392,11 @@ func (ic *ContainerEngine) ContainerMount(ctx context.Context, nameOrIDs []strin
for _, sctr := range storageCtrs {
mounted, path, err := ic.Libpod.IsStorageContainerMounted(sctr.ID)
if err != nil {
if errors.Is(err, types.ErrContainerUnknown) {
// ErrCtrExists means this is a libpod container, we handle that below.
// This can only happen in a narrow race because we first create the storage
// container and then the libpod container so the StorageContainers() call
// above would need to happen in that interval.
if errors.Is(err, types.ErrContainerUnknown) || errors.Is(err, define.ErrCtrExists) {
continue
}
return nil, err
Expand Down

0 comments on commit 7a7aec3

Please sign in to comment.