From: Sage Weil Date: Fri, 16 Mar 2012 20:07:25 +0000 (-0700) Subject: osd: explicitly create new object,snap contexts on push X-Git-Tag: v0.44~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=15d85af4ce23695fce03505853e435bdb57b5e18;p=ceph.git 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 --- diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index afb24732eccb..1a520180786d 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);