From: Sage Weil Date: Sat, 1 Jun 2013 04:23:45 +0000 (-0700) Subject: mon: fix preforker exit behavior behavior X-Git-Tag: v0.64~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=92d085f7fd6224ffe5b7651c1f83b093f964b5cd;p=ceph.git mon: fix preforker exit behavior behavior 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 Reviewed-by: Joao Eduardo Luis --- diff --git a/src/ceph_mon.cc b/src/ceph_mon.cc index 53d8a692c13..5d18bdbad7b 100644 --- a/src/ceph_mon.cc +++ b/src/ceph_mon.cc @@ -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; } diff --git a/src/common/Preforker.h b/src/common/Preforker.h index bf76e189146..20e8b00be15 100644 --- a/src/common/Preforker.h +++ b/src/common/Preforker.h @@ -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);