]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: fix preforker exit behavior behavior
authorSage Weil <sage@inktank.com>
Sat, 1 Jun 2013 04:23:45 +0000 (21:23 -0700)
committerSage Weil <sage@inktank.com>
Thu, 6 Jun 2013 00:44:20 +0000 (17:44 -0700)
In 3c5706163b72245768958155d767abf561e6d96d we made exit() not actually
exit so that the leak checking would behave for a non-forking case.
That is only needed for the normal exit case; every other case expects
exit() to actually terminate and not continue execution.

Instead, make a signal_exit() method that signals the parent (if any)
and then lets you return.  exit() goes back to it's usual behavior,
fixing the many other calls in main().

Backport: cuttlefish
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com>
src/ceph_mon.cc
src/common/Preforker.h

index 53d8a692c136cd4c1b6b9f362d8fe80ea75c4db6..5d18bdbad7bcaaa2ddb1fddbf73a94b47f9a90ea 100644 (file)
@@ -544,6 +544,7 @@ int main(int argc, const char **argv)
     dout(0) << "ceph-mon: gmon.out should be in " << s << dendl;
   }
 
-  return prefork.exit(0);
+  prefork.signal_exit(0);
+  return 0;
 }
 
index bf76e1891463c7f50c8a1b9b0c5c4a060be69134..20e8b00be151e6455559b11c2d00abd75d94c14a 100644 (file)
@@ -76,13 +76,17 @@ public:
     return r;
   }
 
-  int exit(int r) {
+  int signal_exit(int r) {
     if (forked) {
       // tell parent
       (void)::write(fd[1], &r, sizeof(r));
     }
     return r;
   }
+  void exit(int r) {
+    signal_exit(r);
+    exit(r);
+  }
 
   void daemonize() {
     assert(forked);