]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: fix to recover adjacent clone when set_chunk is called 42279/head
authormyoungwon oh <ohmyoungwon@gmail.com>
Mon, 12 Jul 2021 05:20:45 +0000 (14:20 +0900)
committermyoungwon oh <ohmyoungwon@gmail.com>
Tue, 13 Jul 2021 10:53:17 +0000 (19:53 +0900)
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>
src/osd/PrimaryLogPG.cc

index 6a1e0123e8974deb98ed487d2888ee3cc5cf3166..fa02c245c2d3874258a32455d72ecf98ef87314a 100644 (file)
@@ -3445,7 +3445,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;
   }
   ceph_assert(op);