]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: recover unreadable snapshot before reading ref. count info 44181/head
authormyoungwon oh <ohmyoungwon@gmail.com>
Tue, 6 Apr 2021 01:29:56 +0000 (10:29 +0900)
committermyoungwon oh <ohmyoungwon@gmail.com>
Thu, 2 Dec 2021 07:18:09 +0000 (16:18 +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.

Fixes: https://tracker.ceph.com/issues/50192
Signed-off-by: Myoungwon Oh <myoungwon.oh@samsung.com>
(cherry picked from commit acc2a1e12f04efd6b8c25b92a4a438a73851afe1)

src/osd/PrimaryLogPG.cc
src/osd/PrimaryLogPG.h
src/osd/objclass.cc

index 339b262b60b04942ad0ec441ccc2bda9ade132cd..8f45b9fd194fb83e63a2e217e261f36d66849add 100644 (file)
@@ -3339,7 +3339,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
@@ -3366,6 +3366,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 ,
@@ -3396,6 +3399,7 @@ bool PrimaryLogPG::recover_adjacent_clones(ObjectContextRef obc, OpRequestRef op
   if (!obc->obs.oi.manifest.is_chunked() && !has_manifest_op) {
     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 1a8f8560870b2162029141a2428326b37f0b1795..ba57dd4f38aa88aac7bf5518d2fc55e1e7780296 100644 (file)
@@ -1849,7 +1849,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) {