]> 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:42:55 +0000 (22:42 +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 5951fbeb46a1926d664c7661d835033f871bcbf7..455bf59d5f31c80a2e0256a4dd81d286ea6051a3 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();