Skip to content

Commit

Permalink
afs: Log remote unmarshalling errors
Browse files Browse the repository at this point in the history
  • Loading branch information
David Howells committed Apr 23, 2021
1 parent f105da1 commit 0509275
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions fs/afs/rxrpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,39 @@ void afs_make_call(struct afs_addr_cursor *ac, struct afs_call *call, gfp_t gfp)
_leave(" = %d", ret);
}

/*
* Log remote abort codes that indicate that we have a protocol disagreement
* with the server.
*/
static void afs_log_error(struct afs_call *call, s32 remote_abort)
{
static int max = 0;
const char *msg;
int m;

switch (remote_abort) {
case RX_EOF: msg = "unexpected EOF"; break;
case RXGEN_CC_MARSHAL: msg = "client marshalling"; break;
case RXGEN_CC_UNMARSHAL: msg = "client unmarshalling"; break;
case RXGEN_SS_MARSHAL: msg = "server marshalling"; break;
case RXGEN_SS_UNMARSHAL: msg = "server unmarshalling"; break;
case RXGEN_DECODE: msg = "opcode decode"; break;
case RXGEN_SS_XDRFREE: msg = "server XDR cleanup"; break;
case RXGEN_CC_XDRFREE: msg = "client XDR cleanup"; break;
case -32: msg = "insufficient data"; break;
default:
return;
}

m = max;
if (m < 3) {
max = m + 1;
pr_notice("kAFS: Peer reported %s failure on %s [%pISp]\n",
msg, call->type->name,
&call->alist->addrs[call->addr_ix].transport);
}
}

/*
* deliver messages to a call
*/
Expand Down Expand Up @@ -563,6 +596,7 @@ static void afs_deliver_to_call(struct afs_call *call)
goto out;
case -ECONNABORTED:
ASSERTCMP(state, ==, AFS_CALL_COMPLETE);
afs_log_error(call, call->abort_code);
goto done;
case -ENOTSUPP:
abort_code = RXGEN_OPCODE;
Expand Down

0 comments on commit 0509275

Please sign in to comment.