From 02ef1a90d3e385de02e406e37f48bc1a1bbf81e4 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Fri, 21 Aug 2020 11:08:55 +0200 Subject: [PATCH] counter: check for external umounts if a previously mounted container was unmounted externally (e.g. through conmon cleanup for Podman containers), the ref counter will lose track of it and report it as still mounted. Closes: https://github.com/containers/storage/issues/697 Signed-off-by: Giuseppe Scrivano --- drivers/counter.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/counter.go b/drivers/counter.go index 72551a38d4..3fc45495b2 100644 --- a/drivers/counter.go +++ b/drivers/counter.go @@ -51,6 +51,10 @@ func (c *RefCounter) incdec(path string, infoOp func(minfo *minfo)) int { if c.checker.IsMounted(path) { m.count++ } + } else if !c.checker.IsMounted(path) { + // if the unmount was performed outside of this process (e.g. conmon cleanup) + //the ref counter would lose track of it. Check if it is still mounted. + m.count = 0 } infoOp(m) count := m.count