]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: explicitly create new object,snap contexts on push
authorSage Weil <sage@newdream.net>
Fri, 16 Mar 2012 20:07:25 +0000 (13:07 -0700)
committerSage Weil <sage@newdream.net>
Fri, 16 Mar 2012 20:30:51 +0000 (13:30 -0700)
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 <sage@newdream.net>
src/osd/ReplicatedPG.cc

index afb24732eccb4d6f0b690cefc528ed74163e17b3..1a520180786dab31eb469e16d24b033dfdb6aab2 100644 (file)
@@ -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);