afs: Fix yfs_fs_fetch_status() to honour vnode selector

Fix yfs_fs_fetch_status() to honour the vnode selector in
op->fetch_status.which as does afs_fs_fetch_status() that allows
afs_do_lookup() to use this as an alternative to the InlineBulkStatus RPC
call if not implemented by the server.

This doesn't matter in the current code as YFS servers always implement
InlineBulkStatus, but a subsequent will call it on YFS servers too in some
circumstances.

Fixes: e49c7b2f6d ("afs: Build an abstraction around an "operation" concept")
Signed-off-by: David Howells <dhowells@redhat.com>
This commit is contained in:
David Howells 2020-06-16 00:23:12 +01:00
parent 6c85cacc8c
commit 9bd87ec631

View File

@ -329,29 +329,6 @@ static void xdr_decode_YFSFetchVolumeStatus(const __be32 **_bp,
*_bp += sizeof(*x) / sizeof(__be32); *_bp += sizeof(*x) / sizeof(__be32);
} }
/*
* Deliver a reply that's a status, callback and volsync.
*/
static int yfs_deliver_fs_status_cb_and_volsync(struct afs_call *call)
{
struct afs_operation *op = call->op;
const __be32 *bp;
int ret;
ret = afs_transfer_reply(call);
if (ret < 0)
return ret;
/* unmarshall the reply once we've received all of it */
bp = call->buffer;
xdr_decode_YFSFetchStatus(&bp, call, &op->file[0].scb);
xdr_decode_YFSCallBack(&bp, call, &op->file[0].scb);
xdr_decode_YFSVolSync(&bp, &op->volsync);
_leave(" = 0 [done]");
return 0;
}
/* /*
* Deliver reply data to operations that just return a file status and a volume * Deliver reply data to operations that just return a file status and a volume
* sync record. * sync record.
@ -1562,13 +1539,37 @@ void yfs_fs_release_lock(struct afs_operation *op)
afs_make_op_call(op, call, GFP_NOFS); afs_make_op_call(op, call, GFP_NOFS);
} }
/*
* Deliver a reply to YFS.FetchStatus
*/
static int yfs_deliver_fs_fetch_status(struct afs_call *call)
{
struct afs_operation *op = call->op;
struct afs_vnode_param *vp = &op->file[op->fetch_status.which];
const __be32 *bp;
int ret;
ret = afs_transfer_reply(call);
if (ret < 0)
return ret;
/* unmarshall the reply once we've received all of it */
bp = call->buffer;
xdr_decode_YFSFetchStatus(&bp, call, &vp->scb);
xdr_decode_YFSCallBack(&bp, call, &vp->scb);
xdr_decode_YFSVolSync(&bp, &op->volsync);
_leave(" = 0 [done]");
return 0;
}
/* /*
* YFS.FetchStatus operation type * YFS.FetchStatus operation type
*/ */
static const struct afs_call_type yfs_RXYFSFetchStatus = { static const struct afs_call_type yfs_RXYFSFetchStatus = {
.name = "YFS.FetchStatus", .name = "YFS.FetchStatus",
.op = yfs_FS_FetchStatus, .op = yfs_FS_FetchStatus,
.deliver = yfs_deliver_fs_status_cb_and_volsync, .deliver = yfs_deliver_fs_fetch_status,
.destructor = afs_flat_call_destructor, .destructor = afs_flat_call_destructor,
}; };
@ -1577,7 +1578,7 @@ static const struct afs_call_type yfs_RXYFSFetchStatus = {
*/ */
void yfs_fs_fetch_status(struct afs_operation *op) void yfs_fs_fetch_status(struct afs_operation *op)
{ {
struct afs_vnode_param *vp = &op->file[0]; struct afs_vnode_param *vp = &op->file[op->fetch_status.which];
struct afs_call *call; struct afs_call *call;
__be32 *bp; __be32 *bp;