From: Jason Dillaman Date: Fri, 16 Jun 2017 15:10:08 +0000 (-0400) Subject: librbd: remove state machine should ignore group not supported errors X-Git-Tag: v12.1.0~19^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=29d531802fbec1960e6166eb6482e75848cc4a9e;p=ceph.git librbd: remove state machine should ignore group not supported errors Signed-off-by: Jason Dillaman --- diff --git a/src/librbd/image/RemoveRequest.cc b/src/librbd/image/RemoveRequest.cc index cba69c51903d..885e280a8ae0 100644 --- a/src/librbd/image/RemoveRequest.cc +++ b/src/librbd/image/RemoveRequest.cc @@ -250,12 +250,12 @@ Context *RemoveRequest::handle_check_image_watchers(int *result) { return nullptr; } - check_image_consistency_group(); + check_group(); return nullptr; } template -void RemoveRequest::check_image_consistency_group() { +void RemoveRequest::check_group() { ldout(m_cct, 20) << dendl; librados::ObjectReadOperation op; @@ -263,7 +263,7 @@ void RemoveRequest::check_image_consistency_group() { using klass = RemoveRequest; librados::AioCompletion *rados_completion = create_rados_callback< - klass, &klass::handle_check_image_consistency_group>(this); + klass, &klass::handle_check_group>(this); m_out_bl.clear(); int r = m_image_ctx->md_ctx.aio_operate(m_header_oid, rados_completion, &op, &m_out_bl); @@ -272,23 +272,21 @@ void RemoveRequest::check_image_consistency_group() { } template -Context *RemoveRequest::handle_check_image_consistency_group(int *result) { +Context *RemoveRequest::handle_check_group(int *result) { ldout(m_cct, 20) << ": r=" << *result << dendl; - if (*result < 0) { - lderr(m_cct) << "error fetching consistency group for image: " + cls::rbd::GroupSpec s; + if (*result == 0) { + bufferlist::iterator it = m_out_bl.begin(); + *result = librbd::cls_client::image_get_group_finish(&it, &s); + } + if (*result < 0 && *result != -EOPNOTSUPP) { + lderr(m_cct) << "error fetching group for image: " << cpp_strerror(*result) << dendl; send_close_image(*result); return nullptr; } - cls::rbd::GroupSpec s; - bufferlist::iterator it = m_out_bl.begin(); - *result = librbd::cls_client::image_get_group_finish(&it, &s); - if (*result < 0) { - send_close_image(*result); - return nullptr; - } if (s.is_valid()) { lderr(m_cct) << "image is in a group - not removing" << dendl; send_close_image(-EMLINK); @@ -296,7 +294,6 @@ Context *RemoveRequest::handle_check_image_consistency_group(int *result) { } trim_image(); - return nullptr; } diff --git a/src/librbd/image/RemoveRequest.h b/src/librbd/image/RemoveRequest.h index 0853c6b2b879..2a1ec3b60337 100644 --- a/src/librbd/image/RemoveRequest.h +++ b/src/librbd/image/RemoveRequest.h @@ -149,8 +149,8 @@ private: void check_image_watchers(); Context *handle_check_image_watchers(int *result); - void check_image_consistency_group(); - Context *handle_check_image_consistency_group(int *result); + void check_group(); + Context *handle_check_group(int *result); void trim_image(); Context *handle_trim_image(int *result);