|
| 1 | +rxrpc: Make the set of connection IDs per local endpoint |
| 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 f06cb29189361353e9ed12df936c8e1d7f69b730 |
| 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/f06cb291.failed |
| 10 | + |
| 11 | +Make the set of connection IDs per local endpoint so that endpoints don't |
| 12 | +cause each other's connections to get dismissed. |
| 13 | + |
| 14 | + Signed-off-by: David Howells <dhowells@redhat.com> |
| 15 | +cc: Marc Dionne <marc.dionne@auristor.com> |
| 16 | +cc: linux-afs@lists.infradead.org |
| 17 | +(cherry picked from commit f06cb29189361353e9ed12df936c8e1d7f69b730) |
| 18 | + Signed-off-by: Jonathan Maple <jmaple@ciq.com> |
| 19 | + |
| 20 | +# Conflicts: |
| 21 | +# net/rxrpc/ar-internal.h |
| 22 | +# net/rxrpc/conn_client.c |
| 23 | +# net/rxrpc/conn_object.c |
| 24 | +# net/rxrpc/local_object.c |
| 25 | +diff --cc net/rxrpc/ar-internal.h |
| 26 | +index 46ce41afb431,e9ab06100a21..000000000000 |
| 27 | +--- a/net/rxrpc/ar-internal.h |
| 28 | ++++ b/net/rxrpc/ar-internal.h |
| 29 | +@@@ -860,11 -889,10 +862,16 @@@ static inline bool rxrpc_is_client_call |
| 30 | + extern unsigned int rxrpc_reap_client_connections; |
| 31 | + extern unsigned long rxrpc_conn_idle_client_expiry; |
| 32 | + extern unsigned long rxrpc_conn_idle_client_fast_expiry; |
| 33 | +- extern struct idr rxrpc_client_conn_ids; |
| 34 | + |
| 35 | +++<<<<<<< HEAD |
| 36 | + +void rxrpc_destroy_client_conn_ids(void); |
| 37 | + +struct rxrpc_bundle *rxrpc_get_bundle(struct rxrpc_bundle *); |
| 38 | + +void rxrpc_put_bundle(struct rxrpc_bundle *); |
| 39 | +++======= |
| 40 | ++ void rxrpc_destroy_client_conn_ids(struct rxrpc_local *local); |
| 41 | ++ struct rxrpc_bundle *rxrpc_get_bundle(struct rxrpc_bundle *, enum rxrpc_bundle_trace); |
| 42 | ++ void rxrpc_put_bundle(struct rxrpc_bundle *, enum rxrpc_bundle_trace); |
| 43 | +++>>>>>>> f06cb2918936 (rxrpc: Make the set of connection IDs per local endpoint) |
| 44 | + int rxrpc_connect_call(struct rxrpc_sock *, struct rxrpc_call *, |
| 45 | + struct rxrpc_conn_parameters *, struct sockaddr_rxrpc *, |
| 46 | + gfp_t); |
| 47 | +diff --cc net/rxrpc/conn_client.c |
| 48 | +index 827c1308297c,59ce5c08cf57..000000000000 |
| 49 | +--- a/net/rxrpc/conn_client.c |
| 50 | ++++ b/net/rxrpc/conn_client.c |
| 51 | +@@@ -51,7 -45,7 +45,11 @@@ static void rxrpc_deactivate_bundle(str |
| 52 | + static int rxrpc_get_client_connection_id(struct rxrpc_connection *conn, |
| 53 | + gfp_t gfp) |
| 54 | + { |
| 55 | +++<<<<<<< HEAD |
| 56 | + + struct rxrpc_net *rxnet = conn->params.local->rxnet; |
| 57 | +++======= |
| 58 | ++ struct rxrpc_local *local = conn->local; |
| 59 | +++>>>>>>> f06cb2918936 (rxrpc: Make the set of connection IDs per local endpoint) |
| 60 | + int id; |
| 61 | + |
| 62 | + _enter(""); |
| 63 | +@@@ -967,24 -976,7 +965,28 @@@ static void rxrpc_kill_client_conn(stru |
| 64 | + trace_rxrpc_client(conn, -1, rxrpc_client_cleanup); |
| 65 | + atomic_dec(&rxnet->nr_client_conns); |
| 66 | + |
| 67 | +++<<<<<<< HEAD |
| 68 | + + rxrpc_put_client_connection_id(conn); |
| 69 | + + rxrpc_kill_connection(conn); |
| 70 | + +} |
| 71 | + + |
| 72 | + +/* |
| 73 | + + * Clean up a dead client connections. |
| 74 | + + */ |
| 75 | + +void rxrpc_put_client_conn(struct rxrpc_connection *conn) |
| 76 | + +{ |
| 77 | + + const void *here = __builtin_return_address(0); |
| 78 | + + unsigned int debug_id = conn->debug_id; |
| 79 | + + bool dead; |
| 80 | + + int r; |
| 81 | + + |
| 82 | + + dead = __refcount_dec_and_test(&conn->ref, &r); |
| 83 | + + trace_rxrpc_conn(debug_id, rxrpc_conn_put_client, r - 1, here); |
| 84 | + + if (dead) |
| 85 | + + rxrpc_kill_client_conn(conn); |
| 86 | +++======= |
| 87 | ++ rxrpc_put_client_connection_id(local, conn); |
| 88 | +++>>>>>>> f06cb2918936 (rxrpc: Make the set of connection IDs per local endpoint) |
| 89 | + } |
| 90 | + |
| 91 | + /* |
| 92 | +diff --cc net/rxrpc/conn_object.c |
| 93 | +index 156bd26daf74,2e3f0a222e1b..000000000000 |
| 94 | +--- a/net/rxrpc/conn_object.c |
| 95 | ++++ b/net/rxrpc/conn_object.c |
| 96 | +@@@ -79,15 -100,12 +79,24 @@@ struct rxrpc_connection *rxrpc_find_con |
| 97 | + |
| 98 | + _enter(",%x", sp->hdr.cid & RXRPC_CIDMASK); |
| 99 | + |
| 100 | +++<<<<<<< HEAD |
| 101 | + + if (rxrpc_extract_addr_from_skb(&srx, skb) < 0) |
| 102 | + + goto not_found; |
| 103 | + + |
| 104 | + + if (srx.transport.family != local->srx.transport.family && |
| 105 | + + (srx.transport.family == AF_INET && |
| 106 | + + local->srx.transport.family != AF_INET6)) { |
| 107 | + + pr_warn_ratelimited("AF_RXRPC: Protocol mismatch %u not %u\n", |
| 108 | + + srx.transport.family, |
| 109 | + + local->srx.transport.family); |
| 110 | +++======= |
| 111 | ++ /* Look up client connections by connection ID alone as their |
| 112 | ++ * IDs are unique for this machine. |
| 113 | ++ */ |
| 114 | ++ conn = idr_find(&local->conn_ids, sp->hdr.cid >> RXRPC_CIDSHIFT); |
| 115 | ++ if (!conn || refcount_read(&conn->ref) == 0) { |
| 116 | ++ _debug("no conn"); |
| 117 | +++>>>>>>> f06cb2918936 (rxrpc: Make the set of connection IDs per local endpoint) |
| 118 | + goto not_found; |
| 119 | + } |
| 120 | + |
| 121 | +diff --cc net/rxrpc/local_object.c |
| 122 | +index 846558613c7f,ca8b3ee68b59..000000000000 |
| 123 | +--- a/net/rxrpc/local_object.c |
| 124 | ++++ b/net/rxrpc/local_object.c |
| 125 | +@@@ -96,7 -110,15 +97,19 @@@ static struct rxrpc_local *rxrpc_alloc_ |
| 126 | + local->debug_id = atomic_inc_return(&rxrpc_debug_id); |
| 127 | + memcpy(&local->srx, srx, sizeof(*srx)); |
| 128 | + local->srx.srx_service = 0; |
| 129 | +++<<<<<<< HEAD |
| 130 | + + trace_rxrpc_local(local->debug_id, rxrpc_local_new, 1, NULL); |
| 131 | +++======= |
| 132 | ++ idr_init(&local->conn_ids); |
| 133 | ++ get_random_bytes(&tmp, sizeof(tmp)); |
| 134 | ++ tmp &= 0x3fffffff; |
| 135 | ++ if (tmp == 0) |
| 136 | ++ tmp = 1; |
| 137 | ++ idr_set_cursor(&local->conn_ids, tmp); |
| 138 | ++ spin_lock_init(&local->conn_lock); |
| 139 | ++ |
| 140 | ++ trace_rxrpc_local(local->debug_id, rxrpc_local_new, 1, 1); |
| 141 | +++>>>>>>> f06cb2918936 (rxrpc: Make the set of connection IDs per local endpoint) |
| 142 | + } |
| 143 | + |
| 144 | + _leave(" = %p", local); |
| 145 | +@@@ -393,52 -417,8 +406,57 @@@ static void rxrpc_local_destroyer(struc |
| 146 | + /* At this point, there should be no more packets coming in to the |
| 147 | + * local endpoint. |
| 148 | + */ |
| 149 | +++<<<<<<< HEAD |
| 150 | + + rxrpc_purge_queue(&local->reject_queue); |
| 151 | + + rxrpc_purge_queue(&local->event_queue); |
| 152 | + +} |
| 153 | + + |
| 154 | + +/* |
| 155 | + + * Process events on an endpoint. The work item carries a ref which |
| 156 | + + * we must release. |
| 157 | + + */ |
| 158 | + +static void rxrpc_local_processor(struct work_struct *work) |
| 159 | + +{ |
| 160 | + + struct rxrpc_local *local = |
| 161 | + + container_of(work, struct rxrpc_local, processor); |
| 162 | + + bool again; |
| 163 | + + |
| 164 | + + if (local->dead) |
| 165 | + + return; |
| 166 | + + |
| 167 | + + trace_rxrpc_local(local->debug_id, rxrpc_local_processing, |
| 168 | + + refcount_read(&local->ref), NULL); |
| 169 | + + |
| 170 | + + do { |
| 171 | + + again = false; |
| 172 | + + if (!__rxrpc_use_local(local)) { |
| 173 | + + rxrpc_local_destroyer(local); |
| 174 | + + break; |
| 175 | + + } |
| 176 | + + |
| 177 | + + if (!list_empty(&local->ack_tx_queue)) { |
| 178 | + + rxrpc_transmit_ack_packets(local); |
| 179 | + + again = true; |
| 180 | + + } |
| 181 | + + |
| 182 | + + if (!skb_queue_empty(&local->reject_queue)) { |
| 183 | + + rxrpc_reject_packets(local); |
| 184 | + + again = true; |
| 185 | + + } |
| 186 | + + |
| 187 | + + if (!skb_queue_empty(&local->event_queue)) { |
| 188 | + + rxrpc_process_local_events(local); |
| 189 | + + again = true; |
| 190 | + + } |
| 191 | + + |
| 192 | + + __rxrpc_unuse_local(local); |
| 193 | + + } while (again); |
| 194 | + + |
| 195 | + + rxrpc_put_local(local); |
| 196 | +++======= |
| 197 | ++ rxrpc_purge_queue(&local->rx_queue); |
| 198 | ++ rxrpc_destroy_client_conn_ids(local); |
| 199 | +++>>>>>>> f06cb2918936 (rxrpc: Make the set of connection IDs per local endpoint) |
| 200 | + } |
| 201 | + |
| 202 | + /* |
| 203 | +diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c |
| 204 | +index 0f4d34f420f0..ef95d96ca2b1 100644 |
| 205 | +--- a/net/rxrpc/af_rxrpc.c |
| 206 | ++++ b/net/rxrpc/af_rxrpc.c |
| 207 | +@@ -957,16 +957,9 @@ static const struct net_proto_family rxrpc_family_ops = { |
| 208 | + static int __init af_rxrpc_init(void) |
| 209 | + { |
| 210 | + int ret = -1; |
| 211 | +- unsigned int tmp; |
| 212 | + |
| 213 | + BUILD_BUG_ON(sizeof(struct rxrpc_skb_priv) > sizeof_field(struct sk_buff, cb)); |
| 214 | + |
| 215 | +- get_random_bytes(&tmp, sizeof(tmp)); |
| 216 | +- tmp &= 0x3fffffff; |
| 217 | +- if (tmp == 0) |
| 218 | +- tmp = 1; |
| 219 | +- idr_set_cursor(&rxrpc_client_conn_ids, tmp); |
| 220 | +- |
| 221 | + ret = -ENOMEM; |
| 222 | + rxrpc_call_jar = kmem_cache_create( |
| 223 | + "rxrpc_call_jar", sizeof(struct rxrpc_call), 0, |
| 224 | +@@ -1062,7 +1055,6 @@ static void __exit af_rxrpc_exit(void) |
| 225 | + * are released. |
| 226 | + */ |
| 227 | + rcu_barrier(); |
| 228 | +- rxrpc_destroy_client_conn_ids(); |
| 229 | + |
| 230 | + destroy_workqueue(rxrpc_workqueue); |
| 231 | + rxrpc_exit_security(); |
| 232 | +* Unmerged path net/rxrpc/ar-internal.h |
| 233 | +* Unmerged path net/rxrpc/conn_client.c |
| 234 | +* Unmerged path net/rxrpc/conn_object.c |
| 235 | +* Unmerged path net/rxrpc/local_object.c |
0 commit comments