rx: Avoid unnecessary locking in rxi_ReapConnections

rxi_ReapConnections obtains conn_data_lock and rx_refcnt_mutex for each
server connection in the rx_connHashTable.

Instead, only obtain these locks for server connections that have no
calls.

Change-Id: I27d748e604070792bee3c1f31d4d558462fd399a
Reviewed-on: https://gerrit.openafs.org/15349
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
This commit is contained in:
Mark Vitale 2022-10-17 16:27:30 -04:00 committed by Andrew Deason
parent c5993b0a4f
commit 4b5c803d8d

View File

@ -7226,12 +7226,14 @@ rxi_ReapConnections(struct rxevent *unused, void *unused1, void *unused2,
}
}
}
if (havecalls)
continue;
if (conn->type == RX_SERVER_CONNECTION) {
/* This only actually destroys the connection if
* there are no outstanding calls */
MUTEX_ENTER(&conn->conn_data_lock);
MUTEX_ENTER(&rx_refcnt_mutex);
if (!havecalls && !conn->refCount
if (!conn->refCount
&& ((conn->lastSendTime + rx_idleConnectionTime) <
now.sec)) {
conn->refCount++; /* it will be decr in rx_DestroyConn */