From 6d19ecadc869753aaf7875914a3f6e855b97c31b Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Thu, 9 Dec 2021 16:48:44 +0100 Subject: 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 --- libpod/util.go | 1 + 1 file changed, 1 insertion(+) (limited to 'libpod/util.go') 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 -- cgit v1.2.3-54-g00ecf