]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: remove state machine should ignore group not supported errors
authorJason Dillaman <dillaman@redhat.com>
Fri, 16 Jun 2017 15:10:08 +0000 (11:10 -0400)
committerJason Dillaman <dillaman@redhat.com>
Tue, 20 Jun 2017 11:48:40 +0000 (07:48 -0400)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/image/RemoveRequest.cc
src/librbd/image/RemoveRequest.h

index cba69c51903da29379fa8e5593c61ed51745ca35..885e280a8ae0d2b09124b74a0eb5409ffdbf2356 100644 (file)
@@ -250,12 +250,12 @@ Context *RemoveRequest<I>::handle_check_image_watchers(int *result) {
     return nullptr;
   }
 
-  check_image_consistency_group();
+  check_group();
   return nullptr;
 }
 
 template<typename I>
-void RemoveRequest<I>::check_image_consistency_group() {
+void RemoveRequest<I>::check_group() {
   ldout(m_cct, 20) << dendl;
 
   librados::ObjectReadOperation op;
@@ -263,7 +263,7 @@ void RemoveRequest<I>::check_image_consistency_group() {
 
   using klass = RemoveRequest<I>;
   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<I>::check_image_consistency_group() {
 }
 
 template<typename I>
-Context *RemoveRequest<I>::handle_check_image_consistency_group(int *result) {
+Context *RemoveRequest<I>::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<I>::handle_check_image_consistency_group(int *result) {
   }
 
   trim_image();
-
   return nullptr;
 }
 
index 0853c6b2b87951bbb2e3fe4f000c5b633584dc0a..2a1ec3b603378907cb2a1ca547c81d2ed8b0acdf 100644 (file)
@@ -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);