From c8d32546095829663022d9d6331809b1f311b839 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Wed, 31 Jan 2018 16:52:52 -0500 Subject: [PATCH] librbd: potential crash if object map check encounters error Fixes: http://tracker.ceph.com/issues/22819 Signed-off-by: Jason Dillaman --- src/librbd/Operations.cc | 4 +++- src/librbd/operation/ObjectMapIterate.cc | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/librbd/Operations.cc b/src/librbd/Operations.cc index 7fe6cb6b9e3..b8925c45797 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 86f29b5b32e..ee810009974 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; } -- 2.39.5