]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
common: use close_range on Linux 61639/head
authoredef <edef@edef.eu>
Thu, 16 Mar 2023 09:43:58 +0000 (09:43 +0000)
committerPeter Razumovsky <prazumovsky@mirantis.com>
Tue, 4 Feb 2025 11:16:09 +0000 (15:16 +0400)
commit52a658e8395f487c0011499edfa7ee53d05f44c3
tree99e05ae6510f3ab761c2d5a6b662fb4b08a22f93
parentde16b86426ac8a552eeb34b4e5e9be668e0a24ce
common: use close_range on Linux

Fix rook/rook#10110, which occurs when _SC_OPEN_MAX/RLIMIT_NOFILE is
set to very large values (2^30), leaving fork_function pegging a core
busylooping.

The glibc wrappers closefrom(3)/close_range(3) are not available before
glibc 2.34, so we invoke the syscall directly. When glibc 2.34 is old
enough to be a reasonable hard minimum dependency, we should switch to
using closefrom.

If we're not running on (recent enough) Linux, we fall back to the
existing approach.

Fixes: https://tracker.ceph.com/issues/59125
Signed-off-by: edef <edef@edef.eu>
(cherry picked from commit 1a33cefa1980a18b11479275c1f708c1de24ee37)
src/common/SubProcess.cc
src/common/fork_function.h