From: Jason Dillaman Date: Wed, 27 Apr 2016 19:45:25 +0000 (-0400) Subject: librbd: avoid second close attempt of invalid parent image X-Git-Tag: v11.0.0~804^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e91e7f8d9ce10f0d19c48facfb6318d6b49798e8;p=ceph.git librbd: avoid second close attempt of invalid parent image Fixes: http://tracker.ceph.com/issues/15574 Signed-off-by: Jason Dillaman --- diff --git a/src/librbd/image/RefreshParentRequest.cc b/src/librbd/image/RefreshParentRequest.cc index f9ce4f18a891..a44124f39136 100644 --- a/src/librbd/image/RefreshParentRequest.cc +++ b/src/librbd/image/RefreshParentRequest.cc @@ -117,8 +117,9 @@ void RefreshParentRequest::send_open_parent() { } using klass = RefreshParentRequest; - Context *ctx = create_context_callback< - klass, &klass::handle_open_parent, false>(this); + Context *ctx = create_async_context_callback( + m_child_image_ctx, create_context_callback< + klass, &klass::handle_open_parent, false>(this)); OpenRequest *req = OpenRequest::create(m_parent_image_ctx, ctx); req->send(); } @@ -132,8 +133,12 @@ Context *RefreshParentRequest::handle_open_parent(int *result) { if (*result < 0) { lderr(cct) << "failed to open parent image: " << cpp_strerror(*result) << dendl; - send_close_parent(); - return nullptr; + + // image already closed by open state machine + delete m_parent_image_ctx; + m_parent_image_ctx = nullptr; + + return m_on_finish; } send_set_parent_snap(); diff --git a/src/librbd/image/RefreshParentRequest.h b/src/librbd/image/RefreshParentRequest.h index e51d24f48b62..3fe653952c9d 100644 --- a/src/librbd/image/RefreshParentRequest.h +++ b/src/librbd/image/RefreshParentRequest.h @@ -38,19 +38,19 @@ private: * * | * | (open required) - * |----------------> OPEN_PARENT * * * * * * * * - * | | * - * | v * (on error) - * | SET_PARENT_SNAP * * * * * * - * | | * - * | v * - * \----------------> * - * | * - * | (close required) v - * |-----------------> CLOSE_PARENT - * | | - * | v - * \-----------------> + * |----------------> OPEN_PARENT * * * * * * * * * * * * * * * + * | | * + * | v * + * | SET_PARENT_SNAP * * * * * * * + * | | * * + * | v * (on error) * + * \----------------> * * + * | * * + * | (close required) v * + * |-----------------> CLOSE_PARENT * + * | | * + * | v * + * \-----------------> < * * * * * * @endverbatim */