rxrpc: Move peer lookup from call-accept to new-incoming-conn
Move the lookup of a peer from a call that's being accepted into the function that creates a new incoming connection. This will allow us to avoid incrementing the peer's usage count in some cases in future. Note that I haven't bother to integrate rxrpc_get_addr_from_skb() with rxrpc_extract_addr_from_skb() as I'm going to delete the former in the very near future. Signed-off-by: David Howells <dhowells@redhat.com>
This commit is contained in:
@@ -75,7 +75,6 @@ static int rxrpc_accept_incoming_call(struct rxrpc_local *local,
|
||||
{
|
||||
struct rxrpc_connection *conn;
|
||||
struct rxrpc_skb_priv *sp, *nsp;
|
||||
struct rxrpc_peer *peer;
|
||||
struct rxrpc_call *call;
|
||||
struct sk_buff *notification;
|
||||
int ret;
|
||||
@@ -94,15 +93,7 @@ static int rxrpc_accept_incoming_call(struct rxrpc_local *local,
|
||||
rxrpc_new_skb(notification);
|
||||
notification->mark = RXRPC_SKB_MARK_NEW_CALL;
|
||||
|
||||
peer = rxrpc_lookup_peer(local, srx, GFP_NOIO);
|
||||
if (!peer) {
|
||||
_debug("no peer");
|
||||
ret = -EBUSY;
|
||||
goto error;
|
||||
}
|
||||
|
||||
conn = rxrpc_incoming_connection(local, peer, skb);
|
||||
rxrpc_put_peer(peer);
|
||||
conn = rxrpc_incoming_connection(local, srx, skb);
|
||||
if (IS_ERR(conn)) {
|
||||
_debug("no conn");
|
||||
ret = PTR_ERR(conn);
|
||||
@@ -226,20 +217,8 @@ void rxrpc_accept_incoming_calls(struct rxrpc_local *local)
|
||||
whdr._rsvd = 0;
|
||||
whdr.serviceId = htons(sp->hdr.serviceId);
|
||||
|
||||
/* determine the remote address */
|
||||
memset(&srx, 0, sizeof(srx));
|
||||
srx.srx_family = AF_RXRPC;
|
||||
srx.transport.family = local->srx.transport.family;
|
||||
srx.transport_type = local->srx.transport_type;
|
||||
switch (srx.transport.family) {
|
||||
case AF_INET:
|
||||
srx.transport_len = sizeof(struct sockaddr_in);
|
||||
srx.transport.sin.sin_port = udp_hdr(skb)->source;
|
||||
srx.transport.sin.sin_addr.s_addr = ip_hdr(skb)->saddr;
|
||||
break;
|
||||
default:
|
||||
goto busy;
|
||||
}
|
||||
if (rxrpc_extract_addr_from_skb(&srx, skb) < 0)
|
||||
goto drop;
|
||||
|
||||
/* get the socket providing the service */
|
||||
read_lock_bh(&local->services_lock);
|
||||
@@ -285,6 +264,10 @@ busy:
|
||||
rxrpc_free_skb(skb);
|
||||
return;
|
||||
|
||||
drop:
|
||||
rxrpc_free_skb(skb);
|
||||
return;
|
||||
|
||||
invalid_service:
|
||||
skb->priority = RX_INVALID_OPERATION;
|
||||
rxrpc_reject_packet(local, skb);
|
||||
|
Reference in New Issue
Block a user