]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/async/AsyncConnection: avoid dup RETRYGLOBAL sending
authorHaomai Wang <haomai@xsky.com>
Sun, 26 Jun 2016 15:07:18 +0000 (23:07 +0800)
committerHaomai Wang <haomai@xsky.com>
Wed, 29 Jun 2016 04:14:29 +0000 (12:14 +0800)
if two accept all going to dispatch RETRYGLOBAL sending, it will cause
invalid connect side receiver.

Signed-off-by: Haomai Wang <haomai@xsky.com>
src/msg/async/AsyncConnection.cc

index 7e14ff5df45a76b2b01f9259cb704fee528c240b..6f7a38d0acc1a93db45a01bff08e58fc01237228 100644 (file)
@@ -1832,15 +1832,18 @@ ssize_t AsyncConnection::handle_connect_msg(ceph_msg_connect &connect, bufferlis
     _stop();
     // queue a reset on the new connection, which we're dumping for the old
     dispatch_queue->queue_reset(this);
-    existing->lock.Unlock();
-
-    center->submit_to(existing->center->get_id(), [existing, connect, reply, authorizer_reply]() mutable {
+    int new_fd = existing->sd;
+    center->submit_to(existing->center->get_id(), [existing, new_fd, connect, reply, authorizer_reply]() mutable {
       Mutex::Locker l(existing->lock);
+      if (new_fd != existing->sd)
+        return ;
+
       if (existing->_reply_accept(CEPH_MSGR_TAG_RETRY_GLOBAL, connect, reply, authorizer_reply) < 0) {
         // handle error
         existing->fault();
       }
     }, true);
+    existing->lock.Unlock();
 
     return 0;
   }