From: Jason Dillaman Date: Wed, 31 Jan 2018 21:52:52 +0000 (-0500) Subject: librbd: potential crash if object map check encounters error X-Git-Tag: v12.2.5~117^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d415e2bfe2146e7771ea293ab644e11205acee60;p=ceph.git librbd: potential crash if object map check encounters error Fixes: http://tracker.ceph.com/issues/22819 Signed-off-by: Jason Dillaman (cherry picked from commit c8d32546095829663022d9d6331809b1f311b839) --- diff --git a/src/librbd/Operations.cc b/src/librbd/Operations.cc index 393a8b2d7c8..6a1bd3ec025 100644 --- a/src/librbd/Operations.cc +++ b/src/librbd/Operations.cc @@ -481,7 +481,9 @@ int Operations::check_object_map(ProgressContext &prog_ctx) { r = invoke_async_request("check object map", true, boost::bind(&Operations::check_object_map, this, boost::ref(prog_ctx), _1), - [] (Context *c) { c->complete(-EOPNOTSUPP); }); + [this](Context *c) { + m_image_ctx.op_work_queue->queue(c, -EOPNOTSUPP); + }); return r; } diff --git a/src/librbd/operation/ObjectMapIterate.cc b/src/librbd/operation/ObjectMapIterate.cc index 1e4b854bddd..68d2d113783 100644 --- a/src/librbd/operation/ObjectMapIterate.cc +++ b/src/librbd/operation/ObjectMapIterate.cc @@ -200,12 +200,17 @@ template bool ObjectMapIterateRequest::should_complete(int r) { CephContext *cct = m_image_ctx.cct; ldout(cct, 5) << this << " should_complete: " << " r=" << r << dendl; + if (r < 0) { + lderr(cct) << "object map operation encountered an error: " + << cpp_strerror(r) << dendl; + } RWLock::RLocker owner_lock(m_image_ctx.owner_lock); switch (m_state) { case STATE_VERIFY_OBJECTS: if (m_invalidate.test_and_set()) { send_invalidate_object_map(); + return false; } else if (r == 0) { return true; } @@ -223,9 +228,6 @@ bool ObjectMapIterateRequest::should_complete(int r) { } if (r < 0) { - lderr(cct) << "object map operation encountered an error: " - << cpp_strerror(r) - << dendl; return true; }