From: hzwuhongsong Date: Tue, 30 Jun 2020 07:46:28 +0000 (+0800) Subject: common: ignore SIGHUP prior to fork X-Git-Tag: v14.2.12~84^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=477dae404075d2f6720fc36d3bfaeb4783c35b2d;p=ceph.git 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 (cherry picked from commit 385efa7d284438d77e22dde2f728ba3d541c489e) --- diff --git a/src/common/Preforker.h b/src/common/Preforker.h index c0342c86049e..b922f4656127 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();