Lines Matching refs:call
105 * route an incoming cache manager call
108 bool afs_cm_incoming_call(struct afs_call *call)
110 _enter("{%u, CB.OP %u}", call->service_id, call->operation_ID);
112 switch (call->operation_ID) {
114 call->type = &afs_SRXCBCallBack;
117 call->type = &afs_SRXCBInitCallBackState;
120 call->type = &afs_SRXCBInitCallBackState3;
123 call->type = &afs_SRXCBProbe;
126 call->type = &afs_SRXCBProbeUuid;
129 call->type = &afs_SRXCBTellMeAboutYourself;
132 if (call->service_id != YFS_CM_SERVICE)
134 call->type = &afs_SRXYFSCB_CallBack;
145 static int afs_find_cm_server_by_peer(struct afs_call *call)
150 rxrpc_kernel_get_peer(call->net->socket, call->rxcall, &srx);
152 server = afs_find_server(call->net, &srx);
154 trace_afs_cm_no_server(call, &srx);
158 call->server = server;
166 static int afs_find_cm_server_by_uuid(struct afs_call *call,
172 server = afs_find_server_by_uuid(call->net, call->request);
175 trace_afs_cm_no_server_u(call, call->request);
179 call->server = server;
184 * Clean up a cache manager call.
186 static void afs_cm_destructor(struct afs_call *call)
188 kfree(call->buffer);
189 call->buffer = NULL;
193 * Abort a service call from within an action function.
195 static void afs_abort_service_call(struct afs_call *call, u32 abort_code, int error,
198 rxrpc_kernel_abort_call(call->net->socket, call->rxcall,
200 afs_set_call_complete(call, error, 0);
208 struct afs_call *call = container_of(work, struct afs_call, work);
216 if (call->server) {
217 trace_afs_server(call->server->debug_id,
218 refcount_read(&call->server->ref),
219 atomic_read(&call->server->active),
221 afs_break_callbacks(call->server, call->count, call->request);
224 afs_send_empty_reply(call);
225 afs_put_call(call);
230 * deliver request data to a CB.CallBack call
232 static int afs_deliver_cb_callback(struct afs_call *call)
238 _enter("{%u}", call->unmarshall);
240 switch (call->unmarshall) {
242 afs_extract_to_tmp(call);
243 call->unmarshall++;
249 ret = afs_extract_data(call, true);
253 call->count = ntohl(call->tmp);
254 _debug("FID count: %u", call->count);
255 if (call->count > AFSCBMAX)
256 return afs_protocol_error(call, afs_eproto_cb_fid_count);
258 call->buffer = kmalloc(array3_size(call->count, 3, 4),
260 if (!call->buffer)
262 afs_extract_to_buf(call, call->count * 3 * 4);
263 call->unmarshall++;
268 ret = afs_extract_data(call, true);
273 call->request = kcalloc(call->count,
276 if (!call->request)
279 cb = call->request;
280 bp = call->buffer;
281 for (loop = call->count; loop > 0; loop--, cb++) {
287 afs_extract_to_tmp(call);
288 call->unmarshall++;
294 ret = afs_extract_data(call, true);
298 call->count2 = ntohl(call->tmp);
299 _debug("CB count: %u", call->count2);
300 if (call->count2 != call->count && call->count2 != 0)
301 return afs_protocol_error(call, afs_eproto_cb_count);
302 call->iter = &call->def_iter;
303 iov_iter_discard(&call->def_iter, ITER_DEST, call->count2 * 3 * 4);
304 call->unmarshall++;
309 iov_iter_count(call->iter), call->count2 * 3 * 4);
311 ret = afs_extract_data(call, false);
315 call->unmarshall++;
322 if (!afs_check_call_state(call, AFS_CALL_SV_REPLYING))
323 return afs_io_error(call, afs_io_error_cm_reply);
327 return afs_find_cm_server_by_peer(call);
335 struct afs_call *call = container_of(work, struct afs_call, work);
337 _enter("{%p}", call->server);
339 if (call->server)
340 afs_init_callback_state(call->server);
341 afs_send_empty_reply(call);
342 afs_put_call(call);
347 * deliver request data to a CB.InitCallBackState call
349 static int afs_deliver_cb_init_call_back_state(struct afs_call *call)
355 afs_extract_discard(call, 0);
356 ret = afs_extract_data(call, false);
362 return afs_find_cm_server_by_peer(call);
366 * deliver request data to a CB.InitCallBackState3 call
368 static int afs_deliver_cb_init_call_back_state3(struct afs_call *call)
377 _enter("{%u}", call->unmarshall);
379 switch (call->unmarshall) {
381 call->buffer = kmalloc_array(11, sizeof(__be32), GFP_KERNEL);
382 if (!call->buffer)
384 afs_extract_to_buf(call, 11 * sizeof(__be32));
385 call->unmarshall++;
390 ret = afs_extract_data(call, false);
398 call->request = kmalloc(sizeof(struct afs_uuid), GFP_KERNEL);
399 if (!call->request)
402 b = call->buffer;
403 r = call->request;
413 call->unmarshall++;
420 if (!afs_check_call_state(call, AFS_CALL_SV_REPLYING))
421 return afs_io_error(call, afs_io_error_cm_reply);
425 return afs_find_cm_server_by_uuid(call, call->request);
433 struct afs_call *call = container_of(work, struct afs_call, work);
436 afs_send_empty_reply(call);
437 afs_put_call(call);
442 * deliver request data to a CB.Probe call
444 static int afs_deliver_cb_probe(struct afs_call *call)
450 afs_extract_discard(call, 0);
451 ret = afs_extract_data(call, false);
455 if (!afs_check_call_state(call, AFS_CALL_SV_REPLYING))
456 return afs_io_error(call, afs_io_error_cm_reply);
457 return afs_find_cm_server_by_peer(call);
466 struct afs_call *call = container_of(work, struct afs_call, work);
467 struct afs_uuid *r = call->request;
471 if (memcmp(r, &call->net->uuid, sizeof(call->net->uuid)) == 0)
472 afs_send_empty_reply(call);
474 afs_abort_service_call(call, 1, 1, afs_abort_probeuuid_negative);
476 afs_put_call(call);
481 * deliver request data to a CB.ProbeUuid call
483 static int afs_deliver_cb_probe_uuid(struct afs_call *call)
490 _enter("{%u}", call->unmarshall);
492 switch (call->unmarshall) {
494 call->buffer = kmalloc_array(11, sizeof(__be32), GFP_KERNEL);
495 if (!call->buffer)
497 afs_extract_to_buf(call, 11 * sizeof(__be32));
498 call->unmarshall++;
503 ret = afs_extract_data(call, false);
511 call->request = kmalloc(sizeof(struct afs_uuid), GFP_KERNEL);
512 if (!call->request)
515 b = call->buffer;
516 r = call->request;
526 call->unmarshall++;
533 if (!afs_check_call_state(call, AFS_CALL_SV_REPLYING))
534 return afs_io_error(call, afs_io_error_cm_reply);
535 return afs_find_cm_server_by_peer(call);
543 struct afs_call *call = container_of(work, struct afs_call, work);
564 reply.ia.uuid[0] = call->net->uuid.time_low;
565 reply.ia.uuid[1] = htonl(ntohs(call->net->uuid.time_mid));
566 reply.ia.uuid[2] = htonl(ntohs(call->net->uuid.time_hi_and_version));
567 reply.ia.uuid[3] = htonl((s8) call->net->uuid.clock_seq_hi_and_reserved);
568 reply.ia.uuid[4] = htonl((s8) call->net->uuid.clock_seq_low);
570 reply.ia.uuid[loop + 5] = htonl((s8) call->net->uuid.node[loop]);
574 afs_send_simple_reply(call, &reply, sizeof(reply));
575 afs_put_call(call);
580 * deliver request data to a CB.TellMeAboutYourself call
582 static int afs_deliver_cb_tell_me_about_yourself(struct afs_call *call)
588 afs_extract_discard(call, 0);
589 ret = afs_extract_data(call, false);
593 if (!afs_check_call_state(call, AFS_CALL_SV_REPLYING))
594 return afs_io_error(call, afs_io_error_cm_reply);
595 return afs_find_cm_server_by_peer(call);
599 * deliver request data to a YFS CB.CallBack call
601 static int afs_deliver_yfs_cb_callback(struct afs_call *call)
608 _enter("{%u}", call->unmarshall);
610 switch (call->unmarshall) {
612 afs_extract_to_tmp(call);
613 call->unmarshall++;
619 ret = afs_extract_data(call, true);
623 call->count = ntohl(call->tmp);
624 _debug("FID count: %u", call->count);
625 if (call->count > YFSCBMAX)
626 return afs_protocol_error(call, afs_eproto_cb_fid_count);
628 size = array_size(call->count, sizeof(struct yfs_xdr_YFSFid));
629 call->buffer = kmalloc(size, GFP_KERNEL);
630 if (!call->buffer)
632 afs_extract_to_buf(call, size);
633 call->unmarshall++;
638 ret = afs_extract_data(call, false);
643 call->request = kcalloc(call->count,
646 if (!call->request)
649 cb = call->request;
650 bp = call->buffer;
651 for (loop = call->count; loop > 0; loop--, cb++) {
659 afs_extract_to_tmp(call);
660 call->unmarshall++;
667 if (!afs_check_call_state(call, AFS_CALL_SV_REPLYING))
668 return afs_io_error(call, afs_io_error_cm_reply);
673 return afs_find_cm_server_by_peer(call);