]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librados: discard incoming messages when DISCONNECTED
authorSage Weil <sage@newdream.net>
Thu, 2 Feb 2012 05:08:31 +0000 (21:08 -0800)
committerSage Weil <sage@newdream.net>
Thu, 2 Feb 2012 17:02:17 +0000 (09:02 -0800)
If we are disconnected (probably shutting down, if we are receiving a
message) then ignore anything incoming.  This avoids passing it to
partially torn down subsystems like the objecter.

Signed-off-by: Sage Weil <sage@newdream.net>
src/librados.cc

index 9e728982a4cb292a0f09d1f07d1a2ef6835c797b..4b0832139ddc38f2388ce894ae90fbf9933376b4 100644 (file)
@@ -1035,8 +1035,16 @@ librados::RadosClient::~RadosClient()
 
 bool librados::RadosClient::ms_dispatch(Message *m)
 {
+  bool ret;
+
   lock.Lock();
-  bool ret = _dispatch(m);
+  if (state == DISCONNECTED) {
+    ldout(cct, 10) << "disconnected, discarding " << *m << dendl;
+    m->put();
+    ret = true;
+  } else {
+  ret = _dispatch(m);
+  }
   lock.Unlock();
   return ret;
 }