David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 1 | /* Maintain an RxRPC server socket to do AFS communications through |
| 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 | |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 12 | #include <linux/slab.h> |
Ingo Molnar | 174cd4b | 2017-02-02 19:15:33 +0100 | [diff] [blame] | 13 | #include <linux/sched/signal.h> |
| 14 | |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 15 | #include <net/sock.h> |
| 16 | #include <net/af_rxrpc.h> |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 17 | #include "internal.h" |
| 18 | #include "afs_cm.h" |
| 19 | |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 20 | struct workqueue_struct *afs_async_calls; |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 21 | |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 22 | static void afs_wake_up_call_waiter(struct sock *, struct rxrpc_call *, unsigned long); |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 23 | static int afs_wait_for_call_to_complete(struct afs_call *); |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 24 | static void afs_wake_up_async_call(struct sock *, struct rxrpc_call *, unsigned long); |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 25 | static void afs_process_async_call(struct work_struct *); |
David Howells | 00e9071 | 2016-09-08 11:10:12 +0100 | [diff] [blame] | 26 | static void afs_rx_new_call(struct sock *, struct rxrpc_call *, unsigned long); |
| 27 | static void afs_rx_discard_new_call(struct rxrpc_call *, unsigned long); |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 28 | static int afs_deliver_cm_op_id(struct afs_call *); |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 29 | |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 30 | /* asynchronous incoming call initial processing */ |
| 31 | static const struct afs_call_type afs_RXCMxxxx = { |
David Howells | 00d3b7a | 2007-04-26 15:57:07 -0700 | [diff] [blame] | 32 | .name = "CB.xxxx", |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 33 | .deliver = afs_deliver_cm_op_id, |
| 34 | .abort_to_error = afs_abort_to_error, |
| 35 | }; |
| 36 | |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 37 | /* |
| 38 | * open an RxRPC socket and bind it to be a server for callback notifications |
| 39 | * - the socket is left in blocking mode and non-blocking ops use MSG_DONTWAIT |
| 40 | */ |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 41 | int afs_open_socket(struct afs_net *net) |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 42 | { |
| 43 | struct sockaddr_rxrpc srx; |
| 44 | struct socket *socket; |
| 45 | int ret; |
| 46 | |
| 47 | _enter(""); |
| 48 | |
Eric W. Biederman | eeb1bd5 | 2015-05-08 21:08:05 -0500 | [diff] [blame] | 49 | ret = sock_create_kern(&init_net, AF_RXRPC, SOCK_DGRAM, PF_INET, &socket); |
David Howells | 0e119b4 | 2016-06-10 22:30:37 +0100 | [diff] [blame] | 50 | if (ret < 0) |
| 51 | goto error_1; |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 52 | |
| 53 | socket->sk->sk_allocation = GFP_NOFS; |
| 54 | |
| 55 | /* bind the callback manager's address to make this a server socket */ |
| 56 | srx.srx_family = AF_RXRPC; |
| 57 | srx.srx_service = CM_SERVICE; |
| 58 | srx.transport_type = SOCK_DGRAM; |
| 59 | srx.transport_len = sizeof(srx.transport.sin); |
| 60 | srx.transport.sin.sin_family = AF_INET; |
| 61 | srx.transport.sin.sin_port = htons(AFS_CM_PORT); |
| 62 | memset(&srx.transport.sin.sin_addr, 0, |
| 63 | sizeof(srx.transport.sin.sin_addr)); |
| 64 | |
| 65 | ret = kernel_bind(socket, (struct sockaddr *) &srx, sizeof(srx)); |
David Howells | 0e119b4 | 2016-06-10 22:30:37 +0100 | [diff] [blame] | 66 | if (ret < 0) |
| 67 | goto error_2; |
| 68 | |
David Howells | 00e9071 | 2016-09-08 11:10:12 +0100 | [diff] [blame] | 69 | rxrpc_kernel_new_call_notification(socket, afs_rx_new_call, |
| 70 | afs_rx_discard_new_call); |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 71 | |
David Howells | 0e119b4 | 2016-06-10 22:30:37 +0100 | [diff] [blame] | 72 | ret = kernel_listen(socket, INT_MAX); |
| 73 | if (ret < 0) |
| 74 | goto error_2; |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 75 | |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 76 | net->socket = socket; |
| 77 | afs_charge_preallocation(&net->charge_preallocation_work); |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 78 | _leave(" = 0"); |
| 79 | return 0; |
David Howells | 0e119b4 | 2016-06-10 22:30:37 +0100 | [diff] [blame] | 80 | |
| 81 | error_2: |
| 82 | sock_release(socket); |
| 83 | error_1: |
David Howells | 0e119b4 | 2016-06-10 22:30:37 +0100 | [diff] [blame] | 84 | _leave(" = %d", ret); |
| 85 | return ret; |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 86 | } |
| 87 | |
| 88 | /* |
| 89 | * close the RxRPC socket AFS was using |
| 90 | */ |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 91 | void afs_close_socket(struct afs_net *net) |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 92 | { |
| 93 | _enter(""); |
| 94 | |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 95 | kernel_listen(net->socket, 0); |
David Howells | 341f741 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 96 | flush_workqueue(afs_async_calls); |
| 97 | |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 98 | if (net->spare_incoming_call) { |
| 99 | afs_put_call(net->spare_incoming_call); |
| 100 | net->spare_incoming_call = NULL; |
David Howells | 00e9071 | 2016-09-08 11:10:12 +0100 | [diff] [blame] | 101 | } |
| 102 | |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 103 | _debug("outstanding %u", atomic_read(&net->nr_outstanding_calls)); |
| 104 | wait_on_atomic_t(&net->nr_outstanding_calls, atomic_t_wait, |
David Howells | 2f02f7a | 2016-04-07 17:23:03 +0100 | [diff] [blame] | 105 | TASK_UNINTERRUPTIBLE); |
| 106 | _debug("no outstanding calls"); |
| 107 | |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 108 | kernel_sock_shutdown(net->socket, SHUT_RDWR); |
David Howells | 248f219 | 2016-09-08 11:10:12 +0100 | [diff] [blame] | 109 | flush_workqueue(afs_async_calls); |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 110 | sock_release(net->socket); |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 111 | |
| 112 | _debug("dework"); |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 113 | _leave(""); |
| 114 | } |
| 115 | |
| 116 | /* |
David Howells | 341f741 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 117 | * Allocate a call. |
David Howells | 00d3b7a | 2007-04-26 15:57:07 -0700 | [diff] [blame] | 118 | */ |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 119 | static struct afs_call *afs_alloc_call(struct afs_net *net, |
| 120 | const struct afs_call_type *type, |
David Howells | 341f741 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 121 | gfp_t gfp) |
David Howells | 00d3b7a | 2007-04-26 15:57:07 -0700 | [diff] [blame] | 122 | { |
David Howells | 341f741 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 123 | struct afs_call *call; |
| 124 | int o; |
David Howells | 00d3b7a | 2007-04-26 15:57:07 -0700 | [diff] [blame] | 125 | |
David Howells | 341f741 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 126 | call = kzalloc(sizeof(*call), gfp); |
| 127 | if (!call) |
| 128 | return NULL; |
David Howells | 00d3b7a | 2007-04-26 15:57:07 -0700 | [diff] [blame] | 129 | |
David Howells | 341f741 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 130 | call->type = type; |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 131 | call->net = net; |
David Howells | 341f741 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 132 | atomic_set(&call->usage, 1); |
| 133 | INIT_WORK(&call->async_work, afs_process_async_call); |
| 134 | init_waitqueue_head(&call->waitq); |
David Howells | 2f02f7a | 2016-04-07 17:23:03 +0100 | [diff] [blame] | 135 | |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 136 | o = atomic_inc_return(&net->nr_outstanding_calls); |
David Howells | 341f741 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 137 | trace_afs_call(call, afs_call_trace_alloc, 1, o, |
| 138 | __builtin_return_address(0)); |
| 139 | return call; |
David Howells | 00d3b7a | 2007-04-26 15:57:07 -0700 | [diff] [blame] | 140 | } |
| 141 | |
| 142 | /* |
David Howells | 341f741 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 143 | * Dispose of a reference on a call. |
David Howells | 6c67c7c | 2014-05-21 14:48:05 +0100 | [diff] [blame] | 144 | */ |
David Howells | 341f741 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 145 | void afs_put_call(struct afs_call *call) |
David Howells | 6c67c7c | 2014-05-21 14:48:05 +0100 | [diff] [blame] | 146 | { |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 147 | struct afs_net *net = call->net; |
David Howells | 341f741 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 148 | int n = atomic_dec_return(&call->usage); |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 149 | int o = atomic_read(&net->nr_outstanding_calls); |
David Howells | 341f741 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 150 | |
| 151 | trace_afs_call(call, afs_call_trace_put, n + 1, o, |
| 152 | __builtin_return_address(0)); |
| 153 | |
| 154 | ASSERTCMP(n, >=, 0); |
| 155 | if (n == 0) { |
| 156 | ASSERT(!work_pending(&call->async_work)); |
| 157 | ASSERT(call->type->name != NULL); |
| 158 | |
| 159 | if (call->rxcall) { |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 160 | rxrpc_kernel_end_call(net->socket, call->rxcall); |
David Howells | 341f741 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 161 | call->rxcall = NULL; |
| 162 | } |
| 163 | if (call->type->destructor) |
| 164 | call->type->destructor(call); |
| 165 | |
| 166 | kfree(call->request); |
| 167 | kfree(call); |
| 168 | |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 169 | o = atomic_dec_return(&net->nr_outstanding_calls); |
David Howells | 341f741 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 170 | trace_afs_call(call, afs_call_trace_free, 0, o, |
| 171 | __builtin_return_address(0)); |
| 172 | if (o == 0) |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 173 | wake_up_atomic_t(&net->nr_outstanding_calls); |
David Howells | 6c67c7c | 2014-05-21 14:48:05 +0100 | [diff] [blame] | 174 | } |
Nathaniel Wesley Filardo | 6cf1286 | 2014-05-21 16:04:11 +0100 | [diff] [blame] | 175 | } |
| 176 | |
| 177 | /* |
David Howells | 341f741 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 178 | * Queue the call for actual work. Returns 0 unconditionally for convenience. |
Nathaniel Wesley Filardo | 6cf1286 | 2014-05-21 16:04:11 +0100 | [diff] [blame] | 179 | */ |
David Howells | 341f741 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 180 | int afs_queue_call_work(struct afs_call *call) |
Nathaniel Wesley Filardo | 6cf1286 | 2014-05-21 16:04:11 +0100 | [diff] [blame] | 181 | { |
David Howells | 341f741 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 182 | int u = atomic_inc_return(&call->usage); |
| 183 | |
| 184 | trace_afs_call(call, afs_call_trace_work, u, |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 185 | atomic_read(&call->net->nr_outstanding_calls), |
David Howells | 341f741 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 186 | __builtin_return_address(0)); |
| 187 | |
| 188 | INIT_WORK(&call->work, call->type->work); |
| 189 | |
| 190 | if (!queue_work(afs_wq, &call->work)) |
| 191 | afs_put_call(call); |
| 192 | return 0; |
David Howells | 6c67c7c | 2014-05-21 14:48:05 +0100 | [diff] [blame] | 193 | } |
| 194 | |
| 195 | /* |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 196 | * allocate a call with flat request and reply buffers |
| 197 | */ |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 198 | struct afs_call *afs_alloc_flat_call(struct afs_net *net, |
| 199 | const struct afs_call_type *type, |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 200 | size_t request_size, size_t reply_max) |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 201 | { |
| 202 | struct afs_call *call; |
| 203 | |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 204 | call = afs_alloc_call(net, type, GFP_NOFS); |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 205 | if (!call) |
| 206 | goto nomem_call; |
| 207 | |
David Howells | 00d3b7a | 2007-04-26 15:57:07 -0700 | [diff] [blame] | 208 | if (request_size) { |
David Howells | 341f741 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 209 | call->request_size = request_size; |
David Howells | 00d3b7a | 2007-04-26 15:57:07 -0700 | [diff] [blame] | 210 | call->request = kmalloc(request_size, GFP_NOFS); |
| 211 | if (!call->request) |
| 212 | goto nomem_free; |
| 213 | } |
| 214 | |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 215 | if (reply_max) { |
David Howells | 341f741 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 216 | call->reply_max = reply_max; |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 217 | call->buffer = kmalloc(reply_max, GFP_NOFS); |
David Howells | 00d3b7a | 2007-04-26 15:57:07 -0700 | [diff] [blame] | 218 | if (!call->buffer) |
| 219 | goto nomem_free; |
| 220 | } |
| 221 | |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 222 | init_waitqueue_head(&call->waitq); |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 223 | return call; |
| 224 | |
David Howells | 00d3b7a | 2007-04-26 15:57:07 -0700 | [diff] [blame] | 225 | nomem_free: |
David Howells | 341f741 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 226 | afs_put_call(call); |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 227 | nomem_call: |
| 228 | return NULL; |
| 229 | } |
| 230 | |
| 231 | /* |
| 232 | * clean up a call with flat buffer |
| 233 | */ |
| 234 | void afs_flat_call_destructor(struct afs_call *call) |
| 235 | { |
| 236 | _enter(""); |
| 237 | |
| 238 | kfree(call->request); |
| 239 | call->request = NULL; |
| 240 | kfree(call->buffer); |
| 241 | call->buffer = NULL; |
| 242 | } |
| 243 | |
David Howells | 2f5705a | 2017-03-16 16:27:46 +0000 | [diff] [blame] | 244 | #define AFS_BVEC_MAX 8 |
| 245 | |
| 246 | /* |
| 247 | * Load the given bvec with the next few pages. |
| 248 | */ |
| 249 | static void afs_load_bvec(struct afs_call *call, struct msghdr *msg, |
| 250 | struct bio_vec *bv, pgoff_t first, pgoff_t last, |
| 251 | unsigned offset) |
| 252 | { |
| 253 | struct page *pages[AFS_BVEC_MAX]; |
| 254 | unsigned int nr, n, i, to, bytes = 0; |
| 255 | |
| 256 | nr = min_t(pgoff_t, last - first + 1, AFS_BVEC_MAX); |
| 257 | n = find_get_pages_contig(call->mapping, first, nr, pages); |
| 258 | ASSERTCMP(n, ==, nr); |
| 259 | |
| 260 | msg->msg_flags |= MSG_MORE; |
| 261 | for (i = 0; i < nr; i++) { |
| 262 | to = PAGE_SIZE; |
| 263 | if (first + i >= last) { |
| 264 | to = call->last_to; |
| 265 | msg->msg_flags &= ~MSG_MORE; |
| 266 | } |
| 267 | bv[i].bv_page = pages[i]; |
| 268 | bv[i].bv_len = to - offset; |
| 269 | bv[i].bv_offset = offset; |
| 270 | bytes += to - offset; |
| 271 | offset = 0; |
| 272 | } |
| 273 | |
| 274 | iov_iter_bvec(&msg->msg_iter, WRITE | ITER_BVEC, bv, nr, bytes); |
| 275 | } |
| 276 | |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 277 | /* |
David Howells | e833251 | 2017-08-29 10:18:56 +0100 | [diff] [blame] | 278 | * Advance the AFS call state when the RxRPC call ends the transmit phase. |
| 279 | */ |
| 280 | static void afs_notify_end_request_tx(struct sock *sock, |
| 281 | struct rxrpc_call *rxcall, |
| 282 | unsigned long call_user_ID) |
| 283 | { |
| 284 | struct afs_call *call = (struct afs_call *)call_user_ID; |
| 285 | |
| 286 | if (call->state == AFS_CALL_REQUESTING) |
| 287 | call->state = AFS_CALL_AWAIT_REPLY; |
| 288 | } |
| 289 | |
| 290 | /* |
David Howells | 31143d5 | 2007-05-09 02:33:46 -0700 | [diff] [blame] | 291 | * attach the data from a bunch of pages on an inode to a call |
| 292 | */ |
Al Viro | 39c6ace | 2016-01-09 20:36:51 -0500 | [diff] [blame] | 293 | static int afs_send_pages(struct afs_call *call, struct msghdr *msg) |
David Howells | 31143d5 | 2007-05-09 02:33:46 -0700 | [diff] [blame] | 294 | { |
David Howells | 2f5705a | 2017-03-16 16:27:46 +0000 | [diff] [blame] | 295 | struct bio_vec bv[AFS_BVEC_MAX]; |
| 296 | unsigned int bytes, nr, loop, offset; |
David Howells | 31143d5 | 2007-05-09 02:33:46 -0700 | [diff] [blame] | 297 | pgoff_t first = call->first, last = call->last; |
| 298 | int ret; |
| 299 | |
David Howells | 31143d5 | 2007-05-09 02:33:46 -0700 | [diff] [blame] | 300 | offset = call->first_offset; |
| 301 | call->first_offset = 0; |
| 302 | |
| 303 | do { |
David Howells | 2f5705a | 2017-03-16 16:27:46 +0000 | [diff] [blame] | 304 | afs_load_bvec(call, msg, bv, first, last, offset); |
| 305 | offset = 0; |
| 306 | bytes = msg->msg_iter.count; |
| 307 | nr = msg->msg_iter.nr_segs; |
David Howells | 31143d5 | 2007-05-09 02:33:46 -0700 | [diff] [blame] | 308 | |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 309 | ret = rxrpc_kernel_send_data(call->net->socket, call->rxcall, msg, |
David Howells | e833251 | 2017-08-29 10:18:56 +0100 | [diff] [blame] | 310 | bytes, afs_notify_end_request_tx); |
David Howells | 2f5705a | 2017-03-16 16:27:46 +0000 | [diff] [blame] | 311 | for (loop = 0; loop < nr; loop++) |
| 312 | put_page(bv[loop].bv_page); |
David Howells | 31143d5 | 2007-05-09 02:33:46 -0700 | [diff] [blame] | 313 | if (ret < 0) |
| 314 | break; |
David Howells | 2f5705a | 2017-03-16 16:27:46 +0000 | [diff] [blame] | 315 | |
| 316 | first += nr; |
David Howells | 5bbf5d3 | 2007-05-10 03:15:23 -0700 | [diff] [blame] | 317 | } while (first <= last); |
David Howells | 31143d5 | 2007-05-09 02:33:46 -0700 | [diff] [blame] | 318 | |
David Howells | 31143d5 | 2007-05-09 02:33:46 -0700 | [diff] [blame] | 319 | return ret; |
| 320 | } |
| 321 | |
| 322 | /* |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 323 | * initiate a call |
| 324 | */ |
| 325 | int afs_make_call(struct in_addr *addr, struct afs_call *call, gfp_t gfp, |
David Howells | 56ff9c8 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 326 | bool async) |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 327 | { |
| 328 | struct sockaddr_rxrpc srx; |
| 329 | struct rxrpc_call *rxcall; |
| 330 | struct msghdr msg; |
| 331 | struct kvec iov[1]; |
David Howells | 70af0e3 | 2017-03-16 16:27:47 +0000 | [diff] [blame] | 332 | size_t offset; |
David Howells | e754eba | 2017-06-07 12:40:03 +0100 | [diff] [blame] | 333 | s64 tx_total_len; |
David Howells | 70af0e3 | 2017-03-16 16:27:47 +0000 | [diff] [blame] | 334 | u32 abort_code; |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 335 | int ret; |
| 336 | |
| 337 | _enter("%x,{%d},", addr->s_addr, ntohs(call->port)); |
| 338 | |
David Howells | 00d3b7a | 2007-04-26 15:57:07 -0700 | [diff] [blame] | 339 | ASSERT(call->type != NULL); |
| 340 | ASSERT(call->type->name != NULL); |
| 341 | |
David Howells | 31143d5 | 2007-05-09 02:33:46 -0700 | [diff] [blame] | 342 | _debug("____MAKE %p{%s,%x} [%d]____", |
| 343 | call, call->type->name, key_serial(call->key), |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 344 | atomic_read(&call->net->nr_outstanding_calls)); |
David Howells | 00d3b7a | 2007-04-26 15:57:07 -0700 | [diff] [blame] | 345 | |
David Howells | 56ff9c8 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 346 | call->async = async; |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 347 | |
| 348 | memset(&srx, 0, sizeof(srx)); |
| 349 | srx.srx_family = AF_RXRPC; |
| 350 | srx.srx_service = call->service_id; |
| 351 | srx.transport_type = SOCK_DGRAM; |
| 352 | srx.transport_len = sizeof(srx.transport.sin); |
| 353 | srx.transport.sin.sin_family = AF_INET; |
| 354 | srx.transport.sin.sin_port = call->port; |
| 355 | memcpy(&srx.transport.sin.sin_addr, addr, 4); |
| 356 | |
David Howells | e754eba | 2017-06-07 12:40:03 +0100 | [diff] [blame] | 357 | /* Work out the length we're going to transmit. This is awkward for |
| 358 | * calls such as FS.StoreData where there's an extra injection of data |
| 359 | * after the initial fixed part. |
| 360 | */ |
| 361 | tx_total_len = call->request_size; |
| 362 | if (call->send_pages) { |
| 363 | tx_total_len += call->last_to - call->first_offset; |
| 364 | tx_total_len += (call->last - call->first) * PAGE_SIZE; |
| 365 | } |
| 366 | |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 367 | /* create a call */ |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 368 | rxcall = rxrpc_kernel_begin_call(call->net->socket, &srx, call->key, |
David Howells | e754eba | 2017-06-07 12:40:03 +0100 | [diff] [blame] | 369 | (unsigned long)call, |
| 370 | tx_total_len, gfp, |
David Howells | 56ff9c8 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 371 | (async ? |
| 372 | afs_wake_up_async_call : |
David Howells | a68f4a2 | 2017-10-18 11:36:39 +0100 | [diff] [blame] | 373 | afs_wake_up_call_waiter), |
| 374 | call->upgrade); |
David Howells | 00d3b7a | 2007-04-26 15:57:07 -0700 | [diff] [blame] | 375 | call->key = NULL; |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 376 | if (IS_ERR(rxcall)) { |
| 377 | ret = PTR_ERR(rxcall); |
| 378 | goto error_kill_call; |
| 379 | } |
| 380 | |
| 381 | call->rxcall = rxcall; |
| 382 | |
| 383 | /* send the request */ |
| 384 | iov[0].iov_base = call->request; |
| 385 | iov[0].iov_len = call->request_size; |
| 386 | |
| 387 | msg.msg_name = NULL; |
| 388 | msg.msg_namelen = 0; |
Al Viro | 2e90b1c | 2014-11-27 21:50:31 -0500 | [diff] [blame] | 389 | iov_iter_kvec(&msg.msg_iter, WRITE | ITER_KVEC, iov, 1, |
Al Viro | c0371da | 2014-11-24 10:42:55 -0500 | [diff] [blame] | 390 | call->request_size); |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 391 | msg.msg_control = NULL; |
| 392 | msg.msg_controllen = 0; |
David Howells | bc5e3a5 | 2017-10-18 11:07:31 +0100 | [diff] [blame] | 393 | msg.msg_flags = MSG_WAITALL | (call->send_pages ? MSG_MORE : 0); |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 394 | |
David Howells | 70af0e3 | 2017-03-16 16:27:47 +0000 | [diff] [blame] | 395 | /* We have to change the state *before* sending the last packet as |
| 396 | * rxrpc might give us the reply before it returns from sending the |
| 397 | * request. Further, if the send fails, we may already have been given |
| 398 | * a notification and may have collected it. |
| 399 | */ |
David Howells | 31143d5 | 2007-05-09 02:33:46 -0700 | [diff] [blame] | 400 | if (!call->send_pages) |
| 401 | call->state = AFS_CALL_AWAIT_REPLY; |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 402 | ret = rxrpc_kernel_send_data(call->net->socket, rxcall, |
David Howells | e833251 | 2017-08-29 10:18:56 +0100 | [diff] [blame] | 403 | &msg, call->request_size, |
| 404 | afs_notify_end_request_tx); |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 405 | if (ret < 0) |
| 406 | goto error_do_abort; |
| 407 | |
David Howells | 31143d5 | 2007-05-09 02:33:46 -0700 | [diff] [blame] | 408 | if (call->send_pages) { |
Al Viro | 39c6ace | 2016-01-09 20:36:51 -0500 | [diff] [blame] | 409 | ret = afs_send_pages(call, &msg); |
David Howells | 31143d5 | 2007-05-09 02:33:46 -0700 | [diff] [blame] | 410 | if (ret < 0) |
| 411 | goto error_do_abort; |
| 412 | } |
| 413 | |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 414 | /* at this point, an async call may no longer exist as it may have |
| 415 | * already completed */ |
David Howells | 56ff9c8 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 416 | if (call->async) |
| 417 | return -EINPROGRESS; |
| 418 | |
| 419 | return afs_wait_for_call_to_complete(call); |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 420 | |
| 421 | error_do_abort: |
David Howells | 70af0e3 | 2017-03-16 16:27:47 +0000 | [diff] [blame] | 422 | call->state = AFS_CALL_COMPLETE; |
| 423 | if (ret != -ECONNABORTED) { |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 424 | rxrpc_kernel_abort_call(call->net->socket, rxcall, |
| 425 | RX_USER_ABORT, ret, "KSD"); |
David Howells | 70af0e3 | 2017-03-16 16:27:47 +0000 | [diff] [blame] | 426 | } else { |
| 427 | abort_code = 0; |
| 428 | offset = 0; |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 429 | rxrpc_kernel_recv_data(call->net->socket, rxcall, NULL, |
| 430 | 0, &offset, false, &abort_code, |
| 431 | &call->service_id); |
David Howells | 70af0e3 | 2017-03-16 16:27:47 +0000 | [diff] [blame] | 432 | ret = call->type->abort_to_error(abort_code); |
| 433 | } |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 434 | error_kill_call: |
David Howells | 341f741 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 435 | afs_put_call(call); |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 436 | _leave(" = %d", ret); |
| 437 | return ret; |
| 438 | } |
| 439 | |
| 440 | /* |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 441 | * deliver messages to a call |
| 442 | */ |
| 443 | static void afs_deliver_to_call(struct afs_call *call) |
| 444 | { |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 445 | u32 abort_code; |
| 446 | int ret; |
| 447 | |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 448 | _enter("%s", call->type->name); |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 449 | |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 450 | while (call->state == AFS_CALL_AWAIT_REPLY || |
| 451 | call->state == AFS_CALL_AWAIT_OP_ID || |
| 452 | call->state == AFS_CALL_AWAIT_REQUEST || |
| 453 | call->state == AFS_CALL_AWAIT_ACK |
| 454 | ) { |
| 455 | if (call->state == AFS_CALL_AWAIT_ACK) { |
| 456 | size_t offset = 0; |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 457 | ret = rxrpc_kernel_recv_data(call->net->socket, |
| 458 | call->rxcall, |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 459 | NULL, 0, &offset, false, |
David Howells | a68f4a2 | 2017-10-18 11:36:39 +0100 | [diff] [blame] | 460 | &call->abort_code, |
| 461 | &call->service_id); |
David Howells | 8e8d7f1 | 2017-01-05 10:38:34 +0000 | [diff] [blame] | 462 | trace_afs_recv_data(call, 0, offset, false, ret); |
| 463 | |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 464 | if (ret == -EINPROGRESS || ret == -EAGAIN) |
| 465 | return; |
David Howells | 9008f99 | 2016-10-06 08:11:50 +0100 | [diff] [blame] | 466 | if (ret == 1 || ret < 0) { |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 467 | call->state = AFS_CALL_COMPLETE; |
| 468 | goto done; |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 469 | } |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 470 | return; |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 471 | } |
| 472 | |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 473 | ret = call->type->deliver(call); |
| 474 | switch (ret) { |
| 475 | case 0: |
| 476 | if (call->state == AFS_CALL_AWAIT_REPLY) |
| 477 | call->state = AFS_CALL_COMPLETE; |
| 478 | goto done; |
| 479 | case -EINPROGRESS: |
| 480 | case -EAGAIN: |
| 481 | goto out; |
David Howells | 70af0e3 | 2017-03-16 16:27:47 +0000 | [diff] [blame] | 482 | case -ECONNABORTED: |
| 483 | goto call_complete; |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 484 | case -ENOTCONN: |
| 485 | abort_code = RX_CALL_DEAD; |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 486 | rxrpc_kernel_abort_call(call->net->socket, call->rxcall, |
David Howells | 3a92789 | 2017-04-06 10:11:56 +0100 | [diff] [blame] | 487 | abort_code, ret, "KNC"); |
David Howells | 70af0e3 | 2017-03-16 16:27:47 +0000 | [diff] [blame] | 488 | goto save_error; |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 489 | case -ENOTSUPP: |
David Howells | 1157f15 | 2017-03-16 16:27:47 +0000 | [diff] [blame] | 490 | abort_code = RXGEN_OPCODE; |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 491 | rxrpc_kernel_abort_call(call->net->socket, call->rxcall, |
David Howells | 3a92789 | 2017-04-06 10:11:56 +0100 | [diff] [blame] | 492 | abort_code, ret, "KIV"); |
David Howells | 70af0e3 | 2017-03-16 16:27:47 +0000 | [diff] [blame] | 493 | goto save_error; |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 494 | case -ENODATA: |
| 495 | case -EBADMSG: |
| 496 | case -EMSGSIZE: |
| 497 | default: |
| 498 | abort_code = RXGEN_CC_UNMARSHAL; |
| 499 | if (call->state != AFS_CALL_AWAIT_REPLY) |
| 500 | abort_code = RXGEN_SS_UNMARSHAL; |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 501 | rxrpc_kernel_abort_call(call->net->socket, call->rxcall, |
David Howells | 3a92789 | 2017-04-06 10:11:56 +0100 | [diff] [blame] | 502 | abort_code, -EBADMSG, "KUM"); |
David Howells | 70af0e3 | 2017-03-16 16:27:47 +0000 | [diff] [blame] | 503 | goto save_error; |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 504 | } |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 505 | } |
| 506 | |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 507 | done: |
| 508 | if (call->state == AFS_CALL_COMPLETE && call->incoming) |
David Howells | 341f741 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 509 | afs_put_call(call); |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 510 | out: |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 511 | _leave(""); |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 512 | return; |
| 513 | |
David Howells | 70af0e3 | 2017-03-16 16:27:47 +0000 | [diff] [blame] | 514 | save_error: |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 515 | call->error = ret; |
David Howells | 70af0e3 | 2017-03-16 16:27:47 +0000 | [diff] [blame] | 516 | call_complete: |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 517 | call->state = AFS_CALL_COMPLETE; |
| 518 | goto done; |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 519 | } |
| 520 | |
| 521 | /* |
| 522 | * wait synchronously for a call to complete |
| 523 | */ |
| 524 | static int afs_wait_for_call_to_complete(struct afs_call *call) |
| 525 | { |
David Howells | bc5e3a5 | 2017-10-18 11:07:31 +0100 | [diff] [blame] | 526 | signed long rtt2, timeout; |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 527 | int ret; |
David Howells | bc5e3a5 | 2017-10-18 11:07:31 +0100 | [diff] [blame] | 528 | u64 rtt; |
| 529 | u32 life, last_life; |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 530 | |
| 531 | DECLARE_WAITQUEUE(myself, current); |
| 532 | |
| 533 | _enter(""); |
| 534 | |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 535 | rtt = rxrpc_kernel_get_rtt(call->net->socket, call->rxcall); |
David Howells | bc5e3a5 | 2017-10-18 11:07:31 +0100 | [diff] [blame] | 536 | rtt2 = nsecs_to_jiffies64(rtt) * 2; |
| 537 | if (rtt2 < 2) |
| 538 | rtt2 = 2; |
| 539 | |
| 540 | timeout = rtt2; |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 541 | last_life = rxrpc_kernel_check_life(call->net->socket, call->rxcall); |
David Howells | bc5e3a5 | 2017-10-18 11:07:31 +0100 | [diff] [blame] | 542 | |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 543 | add_wait_queue(&call->waitq, &myself); |
| 544 | for (;;) { |
David Howells | bc5e3a5 | 2017-10-18 11:07:31 +0100 | [diff] [blame] | 545 | set_current_state(TASK_UNINTERRUPTIBLE); |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 546 | |
| 547 | /* deliver any messages that are in the queue */ |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 548 | if (call->state < AFS_CALL_COMPLETE && call->need_attention) { |
| 549 | call->need_attention = false; |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 550 | __set_current_state(TASK_RUNNING); |
| 551 | afs_deliver_to_call(call); |
| 552 | continue; |
| 553 | } |
| 554 | |
David Howells | bc5e3a5 | 2017-10-18 11:07:31 +0100 | [diff] [blame] | 555 | if (call->state == AFS_CALL_COMPLETE) |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 556 | break; |
David Howells | bc5e3a5 | 2017-10-18 11:07:31 +0100 | [diff] [blame] | 557 | |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 558 | life = rxrpc_kernel_check_life(call->net->socket, call->rxcall); |
David Howells | bc5e3a5 | 2017-10-18 11:07:31 +0100 | [diff] [blame] | 559 | if (timeout == 0 && |
| 560 | life == last_life && signal_pending(current)) |
| 561 | break; |
| 562 | |
| 563 | if (life != last_life) { |
| 564 | timeout = rtt2; |
| 565 | last_life = life; |
| 566 | } |
| 567 | |
| 568 | timeout = schedule_timeout(timeout); |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 569 | } |
| 570 | |
| 571 | remove_wait_queue(&call->waitq, &myself); |
| 572 | __set_current_state(TASK_RUNNING); |
| 573 | |
David Howells | 954cd6d | 2017-03-16 16:27:49 +0000 | [diff] [blame] | 574 | /* Kill off the call if it's still live. */ |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 575 | if (call->state < AFS_CALL_COMPLETE) { |
David Howells | 954cd6d | 2017-03-16 16:27:49 +0000 | [diff] [blame] | 576 | _debug("call interrupted"); |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 577 | rxrpc_kernel_abort_call(call->net->socket, call->rxcall, |
David Howells | 954cd6d | 2017-03-16 16:27:49 +0000 | [diff] [blame] | 578 | RX_USER_ABORT, -EINTR, "KWI"); |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 579 | } |
| 580 | |
David Howells | 954cd6d | 2017-03-16 16:27:49 +0000 | [diff] [blame] | 581 | ret = call->error; |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 582 | _debug("call complete"); |
David Howells | 341f741 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 583 | afs_put_call(call); |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 584 | _leave(" = %d", ret); |
| 585 | return ret; |
| 586 | } |
| 587 | |
| 588 | /* |
| 589 | * wake up a waiting call |
| 590 | */ |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 591 | static void afs_wake_up_call_waiter(struct sock *sk, struct rxrpc_call *rxcall, |
| 592 | unsigned long call_user_ID) |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 593 | { |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 594 | struct afs_call *call = (struct afs_call *)call_user_ID; |
| 595 | |
| 596 | call->need_attention = true; |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 597 | wake_up(&call->waitq); |
| 598 | } |
| 599 | |
| 600 | /* |
| 601 | * wake up an asynchronous call |
| 602 | */ |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 603 | static void afs_wake_up_async_call(struct sock *sk, struct rxrpc_call *rxcall, |
| 604 | unsigned long call_user_ID) |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 605 | { |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 606 | struct afs_call *call = (struct afs_call *)call_user_ID; |
David Howells | 341f741 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 607 | int u; |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 608 | |
David Howells | 8e8d7f1 | 2017-01-05 10:38:34 +0000 | [diff] [blame] | 609 | trace_afs_notify_call(rxcall, call); |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 610 | call->need_attention = true; |
David Howells | 341f741 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 611 | |
| 612 | u = __atomic_add_unless(&call->usage, 1, 0); |
| 613 | if (u != 0) { |
| 614 | trace_afs_call(call, afs_call_trace_wake, u, |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 615 | atomic_read(&call->net->nr_outstanding_calls), |
David Howells | 341f741 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 616 | __builtin_return_address(0)); |
| 617 | |
| 618 | if (!queue_work(afs_async_calls, &call->async_work)) |
| 619 | afs_put_call(call); |
| 620 | } |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 621 | } |
| 622 | |
| 623 | /* |
David Howells | 341f741 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 624 | * Delete an asynchronous call. The work item carries a ref to the call struct |
| 625 | * that we need to release. |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 626 | */ |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 627 | static void afs_delete_async_call(struct work_struct *work) |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 628 | { |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 629 | struct afs_call *call = container_of(work, struct afs_call, async_work); |
| 630 | |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 631 | _enter(""); |
| 632 | |
David Howells | 341f741 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 633 | afs_put_call(call); |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 634 | |
| 635 | _leave(""); |
| 636 | } |
| 637 | |
| 638 | /* |
David Howells | 341f741 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 639 | * Perform I/O processing on an asynchronous call. The work item carries a ref |
| 640 | * to the call struct that we either need to release or to pass on. |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 641 | */ |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 642 | static void afs_process_async_call(struct work_struct *work) |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 643 | { |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 644 | struct afs_call *call = container_of(work, struct afs_call, async_work); |
| 645 | |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 646 | _enter(""); |
| 647 | |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 648 | if (call->state < AFS_CALL_COMPLETE && call->need_attention) { |
| 649 | call->need_attention = false; |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 650 | afs_deliver_to_call(call); |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 651 | } |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 652 | |
David Howells | 56ff9c8 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 653 | if (call->state == AFS_CALL_COMPLETE) { |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 654 | call->reply = NULL; |
| 655 | |
David Howells | 341f741 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 656 | /* We have two refs to release - one from the alloc and one |
| 657 | * queued with the work item - and we can't just deallocate the |
| 658 | * call because the work item may be queued again. |
| 659 | */ |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 660 | call->async_work.func = afs_delete_async_call; |
David Howells | 341f741 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 661 | if (!queue_work(afs_async_calls, &call->async_work)) |
| 662 | afs_put_call(call); |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 663 | } |
| 664 | |
David Howells | 341f741 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 665 | afs_put_call(call); |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 666 | _leave(""); |
| 667 | } |
| 668 | |
David Howells | 00e9071 | 2016-09-08 11:10:12 +0100 | [diff] [blame] | 669 | static void afs_rx_attach(struct rxrpc_call *rxcall, unsigned long user_call_ID) |
| 670 | { |
| 671 | struct afs_call *call = (struct afs_call *)user_call_ID; |
| 672 | |
| 673 | call->rxcall = rxcall; |
| 674 | } |
| 675 | |
| 676 | /* |
| 677 | * Charge the incoming call preallocation. |
| 678 | */ |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 679 | void afs_charge_preallocation(struct work_struct *work) |
David Howells | 00e9071 | 2016-09-08 11:10:12 +0100 | [diff] [blame] | 680 | { |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 681 | struct afs_net *net = |
| 682 | container_of(work, struct afs_net, charge_preallocation_work); |
| 683 | struct afs_call *call = net->spare_incoming_call; |
David Howells | 00e9071 | 2016-09-08 11:10:12 +0100 | [diff] [blame] | 684 | |
| 685 | for (;;) { |
| 686 | if (!call) { |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 687 | call = afs_alloc_call(net, &afs_RXCMxxxx, GFP_KERNEL); |
David Howells | 00e9071 | 2016-09-08 11:10:12 +0100 | [diff] [blame] | 688 | if (!call) |
| 689 | break; |
| 690 | |
David Howells | 56ff9c8 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 691 | call->async = true; |
David Howells | 00e9071 | 2016-09-08 11:10:12 +0100 | [diff] [blame] | 692 | call->state = AFS_CALL_AWAIT_OP_ID; |
David Howells | 56ff9c8 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 693 | init_waitqueue_head(&call->waitq); |
David Howells | 00e9071 | 2016-09-08 11:10:12 +0100 | [diff] [blame] | 694 | } |
| 695 | |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 696 | if (rxrpc_kernel_charge_accept(net->socket, |
David Howells | 00e9071 | 2016-09-08 11:10:12 +0100 | [diff] [blame] | 697 | afs_wake_up_async_call, |
| 698 | afs_rx_attach, |
| 699 | (unsigned long)call, |
| 700 | GFP_KERNEL) < 0) |
| 701 | break; |
| 702 | call = NULL; |
| 703 | } |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 704 | net->spare_incoming_call = call; |
David Howells | 00e9071 | 2016-09-08 11:10:12 +0100 | [diff] [blame] | 705 | } |
| 706 | |
| 707 | /* |
| 708 | * Discard a preallocated call when a socket is shut down. |
| 709 | */ |
| 710 | static void afs_rx_discard_new_call(struct rxrpc_call *rxcall, |
| 711 | unsigned long user_call_ID) |
| 712 | { |
| 713 | struct afs_call *call = (struct afs_call *)user_call_ID; |
| 714 | |
David Howells | 00e9071 | 2016-09-08 11:10:12 +0100 | [diff] [blame] | 715 | call->rxcall = NULL; |
David Howells | 341f741 | 2017-01-05 10:38:36 +0000 | [diff] [blame] | 716 | afs_put_call(call); |
David Howells | 00e9071 | 2016-09-08 11:10:12 +0100 | [diff] [blame] | 717 | } |
| 718 | |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 719 | /* |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 720 | * Notification of an incoming call. |
| 721 | */ |
David Howells | 00e9071 | 2016-09-08 11:10:12 +0100 | [diff] [blame] | 722 | static void afs_rx_new_call(struct sock *sk, struct rxrpc_call *rxcall, |
| 723 | unsigned long user_call_ID) |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 724 | { |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 725 | struct afs_net *net = afs_sock2net(sk); |
| 726 | |
| 727 | queue_work(afs_wq, &net->charge_preallocation_work); |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 728 | } |
| 729 | |
| 730 | /* |
David Howells | 372ee16 | 2016-08-03 14:11:40 +0100 | [diff] [blame] | 731 | * Grab the operation ID from an incoming cache manager call. The socket |
| 732 | * buffer is discarded on error or if we don't yet have sufficient data. |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 733 | */ |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 734 | static int afs_deliver_cm_op_id(struct afs_call *call) |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 735 | { |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 736 | int ret; |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 737 | |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 738 | _enter("{%zu}", call->offset); |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 739 | |
| 740 | ASSERTCMP(call->offset, <, 4); |
| 741 | |
| 742 | /* the operation ID forms the first four bytes of the request data */ |
David Howells | 50a2c95 | 2016-10-13 08:27:10 +0100 | [diff] [blame] | 743 | ret = afs_extract_data(call, &call->tmp, 4, true); |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 744 | if (ret < 0) |
| 745 | return ret; |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 746 | |
David Howells | 50a2c95 | 2016-10-13 08:27:10 +0100 | [diff] [blame] | 747 | call->operation_ID = ntohl(call->tmp); |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 748 | call->state = AFS_CALL_AWAIT_REQUEST; |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 749 | call->offset = 0; |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 750 | |
| 751 | /* ask the cache manager to route the call (it'll change the call type |
| 752 | * if successful) */ |
| 753 | if (!afs_cm_incoming_call(call)) |
| 754 | return -ENOTSUPP; |
| 755 | |
David Howells | 8e8d7f1 | 2017-01-05 10:38:34 +0000 | [diff] [blame] | 756 | trace_afs_cb_call(call); |
| 757 | |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 758 | /* pass responsibility for the remainer of this message off to the |
| 759 | * cache manager op */ |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 760 | return call->type->deliver(call); |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 761 | } |
| 762 | |
| 763 | /* |
David Howells | e833251 | 2017-08-29 10:18:56 +0100 | [diff] [blame] | 764 | * Advance the AFS call state when an RxRPC service call ends the transmit |
| 765 | * phase. |
| 766 | */ |
| 767 | static void afs_notify_end_reply_tx(struct sock *sock, |
| 768 | struct rxrpc_call *rxcall, |
| 769 | unsigned long call_user_ID) |
| 770 | { |
| 771 | struct afs_call *call = (struct afs_call *)call_user_ID; |
| 772 | |
| 773 | if (call->state == AFS_CALL_REPLYING) |
| 774 | call->state = AFS_CALL_AWAIT_ACK; |
| 775 | } |
| 776 | |
| 777 | /* |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 778 | * send an empty reply |
| 779 | */ |
| 780 | void afs_send_empty_reply(struct afs_call *call) |
| 781 | { |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 782 | struct afs_net *net = call->net; |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 783 | struct msghdr msg; |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 784 | |
| 785 | _enter(""); |
| 786 | |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 787 | rxrpc_kernel_set_tx_length(net->socket, call->rxcall, 0); |
David Howells | e754eba | 2017-06-07 12:40:03 +0100 | [diff] [blame] | 788 | |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 789 | msg.msg_name = NULL; |
| 790 | msg.msg_namelen = 0; |
David Howells | bfd4e95 | 2015-04-01 16:03:46 +0100 | [diff] [blame] | 791 | iov_iter_kvec(&msg.msg_iter, WRITE | ITER_KVEC, NULL, 0, 0); |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 792 | msg.msg_control = NULL; |
| 793 | msg.msg_controllen = 0; |
| 794 | msg.msg_flags = 0; |
| 795 | |
| 796 | call->state = AFS_CALL_AWAIT_ACK; |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 797 | switch (rxrpc_kernel_send_data(net->socket, call->rxcall, &msg, 0, |
David Howells | e833251 | 2017-08-29 10:18:56 +0100 | [diff] [blame] | 798 | afs_notify_end_reply_tx)) { |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 799 | case 0: |
| 800 | _leave(" [replied]"); |
| 801 | return; |
| 802 | |
| 803 | case -ENOMEM: |
| 804 | _debug("oom"); |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 805 | rxrpc_kernel_abort_call(net->socket, call->rxcall, |
David Howells | 3a92789 | 2017-04-06 10:11:56 +0100 | [diff] [blame] | 806 | RX_USER_ABORT, -ENOMEM, "KOO"); |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 807 | default: |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 808 | _leave(" [error]"); |
| 809 | return; |
| 810 | } |
| 811 | } |
| 812 | |
| 813 | /* |
David Howells | b908fe6 | 2007-04-26 15:58:17 -0700 | [diff] [blame] | 814 | * send a simple reply |
| 815 | */ |
| 816 | void afs_send_simple_reply(struct afs_call *call, const void *buf, size_t len) |
| 817 | { |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 818 | struct afs_net *net = call->net; |
David Howells | b908fe6 | 2007-04-26 15:58:17 -0700 | [diff] [blame] | 819 | struct msghdr msg; |
Al Viro | 2e90b1c | 2014-11-27 21:50:31 -0500 | [diff] [blame] | 820 | struct kvec iov[1]; |
David Howells | bd6dc74 | 2007-07-20 10:59:41 +0100 | [diff] [blame] | 821 | int n; |
David Howells | b908fe6 | 2007-04-26 15:58:17 -0700 | [diff] [blame] | 822 | |
| 823 | _enter(""); |
| 824 | |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 825 | rxrpc_kernel_set_tx_length(net->socket, call->rxcall, len); |
David Howells | e754eba | 2017-06-07 12:40:03 +0100 | [diff] [blame] | 826 | |
David Howells | b908fe6 | 2007-04-26 15:58:17 -0700 | [diff] [blame] | 827 | iov[0].iov_base = (void *) buf; |
| 828 | iov[0].iov_len = len; |
| 829 | msg.msg_name = NULL; |
| 830 | msg.msg_namelen = 0; |
Al Viro | 2e90b1c | 2014-11-27 21:50:31 -0500 | [diff] [blame] | 831 | iov_iter_kvec(&msg.msg_iter, WRITE | ITER_KVEC, iov, 1, len); |
David Howells | b908fe6 | 2007-04-26 15:58:17 -0700 | [diff] [blame] | 832 | msg.msg_control = NULL; |
| 833 | msg.msg_controllen = 0; |
| 834 | msg.msg_flags = 0; |
| 835 | |
| 836 | call->state = AFS_CALL_AWAIT_ACK; |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 837 | n = rxrpc_kernel_send_data(net->socket, call->rxcall, &msg, len, |
David Howells | e833251 | 2017-08-29 10:18:56 +0100 | [diff] [blame] | 838 | afs_notify_end_reply_tx); |
David Howells | bd6dc74 | 2007-07-20 10:59:41 +0100 | [diff] [blame] | 839 | if (n >= 0) { |
David Howells | 6c67c7c | 2014-05-21 14:48:05 +0100 | [diff] [blame] | 840 | /* Success */ |
David Howells | b908fe6 | 2007-04-26 15:58:17 -0700 | [diff] [blame] | 841 | _leave(" [replied]"); |
| 842 | return; |
David Howells | bd6dc74 | 2007-07-20 10:59:41 +0100 | [diff] [blame] | 843 | } |
David Howells | 6c67c7c | 2014-05-21 14:48:05 +0100 | [diff] [blame] | 844 | |
David Howells | bd6dc74 | 2007-07-20 10:59:41 +0100 | [diff] [blame] | 845 | if (n == -ENOMEM) { |
David Howells | b908fe6 | 2007-04-26 15:58:17 -0700 | [diff] [blame] | 846 | _debug("oom"); |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 847 | rxrpc_kernel_abort_call(net->socket, call->rxcall, |
David Howells | 3a92789 | 2017-04-06 10:11:56 +0100 | [diff] [blame] | 848 | RX_USER_ABORT, -ENOMEM, "KOO"); |
David Howells | b908fe6 | 2007-04-26 15:58:17 -0700 | [diff] [blame] | 849 | } |
David Howells | bd6dc74 | 2007-07-20 10:59:41 +0100 | [diff] [blame] | 850 | _leave(" [error]"); |
David Howells | b908fe6 | 2007-04-26 15:58:17 -0700 | [diff] [blame] | 851 | } |
| 852 | |
| 853 | /* |
David Howells | 372ee16 | 2016-08-03 14:11:40 +0100 | [diff] [blame] | 854 | * Extract a piece of data from the received data socket buffers. |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 855 | */ |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 856 | int afs_extract_data(struct afs_call *call, void *buf, size_t count, |
| 857 | bool want_more) |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 858 | { |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 859 | struct afs_net *net = call->net; |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 860 | int ret; |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 861 | |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 862 | _enter("{%s,%zu},,%zu,%d", |
| 863 | call->type->name, call->offset, count, want_more); |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 864 | |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 865 | ASSERTCMP(call->offset, <=, count); |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 866 | |
David Howells | f044c88 | 2017-11-02 15:27:45 +0000 | [diff] [blame^] | 867 | ret = rxrpc_kernel_recv_data(net->socket, call->rxcall, |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 868 | buf, count, &call->offset, |
David Howells | a68f4a2 | 2017-10-18 11:36:39 +0100 | [diff] [blame] | 869 | want_more, &call->abort_code, |
| 870 | &call->service_id); |
David Howells | 8e8d7f1 | 2017-01-05 10:38:34 +0000 | [diff] [blame] | 871 | trace_afs_recv_data(call, count, call->offset, want_more, ret); |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 872 | if (ret == 0 || ret == -EAGAIN) |
| 873 | return ret; |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 874 | |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 875 | if (ret == 1) { |
| 876 | switch (call->state) { |
| 877 | case AFS_CALL_AWAIT_REPLY: |
| 878 | call->state = AFS_CALL_COMPLETE; |
| 879 | break; |
| 880 | case AFS_CALL_AWAIT_REQUEST: |
| 881 | call->state = AFS_CALL_REPLYING; |
| 882 | break; |
| 883 | default: |
| 884 | break; |
| 885 | } |
| 886 | return 0; |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 887 | } |
David Howells | d001648 | 2016-08-30 20:42:14 +0100 | [diff] [blame] | 888 | |
| 889 | if (ret == -ECONNABORTED) |
| 890 | call->error = call->type->abort_to_error(call->abort_code); |
| 891 | else |
| 892 | call->error = ret; |
| 893 | call->state = AFS_CALL_COMPLETE; |
| 894 | return ret; |
David Howells | 08e0e7c | 2007-04-26 15:55:03 -0700 | [diff] [blame] | 895 | } |