From: Jason Dillaman Date: Mon, 30 Nov 2015 17:36:13 +0000 (-0500) Subject: librbd: check for presence of journal before attempting to remove X-Git-Tag: v10.0.2~148^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F6737%2Fhead;p=ceph.git librbd: check for presence of journal before attempting to remove Fixes: #13912 Signed-off-by: Jason Dillaman --- diff --git a/src/librbd/Journal.cc b/src/librbd/Journal.cc index d83438c60235..797349e8bb53 100644 --- a/src/librbd/Journal.cc +++ b/src/librbd/Journal.cc @@ -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) {