]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: fix to recover adjacent clone when set_chunk is called 43099/head
authormyoungwon oh <ohmyoungwon@gmail.com>
Mon, 12 Jul 2021 05:20:45 +0000 (14:20 +0900)
committerCory Snyder <csnyder@iland.com>
Wed, 8 Sep 2021 15:42:32 +0000 (11:42 -0400)
set_chunk needs adjacent clones to calculate reference count

fixes: https://tracker.ceph.com/issues/51627

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

src/osd/PrimaryLogPG.cc

index 69893d1c40c1b52ddd023102cd298cdb90c2a6d2..339b262b60b04942ad0ec441ccc2bda9ade132cd 100644 (file)
@@ -3383,7 +3383,17 @@ int PrimaryLogPG::get_manifest_ref_count(ObjectContextRef obc, std::string& fp_o
 
 bool PrimaryLogPG::recover_adjacent_clones(ObjectContextRef obc, OpRequestRef op)
 {
-  if (!obc->obs.oi.manifest.is_chunked() || !obc->ssc || !obc->ssc->snapset.clones.size()) {
+  if (!obc->ssc || !obc->ssc->snapset.clones.size()) {
+    return false;
+  }
+  MOSDOp *m = static_cast<MOSDOp*>(op->get_nonconst_req());
+  bool has_manifest_op = std::any_of(
+    begin(m->ops),
+    end(m->ops),
+    [](const auto& osd_op) {
+       return osd_op.op.op == CEPH_OSD_OP_SET_CHUNK;
+    });
+  if (!obc->obs.oi.manifest.is_chunked() && !has_manifest_op) {
     return false;
   }