From 15d85af4ce23695fce03505853e435bdb57b5e18 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 16 Mar 2012 13:07:25 -0700 Subject: [PATCH] osd: explicitly create new object,snap contexts on push We specifically want to use this during recovery to avoid loading the obc or ssc for a previous version of the object and populating the watchers. We know we won't have any existing obc here because it is missing (old or dne). For the snapset context, we provide it explicitly when we recover the head or snapset object (which we always do first). For clones, we re-use the existing get_snapset_context(), which will either have the ssc open or can load it from the head/snapset object. Signed-off-by: Sage Weil --- src/osd/ReplicatedPG.cc | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index afb24732eccb4..1a520180786da 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -4813,17 +4813,18 @@ void ReplicatedPG::handle_pull_response(OpRequest *op) if (complete) { submit_push_complete(pi.recovery_info, t); - ObjectContext *obc = get_object_context(hoid, - pi.recovery_info.oi.oloc, - true); - obc->ondisk_write_lock(); - obc->obs.exists = true; - obc->obs.oi = pi.recovery_info.oi; - populate_obc_watchers(obc); - + SnapSetContext *ssc; if (hoid.snap == CEPH_NOSNAP || hoid.snap == CEPH_SNAPDIR) { - obc->ssc->snapset = pi.recovery_info.ss; + ssc = create_snapset_context(hoid.oid); + ssc->snapset = pi.recovery_info.ss; + } else { + ssc = get_snapset_context(hoid.oid, hoid.get_key(), hoid.hash, false); + assert(ssc); } + ObjectContext *obc = create_object_context(pi.recovery_info.oi, ssc); + obc->obs.exists = true; + + obc->ondisk_write_lock(); onreadable = new C_OSD_AppliedRecoveredObject(this, t, obc); onreadable_sync = new C_OSD_OndiskWriteUnlock(obc); -- 2.39.5