David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 1 | /* RxRPC virtual connection handler |
| 2 | * |
| 3 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. |
| 4 | * Written by David Howells (dhowells@redhat.com) |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License |
| 8 | * as published by the Free Software Foundation; either version |
| 9 | * 2 of the License, or (at your option) any later version. |
| 10 | */ |
| 11 | |
Joe Perches | 9b6d539 | 2016-06-02 12:08:52 -0700 | [diff] [blame] | 12 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
| 13 | |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 14 | #include <linux/module.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 15 | #include <linux/slab.h> |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 16 | #include <linux/net.h> |
| 17 | #include <linux/skbuff.h> |
| 18 | #include <linux/crypto.h> |
| 19 | #include <net/sock.h> |
| 20 | #include <net/af_rxrpc.h> |
| 21 | #include "ar-internal.h" |
| 22 | |
David Howells | 5873c08 | 2014-02-07 18:58:44 +0000 | [diff] [blame] | 23 | /* |
| 24 | * Time till a connection expires after last use (in seconds). |
| 25 | */ |
David Howells | dad8aff | 2016-03-09 23:22:56 +0000 | [diff] [blame] | 26 | unsigned int rxrpc_connection_expiry = 10 * 60; |
David Howells | 5873c08 | 2014-02-07 18:58:44 +0000 | [diff] [blame] | 27 | |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 28 | static void rxrpc_connection_reaper(struct work_struct *work); |
| 29 | |
| 30 | LIST_HEAD(rxrpc_connections); |
| 31 | DEFINE_RWLOCK(rxrpc_connection_lock); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 32 | static DECLARE_DELAYED_WORK(rxrpc_connection_reap, rxrpc_connection_reaper); |
| 33 | |
| 34 | /* |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 35 | * allocate a new connection |
| 36 | */ |
| 37 | static struct rxrpc_connection *rxrpc_alloc_connection(gfp_t gfp) |
| 38 | { |
| 39 | struct rxrpc_connection *conn; |
| 40 | |
| 41 | _enter(""); |
| 42 | |
| 43 | conn = kzalloc(sizeof(struct rxrpc_connection), gfp); |
| 44 | if (conn) { |
David Howells | 999b69f | 2016-06-17 15:42:35 +0100 | [diff] [blame] | 45 | spin_lock_init(&conn->channel_lock); |
| 46 | init_waitqueue_head(&conn->channel_wq); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 47 | INIT_WORK(&conn->processor, &rxrpc_process_connection); |
David Howells | 999b69f | 2016-06-17 15:42:35 +0100 | [diff] [blame] | 48 | INIT_LIST_HEAD(&conn->link); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 49 | conn->calls = RB_ROOT; |
| 50 | skb_queue_head_init(&conn->rx_queue); |
David Howells | e0e4d82 | 2016-04-07 17:23:58 +0100 | [diff] [blame] | 51 | conn->security = &rxrpc_no_security; |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 52 | rwlock_init(&conn->lock); |
| 53 | spin_lock_init(&conn->state_lock); |
| 54 | atomic_set(&conn->usage, 1); |
| 55 | conn->debug_id = atomic_inc_return(&rxrpc_debug_id); |
David Howells | 999b69f | 2016-06-17 15:42:35 +0100 | [diff] [blame] | 56 | atomic_set(&conn->avail_chans, RXRPC_MAXCALLS); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 57 | conn->size_align = 4; |
David Howells | 0d12f8a | 2016-03-04 15:53:46 +0000 | [diff] [blame] | 58 | conn->header_size = sizeof(struct rxrpc_wire_header); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 59 | } |
| 60 | |
Adrian Bunk | 16c61ad | 2007-06-15 15:15:43 -0700 | [diff] [blame] | 61 | _leave(" = %p{%d}", conn, conn ? conn->debug_id : 0); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 62 | return conn; |
| 63 | } |
| 64 | |
| 65 | /* |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 66 | * add a call to a connection's call-by-ID tree |
| 67 | */ |
| 68 | static void rxrpc_add_call_ID_to_conn(struct rxrpc_connection *conn, |
| 69 | struct rxrpc_call *call) |
| 70 | { |
| 71 | struct rxrpc_call *xcall; |
| 72 | struct rb_node *parent, **p; |
David Howells | 88b99d0 | 2016-07-01 08:27:42 +0100 | [diff] [blame] | 73 | u32 call_id; |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 74 | |
| 75 | write_lock_bh(&conn->lock); |
| 76 | |
| 77 | call_id = call->call_id; |
| 78 | p = &conn->calls.rb_node; |
| 79 | parent = NULL; |
| 80 | while (*p) { |
| 81 | parent = *p; |
| 82 | xcall = rb_entry(parent, struct rxrpc_call, conn_node); |
| 83 | |
| 84 | if (call_id < xcall->call_id) |
| 85 | p = &(*p)->rb_left; |
| 86 | else if (call_id > xcall->call_id) |
| 87 | p = &(*p)->rb_right; |
| 88 | else |
| 89 | BUG(); |
| 90 | } |
| 91 | |
| 92 | rb_link_node(&call->conn_node, parent, p); |
| 93 | rb_insert_color(&call->conn_node, &conn->calls); |
| 94 | |
| 95 | write_unlock_bh(&conn->lock); |
| 96 | } |
| 97 | |
| 98 | /* |
David Howells | 999b69f | 2016-06-17 15:42:35 +0100 | [diff] [blame] | 99 | * Allocate a client connection. The caller must take care to clear any |
| 100 | * padding bytes in *cp. |
David Howells | 4a3388c | 2016-04-04 14:00:37 +0100 | [diff] [blame] | 101 | */ |
| 102 | static struct rxrpc_connection * |
David Howells | aa390bb | 2016-06-17 10:06:56 +0100 | [diff] [blame] | 103 | rxrpc_alloc_client_connection(struct rxrpc_conn_parameters *cp, gfp_t gfp) |
David Howells | 4a3388c | 2016-04-04 14:00:37 +0100 | [diff] [blame] | 104 | { |
| 105 | struct rxrpc_connection *conn; |
| 106 | int ret; |
| 107 | |
| 108 | _enter(""); |
| 109 | |
| 110 | conn = rxrpc_alloc_connection(gfp); |
| 111 | if (!conn) { |
| 112 | _leave(" = -ENOMEM"); |
| 113 | return ERR_PTR(-ENOMEM); |
| 114 | } |
| 115 | |
| 116 | conn->params = *cp; |
| 117 | conn->proto.local = cp->local; |
| 118 | conn->proto.epoch = rxrpc_epoch; |
| 119 | conn->proto.cid = 0; |
| 120 | conn->proto.in_clientflag = 0; |
| 121 | conn->proto.family = cp->peer->srx.transport.family; |
| 122 | conn->out_clientflag = RXRPC_CLIENT_INITIATED; |
| 123 | conn->state = RXRPC_CONN_CLIENT; |
| 124 | |
| 125 | switch (conn->proto.family) { |
| 126 | case AF_INET: |
| 127 | conn->proto.addr_size = sizeof(conn->proto.ipv4_addr); |
| 128 | conn->proto.ipv4_addr = cp->peer->srx.transport.sin.sin_addr; |
| 129 | conn->proto.port = cp->peer->srx.transport.sin.sin_port; |
| 130 | break; |
| 131 | } |
| 132 | |
David Howells | 999b69f | 2016-06-17 15:42:35 +0100 | [diff] [blame] | 133 | ret = rxrpc_get_client_connection_id(conn, gfp); |
David Howells | 4a3388c | 2016-04-04 14:00:37 +0100 | [diff] [blame] | 134 | if (ret < 0) |
| 135 | goto error_0; |
| 136 | |
| 137 | ret = rxrpc_init_client_conn_security(conn); |
| 138 | if (ret < 0) |
| 139 | goto error_1; |
| 140 | |
| 141 | conn->security->prime_packet_security(conn); |
| 142 | |
| 143 | write_lock(&rxrpc_connection_lock); |
| 144 | list_add_tail(&conn->link, &rxrpc_connections); |
| 145 | write_unlock(&rxrpc_connection_lock); |
| 146 | |
David Howells | aa390bb | 2016-06-17 10:06:56 +0100 | [diff] [blame] | 147 | /* We steal the caller's peer ref. */ |
| 148 | cp->peer = NULL; |
| 149 | rxrpc_get_local(conn->params.local); |
David Howells | 4a3388c | 2016-04-04 14:00:37 +0100 | [diff] [blame] | 150 | key_get(conn->params.key); |
| 151 | |
| 152 | _leave(" = %p", conn); |
| 153 | return conn; |
| 154 | |
| 155 | error_1: |
| 156 | rxrpc_put_client_connection_id(conn); |
| 157 | error_0: |
| 158 | kfree(conn); |
| 159 | _leave(" = %d", ret); |
| 160 | return ERR_PTR(ret); |
| 161 | } |
| 162 | |
| 163 | /* |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 164 | * find a connection for a call |
| 165 | * - called in process context with IRQs enabled |
| 166 | */ |
David Howells | 999b69f | 2016-06-17 15:42:35 +0100 | [diff] [blame] | 167 | int rxrpc_connect_call(struct rxrpc_call *call, |
David Howells | 19ffa01 | 2016-04-04 14:00:36 +0100 | [diff] [blame] | 168 | struct rxrpc_conn_parameters *cp, |
David Howells | 999b69f | 2016-06-17 15:42:35 +0100 | [diff] [blame] | 169 | struct sockaddr_rxrpc *srx, |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 170 | gfp_t gfp) |
| 171 | { |
David Howells | 999b69f | 2016-06-17 15:42:35 +0100 | [diff] [blame] | 172 | struct rxrpc_connection *conn, *candidate = NULL; |
| 173 | struct rxrpc_local *local = cp->local; |
| 174 | struct rb_node *p, **pp, *parent; |
| 175 | long diff; |
David Howells | 4a3388c | 2016-04-04 14:00:37 +0100 | [diff] [blame] | 176 | int chan; |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 177 | |
| 178 | DECLARE_WAITQUEUE(myself, current); |
| 179 | |
David Howells | 999b69f | 2016-06-17 15:42:35 +0100 | [diff] [blame] | 180 | _enter("{%d,%lx},", call->debug_id, call->user_call_ID); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 181 | |
David Howells | aa390bb | 2016-06-17 10:06:56 +0100 | [diff] [blame] | 182 | cp->peer = rxrpc_lookup_peer(cp->local, srx, gfp); |
| 183 | if (!cp->peer) |
| 184 | return -ENOMEM; |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 185 | |
David Howells | 999b69f | 2016-06-17 15:42:35 +0100 | [diff] [blame] | 186 | if (!cp->exclusive) { |
| 187 | /* Search for a existing client connection unless this is going |
| 188 | * to be a connection that's used exclusively for a single call. |
| 189 | */ |
| 190 | _debug("search 1"); |
| 191 | spin_lock(&local->client_conns_lock); |
| 192 | p = local->client_conns.rb_node; |
| 193 | while (p) { |
| 194 | conn = rb_entry(p, struct rxrpc_connection, client_node); |
| 195 | |
| 196 | #define cmp(X) ((long)conn->params.X - (long)cp->X) |
| 197 | diff = (cmp(peer) ?: |
| 198 | cmp(key) ?: |
| 199 | cmp(security_level)); |
| 200 | if (diff < 0) |
| 201 | p = p->rb_left; |
| 202 | else if (diff > 0) |
| 203 | p = p->rb_right; |
| 204 | else |
| 205 | goto found_extant_conn; |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 206 | } |
David Howells | 999b69f | 2016-06-17 15:42:35 +0100 | [diff] [blame] | 207 | spin_unlock(&local->client_conns_lock); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 208 | } |
| 209 | |
David Howells | 999b69f | 2016-06-17 15:42:35 +0100 | [diff] [blame] | 210 | /* We didn't find a connection or we want an exclusive one. */ |
| 211 | _debug("get new conn"); |
David Howells | aa390bb | 2016-06-17 10:06:56 +0100 | [diff] [blame] | 212 | candidate = rxrpc_alloc_client_connection(cp, gfp); |
David Howells | 999b69f | 2016-06-17 15:42:35 +0100 | [diff] [blame] | 213 | if (!candidate) { |
| 214 | _leave(" = -ENOMEM"); |
| 215 | return -ENOMEM; |
| 216 | } |
| 217 | |
| 218 | if (cp->exclusive) { |
| 219 | /* Assign the call on an exclusive connection to channel 0 and |
| 220 | * don't add the connection to the endpoint's shareable conn |
| 221 | * lookup tree. |
| 222 | */ |
| 223 | _debug("exclusive chan 0"); |
| 224 | conn = candidate; |
| 225 | atomic_set(&conn->avail_chans, RXRPC_MAXCALLS - 1); |
| 226 | spin_lock(&conn->channel_lock); |
| 227 | chan = 0; |
| 228 | goto found_channel; |
| 229 | } |
| 230 | |
| 231 | /* We need to redo the search before attempting to add a new connection |
| 232 | * lest we race with someone else adding a conflicting instance. |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 233 | */ |
David Howells | 999b69f | 2016-06-17 15:42:35 +0100 | [diff] [blame] | 234 | _debug("search 2"); |
| 235 | spin_lock(&local->client_conns_lock); |
| 236 | |
| 237 | pp = &local->client_conns.rb_node; |
| 238 | parent = NULL; |
| 239 | while (*pp) { |
| 240 | parent = *pp; |
| 241 | conn = rb_entry(parent, struct rxrpc_connection, client_node); |
| 242 | |
| 243 | diff = (cmp(peer) ?: |
| 244 | cmp(key) ?: |
| 245 | cmp(security_level)); |
| 246 | if (diff < 0) |
| 247 | pp = &(*pp)->rb_left; |
| 248 | else if (diff > 0) |
| 249 | pp = &(*pp)->rb_right; |
| 250 | else |
| 251 | goto found_extant_conn; |
| 252 | } |
| 253 | |
| 254 | /* The second search also failed; simply add the new connection with |
| 255 | * the new call in channel 0. Note that we need to take the channel |
| 256 | * lock before dropping the client conn lock. |
| 257 | */ |
| 258 | _debug("new conn"); |
| 259 | conn = candidate; |
| 260 | candidate = NULL; |
| 261 | |
| 262 | rb_link_node(&conn->client_node, parent, pp); |
| 263 | rb_insert_color(&conn->client_node, &local->client_conns); |
| 264 | |
| 265 | atomic_set(&conn->avail_chans, RXRPC_MAXCALLS - 1); |
| 266 | spin_lock(&conn->channel_lock); |
| 267 | spin_unlock(&local->client_conns_lock); |
| 268 | chan = 0; |
| 269 | |
| 270 | found_channel: |
| 271 | _debug("found chan"); |
| 272 | call->conn = conn; |
| 273 | call->channel = chan; |
| 274 | call->epoch = conn->proto.epoch; |
| 275 | call->cid = conn->proto.cid | chan; |
| 276 | call->call_id = ++conn->call_counter; |
| 277 | rcu_assign_pointer(conn->channels[chan], call); |
| 278 | |
| 279 | _net("CONNECT call %d on conn %d", call->debug_id, conn->debug_id); |
| 280 | |
| 281 | rxrpc_add_call_ID_to_conn(conn, call); |
| 282 | spin_unlock(&conn->channel_lock); |
David Howells | aa390bb | 2016-06-17 10:06:56 +0100 | [diff] [blame] | 283 | rxrpc_put_peer(cp->peer); |
| 284 | cp->peer = NULL; |
David Howells | 999b69f | 2016-06-17 15:42:35 +0100 | [diff] [blame] | 285 | _leave(" = %p {u=%d}", conn, atomic_read(&conn->usage)); |
| 286 | return 0; |
| 287 | |
| 288 | /* We found a suitable connection already in existence. Discard any |
| 289 | * candidate we may have allocated, and try to get a channel on this |
| 290 | * one. |
| 291 | */ |
| 292 | found_extant_conn: |
| 293 | _debug("found conn"); |
| 294 | rxrpc_get_connection(conn); |
| 295 | spin_unlock(&local->client_conns_lock); |
| 296 | |
| 297 | rxrpc_put_connection(candidate); |
| 298 | |
| 299 | if (!atomic_add_unless(&conn->avail_chans, -1, 0)) { |
| 300 | if (!gfpflags_allow_blocking(gfp)) { |
| 301 | rxrpc_put_connection(conn); |
| 302 | _leave(" = -EAGAIN"); |
| 303 | return -EAGAIN; |
| 304 | } |
| 305 | |
| 306 | add_wait_queue(&conn->channel_wq, &myself); |
| 307 | for (;;) { |
| 308 | set_current_state(TASK_INTERRUPTIBLE); |
| 309 | if (atomic_add_unless(&conn->avail_chans, -1, 0)) |
| 310 | break; |
| 311 | if (signal_pending(current)) |
| 312 | goto interrupted; |
| 313 | schedule(); |
| 314 | } |
| 315 | remove_wait_queue(&conn->channel_wq, &myself); |
| 316 | __set_current_state(TASK_RUNNING); |
| 317 | } |
| 318 | |
| 319 | /* The connection allegedly now has a free channel and we can now |
| 320 | * attach the call to it. |
| 321 | */ |
| 322 | spin_lock(&conn->channel_lock); |
| 323 | |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 324 | for (chan = 0; chan < RXRPC_MAXCALLS; chan++) |
| 325 | if (!conn->channels[chan]) |
| 326 | goto found_channel; |
| 327 | BUG(); |
| 328 | |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 329 | interrupted: |
David Howells | 999b69f | 2016-06-17 15:42:35 +0100 | [diff] [blame] | 330 | remove_wait_queue(&conn->channel_wq, &myself); |
| 331 | __set_current_state(TASK_RUNNING); |
| 332 | rxrpc_put_connection(conn); |
David Howells | aa390bb | 2016-06-17 10:06:56 +0100 | [diff] [blame] | 333 | rxrpc_put_peer(cp->peer); |
| 334 | cp->peer = NULL; |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 335 | _leave(" = -ERESTARTSYS"); |
| 336 | return -ERESTARTSYS; |
| 337 | } |
| 338 | |
| 339 | /* |
| 340 | * get a record of an incoming connection |
| 341 | */ |
David Howells | aa390bb | 2016-06-17 10:06:56 +0100 | [diff] [blame] | 342 | struct rxrpc_connection *rxrpc_incoming_connection(struct rxrpc_local *local, |
| 343 | struct rxrpc_peer *peer, |
David Howells | 999b69f | 2016-06-17 15:42:35 +0100 | [diff] [blame] | 344 | struct sk_buff *skb) |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 345 | { |
| 346 | struct rxrpc_connection *conn, *candidate = NULL; |
David Howells | 42886ff | 2016-06-16 13:31:07 +0100 | [diff] [blame] | 347 | struct rxrpc_skb_priv *sp = rxrpc_skb(skb); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 348 | struct rb_node *p, **pp; |
| 349 | const char *new = "old"; |
David Howells | 88b99d0 | 2016-07-01 08:27:42 +0100 | [diff] [blame] | 350 | u32 epoch, cid; |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 351 | |
| 352 | _enter(""); |
| 353 | |
David Howells | 42886ff | 2016-06-16 13:31:07 +0100 | [diff] [blame] | 354 | ASSERT(sp->hdr.flags & RXRPC_CLIENT_INITIATED); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 355 | |
David Howells | 42886ff | 2016-06-16 13:31:07 +0100 | [diff] [blame] | 356 | epoch = sp->hdr.epoch; |
| 357 | cid = sp->hdr.cid & RXRPC_CIDMASK; |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 358 | |
| 359 | /* search the connection list first */ |
David Howells | aa390bb | 2016-06-17 10:06:56 +0100 | [diff] [blame] | 360 | read_lock_bh(&peer->conn_lock); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 361 | |
David Howells | aa390bb | 2016-06-17 10:06:56 +0100 | [diff] [blame] | 362 | p = peer->service_conns.rb_node; |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 363 | while (p) { |
David Howells | 999b69f | 2016-06-17 15:42:35 +0100 | [diff] [blame] | 364 | conn = rb_entry(p, struct rxrpc_connection, service_node); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 365 | |
David Howells | 19ffa01 | 2016-04-04 14:00:36 +0100 | [diff] [blame] | 366 | _debug("maybe %x", conn->proto.cid); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 367 | |
David Howells | 19ffa01 | 2016-04-04 14:00:36 +0100 | [diff] [blame] | 368 | if (epoch < conn->proto.epoch) |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 369 | p = p->rb_left; |
David Howells | 19ffa01 | 2016-04-04 14:00:36 +0100 | [diff] [blame] | 370 | else if (epoch > conn->proto.epoch) |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 371 | p = p->rb_right; |
David Howells | 19ffa01 | 2016-04-04 14:00:36 +0100 | [diff] [blame] | 372 | else if (cid < conn->proto.cid) |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 373 | p = p->rb_left; |
David Howells | 19ffa01 | 2016-04-04 14:00:36 +0100 | [diff] [blame] | 374 | else if (cid > conn->proto.cid) |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 375 | p = p->rb_right; |
| 376 | else |
| 377 | goto found_extant_connection; |
| 378 | } |
David Howells | aa390bb | 2016-06-17 10:06:56 +0100 | [diff] [blame] | 379 | read_unlock_bh(&peer->conn_lock); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 380 | |
| 381 | /* not yet present - create a candidate for a new record and then |
| 382 | * redo the search */ |
David Howells | 843099c | 2016-04-07 17:23:37 +0100 | [diff] [blame] | 383 | candidate = rxrpc_alloc_connection(GFP_NOIO); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 384 | if (!candidate) { |
| 385 | _leave(" = -ENOMEM"); |
| 386 | return ERR_PTR(-ENOMEM); |
| 387 | } |
| 388 | |
David Howells | aa390bb | 2016-06-17 10:06:56 +0100 | [diff] [blame] | 389 | candidate->proto.local = local; |
David Howells | 42886ff | 2016-06-16 13:31:07 +0100 | [diff] [blame] | 390 | candidate->proto.epoch = sp->hdr.epoch; |
| 391 | candidate->proto.cid = sp->hdr.cid & RXRPC_CIDMASK; |
| 392 | candidate->proto.in_clientflag = RXRPC_CLIENT_INITIATED; |
David Howells | aa390bb | 2016-06-17 10:06:56 +0100 | [diff] [blame] | 393 | candidate->params.local = local; |
| 394 | candidate->params.peer = peer; |
David Howells | 42886ff | 2016-06-16 13:31:07 +0100 | [diff] [blame] | 395 | candidate->params.service_id = sp->hdr.serviceId; |
| 396 | candidate->security_ix = sp->hdr.securityIndex; |
| 397 | candidate->out_clientflag = 0; |
| 398 | candidate->state = RXRPC_CONN_SERVER; |
David Howells | 19ffa01 | 2016-04-04 14:00:36 +0100 | [diff] [blame] | 399 | if (candidate->params.service_id) |
David Howells | 42886ff | 2016-06-16 13:31:07 +0100 | [diff] [blame] | 400 | candidate->state = RXRPC_CONN_SERVER_UNSECURED; |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 401 | |
David Howells | aa390bb | 2016-06-17 10:06:56 +0100 | [diff] [blame] | 402 | write_lock_bh(&peer->conn_lock); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 403 | |
David Howells | aa390bb | 2016-06-17 10:06:56 +0100 | [diff] [blame] | 404 | pp = &peer->service_conns.rb_node; |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 405 | p = NULL; |
| 406 | while (*pp) { |
| 407 | p = *pp; |
David Howells | 999b69f | 2016-06-17 15:42:35 +0100 | [diff] [blame] | 408 | conn = rb_entry(p, struct rxrpc_connection, service_node); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 409 | |
David Howells | 19ffa01 | 2016-04-04 14:00:36 +0100 | [diff] [blame] | 410 | if (epoch < conn->proto.epoch) |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 411 | pp = &(*pp)->rb_left; |
David Howells | 19ffa01 | 2016-04-04 14:00:36 +0100 | [diff] [blame] | 412 | else if (epoch > conn->proto.epoch) |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 413 | pp = &(*pp)->rb_right; |
David Howells | 19ffa01 | 2016-04-04 14:00:36 +0100 | [diff] [blame] | 414 | else if (cid < conn->proto.cid) |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 415 | pp = &(*pp)->rb_left; |
David Howells | 19ffa01 | 2016-04-04 14:00:36 +0100 | [diff] [blame] | 416 | else if (cid > conn->proto.cid) |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 417 | pp = &(*pp)->rb_right; |
| 418 | else |
| 419 | goto found_extant_second; |
| 420 | } |
| 421 | |
| 422 | /* we can now add the new candidate to the list */ |
| 423 | conn = candidate; |
| 424 | candidate = NULL; |
David Howells | 999b69f | 2016-06-17 15:42:35 +0100 | [diff] [blame] | 425 | rb_link_node(&conn->service_node, p, pp); |
David Howells | aa390bb | 2016-06-17 10:06:56 +0100 | [diff] [blame] | 426 | rb_insert_color(&conn->service_node, &peer->service_conns); |
| 427 | rxrpc_get_peer(peer); |
| 428 | rxrpc_get_local(local); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 429 | |
David Howells | aa390bb | 2016-06-17 10:06:56 +0100 | [diff] [blame] | 430 | write_unlock_bh(&peer->conn_lock); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 431 | |
David Howells | b3f5750 | 2016-06-21 16:10:03 +0100 | [diff] [blame] | 432 | write_lock(&rxrpc_connection_lock); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 433 | list_add_tail(&conn->link, &rxrpc_connections); |
David Howells | b3f5750 | 2016-06-21 16:10:03 +0100 | [diff] [blame] | 434 | write_unlock(&rxrpc_connection_lock); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 435 | |
| 436 | new = "new"; |
| 437 | |
| 438 | success: |
David Howells | 19ffa01 | 2016-04-04 14:00:36 +0100 | [diff] [blame] | 439 | _net("CONNECTION %s %d {%x}", new, conn->debug_id, conn->proto.cid); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 440 | |
| 441 | _leave(" = %p {u=%d}", conn, atomic_read(&conn->usage)); |
| 442 | return conn; |
| 443 | |
| 444 | /* we found the connection in the list immediately */ |
| 445 | found_extant_connection: |
David Howells | 42886ff | 2016-06-16 13:31:07 +0100 | [diff] [blame] | 446 | if (sp->hdr.securityIndex != conn->security_ix) { |
David Howells | aa390bb | 2016-06-17 10:06:56 +0100 | [diff] [blame] | 447 | read_unlock_bh(&peer->conn_lock); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 448 | goto security_mismatch; |
| 449 | } |
David Howells | 5627cc8 | 2016-04-04 14:00:38 +0100 | [diff] [blame] | 450 | rxrpc_get_connection(conn); |
David Howells | aa390bb | 2016-06-17 10:06:56 +0100 | [diff] [blame] | 451 | read_unlock_bh(&peer->conn_lock); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 452 | goto success; |
| 453 | |
| 454 | /* we found the connection on the second time through the list */ |
| 455 | found_extant_second: |
David Howells | 42886ff | 2016-06-16 13:31:07 +0100 | [diff] [blame] | 456 | if (sp->hdr.securityIndex != conn->security_ix) { |
David Howells | aa390bb | 2016-06-17 10:06:56 +0100 | [diff] [blame] | 457 | write_unlock_bh(&peer->conn_lock); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 458 | goto security_mismatch; |
| 459 | } |
David Howells | 5627cc8 | 2016-04-04 14:00:38 +0100 | [diff] [blame] | 460 | rxrpc_get_connection(conn); |
David Howells | aa390bb | 2016-06-17 10:06:56 +0100 | [diff] [blame] | 461 | write_unlock_bh(&peer->conn_lock); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 462 | kfree(candidate); |
| 463 | goto success; |
| 464 | |
| 465 | security_mismatch: |
| 466 | kfree(candidate); |
| 467 | _leave(" = -EKEYREJECTED"); |
| 468 | return ERR_PTR(-EKEYREJECTED); |
| 469 | } |
| 470 | |
| 471 | /* |
| 472 | * find a connection based on transport and RxRPC connection ID for an incoming |
| 473 | * packet |
| 474 | */ |
David Howells | aa390bb | 2016-06-17 10:06:56 +0100 | [diff] [blame] | 475 | struct rxrpc_connection *rxrpc_find_connection(struct rxrpc_local *local, |
| 476 | struct rxrpc_peer *peer, |
David Howells | 42886ff | 2016-06-16 13:31:07 +0100 | [diff] [blame] | 477 | struct sk_buff *skb) |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 478 | { |
| 479 | struct rxrpc_connection *conn; |
David Howells | 42886ff | 2016-06-16 13:31:07 +0100 | [diff] [blame] | 480 | struct rxrpc_skb_priv *sp = rxrpc_skb(skb); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 481 | struct rb_node *p; |
David Howells | 0d12f8a | 2016-03-04 15:53:46 +0000 | [diff] [blame] | 482 | u32 epoch, cid; |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 483 | |
David Howells | 42886ff | 2016-06-16 13:31:07 +0100 | [diff] [blame] | 484 | _enter(",{%x,%x}", sp->hdr.cid, sp->hdr.flags); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 485 | |
David Howells | aa390bb | 2016-06-17 10:06:56 +0100 | [diff] [blame] | 486 | read_lock_bh(&peer->conn_lock); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 487 | |
David Howells | 42886ff | 2016-06-16 13:31:07 +0100 | [diff] [blame] | 488 | cid = sp->hdr.cid & RXRPC_CIDMASK; |
| 489 | epoch = sp->hdr.epoch; |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 490 | |
David Howells | 4a3388c | 2016-04-04 14:00:37 +0100 | [diff] [blame] | 491 | if (sp->hdr.flags & RXRPC_CLIENT_INITIATED) { |
David Howells | aa390bb | 2016-06-17 10:06:56 +0100 | [diff] [blame] | 492 | p = peer->service_conns.rb_node; |
David Howells | 4a3388c | 2016-04-04 14:00:37 +0100 | [diff] [blame] | 493 | while (p) { |
David Howells | 999b69f | 2016-06-17 15:42:35 +0100 | [diff] [blame] | 494 | conn = rb_entry(p, struct rxrpc_connection, service_node); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 495 | |
David Howells | 4a3388c | 2016-04-04 14:00:37 +0100 | [diff] [blame] | 496 | _debug("maybe %x", conn->proto.cid); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 497 | |
David Howells | 4a3388c | 2016-04-04 14:00:37 +0100 | [diff] [blame] | 498 | if (epoch < conn->proto.epoch) |
| 499 | p = p->rb_left; |
| 500 | else if (epoch > conn->proto.epoch) |
| 501 | p = p->rb_right; |
| 502 | else if (cid < conn->proto.cid) |
| 503 | p = p->rb_left; |
| 504 | else if (cid > conn->proto.cid) |
| 505 | p = p->rb_right; |
| 506 | else |
| 507 | goto found; |
| 508 | } |
| 509 | } else { |
| 510 | conn = idr_find(&rxrpc_client_conn_ids, cid >> RXRPC_CIDSHIFT); |
David Howells | 689f4c6 | 2016-06-30 11:34:30 +0100 | [diff] [blame^] | 511 | if (conn && |
| 512 | conn->proto.epoch == epoch && |
| 513 | conn->params.peer == peer) |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 514 | goto found; |
| 515 | } |
| 516 | |
David Howells | aa390bb | 2016-06-17 10:06:56 +0100 | [diff] [blame] | 517 | read_unlock_bh(&peer->conn_lock); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 518 | _leave(" = NULL"); |
| 519 | return NULL; |
| 520 | |
| 521 | found: |
David Howells | 5627cc8 | 2016-04-04 14:00:38 +0100 | [diff] [blame] | 522 | rxrpc_get_connection(conn); |
David Howells | aa390bb | 2016-06-17 10:06:56 +0100 | [diff] [blame] | 523 | read_unlock_bh(&peer->conn_lock); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 524 | _leave(" = %p", conn); |
| 525 | return conn; |
| 526 | } |
| 527 | |
| 528 | /* |
David Howells | 999b69f | 2016-06-17 15:42:35 +0100 | [diff] [blame] | 529 | * Disconnect a call and clear any channel it occupies when that call |
| 530 | * terminates. |
| 531 | */ |
| 532 | void rxrpc_disconnect_call(struct rxrpc_call *call) |
| 533 | { |
| 534 | struct rxrpc_connection *conn = call->conn; |
| 535 | unsigned chan = call->channel; |
| 536 | |
| 537 | _enter("%d,%d", conn->debug_id, call->channel); |
| 538 | |
| 539 | if (conn->channels[chan] == call) { |
| 540 | rcu_assign_pointer(conn->channels[chan], NULL); |
| 541 | atomic_inc(&conn->avail_chans); |
| 542 | wake_up(&conn->channel_wq); |
| 543 | } |
| 544 | } |
| 545 | |
| 546 | /* |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 547 | * release a virtual connection |
| 548 | */ |
| 549 | void rxrpc_put_connection(struct rxrpc_connection *conn) |
| 550 | { |
David Howells | 999b69f | 2016-06-17 15:42:35 +0100 | [diff] [blame] | 551 | if (!conn) |
| 552 | return; |
| 553 | |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 554 | _enter("%p{u=%d,d=%d}", |
| 555 | conn, atomic_read(&conn->usage), conn->debug_id); |
| 556 | |
| 557 | ASSERTCMP(atomic_read(&conn->usage), >, 0); |
| 558 | |
Ksenija Stanojevic | 22a3f9a | 2015-09-17 18:12:53 +0200 | [diff] [blame] | 559 | conn->put_time = ktime_get_seconds(); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 560 | if (atomic_dec_and_test(&conn->usage)) { |
| 561 | _debug("zombie"); |
David Howells | 651350d | 2007-04-26 15:50:17 -0700 | [diff] [blame] | 562 | rxrpc_queue_delayed_work(&rxrpc_connection_reap, 0); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 563 | } |
| 564 | |
| 565 | _leave(""); |
| 566 | } |
| 567 | |
| 568 | /* |
| 569 | * destroy a virtual connection |
| 570 | */ |
| 571 | static void rxrpc_destroy_connection(struct rxrpc_connection *conn) |
| 572 | { |
| 573 | _enter("%p{%d}", conn, atomic_read(&conn->usage)); |
| 574 | |
| 575 | ASSERTCMP(atomic_read(&conn->usage), ==, 0); |
| 576 | |
| 577 | _net("DESTROY CONN %d", conn->debug_id); |
| 578 | |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 579 | ASSERT(RB_EMPTY_ROOT(&conn->calls)); |
| 580 | rxrpc_purge_queue(&conn->rx_queue); |
| 581 | |
David Howells | e0e4d82 | 2016-04-07 17:23:58 +0100 | [diff] [blame] | 582 | conn->security->clear(conn); |
David Howells | 19ffa01 | 2016-04-04 14:00:36 +0100 | [diff] [blame] | 583 | key_put(conn->params.key); |
David Howells | e0e4d82 | 2016-04-07 17:23:58 +0100 | [diff] [blame] | 584 | key_put(conn->server_key); |
David Howells | aa390bb | 2016-06-17 10:06:56 +0100 | [diff] [blame] | 585 | rxrpc_put_peer(conn->params.peer); |
| 586 | rxrpc_put_local(conn->params.local); |
David Howells | e0e4d82 | 2016-04-07 17:23:58 +0100 | [diff] [blame] | 587 | |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 588 | kfree(conn); |
| 589 | _leave(""); |
| 590 | } |
| 591 | |
| 592 | /* |
| 593 | * reap dead connections |
| 594 | */ |
Roel Kluin | 5eaa65b | 2008-12-10 15:18:31 -0800 | [diff] [blame] | 595 | static void rxrpc_connection_reaper(struct work_struct *work) |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 596 | { |
| 597 | struct rxrpc_connection *conn, *_p; |
David Howells | aa390bb | 2016-06-17 10:06:56 +0100 | [diff] [blame] | 598 | struct rxrpc_peer *peer; |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 599 | unsigned long now, earliest, reap_time; |
| 600 | |
| 601 | LIST_HEAD(graveyard); |
| 602 | |
| 603 | _enter(""); |
| 604 | |
Ksenija Stanojevic | 22a3f9a | 2015-09-17 18:12:53 +0200 | [diff] [blame] | 605 | now = ktime_get_seconds(); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 606 | earliest = ULONG_MAX; |
| 607 | |
David Howells | b3f5750 | 2016-06-21 16:10:03 +0100 | [diff] [blame] | 608 | write_lock(&rxrpc_connection_lock); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 609 | list_for_each_entry_safe(conn, _p, &rxrpc_connections, link) { |
| 610 | _debug("reap CONN %d { u=%d,t=%ld }", |
| 611 | conn->debug_id, atomic_read(&conn->usage), |
| 612 | (long) now - (long) conn->put_time); |
| 613 | |
| 614 | if (likely(atomic_read(&conn->usage) > 0)) |
| 615 | continue; |
| 616 | |
David Howells | 999b69f | 2016-06-17 15:42:35 +0100 | [diff] [blame] | 617 | if (rxrpc_conn_is_client(conn)) { |
| 618 | struct rxrpc_local *local = conn->params.local; |
| 619 | spin_lock(&local->client_conns_lock); |
| 620 | reap_time = conn->put_time + rxrpc_connection_expiry; |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 621 | |
David Howells | 999b69f | 2016-06-17 15:42:35 +0100 | [diff] [blame] | 622 | if (atomic_read(&conn->usage) > 0) { |
| 623 | ; |
| 624 | } else if (reap_time <= now) { |
| 625 | list_move_tail(&conn->link, &graveyard); |
David Howells | 4a3388c | 2016-04-04 14:00:37 +0100 | [diff] [blame] | 626 | rxrpc_put_client_connection_id(conn); |
David Howells | 999b69f | 2016-06-17 15:42:35 +0100 | [diff] [blame] | 627 | rb_erase(&conn->client_node, |
| 628 | &local->client_conns); |
| 629 | } else if (reap_time < earliest) { |
| 630 | earliest = reap_time; |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 631 | } |
| 632 | |
David Howells | 999b69f | 2016-06-17 15:42:35 +0100 | [diff] [blame] | 633 | spin_unlock(&local->client_conns_lock); |
| 634 | } else { |
David Howells | aa390bb | 2016-06-17 10:06:56 +0100 | [diff] [blame] | 635 | peer = conn->params.peer; |
| 636 | write_lock_bh(&peer->conn_lock); |
David Howells | 999b69f | 2016-06-17 15:42:35 +0100 | [diff] [blame] | 637 | reap_time = conn->put_time + rxrpc_connection_expiry; |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 638 | |
David Howells | 999b69f | 2016-06-17 15:42:35 +0100 | [diff] [blame] | 639 | if (atomic_read(&conn->usage) > 0) { |
| 640 | ; |
| 641 | } else if (reap_time <= now) { |
| 642 | list_move_tail(&conn->link, &graveyard); |
| 643 | rb_erase(&conn->service_node, |
David Howells | aa390bb | 2016-06-17 10:06:56 +0100 | [diff] [blame] | 644 | &peer->service_conns); |
David Howells | 999b69f | 2016-06-17 15:42:35 +0100 | [diff] [blame] | 645 | } else if (reap_time < earliest) { |
| 646 | earliest = reap_time; |
| 647 | } |
| 648 | |
David Howells | aa390bb | 2016-06-17 10:06:56 +0100 | [diff] [blame] | 649 | write_unlock_bh(&peer->conn_lock); |
David Howells | 999b69f | 2016-06-17 15:42:35 +0100 | [diff] [blame] | 650 | } |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 651 | } |
David Howells | b3f5750 | 2016-06-21 16:10:03 +0100 | [diff] [blame] | 652 | write_unlock(&rxrpc_connection_lock); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 653 | |
| 654 | if (earliest != ULONG_MAX) { |
| 655 | _debug("reschedule reaper %ld", (long) earliest - now); |
| 656 | ASSERTCMP(earliest, >, now); |
David Howells | 651350d | 2007-04-26 15:50:17 -0700 | [diff] [blame] | 657 | rxrpc_queue_delayed_work(&rxrpc_connection_reap, |
| 658 | (earliest - now) * HZ); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 659 | } |
| 660 | |
| 661 | /* then destroy all those pulled out */ |
| 662 | while (!list_empty(&graveyard)) { |
| 663 | conn = list_entry(graveyard.next, struct rxrpc_connection, |
| 664 | link); |
| 665 | list_del_init(&conn->link); |
| 666 | |
| 667 | ASSERTCMP(atomic_read(&conn->usage), ==, 0); |
| 668 | rxrpc_destroy_connection(conn); |
| 669 | } |
| 670 | |
| 671 | _leave(""); |
| 672 | } |
| 673 | |
| 674 | /* |
| 675 | * preemptively destroy all the connection records rather than waiting for them |
| 676 | * to time out |
| 677 | */ |
| 678 | void __exit rxrpc_destroy_all_connections(void) |
| 679 | { |
| 680 | _enter(""); |
| 681 | |
David Howells | 5873c08 | 2014-02-07 18:58:44 +0000 | [diff] [blame] | 682 | rxrpc_connection_expiry = 0; |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 683 | cancel_delayed_work(&rxrpc_connection_reap); |
David Howells | 651350d | 2007-04-26 15:50:17 -0700 | [diff] [blame] | 684 | rxrpc_queue_delayed_work(&rxrpc_connection_reap, 0); |
David Howells | 17926a7 | 2007-04-26 15:48:28 -0700 | [diff] [blame] | 685 | |
| 686 | _leave(""); |
| 687 | } |