]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
msgr: reorder locking in mark_down()
authorSage Weil <sage@newdream.net>
Tue, 4 Nov 2008 00:42:22 +0000 (16:42 -0800)
committerSage Weil <sage@newdream.net>
Tue, 4 Nov 2008 00:54:32 +0000 (16:54 -0800)
There was a strange series of crashes when retaking Pipe::lock inside
stop().  Not exactly sure why, but this simplifies locking slightly, and
behaves.

src/msg/SimpleMessenger.cc

index 0b0a8643ba56d0c4883c43479e960c4a02b94377..d5f89fa77f71e3b3dc895ae998b1d6f4dc391962 100644 (file)
@@ -747,6 +747,7 @@ void Rank::mark_down(entity_addr_t addr)
   if (rank_pipe.count(addr)) {
     Pipe *p = rank_pipe[addr];
     dout(2) << "mark_down " << addr << " -- " << p << dendl;
+    p->unregister_pipe();
     lock.Unlock();
     p->lock.Lock();
     p->stop();
@@ -1370,6 +1371,13 @@ void Rank::Pipe::fail()
   for (unsigned i=0; i<rank.local.size(); i++) 
     if (rank.local[i] && rank.local[i]->get_dispatcher())
       rank.local[i]->queue_reset(peer_addr, last_dest_name);
+
+  // unregister
+  lock.Unlock();
+  rank.lock.Lock();
+  unregister_pipe();
+  rank.lock.Unlock();
+  lock.Lock();
 }
 
 void Rank::Pipe::was_session_reset()
@@ -1420,13 +1428,6 @@ void Rank::Pipe::stop()
   if (sd >= 0)
     ::close(sd);
   sd = -1;
-
-  // deactivate myself
-  lock.Unlock();
-  rank.lock.Lock();
-  unregister_pipe();
-  rank.lock.Unlock();
-  lock.Lock();
 }