]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: check for presence of journal before attempting to remove 6737/head
authorJason Dillaman <dillaman@redhat.com>
Mon, 30 Nov 2015 17:36:13 +0000 (12:36 -0500)
committerJason Dillaman <dillaman@redhat.com>
Mon, 30 Nov 2015 17:36:13 +0000 (12:36 -0500)
Fixes: #13912
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/Journal.cc

index d83438c60235f1c47c72c36518a75eccf388968d..797349e8bb530c5cdfceb32cc76a9fe8b67f13bf 100644 (file)
@@ -119,10 +119,19 @@ int Journal::remove(librados::IoCtx &io_ctx, const std::string &image_id) {
   // TODO configurable commit flush interval
   ::journal::Journaler journaler(io_ctx, image_id, "", 5);
 
+  bool journal_exists;
+  int r = journaler.exists(&journal_exists);
+  if (r < 0) {
+    lderr(cct) << "failed to stat journal header: " << cpp_strerror(r) << dendl;
+    return r;
+  } else if (!journal_exists) {
+    return 0;
+  }
+
   C_SaferCond cond;
   journaler.init(&cond);
 
-  int r = cond.wait();
+  r = cond.wait();
   if (r == -ENOENT) {
     return 0;
   } else if (r < 0) {