aboutsummaryrefslogtreecommitdiffstats
path: root/net/rxrpc/conn_object.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2016-04-04 14:00:38 +0100
committerDavid Howells <dhowells@redhat.com>2016-06-22 09:17:51 +0100
commit5627cc8b961e4b07d5d649d9bd01ac929dcc1a95 (patch)
treea56752e988d6e458623e5f1f660b4b95d195007f /net/rxrpc/conn_object.c
parentrxrpc: Make rxrpc_send_packet() take a connection not a transport (diff)
downloadlinux-dev-5627cc8b961e4b07d5d649d9bd01ac929dcc1a95.tar.xz
linux-dev-5627cc8b961e4b07d5d649d9bd01ac929dcc1a95.zip
rxrpc: Provide more refcount helper functions
Provide refcount helper functions for connections so that the code doesn't touch local or connection usage counts directly. Also make it such that local and peer put functions can take a NULL pointer. Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'net/rxrpc/conn_object.c')
-rw-r--r--net/rxrpc/conn_object.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/net/rxrpc/conn_object.c b/net/rxrpc/conn_object.c
index 312b75091d29..1754f2e2e16b 100644
--- a/net/rxrpc/conn_object.c
+++ b/net/rxrpc/conn_object.c
@@ -333,7 +333,7 @@ static int rxrpc_connect_exclusive(struct rxrpc_sock *rx,
* channel.
*/
chan = 0;
- atomic_inc(&conn->usage);
+ rxrpc_get_connection(conn);
conn->avail_calls = RXRPC_MAXCALLS - 1;
conn->channels[chan] = call;
conn->call_counter = 1;
@@ -392,7 +392,7 @@ int rxrpc_connect_call(struct rxrpc_sock *rx,
conn->channels[1] == NULL ||
conn->channels[2] == NULL ||
conn->channels[3] == NULL);
- atomic_inc(&conn->usage);
+ rxrpc_get_connection(conn);
break;
}
@@ -412,7 +412,7 @@ int rxrpc_connect_call(struct rxrpc_sock *rx,
conn->channels[1] == NULL &&
conn->channels[2] == NULL &&
conn->channels[3] == NULL);
- atomic_inc(&conn->usage);
+ rxrpc_get_connection(conn);
list_move(&conn->bundle_link, &bundle->avail_conns);
break;
}
@@ -629,7 +629,7 @@ found_extant_connection:
read_unlock_bh(&trans->conn_lock);
goto security_mismatch;
}
- atomic_inc(&conn->usage);
+ rxrpc_get_connection(conn);
read_unlock_bh(&trans->conn_lock);
goto success;
@@ -639,7 +639,7 @@ found_extant_second:
write_unlock_bh(&trans->conn_lock);
goto security_mismatch;
}
- atomic_inc(&conn->usage);
+ rxrpc_get_connection(conn);
write_unlock_bh(&trans->conn_lock);
kfree(candidate);
goto success;
@@ -698,7 +698,7 @@ struct rxrpc_connection *rxrpc_find_connection(struct rxrpc_transport *trans,
return NULL;
found:
- atomic_inc(&conn->usage);
+ rxrpc_get_connection(conn);
read_unlock_bh(&trans->conn_lock);
_leave(" = %p", conn);
return conn;