]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd, test: wait if the snapshot is deleting 39773/head
authormyoungwon oh <ohmyoungwon@gmail.com>
Tue, 16 Feb 2021 05:42:44 +0000 (14:42 +0900)
committermyoungwon oh <ohmyoungwon@gmail.com>
Tue, 2 Mar 2021 04:25:06 +0000 (13:25 +0900)
After calling selfmanaged_snap_remove, we don't know
when trimming snapshot is finished.
So, we make the OSD to return EBUSY if the snapshot in removed_snap_queue,
then the unit test waits the completion

Signed-off-by: Myoungwon Oh <myoungwon.oh@samsung.com>
(cherry-picked from commit d6f9f23012b9ac133e767bd07a804707ba2207ef)

src/osd/PrimaryLogPG.cc
src/test/librados/tier_cxx.cc

index 2fa3c40f91f18ce3fd98c17aa868aac106b728a6..e639ca299b9ae9841291386e169d77c8d1370b3b 100644 (file)
@@ -3347,6 +3347,7 @@ int PrimaryLogPG::get_manifest_ref_count(ObjectContextRef obc, std::string& fp_o
   }
   // snap
   SnapSet& ss = obc->ssc->snapset;
+  const OSDMapRef& osdmap = get_osdmap();
   for (vector<snapid_t>::const_reverse_iterator p = ss.clones.rbegin();
       p != ss.clones.rend();
       ++p) {
@@ -3355,6 +3356,9 @@ int PrimaryLogPG::get_manifest_ref_count(ObjectContextRef obc, std::string& fp_o
     ObjectContextRef obc_g = nullptr;
     hobject_t clone_oid = obc->obs.oi.soid;
     clone_oid.snap = *p;
+    if (osdmap->in_removed_snaps_queue(info.pgid.pgid.pool(), *p)) {
+      return -EBUSY;
+    }
     ObjectContextRef clone_obc = get_object_context(clone_oid, false);
     if (!clone_obc) {
       break;
index fbb01c60ca1e5899a9d5fa91b9a0b9b6be1e7bfb..d3cd46a908980631896806dd372d9287f592b258 100644 (file)
@@ -179,11 +179,17 @@ void is_intended_refcount_state(librados::IoCtx& src_ioctx,
     }
     dst_refcount = refs.count();
   }
-  r = cls_cas_references_chunk(src_ioctx, src_oid, dst_oid);
-  if (r == -ENOENT || r == -ENOLINK) {
-    src_refcount = 0;
-  } else {
-    src_refcount = r;
+  for (int tries = 0; tries < 10; ++tries) {
+    r = cls_cas_references_chunk(src_ioctx, src_oid, dst_oid);
+    if (r == -ENOENT || r == -ENOLINK) {
+      src_refcount = 0;
+    } else if (r == -EBUSY) {
+      sleep(15);
+      continue;
+    } else {
+      src_refcount = r;
+    }
+    break;
   }
   ASSERT_TRUE(src_refcount >= 0);
   ASSERT_TRUE(src_refcount == expected_refcount);