Commit 9bd87ec6 authored by David Howells's avatar David Howells
Browse files

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: e49c7b2f ("afs: Build an abstraction around an "operation" concept")
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
parent 6c85cacc
Loading
Loading
Loading
Loading
+26 −25
Original line number Diff line number Diff line
@@ -329,29 +329,6 @@ static void xdr_decode_YFSFetchVolumeStatus(const __be32 **_bp,
	*_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
 * sync record.
@@ -1562,13 +1539,37 @@ void yfs_fs_release_lock(struct afs_operation *op)
	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
 */
static const struct afs_call_type yfs_RXYFSFetchStatus = {
	.name		= "YFS.FetchStatus",
	.op		= yfs_FS_FetchStatus,
	.deliver	= yfs_deliver_fs_status_cb_and_volsync,
	.deliver	= yfs_deliver_fs_fetch_status,
	.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)
{
	struct afs_vnode_param *vp = &op->file[0];
	struct afs_vnode_param *vp = &op->file[op->fetch_status.which];
	struct afs_call *call;
	__be32 *bp;