]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common: ignore SIGHUP prior to fork
authorhzwuhongsong <hzwuhongsong@corp.netease.com>
Tue, 30 Jun 2020 07:46:28 +0000 (15:46 +0800)
committerNathan Cutler <ncutler@suse.com>
Sun, 9 Aug 2020 20:41:27 +0000 (22:41 +0200)
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 <hzwuhongsong@corp.netease.com>
(cherry picked from commit 385efa7d284438d77e22dde2f728ba3d541c489e)

src/common/Preforker.h

index c0342c86049e615e8add6086079795fd858b9c30..b922f4656127f34078d7965aa622ed548e084a56 100644 (file)
@@ -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();