From 1cc239820891c7ecd9592529b8ee77f97571765c Mon Sep 17 00:00:00 2001 From: Zengran Zhang Date: Thu, 18 Apr 2019 20:44:11 +0800 Subject: [PATCH] osd: avoid prep_object_replica_pushes() on clone object when head missing the leak path: maybe_kick_recovery() -> prep_object_replica_pushes() Fixes: http://tracker.ceph.com/issues/39286 Signed-off-by: Zengran Zhang --- src/osd/PrimaryLogPG.cc | 18 ++++++++++++++++++ src/osd/ReplicatedBackend.cc | 5 +++++ 2 files changed, 23 insertions(+) diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index af44294c0b866..f2765b165cbe7 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -12539,6 +12539,24 @@ int PrimaryLogPG::prep_object_replica_pushes( ceph_assert(is_primary()); dout(10) << __func__ << ": on " << soid << dendl; + if (soid.snap && soid.snap < CEPH_NOSNAP) { + // do we have the head and/or snapdir? + hobject_t head = soid.get_head(); + if (recovery_state.get_pg_log().get_missing().is_missing(head)) { + if (recovering.count(head)) { + dout(10) << " missing but already recovering head " << head << dendl; + return 0; + } else { + int r = recover_missing( + head, recovery_state.get_pg_log().get_missing().get_items().find(head)->second.need, + get_recovery_op_priority(), h); + if (r != PULL_NONE) + return 1; + return 0; + } + } + } + // NOTE: we know we will get a valid oloc off of disk here. ObjectContextRef obc = get_object_context(soid, false); if (!obc) { diff --git a/src/osd/ReplicatedBackend.cc b/src/osd/ReplicatedBackend.cc index 81e2651d988bc..c1634f9f714d0 100644 --- a/src/osd/ReplicatedBackend.cc +++ b/src/osd/ReplicatedBackend.cc @@ -1779,6 +1779,11 @@ bool ReplicatedBackend::handle_pull_response( a.second.rebuild(); } pi.obc = get_parent()->get_obc(pi.recovery_info.soid, attrset); + if (attrset.find(SS_ATTR) != attrset.end()) { + bufferlist ssbv = attrset.at(SS_ATTR); + SnapSet ss(ssbv); + assert(ss.seq == pi.obc->ssc->snapset.seq); + } pi.recovery_info.oi = pi.obc->obs.oi; pi.recovery_info = recalc_subsets( pi.recovery_info, -- 2.47.3