|
| 1 | +rxrpc: Stash the network namespace pointer in rxrpc_local |
| 2 | + |
| 3 | +jira LE-1907 |
| 4 | +Rebuild_History Non-Buildable kernel-rt-5.14.0-284.30.1.rt14.315.el9_2 |
| 5 | +commit-author David Howells <dhowells@redhat.com> |
| 6 | +commit 8a758d98dba380a7d32a98b0840ad707e3036233 |
| 7 | +Empty-Commit: Cherry-Pick Conflicts during history rebuild. |
| 8 | +Will be included in final tarball splat. Ref for failed cherry-pick at: |
| 9 | +ciq/ciq_backports/kernel-rt-5.14.0-284.30.1.rt14.315.el9_2/8a758d98.failed |
| 10 | + |
| 11 | +Stash the network namespace pointer in the rxrpc_local struct in addition |
| 12 | +to a pointer to the rxrpc-specific net namespace info. Use this to remove |
| 13 | +some places where the socket is passed as a parameter. |
| 14 | + |
| 15 | + Signed-off-by: David Howells <dhowells@redhat.com> |
| 16 | +cc: Marc Dionne <marc.dionne@auristor.com> |
| 17 | +cc: linux-afs@lists.infradead.org |
| 18 | +(cherry picked from commit 8a758d98dba380a7d32a98b0840ad707e3036233) |
| 19 | + Signed-off-by: Jonathan Maple <jmaple@ciq.com> |
| 20 | + |
| 21 | +# Conflicts: |
| 22 | +# net/rxrpc/ar-internal.h |
| 23 | +diff --cc net/rxrpc/ar-internal.h |
| 24 | +index 46ce41afb431,9cf763c338bc..000000000000 |
| 25 | +--- a/net/rxrpc/ar-internal.h |
| 26 | ++++ b/net/rxrpc/ar-internal.h |
| 27 | +@@@ -276,16 -283,16 +276,17 @@@ struct rxrpc_local |
| 28 | + struct rcu_head rcu; |
| 29 | + atomic_t active_users; /* Number of users of the local endpoint */ |
| 30 | + refcount_t ref; /* Number of references to the structure */ |
| 31 | +- struct rxrpc_net *rxnet; /* The network ns in which this resides */ |
| 32 | ++ struct net *net; /* The network namespace */ |
| 33 | ++ struct rxrpc_net *rxnet; /* Our bits in the network namespace */ |
| 34 | + struct hlist_node link; |
| 35 | + struct socket *socket; /* my UDP socket */ |
| 36 | + - struct task_struct *io_thread; |
| 37 | + - struct completion io_thread_ready; /* Indication that the I/O thread started */ |
| 38 | + + struct work_struct processor; |
| 39 | + + struct list_head ack_tx_queue; /* List of ACKs that need sending */ |
| 40 | + + spinlock_t ack_tx_lock; /* ACK list lock */ |
| 41 | + struct rxrpc_sock __rcu *service; /* Service(s) listening on this endpoint */ |
| 42 | + struct rw_semaphore defrag_sem; /* control re-enablement of IP DF bit */ |
| 43 | + - struct sk_buff_head rx_queue; /* Received packets */ |
| 44 | + - struct list_head call_attend_q; /* Calls requiring immediate attention */ |
| 45 | + + struct sk_buff_head reject_queue; /* packets awaiting rejection */ |
| 46 | + + struct sk_buff_head event_queue; /* endpoint event packets awaiting processing */ |
| 47 | + struct rb_root client_bundles; /* Client connection bundles by socket params */ |
| 48 | + spinlock_t client_bundles_lock; /* Lock for client_bundles */ |
| 49 | + spinlock_t lock; /* access lock */ |
| 50 | +@@@ -1026,16 -1064,15 +1027,24 @@@ void rxrpc_peer_keepalive_worker(struc |
| 51 | + */ |
| 52 | + struct rxrpc_peer *rxrpc_lookup_peer_rcu(struct rxrpc_local *, |
| 53 | + const struct sockaddr_rxrpc *); |
| 54 | +++<<<<<<< HEAD |
| 55 | + +struct rxrpc_peer *rxrpc_lookup_peer(struct rxrpc_sock *, struct rxrpc_local *, |
| 56 | + + struct sockaddr_rxrpc *, gfp_t); |
| 57 | + +struct rxrpc_peer *rxrpc_alloc_peer(struct rxrpc_local *, gfp_t); |
| 58 | + +void rxrpc_new_incoming_peer(struct rxrpc_sock *, struct rxrpc_local *, |
| 59 | + + struct rxrpc_peer *); |
| 60 | +++======= |
| 61 | ++ struct rxrpc_peer *rxrpc_lookup_peer(struct rxrpc_local *local, |
| 62 | ++ struct sockaddr_rxrpc *srx, gfp_t gfp); |
| 63 | ++ struct rxrpc_peer *rxrpc_alloc_peer(struct rxrpc_local *, gfp_t, |
| 64 | ++ enum rxrpc_peer_trace); |
| 65 | ++ void rxrpc_new_incoming_peer(struct rxrpc_local *local, struct rxrpc_peer *peer); |
| 66 | +++>>>>>>> 8a758d98dba3 (rxrpc: Stash the network namespace pointer in rxrpc_local) |
| 67 | + void rxrpc_destroy_all_peers(struct rxrpc_net *); |
| 68 | + -struct rxrpc_peer *rxrpc_get_peer(struct rxrpc_peer *, enum rxrpc_peer_trace); |
| 69 | + -struct rxrpc_peer *rxrpc_get_peer_maybe(struct rxrpc_peer *, enum rxrpc_peer_trace); |
| 70 | + -void rxrpc_put_peer(struct rxrpc_peer *, enum rxrpc_peer_trace); |
| 71 | + +struct rxrpc_peer *rxrpc_get_peer(struct rxrpc_peer *); |
| 72 | + +struct rxrpc_peer *rxrpc_get_peer_maybe(struct rxrpc_peer *); |
| 73 | + +void rxrpc_put_peer(struct rxrpc_peer *); |
| 74 | + +void rxrpc_put_peer_locked(struct rxrpc_peer *); |
| 75 | + |
| 76 | + /* |
| 77 | + * proc.c |
| 78 | +* Unmerged path net/rxrpc/ar-internal.h |
| 79 | +diff --git a/net/rxrpc/call_accept.c b/net/rxrpc/call_accept.c |
| 80 | +index afe1f587aaf0..15d680d0938f 100644 |
| 81 | +--- a/net/rxrpc/call_accept.c |
| 82 | ++++ b/net/rxrpc/call_accept.c |
| 83 | +@@ -295,7 +295,7 @@ static struct rxrpc_call *rxrpc_alloc_incoming_call(struct rxrpc_sock *rx, |
| 84 | + (peer_tail + 1) & |
| 85 | + (RXRPC_BACKLOG_MAX - 1)); |
| 86 | + |
| 87 | +- rxrpc_new_incoming_peer(rx, local, peer); |
| 88 | ++ rxrpc_new_incoming_peer(local, peer); |
| 89 | + } |
| 90 | + |
| 91 | + /* Now allocate and set up the connection */ |
| 92 | +diff --git a/net/rxrpc/conn_client.c b/net/rxrpc/conn_client.c |
| 93 | +index 827c1308297c..0545442024a4 100644 |
| 94 | +--- a/net/rxrpc/conn_client.c |
| 95 | ++++ b/net/rxrpc/conn_client.c |
| 96 | +@@ -363,7 +363,7 @@ static struct rxrpc_bundle *rxrpc_prep_call(struct rxrpc_sock *rx, |
| 97 | + |
| 98 | + _enter("{%d,%lx},", call->debug_id, call->user_call_ID); |
| 99 | + |
| 100 | +- cp->peer = rxrpc_lookup_peer(rx, cp->local, srx, gfp); |
| 101 | ++ cp->peer = rxrpc_lookup_peer(cp->local, srx, gfp); |
| 102 | + if (!cp->peer) |
| 103 | + goto error; |
| 104 | + |
| 105 | +diff --git a/net/rxrpc/local_object.c b/net/rxrpc/local_object.c |
| 106 | +index 846558613c7f..f0debb7ccdad 100644 |
| 107 | +--- a/net/rxrpc/local_object.c |
| 108 | ++++ b/net/rxrpc/local_object.c |
| 109 | +@@ -72,7 +72,7 @@ static long rxrpc_local_cmp_key(const struct rxrpc_local *local, |
| 110 | + /* |
| 111 | + * Allocate a new local endpoint. |
| 112 | + */ |
| 113 | +-static struct rxrpc_local *rxrpc_alloc_local(struct rxrpc_net *rxnet, |
| 114 | ++static struct rxrpc_local *rxrpc_alloc_local(struct net *net, |
| 115 | + const struct sockaddr_rxrpc *srx) |
| 116 | + { |
| 117 | + struct rxrpc_local *local; |
| 118 | +@@ -81,7 +81,8 @@ static struct rxrpc_local *rxrpc_alloc_local(struct rxrpc_net *rxnet, |
| 119 | + if (local) { |
| 120 | + refcount_set(&local->ref, 1); |
| 121 | + atomic_set(&local->active_users, 1); |
| 122 | +- local->rxnet = rxnet; |
| 123 | ++ local->net = net; |
| 124 | ++ local->rxnet = rxrpc_net(net); |
| 125 | + INIT_HLIST_NODE(&local->link); |
| 126 | + INIT_WORK(&local->processor, rxrpc_local_processor); |
| 127 | + INIT_LIST_HEAD(&local->ack_tx_queue); |
| 128 | +@@ -221,7 +222,7 @@ struct rxrpc_local *rxrpc_lookup_local(struct net *net, |
| 129 | + goto found; |
| 130 | + } |
| 131 | + |
| 132 | +- local = rxrpc_alloc_local(rxnet, srx); |
| 133 | ++ local = rxrpc_alloc_local(net, srx); |
| 134 | + if (!local) |
| 135 | + goto nomem; |
| 136 | + |
| 137 | +diff --git a/net/rxrpc/peer_object.c b/net/rxrpc/peer_object.c |
| 138 | +index 041a51225c5f..1f4ea29354a7 100644 |
| 139 | +--- a/net/rxrpc/peer_object.c |
| 140 | ++++ b/net/rxrpc/peer_object.c |
| 141 | +@@ -149,10 +149,10 @@ struct rxrpc_peer *rxrpc_lookup_peer_rcu(struct rxrpc_local *local, |
| 142 | + * assess the MTU size for the network interface through which this peer is |
| 143 | + * reached |
| 144 | + */ |
| 145 | +-static void rxrpc_assess_MTU_size(struct rxrpc_sock *rx, |
| 146 | ++static void rxrpc_assess_MTU_size(struct rxrpc_local *local, |
| 147 | + struct rxrpc_peer *peer) |
| 148 | + { |
| 149 | +- struct net *net = sock_net(&rx->sk); |
| 150 | ++ struct net *net = local->net; |
| 151 | + struct dst_entry *dst; |
| 152 | + struct rtable *rt; |
| 153 | + struct flowi fl; |
| 154 | +@@ -238,11 +238,11 @@ struct rxrpc_peer *rxrpc_alloc_peer(struct rxrpc_local *local, gfp_t gfp) |
| 155 | + /* |
| 156 | + * Initialise peer record. |
| 157 | + */ |
| 158 | +-static void rxrpc_init_peer(struct rxrpc_sock *rx, struct rxrpc_peer *peer, |
| 159 | ++static void rxrpc_init_peer(struct rxrpc_local *local, struct rxrpc_peer *peer, |
| 160 | + unsigned long hash_key) |
| 161 | + { |
| 162 | + peer->hash_key = hash_key; |
| 163 | +- rxrpc_assess_MTU_size(rx, peer); |
| 164 | ++ rxrpc_assess_MTU_size(local, peer); |
| 165 | + peer->mtu = peer->if_mtu; |
| 166 | + peer->rtt_last_req = ktime_get_real(); |
| 167 | + |
| 168 | +@@ -274,8 +274,7 @@ static void rxrpc_init_peer(struct rxrpc_sock *rx, struct rxrpc_peer *peer, |
| 169 | + /* |
| 170 | + * Set up a new peer. |
| 171 | + */ |
| 172 | +-static struct rxrpc_peer *rxrpc_create_peer(struct rxrpc_sock *rx, |
| 173 | +- struct rxrpc_local *local, |
| 174 | ++static struct rxrpc_peer *rxrpc_create_peer(struct rxrpc_local *local, |
| 175 | + struct sockaddr_rxrpc *srx, |
| 176 | + unsigned long hash_key, |
| 177 | + gfp_t gfp) |
| 178 | +@@ -287,7 +286,7 @@ static struct rxrpc_peer *rxrpc_create_peer(struct rxrpc_sock *rx, |
| 179 | + peer = rxrpc_alloc_peer(local, gfp); |
| 180 | + if (peer) { |
| 181 | + memcpy(&peer->srx, srx, sizeof(*srx)); |
| 182 | +- rxrpc_init_peer(rx, peer, hash_key); |
| 183 | ++ rxrpc_init_peer(local, peer, hash_key); |
| 184 | + } |
| 185 | + |
| 186 | + _leave(" = %p", peer); |
| 187 | +@@ -305,14 +304,13 @@ static void rxrpc_free_peer(struct rxrpc_peer *peer) |
| 188 | + * since we've already done a search in the list from the non-reentrant context |
| 189 | + * (the data_ready handler) that is the only place we can add new peers. |
| 190 | + */ |
| 191 | +-void rxrpc_new_incoming_peer(struct rxrpc_sock *rx, struct rxrpc_local *local, |
| 192 | +- struct rxrpc_peer *peer) |
| 193 | ++void rxrpc_new_incoming_peer(struct rxrpc_local *local, struct rxrpc_peer *peer) |
| 194 | + { |
| 195 | + struct rxrpc_net *rxnet = local->rxnet; |
| 196 | + unsigned long hash_key; |
| 197 | + |
| 198 | + hash_key = rxrpc_peer_hash_key(local, &peer->srx); |
| 199 | +- rxrpc_init_peer(rx, peer, hash_key); |
| 200 | ++ rxrpc_init_peer(local, peer, hash_key); |
| 201 | + |
| 202 | + spin_lock(&rxnet->peer_hash_lock); |
| 203 | + hash_add_rcu(rxnet->peer_hash, &peer->hash_link, hash_key); |
| 204 | +@@ -323,8 +321,7 @@ void rxrpc_new_incoming_peer(struct rxrpc_sock *rx, struct rxrpc_local *local, |
| 205 | + /* |
| 206 | + * obtain a remote transport endpoint for the specified address |
| 207 | + */ |
| 208 | +-struct rxrpc_peer *rxrpc_lookup_peer(struct rxrpc_sock *rx, |
| 209 | +- struct rxrpc_local *local, |
| 210 | ++struct rxrpc_peer *rxrpc_lookup_peer(struct rxrpc_local *local, |
| 211 | + struct sockaddr_rxrpc *srx, gfp_t gfp) |
| 212 | + { |
| 213 | + struct rxrpc_peer *peer, *candidate; |
| 214 | +@@ -344,7 +341,7 @@ struct rxrpc_peer *rxrpc_lookup_peer(struct rxrpc_sock *rx, |
| 215 | + /* The peer is not yet present in hash - create a candidate |
| 216 | + * for a new record and then redo the search. |
| 217 | + */ |
| 218 | +- candidate = rxrpc_create_peer(rx, local, srx, hash_key, gfp); |
| 219 | ++ candidate = rxrpc_create_peer(local, srx, hash_key, gfp); |
| 220 | + if (!candidate) { |
| 221 | + _leave(" = NULL [nomem]"); |
| 222 | + return NULL; |
0 commit comments