summaryrefslogtreecommitdiff
path: root/libpod/util.go
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2021-12-09 16:48:44 +0100
committerValentin Rothberg <rothberg@redhat.com>2021-12-09 17:06:21 +0100
commit6d19ecadc869753aaf7875914a3f6e855b97c31b (patch)
tree6849a5fbfb58450822aaa2ec42d1c94af0508b4b /libpod/util.go
parent4a52a457d1e33a4817e4ce1dca390ba942eaec44 (diff)
downloadpodman-6d19ecadc869753aaf7875914a3f6e855b97c31b.tar.gz
podman-6d19ecadc869753aaf7875914a3f6e855b97c31b.tar.bz2
podman-6d19ecadc869753aaf7875914a3f6e855b97c31b.zip
inotify: make sure to remove files
Issue #11825 suggests that *rootless* Podman can run into situations where too many inotify fds are open. Indeed, rootless Podman has a slightly higher usage of inotify watchers than the root counterpart when using slirp4netns Make sure to not only close all watchers but to also remove the files from being watched. Otherwise, the fds only get closed when the files are removed. [NO NEW TESTS NEEDED] since we don't have a way to test it. Fixes: #11825 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'libpod/util.go')
-rw-r--r--libpod/util.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/libpod/util.go b/libpod/util.go
index 5154a261e..e89c6faaa 100644
--- a/libpod/util.go
+++ b/libpod/util.go
@@ -56,6 +56,7 @@ func WaitForFile(path string, chWait chan error, timeout time.Duration) (bool, e
inotifyEvents = watcher.Events
}
defer watcher.Close()
+ defer watcher.Remove(filepath.Dir(path))
}
var timeoutChan <-chan time.Time