]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
messenger: Make sure to unlock existing->pipe_lock.
authorGreg Farnum <gregf@hq.newdream.net>
Mon, 18 Oct 2010 18:23:50 +0000 (11:23 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Mon, 18 Oct 2010 20:02:49 +0000 (13:02 -0700)
There are a few cases in the "open" section where we can go to
fail_unlocked while still holding existing->pipe_lock. So unlock it.

src/msg/SimpleMessenger.cc

index 463226777dbf6ddcda01742bfa69a70531a9d5fa..f826448d98d75e6d9f3f07e03b9ad48901616503 100644 (file)
@@ -842,13 +842,19 @@ int SimpleMessenger::Pipe::accept()
   messenger->lock.Unlock();
 
   rc = tcp_write(sd, (char*)&reply, sizeof(reply));
-  if (rc < 0)
+  if (rc < 0) {
+    if (existing)
+      existing->pipe_lock.Unlock();
     goto fail_unlocked;
+  }
 
   if (reply.authorizer_len) {
     rc = tcp_write(sd, authorizer_reply.c_str(), authorizer_reply.length());
-    if (rc < 0)
+    if (rc < 0) {
+      if (existing)
+        existing->pipe_lock.Unlock();
       goto fail_unlocked;
+    }
   }
 
   if (replace) {
@@ -856,10 +862,12 @@ int SimpleMessenger::Pipe::accept()
     if (reply_tag == CEPH_MSGR_TAG_SEQ) {
       if(tcp_write(sd, (char*)&existing->in_seq, sizeof(existing->in_seq)) < 0) {
         dout(2) << "accept write error on in_seq" << dendl;
+        existing->pipe_lock.Unlock();
         goto fail_unlocked;
       }
       if(tcp_read(sd, (char*)&newly_acked_seq, sizeof(newly_acked_seq)) < 0) {
         dout(2) << "accept read error on newly_acked_seq" << dendl;
+        existing->pipe_lock.Unlock();
         goto fail_unlocked;
       }
     }