]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedPG: populate obc watchers on sub_op_push
authorSamuel Just <rexludorum@gmail.com>
Tue, 20 Sep 2011 17:50:07 +0000 (10:50 -0700)
committerSamuel Just <samuel.just@dreamhost.com>
Tue, 20 Sep 2011 18:46:46 +0000 (11:46 -0700)
Previously, obc->unconnected_watchers did not get filled in during
sub_op_push.

Signed-off-by: Samuel Just <samuel.just@dreamhost.com>
src/osd/ReplicatedPG.cc
src/osd/ReplicatedPG.h

index f5cde506cddd375aeb6a92ca2d084d8574402b0a..0a8261bb6272a283fe4c1f600bbafce2e32b6d31 100644 (file)
@@ -3012,6 +3012,22 @@ void ReplicatedPG::repop_ack(RepGather *repop, int result, int ack_type,
 
 // -------------------------------------------------------
 
+void ReplicatedPG::populate_obc_watchers(ObjectContext *obc)
+{
+  if (!obc->obs.oi.watchers.empty()) {
+    // populate unconnected_watchers
+    utime_t now = ceph_clock_now(g_ceph_context);
+    for (map<entity_name_t, watch_info_t>::iterator p = obc->obs.oi.watchers.begin();
+        p != obc->obs.oi.watchers.end();
+        p++) {
+      utime_t expire = now;
+      expire += p->second.timeout_seconds;
+      dout(10) << "  unconnected watcher " << p->first << " will expire " << expire << dendl;
+      obc->unconnected_watchers[p->first] = expire;
+    }
+  }
+}
+
 
 ReplicatedPG::ObjectContext *ReplicatedPG::get_object_context(const hobject_t& soid,
                                                              const object_locator_t& oloc,
@@ -3056,18 +3072,7 @@ ReplicatedPG::ObjectContext *ReplicatedPG::get_object_context(const hobject_t& s
       obc->obs.oi.decode(bv);
       obc->obs.exists = true;
 
-      if (!obc->obs.oi.watchers.empty()) {
-       // populate unconnected_watchers
-       utime_t now = ceph_clock_now(g_ceph_context);
-       for (map<entity_name_t, watch_info_t>::iterator p = obc->obs.oi.watchers.begin();
-            p != obc->obs.oi.watchers.end();
-            p++) {
-         utime_t expire = now;
-         expire += p->second.timeout_seconds;
-         dout(10) << "  unconnected watcher " << p->first << " will expire " << expire << dendl;
-         obc->unconnected_watchers[p->first] = expire;
-       }
-      }
+      populate_obc_watchers(obc);
     } else {
       obc->obs.exists = false;
     }
@@ -4263,6 +4268,8 @@ void ReplicatedPG::sub_op_push(MOSDSubOp *op)
       
       obc->obs.exists = true;
       obc->obs.oi.decode(oibl);
+
+      populate_obc_watchers(obc);
       
       // suck in snapset context?
       SnapSetContext *ssc = obc->ssc;
index 3c847f4b7ae7ef604a82ce5cb97cb0e6fe9fdab8..a1fa6367c376a3bd6b18398a40437a61ecba6cbb 100644 (file)
@@ -485,6 +485,8 @@ protected:
   map<hobject_t, ObjectContext*> object_contexts;
   map<object_t, SnapSetContext*> snapset_contexts;
 
+  void populate_obc_watchers(ObjectContext *obc);
+
   ObjectContext *lookup_object_context(const hobject_t& soid) {
     if (object_contexts.count(soid)) {
       ObjectContext *obc = object_contexts[soid];