]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: simplify the session ref-counting branches
authorGreg Farnum <gregory.farnum@dreamhost.com>
Mon, 19 Sep 2011 22:47:14 +0000 (15:47 -0700)
committerGreg Farnum <gregory.farnum@dreamhost.com>
Thu, 6 Oct 2011 16:44:44 +0000 (09:44 -0700)
Signed-off-by: Greg Farnum <gregory.farnum@dreamhost.com>
src/osd/OSD.cc

index 889fb47b78d7e8da23052f0f5547f940af042a96..d13ca3b8307d1d5e148ee62ecafa2bf40e3f5f06 100644 (file)
@@ -2982,14 +2982,16 @@ void OSD::handle_osd_map(MOSDMap *m)
   }
 
   Session *session = (Session *)m->get_connection()->get_priv();
-  if (session && !(session->caps.is_mon() || session->caps.is_osd())) {
+  bool is_mon_or_osd = false;
+  if (session) {
+    is_mon_or_osd = session->caps.is_mon() || session->caps.is_osd();
+    session->put();
+  }
+  if (!is_mon_or_osd) {
     //not enough perms!
     m->put();
-    session->put();
     return;
   }
-  if (session)
-    session->put();
 
   epoch_t first = m->get_first();
   epoch_t last = m->get_last();