diff options
author | David Howells <dhowells@redhat.com> | 2023-10-25 17:53:33 +0100 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2023-12-24 15:22:53 +0000 |
commit | aa453becce5d1ae1b94b7fc22f47d7b05d22b14e (patch) | |
tree | 933b826c996b2688608d7108d04ff03d390b9585 /fs/afs/fs_operation.c | |
parent | 6f2ff7e89bd05677f4c08fccafcf625ca3e09c1c (diff) |
afs: Simplify error handling
Simplify error handling a bit by moving it from the afs_addr_cursor struct
to the afs_operation and afs_vl_cursor structs and using the error
prioritisation function for accumulating errors from multiple sources (AFS
tries to rotate between multiple fileservers, some of which may be
inaccessible or in some state of offlinedness).
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
Diffstat (limited to 'fs/afs/fs_operation.c')
-rw-r--r-- | fs/afs/fs_operation.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/fs/afs/fs_operation.c b/fs/afs/fs_operation.c index 1c22d6e77846..cebe4fad8192 100644 --- a/fs/afs/fs_operation.c +++ b/fs/afs/fs_operation.c @@ -169,9 +169,6 @@ static void afs_end_vnode_operation(struct afs_operation *op) } afs_drop_io_locks(op); - - if (op->error == -ECONNABORTED) - op->error = afs_abort_to_error(op->ac.abort_code); } /* @@ -182,6 +179,8 @@ void afs_wait_for_operation(struct afs_operation *op) _enter(""); while (afs_select_fileserver(op)) { + op->call_error = 0; + op->call_abort_code = 0; op->cb_s_break = op->server->cb_s_break; if (test_bit(AFS_SERVER_FL_IS_YFS, &op->server->flags) && op->ops->issue_yfs_rpc) @@ -189,28 +188,29 @@ void afs_wait_for_operation(struct afs_operation *op) else if (op->ops->issue_afs_rpc) op->ops->issue_afs_rpc(op); else - op->ac.error = -ENOTSUPP; + op->call_error = -ENOTSUPP; if (op->call) { afs_wait_for_call_to_complete(op->call, &op->ac); - op->error = op->ac.error; + op->call_abort_code = op->call->abort_code; + op->call_error = op->call->error; + op->call_responded = op->call->responded; + op->ac.call_responded = true; + WRITE_ONCE(op->ac.alist->addrs[op->ac.index].last_error, + op->call_error); afs_put_call(op->call); } } - switch (op->error) { - case 0: + if (!afs_op_error(op)) { _debug("success"); op->ops->success(op); - break; - case -ECONNABORTED: + } else if (op->cumul_error.aborted) { if (op->ops->aborted) op->ops->aborted(op); - fallthrough; - default: + } else { if (op->ops->failed) op->ops->failed(op); - break; } afs_end_vnode_operation(op); |