1 /* Maintain an RxRPC server socket to do AFS communications through
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
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.
12 #include <linux/slab.h>
13 #include <linux/sched/signal.h>
16 #include <net/af_rxrpc.h>
19 #include "protocol_yfs.h"
21 struct workqueue_struct *afs_async_calls;
23 static void afs_wake_up_call_waiter(struct sock *, struct rxrpc_call *, unsigned long);
24 static long afs_wait_for_call_to_complete(struct afs_call *, struct afs_addr_cursor *);
25 static void afs_wake_up_async_call(struct sock *, struct rxrpc_call *, unsigned long);
26 static void afs_delete_async_call(struct work_struct *);
27 static void afs_process_async_call(struct work_struct *);
28 static void afs_rx_new_call(struct sock *, struct rxrpc_call *, unsigned long);
29 static void afs_rx_discard_new_call(struct rxrpc_call *, unsigned long);
30 static int afs_deliver_cm_op_id(struct afs_call *);
32 /* asynchronous incoming call initial processing */
33 static const struct afs_call_type afs_RXCMxxxx = {
35 .deliver = afs_deliver_cm_op_id,
39 * open an RxRPC socket and bind it to be a server for callback notifications
40 * - the socket is left in blocking mode and non-blocking ops use MSG_DONTWAIT
42 int afs_open_socket(struct afs_net *net)
44 struct sockaddr_rxrpc srx;
45 struct socket *socket;
46 unsigned int min_level;
51 ret = sock_create_kern(net->net, AF_RXRPC, SOCK_DGRAM, PF_INET6, &socket);
55 socket->sk->sk_allocation = GFP_NOFS;
57 /* bind the callback manager's address to make this a server socket */
58 memset(&srx, 0, sizeof(srx));
59 srx.srx_family = AF_RXRPC;
60 srx.srx_service = CM_SERVICE;
61 srx.transport_type = SOCK_DGRAM;
62 srx.transport_len = sizeof(srx.transport.sin6);
63 srx.transport.sin6.sin6_family = AF_INET6;
64 srx.transport.sin6.sin6_port = htons(AFS_CM_PORT);
66 min_level = RXRPC_SECURITY_ENCRYPT;
67 ret = kernel_setsockopt(socket, SOL_RXRPC, RXRPC_MIN_SECURITY_LEVEL,
68 (void *)&min_level, sizeof(min_level));
72 ret = kernel_bind(socket, (struct sockaddr *) &srx, sizeof(srx));
73 if (ret == -EADDRINUSE) {
74 srx.transport.sin6.sin6_port = 0;
75 ret = kernel_bind(socket, (struct sockaddr *) &srx, sizeof(srx));
80 srx.srx_service = YFS_CM_SERVICE;
81 ret = kernel_bind(socket, (struct sockaddr *) &srx, sizeof(srx));
85 /* Ideally, we'd turn on service upgrade here, but we can't because
86 * OpenAFS is buggy and leaks the userStatus field from packet to
87 * packet and between FS packets and CB packets - so if we try to do an
88 * upgrade on an FS packet, OpenAFS will leak that into the CB packet
89 * it sends back to us.
92 rxrpc_kernel_new_call_notification(socket, afs_rx_new_call,
93 afs_rx_discard_new_call);
95 ret = kernel_listen(socket, INT_MAX);
100 afs_charge_preallocation(&net->charge_preallocation_work);
105 sock_release(socket);
107 _leave(" = %d", ret);
112 * close the RxRPC socket AFS was using
114 void afs_close_socket(struct afs_net *net)
118 kernel_listen(net->socket, 0);
119 flush_workqueue(afs_async_calls);
121 if (net->spare_incoming_call) {
122 afs_put_call(net->spare_incoming_call);
123 net->spare_incoming_call = NULL;
126 _debug("outstanding %u", atomic_read(&net->nr_outstanding_calls));
127 wait_var_event(&net->nr_outstanding_calls,
128 !atomic_read(&net->nr_outstanding_calls));
129 _debug("no outstanding calls");
131 kernel_sock_shutdown(net->socket, SHUT_RDWR);
132 flush_workqueue(afs_async_calls);
133 sock_release(net->socket);
142 static struct afs_call *afs_alloc_call(struct afs_net *net,
143 const struct afs_call_type *type,
146 struct afs_call *call;
149 call = kzalloc(sizeof(*call), gfp);
155 call->debug_id = atomic_inc_return(&rxrpc_debug_id);
156 atomic_set(&call->usage, 1);
157 INIT_WORK(&call->async_work, afs_process_async_call);
158 init_waitqueue_head(&call->waitq);
159 spin_lock_init(&call->state_lock);
160 call->_iter = &call->iter;
162 o = atomic_inc_return(&net->nr_outstanding_calls);
163 trace_afs_call(call, afs_call_trace_alloc, 1, o,
164 __builtin_return_address(0));
169 * Dispose of a reference on a call.
171 void afs_put_call(struct afs_call *call)
173 struct afs_net *net = call->net;
174 int n = atomic_dec_return(&call->usage);
175 int o = atomic_read(&net->nr_outstanding_calls);
177 trace_afs_call(call, afs_call_trace_put, n + 1, o,
178 __builtin_return_address(0));
182 ASSERT(!work_pending(&call->async_work));
183 ASSERT(call->type->name != NULL);
186 rxrpc_kernel_end_call(net->socket, call->rxcall);
189 if (call->type->destructor)
190 call->type->destructor(call);
192 afs_put_server(call->net, call->cm_server);
193 afs_put_cb_interest(call->net, call->cbi);
194 afs_put_addrlist(call->alist);
195 kfree(call->request);
197 trace_afs_call(call, afs_call_trace_free, 0, o,
198 __builtin_return_address(0));
201 o = atomic_dec_return(&net->nr_outstanding_calls);
203 wake_up_var(&net->nr_outstanding_calls);
207 static struct afs_call *afs_get_call(struct afs_call *call,
208 enum afs_call_trace why)
210 int u = atomic_inc_return(&call->usage);
212 trace_afs_call(call, why, u,
213 atomic_read(&call->net->nr_outstanding_calls),
214 __builtin_return_address(0));
219 * Queue the call for actual work.
221 static void afs_queue_call_work(struct afs_call *call)
223 if (call->type->work) {
224 INIT_WORK(&call->work, call->type->work);
226 afs_get_call(call, afs_call_trace_work);
227 if (!queue_work(afs_wq, &call->work))
233 * allocate a call with flat request and reply buffers
235 struct afs_call *afs_alloc_flat_call(struct afs_net *net,
236 const struct afs_call_type *type,
237 size_t request_size, size_t reply_max)
239 struct afs_call *call;
241 call = afs_alloc_call(net, type, GFP_NOFS);
246 call->request_size = request_size;
247 call->request = kmalloc(request_size, GFP_NOFS);
253 call->reply_max = reply_max;
254 call->buffer = kmalloc(reply_max, GFP_NOFS);
259 afs_extract_to_buf(call, call->reply_max);
260 call->operation_ID = type->op;
261 init_waitqueue_head(&call->waitq);
271 * clean up a call with flat buffer
273 void afs_flat_call_destructor(struct afs_call *call)
277 kfree(call->request);
278 call->request = NULL;
283 #define AFS_BVEC_MAX 8
286 * Load the given bvec with the next few pages.
288 static void afs_load_bvec(struct afs_call *call, struct msghdr *msg,
289 struct bio_vec *bv, pgoff_t first, pgoff_t last,
292 struct page *pages[AFS_BVEC_MAX];
293 unsigned int nr, n, i, to, bytes = 0;
295 nr = min_t(pgoff_t, last - first + 1, AFS_BVEC_MAX);
296 n = find_get_pages_contig(call->mapping, first, nr, pages);
297 ASSERTCMP(n, ==, nr);
299 msg->msg_flags |= MSG_MORE;
300 for (i = 0; i < nr; i++) {
302 if (first + i >= last) {
304 msg->msg_flags &= ~MSG_MORE;
306 bv[i].bv_page = pages[i];
307 bv[i].bv_len = to - offset;
308 bv[i].bv_offset = offset;
309 bytes += to - offset;
313 iov_iter_bvec(&msg->msg_iter, WRITE, bv, nr, bytes);
317 * Advance the AFS call state when the RxRPC call ends the transmit phase.
319 static void afs_notify_end_request_tx(struct sock *sock,
320 struct rxrpc_call *rxcall,
321 unsigned long call_user_ID)
323 struct afs_call *call = (struct afs_call *)call_user_ID;
325 afs_set_call_state(call, AFS_CALL_CL_REQUESTING, AFS_CALL_CL_AWAIT_REPLY);
329 * attach the data from a bunch of pages on an inode to a call
331 static int afs_send_pages(struct afs_call *call, struct msghdr *msg)
333 struct bio_vec bv[AFS_BVEC_MAX];
334 unsigned int bytes, nr, loop, offset;
335 pgoff_t first = call->first, last = call->last;
338 offset = call->first_offset;
339 call->first_offset = 0;
342 afs_load_bvec(call, msg, bv, first, last, offset);
343 trace_afs_send_pages(call, msg, first, last, offset);
346 bytes = msg->msg_iter.count;
347 nr = msg->msg_iter.nr_segs;
349 ret = rxrpc_kernel_send_data(call->net->socket, call->rxcall, msg,
350 bytes, afs_notify_end_request_tx);
351 for (loop = 0; loop < nr; loop++)
352 put_page(bv[loop].bv_page);
357 } while (first <= last);
359 trace_afs_sent_pages(call, call->first, last, first, ret);
366 long afs_make_call(struct afs_addr_cursor *ac, struct afs_call *call,
367 gfp_t gfp, bool async)
369 struct sockaddr_rxrpc *srx = &ac->alist->addrs[ac->index];
370 struct rxrpc_call *rxcall;
376 _enter(",{%pISp},", &srx->transport);
378 ASSERT(call->type != NULL);
379 ASSERT(call->type->name != NULL);
381 _debug("____MAKE %p{%s,%x} [%d]____",
382 call, call->type->name, key_serial(call->key),
383 atomic_read(&call->net->nr_outstanding_calls));
386 call->addr_ix = ac->index;
387 call->alist = afs_get_addrlist(ac->alist);
389 /* Work out the length we're going to transmit. This is awkward for
390 * calls such as FS.StoreData where there's an extra injection of data
391 * after the initial fixed part.
393 tx_total_len = call->request_size;
394 if (call->send_pages) {
395 if (call->last == call->first) {
396 tx_total_len += call->last_to - call->first_offset;
398 /* It looks mathematically like you should be able to
399 * combine the following lines with the ones above, but
400 * unsigned arithmetic is fun when it wraps...
402 tx_total_len += PAGE_SIZE - call->first_offset;
403 tx_total_len += call->last_to;
404 tx_total_len += (call->last - call->first - 1) * PAGE_SIZE;
408 /* If the call is going to be asynchronous, we need an extra ref for
409 * the call to hold itself so the caller need not hang on to its ref.
412 afs_get_call(call, afs_call_trace_get);
415 rxcall = rxrpc_kernel_begin_call(call->net->socket, srx, call->key,
419 afs_wake_up_async_call :
420 afs_wake_up_call_waiter),
423 if (IS_ERR(rxcall)) {
424 ret = PTR_ERR(rxcall);
426 goto error_kill_call;
429 call->rxcall = rxcall;
431 /* send the request */
432 iov[0].iov_base = call->request;
433 iov[0].iov_len = call->request_size;
437 iov_iter_kvec(&msg.msg_iter, WRITE, iov, 1, call->request_size);
438 msg.msg_control = NULL;
439 msg.msg_controllen = 0;
440 msg.msg_flags = MSG_WAITALL | (call->send_pages ? MSG_MORE : 0);
442 ret = rxrpc_kernel_send_data(call->net->socket, rxcall,
443 &msg, call->request_size,
444 afs_notify_end_request_tx);
448 if (call->send_pages) {
449 ret = afs_send_pages(call, &msg);
454 /* Note that at this point, we may have received the reply or an abort
455 * - and an asynchronous call may already have completed.
462 return afs_wait_for_call_to_complete(call, ac);
465 if (ret != -ECONNABORTED) {
466 rxrpc_kernel_abort_call(call->net->socket, rxcall,
467 RX_USER_ABORT, ret, "KSD");
469 iov_iter_kvec(&msg.msg_iter, READ, NULL, 0, 0);
470 rxrpc_kernel_recv_data(call->net->socket, rxcall,
471 &msg.msg_iter, false,
472 &call->abort_code, &call->service_id);
473 ac->abort_code = call->abort_code;
474 ac->responded = true;
477 trace_afs_call_done(call);
479 if (call->type->done)
480 call->type->done(call);
482 /* We need to dispose of the extra ref we grabbed for an async call.
483 * The call, however, might be queued on afs_async_calls and we need to
484 * make sure we don't get any more notifications that might requeue it.
487 rxrpc_kernel_end_call(call->net->socket, call->rxcall);
491 if (cancel_work_sync(&call->async_work))
497 call->state = AFS_CALL_COMPLETE;
499 _leave(" = %d", ret);
504 * deliver messages to a call
506 static void afs_deliver_to_call(struct afs_call *call)
508 enum afs_call_state state;
509 u32 abort_code, remote_abort = 0;
512 _enter("%s", call->type->name);
514 while (state = READ_ONCE(call->state),
515 state == AFS_CALL_CL_AWAIT_REPLY ||
516 state == AFS_CALL_SV_AWAIT_OP_ID ||
517 state == AFS_CALL_SV_AWAIT_REQUEST ||
518 state == AFS_CALL_SV_AWAIT_ACK
520 if (state == AFS_CALL_SV_AWAIT_ACK) {
521 iov_iter_kvec(&call->iter, READ, NULL, 0, 0);
522 ret = rxrpc_kernel_recv_data(call->net->socket,
523 call->rxcall, &call->iter,
524 false, &remote_abort,
526 trace_afs_receive_data(call, &call->iter, false, ret);
528 if (ret == -EINPROGRESS || ret == -EAGAIN)
530 if (ret < 0 || ret == 1) {
538 if (call->want_reply_time &&
539 rxrpc_kernel_get_reply_time(call->net->socket,
542 call->want_reply_time = false;
544 ret = call->type->deliver(call);
545 state = READ_ONCE(call->state);
548 afs_queue_call_work(call);
549 if (state == AFS_CALL_CL_PROC_REPLY) {
551 set_bit(AFS_SERVER_FL_MAY_HAVE_CB,
552 &call->cbi->server->flags);
555 ASSERTCMP(state, >, AFS_CALL_CL_PROC_REPLY);
561 ASSERTCMP(state, ==, AFS_CALL_COMPLETE);
564 abort_code = RXGEN_OPCODE;
565 rxrpc_kernel_abort_call(call->net->socket, call->rxcall,
566 abort_code, ret, "KIV");
569 pr_err("kAFS: Call %u in bad state %u\n",
570 call->debug_id, state);
576 abort_code = RXGEN_CC_UNMARSHAL;
577 if (state != AFS_CALL_CL_AWAIT_REPLY)
578 abort_code = RXGEN_SS_UNMARSHAL;
579 rxrpc_kernel_abort_call(call->net->socket, call->rxcall,
580 abort_code, ret, "KUM");
586 if (call->type->done)
587 call->type->done(call);
588 if (state == AFS_CALL_COMPLETE && call->incoming)
597 afs_set_call_complete(call, ret, remote_abort);
598 state = AFS_CALL_COMPLETE;
603 * wait synchronously for a call to complete
605 static long afs_wait_for_call_to_complete(struct afs_call *call,
606 struct afs_addr_cursor *ac)
608 signed long rtt2, timeout;
610 bool stalled = false;
614 DECLARE_WAITQUEUE(myself, current);
618 rtt = rxrpc_kernel_get_rtt(call->net->socket, call->rxcall);
619 rtt2 = nsecs_to_jiffies64(rtt) * 2;
624 last_life = rxrpc_kernel_check_life(call->net->socket, call->rxcall);
626 add_wait_queue(&call->waitq, &myself);
628 set_current_state(TASK_UNINTERRUPTIBLE);
630 /* deliver any messages that are in the queue */
631 if (!afs_check_call_state(call, AFS_CALL_COMPLETE) &&
632 call->need_attention) {
633 call->need_attention = false;
634 __set_current_state(TASK_RUNNING);
635 afs_deliver_to_call(call);
639 if (afs_check_call_state(call, AFS_CALL_COMPLETE))
642 life = rxrpc_kernel_check_life(call->net->socket, call->rxcall);
644 life == last_life && signal_pending(current)) {
647 __set_current_state(TASK_RUNNING);
648 rxrpc_kernel_probe_life(call->net->socket, call->rxcall);
654 if (life != last_life) {
660 timeout = schedule_timeout(timeout);
663 remove_wait_queue(&call->waitq, &myself);
664 __set_current_state(TASK_RUNNING);
666 /* Kill off the call if it's still live. */
667 if (!afs_check_call_state(call, AFS_CALL_COMPLETE)) {
668 _debug("call interrupted");
669 if (rxrpc_kernel_abort_call(call->net->socket, call->rxcall,
670 RX_USER_ABORT, -EINTR, "KWI"))
671 afs_set_call_complete(call, -EINTR, 0);
674 spin_lock_bh(&call->state_lock);
675 ac->abort_code = call->abort_code;
676 ac->error = call->error;
677 spin_unlock_bh(&call->state_lock);
682 if (call->ret_reply0) {
683 ret = (long)call->reply[0];
684 call->reply[0] = NULL;
688 ac->responded = true;
692 _debug("call complete");
694 _leave(" = %p", (void *)ret);
699 * wake up a waiting call
701 static void afs_wake_up_call_waiter(struct sock *sk, struct rxrpc_call *rxcall,
702 unsigned long call_user_ID)
704 struct afs_call *call = (struct afs_call *)call_user_ID;
706 call->need_attention = true;
707 wake_up(&call->waitq);
711 * wake up an asynchronous call
713 static void afs_wake_up_async_call(struct sock *sk, struct rxrpc_call *rxcall,
714 unsigned long call_user_ID)
716 struct afs_call *call = (struct afs_call *)call_user_ID;
719 trace_afs_notify_call(rxcall, call);
720 call->need_attention = true;
722 u = atomic_fetch_add_unless(&call->usage, 1, 0);
724 trace_afs_call(call, afs_call_trace_wake, u,
725 atomic_read(&call->net->nr_outstanding_calls),
726 __builtin_return_address(0));
728 if (!queue_work(afs_async_calls, &call->async_work))
734 * Delete an asynchronous call. The work item carries a ref to the call struct
735 * that we need to release.
737 static void afs_delete_async_call(struct work_struct *work)
739 struct afs_call *call = container_of(work, struct afs_call, async_work);
749 * Perform I/O processing on an asynchronous call. The work item carries a ref
750 * to the call struct that we either need to release or to pass on.
752 static void afs_process_async_call(struct work_struct *work)
754 struct afs_call *call = container_of(work, struct afs_call, async_work);
758 if (call->state < AFS_CALL_COMPLETE && call->need_attention) {
759 call->need_attention = false;
760 afs_deliver_to_call(call);
763 if (call->state == AFS_CALL_COMPLETE) {
764 /* We have two refs to release - one from the alloc and one
765 * queued with the work item - and we can't just deallocate the
766 * call because the work item may be queued again.
768 call->async_work.func = afs_delete_async_call;
769 if (!queue_work(afs_async_calls, &call->async_work))
777 static void afs_rx_attach(struct rxrpc_call *rxcall, unsigned long user_call_ID)
779 struct afs_call *call = (struct afs_call *)user_call_ID;
781 call->rxcall = rxcall;
785 * Charge the incoming call preallocation.
787 void afs_charge_preallocation(struct work_struct *work)
789 struct afs_net *net =
790 container_of(work, struct afs_net, charge_preallocation_work);
791 struct afs_call *call = net->spare_incoming_call;
795 call = afs_alloc_call(net, &afs_RXCMxxxx, GFP_KERNEL);
800 call->state = AFS_CALL_SV_AWAIT_OP_ID;
801 init_waitqueue_head(&call->waitq);
802 afs_extract_to_tmp(call);
805 if (rxrpc_kernel_charge_accept(net->socket,
806 afs_wake_up_async_call,
814 net->spare_incoming_call = call;
818 * Discard a preallocated call when a socket is shut down.
820 static void afs_rx_discard_new_call(struct rxrpc_call *rxcall,
821 unsigned long user_call_ID)
823 struct afs_call *call = (struct afs_call *)user_call_ID;
830 * Notification of an incoming call.
832 static void afs_rx_new_call(struct sock *sk, struct rxrpc_call *rxcall,
833 unsigned long user_call_ID)
835 struct afs_net *net = afs_sock2net(sk);
837 queue_work(afs_wq, &net->charge_preallocation_work);
841 * Grab the operation ID from an incoming cache manager call. The socket
842 * buffer is discarded on error or if we don't yet have sufficient data.
844 static int afs_deliver_cm_op_id(struct afs_call *call)
848 _enter("{%zu}", iov_iter_count(call->_iter));
850 /* the operation ID forms the first four bytes of the request data */
851 ret = afs_extract_data(call, true);
855 call->operation_ID = ntohl(call->tmp);
856 afs_set_call_state(call, AFS_CALL_SV_AWAIT_OP_ID, AFS_CALL_SV_AWAIT_REQUEST);
858 /* ask the cache manager to route the call (it'll change the call type
860 if (!afs_cm_incoming_call(call))
863 trace_afs_cb_call(call);
865 /* pass responsibility for the remainer of this message off to the
866 * cache manager op */
867 return call->type->deliver(call);
871 * Advance the AFS call state when an RxRPC service call ends the transmit
874 static void afs_notify_end_reply_tx(struct sock *sock,
875 struct rxrpc_call *rxcall,
876 unsigned long call_user_ID)
878 struct afs_call *call = (struct afs_call *)call_user_ID;
880 afs_set_call_state(call, AFS_CALL_SV_REPLYING, AFS_CALL_SV_AWAIT_ACK);
884 * send an empty reply
886 void afs_send_empty_reply(struct afs_call *call)
888 struct afs_net *net = call->net;
893 rxrpc_kernel_set_tx_length(net->socket, call->rxcall, 0);
897 iov_iter_kvec(&msg.msg_iter, WRITE, NULL, 0, 0);
898 msg.msg_control = NULL;
899 msg.msg_controllen = 0;
902 switch (rxrpc_kernel_send_data(net->socket, call->rxcall, &msg, 0,
903 afs_notify_end_reply_tx)) {
905 _leave(" [replied]");
910 rxrpc_kernel_abort_call(net->socket, call->rxcall,
911 RX_USER_ABORT, -ENOMEM, "KOO");
919 * send a simple reply
921 void afs_send_simple_reply(struct afs_call *call, const void *buf, size_t len)
923 struct afs_net *net = call->net;
930 rxrpc_kernel_set_tx_length(net->socket, call->rxcall, len);
932 iov[0].iov_base = (void *) buf;
933 iov[0].iov_len = len;
936 iov_iter_kvec(&msg.msg_iter, WRITE, iov, 1, len);
937 msg.msg_control = NULL;
938 msg.msg_controllen = 0;
941 n = rxrpc_kernel_send_data(net->socket, call->rxcall, &msg, len,
942 afs_notify_end_reply_tx);
945 _leave(" [replied]");
951 rxrpc_kernel_abort_call(net->socket, call->rxcall,
952 RX_USER_ABORT, -ENOMEM, "KOO");
958 * Extract a piece of data from the received data socket buffers.
960 int afs_extract_data(struct afs_call *call, bool want_more)
962 struct afs_net *net = call->net;
963 struct iov_iter *iter = call->_iter;
964 enum afs_call_state state;
965 u32 remote_abort = 0;
968 _enter("{%s,%zu},%d", call->type->name, iov_iter_count(iter), want_more);
970 ret = rxrpc_kernel_recv_data(net->socket, call->rxcall, iter,
971 want_more, &remote_abort,
973 if (ret == 0 || ret == -EAGAIN)
976 state = READ_ONCE(call->state);
979 case AFS_CALL_CL_AWAIT_REPLY:
980 afs_set_call_state(call, state, AFS_CALL_CL_PROC_REPLY);
982 case AFS_CALL_SV_AWAIT_REQUEST:
983 afs_set_call_state(call, state, AFS_CALL_SV_REPLYING);
985 case AFS_CALL_COMPLETE:
986 kdebug("prem complete %d", call->error);
987 return afs_io_error(call, afs_io_error_extract);
994 afs_set_call_complete(call, ret, remote_abort);
999 * Log protocol error production.
1001 noinline int afs_protocol_error(struct afs_call *call, int error,
1002 enum afs_eproto_cause cause)
1004 trace_afs_protocol_error(call, error, cause);