]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
common: ignore SIGHUP prior to fork
authorhzwuhongsong <hzwuhongsong@corp.netease.com>
Tue, 30 Jun 2020 07:46:28 +0000 (15:46 +0800)
committerhzwuhongsong <hzwuhongsong@corp.netease.com>
Mon, 13 Jul 2020 12:30:14 +0000 (20:30 +0800)
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>
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();