]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
common: use close_range on Linux 61625/head
authoredef <edef@edef.eu>
Thu, 16 Mar 2023 09:43:58 +0000 (09:43 +0000)
committerPeter Razumovsky <prazumovsky@mirantis.com>
Mon, 3 Feb 2025 13:17:28 +0000 (17:17 +0400)
commit1fe1d5d541fd54ce6d49b59b6a8dcf1079d2be49
tree4a9a6df2b15ceece3bb887d225eef83d4d739d8f
parentcdd5126235302c379cf8f9786d14d4c3ad444ca7
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