From 7b669e4af42d63d2ca29e78de6cc6ffb5428e30a Mon Sep 17 00:00:00 2001 From: myoungwon oh Date: Mon, 12 Jul 2021 14:20:45 +0900 Subject: [PATCH] osd: fix to recover adjacent clone when set_chunk is called set_chunk needs adjacent clones to calculate reference count fixes: https://tracker.ceph.com/issues/51627 Signed-off-by: Myoungwon Oh --- src/osd/PrimaryLogPG.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 6a1e0123e8974..fa02c245c2d38 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -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(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); -- 2.39.5