diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2024-02-15 23:24:32 +0100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2024-02-16 08:47:14 +0100 |
commit | 8f3f8e190c43fc6a3adc7912aaa262e86f9d0748 (patch) | |
tree | 52538ea8bd1e6d89062a2eaeaeaeb405c734433d /passt.h | |
parent | f57a2fb4d5ee8728d92250fc6eb45ffeab221990 (diff) | |
download | passt-8f3f8e190c43fc6a3adc7912aaa262e86f9d0748.tar passt-8f3f8e190c43fc6a3adc7912aaa262e86f9d0748.tar.gz passt-8f3f8e190c43fc6a3adc7912aaa262e86f9d0748.tar.bz2 passt-8f3f8e190c43fc6a3adc7912aaa262e86f9d0748.tar.lz passt-8f3f8e190c43fc6a3adc7912aaa262e86f9d0748.tar.xz passt-8f3f8e190c43fc6a3adc7912aaa262e86f9d0748.tar.zst passt-8f3f8e190c43fc6a3adc7912aaa262e86f9d0748.zip |
pasta: Add fallback timer mechanism to check if namespace is gone
We don't know how frequently this happens, but hitting
fs.inotify.max_user_watches or similar sysctl limits is definitely
not out of question, and Paul mentioned that, for example, Podman's
CI environments hit similar issues in the past.
Introduce a fallback mechanism based on a timer file descriptor: we
grab the directory handle at startup, and we can then use openat(),
triggered periodically, to check if the (network) namespace directory
still exists. If openat() fails at some point, exit.
Link: https://github.com/containers/podman/pull/21563#issuecomment-1943505707
Reported-by: Paul Holzinger <pholzing@redhat.com>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'passt.h')
-rw-r--r-- | passt.h | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -64,7 +64,9 @@ enum epoll_type { /* ICMPv6 sockets */ EPOLL_TYPE_ICMPV6, /* inotify fd watching for end of netns (pasta) */ - EPOLL_TYPE_NSQUIT, + EPOLL_TYPE_NSQUIT_INOTIFY, + /* timer fd watching for end of netns, fallback for inotify (pasta) */ + EPOLL_TYPE_NSQUIT_TIMER, /* tuntap character device */ EPOLL_TYPE_TAP_PASTA, /* socket connected to qemu */ @@ -84,6 +86,7 @@ enum epoll_type { * @udp: UDP-specific reference part * @icmp: ICMP-specific reference part * @data: Data handled by protocol handlers + * @nsdir_fd: netns dirfd for fallback timer checking if namespace is gone * @u64: Opaque reference for epoll_ctl() and epoll_wait() */ union epoll_ref { @@ -99,6 +102,7 @@ union epoll_ref { union udp_epoll_ref udp; union icmp_epoll_ref icmp; uint32_t data; + int nsdir_fd; }; }; uint64_t u64; |