From: Sage Weil Date: Sat, 15 Jun 2013 15:14:40 +0000 (-0700) Subject: common/Preforker: fix broken recursion on exit(3) X-Git-Tag: v0.65~58 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7e7ff7532d343c473178799e37f4b83cf29c4eee;p=ceph.git common/Preforker: fix broken recursion on exit(3) If we exit via preforker, call exit(3) and not recursively back into Preforker::exit(r). Otherwise you get a hang with the child blocked at: Thread 1 (Thread 0x7fa08962e7c0 (LWP 5419)): #0 0x000000309860e0cd in write () from /lib64/libpthread.so.0 #1 0x00000000005cc906 in Preforker::exit(int) () #2 0x00000000005c8dfb in main () and the parent at #0 0x000000309860eba7 in waitpid () from /lib64/libpthread.so.0 #1 0x00000000005cc87a in Preforker::parent_wait() () #2 0x00000000005c75ae in main () Backport: cuttlefish Signed-off-by: Sage Weil --- diff --git a/src/common/Preforker.h b/src/common/Preforker.h index 20e8b00be151..2c1d4fd67956 100644 --- a/src/common/Preforker.h +++ b/src/common/Preforker.h @@ -79,13 +79,13 @@ public: int signal_exit(int r) { if (forked) { // tell parent - (void)::write(fd[1], &r, sizeof(r)); + (void)safe_write(fd[1], &r, sizeof(r)); } return r; } void exit(int r) { signal_exit(r); - exit(r); + ::exit(r); } void daemonize() {