// SPDX-License-Identifier: GPL-2.0-or-later /* AFS Cache Manager Service * * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. * Written by David Howells (dhowells@redhat.com)
*/
/* * route an incoming cache manager call * - return T if supported, F if not
*/ bool afs_cm_incoming_call(struct afs_call *call)
{
_enter("{%u, CB.OP %u}", call->service_id, call->operation_ID);
switch (call->operation_ID) { case CBCallBack:
call->type = &afs_SRXCBCallBack; returntrue; case CBInitCallBackState:
call->type = &afs_SRXCBInitCallBackState; returntrue; case CBInitCallBackState3:
call->type = &afs_SRXCBInitCallBackState3; returntrue; case CBProbe:
call->type = &afs_SRXCBProbe; returntrue; case CBProbeUuid:
call->type = &afs_SRXCBProbeUuid; returntrue; case CBTellMeAboutYourself:
call->type = &afs_SRXCBTellMeAboutYourself; returntrue; case YFSCBCallBack: if (call->service_id != YFS_CM_SERVICE) returnfalse;
call->type = &afs_SRXYFSCB_CallBack; returntrue; default: returnfalse;
}
}
/* * Clean up a cache manager call.
*/ staticvoid afs_cm_destructor(struct afs_call *call)
{
kfree(call->buffer);
call->buffer = NULL;
}
/* * Abort a service call from within an action function.
*/ staticvoid afs_abort_service_call(struct afs_call *call, u32 abort_code, int error, enum rxrpc_abort_reason why)
{
rxrpc_kernel_abort_call(call->net->socket, call->rxcall,
abort_code, error, why);
afs_set_call_complete(call, error, 0);
}
/* * The server supplied a list of callbacks that it wanted to break.
*/ staticvoid SRXAFSCB_CallBack(struct work_struct *work)
{ struct afs_call *call = container_of(work, struct afs_call, work);
_enter("");
/* We need to break the callbacks before sending the reply as the * server holds up change visibility till it receives our reply so as * to maintain cache coherency.
*/ if (call->server) {
trace_afs_server(call->server->debug_id,
refcount_read(&call->server->ref),
atomic_read(&call->server->active),
afs_server_trace_callback);
afs_break_callbacks(call->server, call->count, call->request);
}
/* * deliver request data to a CB.CallBack call
*/ staticint afs_deliver_cb_callback(struct afs_call *call)
{ struct afs_callback_break *cb;
__be32 *bp; int ret, loop;
_enter("{%u}", call->unmarshall);
switch (call->unmarshall) { case 0:
afs_extract_to_tmp(call);
call->unmarshall++;
/* extract the FID array and its count in two steps */
fallthrough; case 1:
_debug("extract FID count");
ret = afs_extract_data(call, true); if (ret < 0) return ret;
/* extract the callback array and its count in two steps */
fallthrough; case 3:
_debug("extract CB count");
ret = afs_extract_data(call, true); if (ret < 0) return ret;
if (!afs_check_call_state(call, AFS_CALL_SV_REPLYING)) return afs_io_error(call, afs_io_error_cm_reply);
if (memcmp(call->request, &call->server->_uuid, sizeof(call->server->_uuid)) != 0) {
pr_notice("Callback UUID does not match fileserver UUID\n");
trace_afs_cm_no_server_u(call, call->request); return 0;
}
return 0;
}
/* * allow the fileserver to see if the cache manager is still alive
*/ staticvoid SRXAFSCB_Probe(struct work_struct *work)
{ struct afs_call *call = container_of(work, struct afs_call, work);
/* * deliver request data to a CB.TellMeAboutYourself call
*/ staticint afs_deliver_cb_tell_me_about_yourself(struct afs_call *call)
{ int ret;
_enter("");
afs_extract_discard(call, 0);
ret = afs_extract_data(call, false); if (ret < 0) return ret;
if (!afs_check_call_state(call, AFS_CALL_SV_REPLYING)) return afs_io_error(call, afs_io_error_cm_reply); return 0;
}
/* * deliver request data to a YFS CB.CallBack call
*/ staticint afs_deliver_yfs_cb_callback(struct afs_call *call)
{ struct afs_callback_break *cb; struct yfs_xdr_YFSFid *bp;
size_t size; int ret, loop;
_enter("{%u}", call->unmarshall);
switch (call->unmarshall) { case 0:
afs_extract_to_tmp(call);
call->unmarshall++;
/* extract the FID array and its count in two steps */
fallthrough; case 1:
_debug("extract FID count");
ret = afs_extract_data(call, true); if (ret < 0) return ret;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.