]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/async: dec active connections when marked down
authorPatrick Donnelly <pdonnell@redhat.com>
Fri, 5 Apr 2019 23:04:14 +0000 (16:04 -0700)
committerNathan Cutler <ncutler@suse.com>
Thu, 25 Apr 2019 07:47:12 +0000 (09:47 +0200)
Otherwise, tests can't tell when a connection is stopped until it's eventually
"lazily" deleted. This should be safe since the perf counter is manipulating an
atomic value.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit d2d38ac858cb6d01b2744d2c0e3b6c0b532470d2)

src/msg/async/AsyncMessenger.cc
src/msg/async/AsyncMessenger.h

index f6bcaa9b794eac33d001b89b96152b948471d98b..4517cbaad5fb73eeb98423921cf5ba743c5dc0bc 100644 (file)
@@ -860,7 +860,6 @@ int AsyncMessenger::accept_conn(AsyncConnectionRef conn)
     // If conn already in, we will return 0
     Mutex::Locker l(deleted_lock);
     if (deleted_conns.erase(existing)) {
-      existing->get_perf_counter()->dec(l_msgr_active_connections);
       conns.erase(it);
     } else if (conn != existing) {
       return -1;
index f13e30c0b962da252a212f34dbe138231f5151ad..809a3df9c163ce7feb238311443c1639d73bf97e 100644 (file)
@@ -315,7 +315,6 @@ private:
     // lazy delete, see "deleted_conns"
     Mutex::Locker l(deleted_lock);
     if (deleted_conns.erase(p->second)) {
-      p->second->get_perf_counter()->dec(l_msgr_active_connections);
       conns.erase(p);
       return NULL;
     }
@@ -403,6 +402,7 @@ public:
   void unregister_conn(AsyncConnectionRef conn) {
     Mutex::Locker l(deleted_lock);
     deleted_conns.insert(conn);
+    conn->get_perf_counter()->dec(l_msgr_active_connections);
 
     if (deleted_conns.size() >= ReapDeadConnectionThreshold) {
       local_worker->center.dispatch_event_external(reap_handler);