]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-osd: --flush-journal: sporadic segfaults on exit 13477/head
authorAlexey Sheplyakov <asheplyakov@mirantis.com>
Tue, 7 Feb 2017 12:47:45 +0000 (16:47 +0400)
committerAlexey Sheplyakov <asheplyakov@mirantis.com>
Fri, 17 Feb 2017 09:25:48 +0000 (13:25 +0400)
FileStore holds a number of recources like op thread pool and work
queue, key/value DB threads, etc. These should be properly stopped
(released) before exiting to avoid segfaults on exit.

Note: more code paths (mkfs, dump_journal, etc) need similar fixes,
these will be submitted as separate patches.

Fixes: http://tracker.ceph.com/issues/18820
Signed-off-by: Alexey Sheplyakov <asheplyakov@mirantis.com>
(cherry picked from commit 00184814c156f6194a6ba4b696073ca1c18a3f8f)

Adjustments:
 - release g_ceph_context in the same way as the main code path does

src/ceph_osd.cc

index 7deb5a159c9520b2973948d409415e2049e905aa..3ae3165a5149ac2d292878a222bb271c9657b136 100644 (file)
@@ -360,13 +360,16 @@ int main(int argc, const char **argv)
       derr << TEXT_RED << " ** ERROR: error flushing journal " << g_conf->osd_journal
           << " for object store " << g_conf->osd_data
           << ": " << cpp_strerror(-err) << TEXT_NORMAL << dendl;
-      exit(1);
+      goto flushjournal_out;
     }
     store->umount();
     derr << "flushed journal " << g_conf->osd_journal
         << " for object store " << g_conf->osd_data
         << dendl;
-    exit(0);
+flushjournal_out:
+    delete store;
+    g_ceph_context->put();
+    exit(err < 0 ? 1 : 0);
   }
   if (dump_journal) {
     common_init_finish(g_ceph_context);