From 385efa7d284438d77e22dde2f728ba3d541c489e Mon Sep 17 00:00:00 2001 From: hzwuhongsong Date: Tue, 30 Jun 2020 15:46:28 +0800 Subject: [PATCH] common: ignore SIGHUP prior to fork Otherwise, the ceph-fuse process is terminated by the logratote task and will produce one Uninterruptible Sleep process. Fixes: http://tracker.ceph.com/issues/46269 Signed-off-by: hzwuhongsong --- src/common/Preforker.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/common/Preforker.h b/src/common/Preforker.h index 5951fbeb46a1..455bf59d5f31 100644 --- a/src/common/Preforker.h +++ b/src/common/Preforker.h @@ -45,6 +45,17 @@ public: return (errno = e, -1); } + struct sigaction sa; + sa.sa_handler = SIG_IGN; + sigemptyset(&sa.sa_mask); + sa.sa_flags = 0; + if (sigaction(SIGHUP, &sa, nullptr) != 0) { + int e = errno; + oss << "[" << getpid() << "]: unable to ignore SIGHUP: " << cpp_strerror(e); + err = oss.str(); + return (errno = e, -1); + } + forked = true; childpid = fork(); -- 2.47.3