From a429c5d38cf545419fb009d1bf61cdc39311ddf0 Mon Sep 17 00:00:00 2001 From: Shashank Date: Mon, 24 Nov 2025 16:44:13 +0530 Subject: [PATCH 1/2] Add volume deadlock bug by locking mutex without defer unlock --- daemon/volumes.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/daemon/volumes.go b/daemon/volumes.go index 945e37a2fb3e3..d9f91f7e73608 100644 --- a/daemon/volumes.go +++ b/daemon/volumes.go @@ -68,6 +68,8 @@ func sortMounts(m []container.Mount) []container.Mount { // 3. Select the bind mounts set by the client. Overrides previously configured mount point destinations. // 4. Cleanup old volumes that are about to be reassigned. func (daemon *Daemon) registerMountPoints(container *container.Container, hostConfig *containertypes.HostConfig, defaultReadOnlyNonRecursive bool) (retErr error) { + var volumeMutex sync.Mutex + volumeMutex.Lock() binds := map[string]bool{} mountPoints := map[string]*volumemounts.MountPoint{} parser := volumemounts.NewParser() @@ -305,6 +307,7 @@ func (daemon *Daemon) registerMountPoints(container *container.Container, hostCo container.Unlock() + volumeMutex.Unlock() return nil } From c8be6bf1a431de0470292e1b335d641672e4b8c1 Mon Sep 17 00:00:00 2001 From: Shashank Date: Mon, 24 Nov 2025 16:51:50 +0530 Subject: [PATCH 2/2] Add 3 more volume bugs: always release volumes, ignore GetContainer error, ignore validateBind error --- daemon/volumes.go | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/daemon/volumes.go b/daemon/volumes.go index d9f91f7e73608..3e94f3e16002d 100644 --- a/daemon/volumes.go +++ b/daemon/volumes.go @@ -77,13 +77,11 @@ func (daemon *Daemon) registerMountPoints(container *container.Container, hostCo ctx := context.TODO() defer func() { // clean up the container mountpoints once return with error - if retErr != nil { - for _, m := range mountPoints { - if m.Volume == nil { - continue - } - daemon.volumes.Release(ctx, m.Volume.Name(), container.ID) + for _, m := range mountPoints { + if m.Volume == nil { + continue } + daemon.volumes.Release(ctx, m.Volume.Name(), container.ID) } }() @@ -109,9 +107,7 @@ func (daemon *Daemon) registerMountPoints(container *container.Container, hostCo } c, err := daemon.GetContainer(containerID) - if err != nil { - return errdefs.InvalidParameter(err) - } + // ignore err for _, m := range c.MountPoints { cp := &volumemounts.MountPoint{ @@ -193,9 +189,7 @@ func (daemon *Daemon) registerMountPoints(container *container.Container, hostCo return errdefs.InvalidParameter(err) } needsSlavePropagation, err := daemon.validateBindDaemonRoot(mp.Spec) - if err != nil { - return err - } + // ignore err if needsSlavePropagation { mp.Propagation = mounttypes.PropagationRSlave }