]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: recover unreadable snapshot before reading ref. count info 40606/head
authormyoungwon oh <ohmyoungwon@gmail.com>
Tue, 6 Apr 2021 01:29:56 +0000 (10:29 +0900)
committermyoungwon oh <ohmyoungwon@gmail.com>
Thu, 8 Apr 2021 01:08:41 +0000 (10:08 +0900)
Manifest objects needs adjacent clones when incrementing/decrementing
refcount. This commit makes the current code to call get_manifest_ref_count
before reading ref. count info.

Signed-off-by: Myoungwon Oh <myoungwon.oh@samsung.com>
src/osd/PrimaryLogPG.cc
src/osd/PrimaryLogPG.h
src/osd/objclass.cc

index 8d01780a8053f98c2e1daa6696611c74b3dcb198..161134237b5086dd4951da07a8d15c83602d06bd 100644 (file)
@@ -3381,7 +3381,7 @@ void PrimaryLogPG::cancel_manifest_ops(bool requeue, vector<ceph_tid_t> *tids)
   }
 }
 
-int PrimaryLogPG::get_manifest_ref_count(ObjectContextRef obc, std::string& fp_oid) 
+int PrimaryLogPG::get_manifest_ref_count(ObjectContextRef obc, std::string& fp_oid, OpRequestRef op
 {
   int cnt = 0;
   // head
@@ -3408,6 +3408,9 @@ int PrimaryLogPG::get_manifest_ref_count(ObjectContextRef obc, std::string& fp_o
     if (!clone_obc) {
       break;
     }
+    if (recover_adjacent_clones(obc, op)) {
+      return -EAGAIN;
+    }
     get_adjacent_clones(clone_obc, obc_l, obc_g);
     clone_obc->obs.oi.manifest.calc_refs_to_inc_on_set(
       obc_g ? &(obc_g->obs.oi.manifest) : nullptr ,
@@ -3428,6 +3431,7 @@ bool PrimaryLogPG::recover_adjacent_clones(ObjectContextRef obc, OpRequestRef op
   if (!obc->obs.oi.manifest.is_chunked() || !obc->ssc || !obc->ssc->snapset.clones.size()) {
     return false;
   }
+  ceph_assert(op);
 
   const SnapSet& snapset = obc->ssc->snapset;
   auto s = std::find(snapset.clones.begin(), snapset.clones.end(), obc->obs.oi.soid.snap);
index e9f9cb9c828cb2b53b837bc617a7282f9b5a4080..e84078be3825312a429c90c5fcbb451d7b94cf76 100644 (file)
@@ -1811,7 +1811,7 @@ public:
   void maybe_kick_recovery(const hobject_t &soid);
   void wait_for_unreadable_object(const hobject_t& oid, OpRequestRef op);
 
-  int get_manifest_ref_count(ObjectContextRef obc, std::string& fp_oid);
+  int get_manifest_ref_count(ObjectContextRef obc, std::string& fp_oid, OpRequestRef op);
 
   bool check_laggy(OpRequestRef& op);
   bool check_laggy_requeue(OpRequestRef& op);
index 6130ecce2256d2cb6db6c4f36e24cb48f863838a..274f5e063e62bf3c03fee7a82cbdc146905c4b9c 100644 (file)
@@ -685,7 +685,7 @@ int cls_cxx_chunk_write_and_set(cls_method_context_t hctx, int ofs, int len,
 int cls_get_manifest_ref_count(cls_method_context_t hctx, string fp_oid)
 {
   PrimaryLogPG::OpContext *ctx = *(PrimaryLogPG::OpContext **)hctx;
-  return ctx->pg->get_manifest_ref_count(ctx->obc, fp_oid);
+  return ctx->pg->get_manifest_ref_count(ctx->obc, fp_oid, ctx->op);
 }
 
 uint64_t cls_get_osd_min_alloc_size(cls_method_context_t hctx) {