]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
tools/rbd-ggate: close log before running postfork
authorWillem Jan Withagen <wjw@digiware.nl>
Thu, 29 Aug 2019 13:54:30 +0000 (15:54 +0200)
committerWillem Jan Withagen <wjw@digiware.nl>
Mon, 2 Sep 2019 08:21:50 +0000 (10:21 +0200)
Otherwise the assert in Log:open() will trigger since
all data is kept during the fork and also the `is_started` flag

Fixes: https://tracker.ceph.com/issues/41592
Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>
src/tools/rbd_ggate/main.cc

index 67fe81942b4fd81a875a2c223d9d8b8eaaffca7c..5ed582fbf81c5d745532dd684eb7828558b54237 100644 (file)
@@ -102,14 +102,13 @@ static int do_map(int argc, const char *argv[])
       std::cerr << err << std::endl;
       return r;
     }
-
     if (forker.is_parent()) {
-      global_init_postfork_start(g_ceph_context);
       if (forker.parent_wait(err) != 0) {
         return -ENXIO;
       }
       return 0;
     }
+    global_init_postfork_start(g_ceph_context);
   }
 
   common_init_finish(g_ceph_context);
@@ -204,9 +203,8 @@ static int do_map(int argc, const char *argv[])
   std::cout << "/dev/" << drv->get_devname() << std::endl;
 
   if (g_conf()->daemonize) {
-    forker.daemonize();
-    global_init_postfork_start(g_ceph_context);
     global_init_postfork_finish(g_ceph_context);
+    forker.daemonize();
   }
 
   init_async_signal_handler();