From 6c635a66b54bcfa2920ac532905758346c89c772 Mon Sep 17 00:00:00 2001 From: Benjamin Kaduk Date: Thu, 16 Nov 2017 04:49:49 -0600 Subject: [PATCH] Sprinkle rx_GetConnection() for concision Instead of inlining the body (taking the lock, incrementing the refcount, and dropping the lock), use the convenience function designed for this purpose. Reviewed-on: https://gerrit.openafs.org/12772 Reviewed-by: Mark Vitale Tested-by: BuildBot Reviewed-by: Benjamin Kaduk (cherry picked from commit 2ae84bf053fe66b73a2c77b5d71305bae2c17587) Change-Id: I60794d877a76fbb7c8ba59207e710a20641cc8f1 Reviewed-on: https://gerrit.openafs.org/12778 Tested-by: BuildBot Reviewed-by: Michael Meffie Reviewed-by: Benjamin Kaduk --- src/rx/rx.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/rx/rx.c b/src/rx/rx.c index 95e88c291..ce9adcb43 100644 --- a/src/rx/rx.c +++ b/src/rx/rx.c @@ -2508,9 +2508,7 @@ rx_Finalize(void) for (conn = *conn_ptr; conn; conn = next) { next = conn->next; if (conn->type == RX_CLIENT_CONNECTION) { - MUTEX_ENTER(&rx_refcnt_mutex); - conn->refCount++; - MUTEX_EXIT(&rx_refcnt_mutex); + rx_GetConnection(conn); #ifdef RX_ENABLE_LOCKS rxi_DestroyConnectionNoLock(conn); #else /* RX_ENABLE_LOCKS */ @@ -2765,9 +2763,7 @@ rxi_FreeCall(struct rx_call *call, int haveCTLock) */ MUTEX_ENTER(&conn->conn_data_lock); if (conn->flags & RX_CONN_DESTROY_ME && !(conn->flags & RX_CONN_MAKECALL_WAITING)) { - MUTEX_ENTER(&rx_refcnt_mutex); - conn->refCount++; - MUTEX_EXIT(&rx_refcnt_mutex); + rx_GetConnection(conn); MUTEX_EXIT(&conn->conn_data_lock); #ifdef RX_ENABLE_LOCKS if (haveCTLock) @@ -3153,9 +3149,7 @@ rxi_FindConnection(osi_socket socket, afs_uint32 host, rx_atomic_inc(&rx_stats.nServerConns); } - MUTEX_ENTER(&rx_refcnt_mutex); - conn->refCount++; - MUTEX_EXIT(&rx_refcnt_mutex); + rx_GetConnection(conn); rxLastConn = conn; /* store this connection as the last conn used */ MUTEX_EXIT(&rx_connHashTable_lock); -- 2.11.4.GIT