]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: guard _dispatch to prevent execution of new messages while the map is updating
authorGreg Farnum <gregf@hq.newdream.net>
Tue, 3 Aug 2010 21:50:24 +0000 (14:50 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Tue, 3 Aug 2010 21:56:02 +0000 (14:56 -0700)
src/osd/OSD.cc

index 8b1649d40d011f3375131a9ae5865d1b3c404e05..f532b65270053dac2c7acb0ee35b3106a37bf452 100644 (file)
@@ -1944,6 +1944,17 @@ void OSD::_dispatch(Message *m)
   assert(osd_lock.is_locked());
   dout(20) << "_dispatch " << m << " " << *m << dendl;
   Session *session = NULL;
+
+  if (handle_map_lock) { //can't dispatch while map is being updated!
+    handle_map_lock->Lock();
+    if (map_in_progress) {
+      dout(25) << "waiting for handle_osd_map to complete before dispatching" << dendl;
+      while (map_in_progress)
+        map_cond.Wait(*handle_map_lock);
+    }
+    handle_map_lock->Unlock();
+  }
+
   switch (m->get_type()) {
 
     // -- don't need lock --