Skip to content

Commit 2f468e6

Browse files
committed
Remove path from counter when count becomes <= 0
Upstream already behaves this way and it isn't merely an aesthetic change. Doing this fixes an issue where count can become -1 when a new daemon instance attempts to unmount the container base dir, with the later not being actually mounted. The most common action leading to this scenario is an unorderly restart of the server running docker. After count becomes -1, a combination of "docker start" + "docker restart" will lead to a situation in which the mountpoint is not visible from the global namespace, and attempts to run new processes in the container will fail with an error like this one: error: code = 2 desc = oci runtime error: exec failed: container_linux.go:247: starting container process caused "process_linux.go:75: starting setns process caused \"fork/exec /proc/self/exe: no such file or directory\"" Signed-off-by: Sergio Lopez <slp@redhat.com>
1 parent 9e82212 commit 2f468e6

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

daemon/graphdriver/counter.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ func (c *RefCounter) Decrement(path string) int {
6262
}
6363
}
6464
m.count--
65+
count := m.count
66+
if count <= 0 {
67+
delete(c.counts, path)
68+
}
6569
c.mu.Unlock()
6670
return m.count
6771
}

0 commit comments

Comments
 (0)