NFSD: Replace READ* macros in nfsd4_decode_copy()
[ Upstream commit e8febea7190bcbd1e608093acb67f2a5009556aa ] Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
dc1a31ca8e
commit
8604d294c1
@@ -1982,40 +1982,44 @@ static __be32 nfsd4_decode_nl4_server(struct nfsd4_compoundargs *argp,
|
|||||||
static __be32
|
static __be32
|
||||||
nfsd4_decode_copy(struct nfsd4_compoundargs *argp, struct nfsd4_copy *copy)
|
nfsd4_decode_copy(struct nfsd4_compoundargs *argp, struct nfsd4_copy *copy)
|
||||||
{
|
{
|
||||||
DECODE_HEAD;
|
|
||||||
struct nl4_server *ns_dummy;
|
struct nl4_server *ns_dummy;
|
||||||
int i, count;
|
u32 consecutive, i, count;
|
||||||
|
__be32 status;
|
||||||
|
|
||||||
status = nfsd4_decode_stateid(argp, ©->cp_src_stateid);
|
status = nfsd4_decode_stateid4(argp, ©->cp_src_stateid);
|
||||||
if (status)
|
if (status)
|
||||||
return status;
|
return status;
|
||||||
status = nfsd4_decode_stateid(argp, ©->cp_dst_stateid);
|
status = nfsd4_decode_stateid4(argp, ©->cp_dst_stateid);
|
||||||
if (status)
|
if (status)
|
||||||
return status;
|
return status;
|
||||||
|
if (xdr_stream_decode_u64(argp->xdr, ©->cp_src_pos) < 0)
|
||||||
|
return nfserr_bad_xdr;
|
||||||
|
if (xdr_stream_decode_u64(argp->xdr, ©->cp_dst_pos) < 0)
|
||||||
|
return nfserr_bad_xdr;
|
||||||
|
if (xdr_stream_decode_u64(argp->xdr, ©->cp_count) < 0)
|
||||||
|
return nfserr_bad_xdr;
|
||||||
|
/* ca_consecutive: we always do consecutive copies */
|
||||||
|
if (xdr_stream_decode_u32(argp->xdr, &consecutive) < 0)
|
||||||
|
return nfserr_bad_xdr;
|
||||||
|
if (xdr_stream_decode_u32(argp->xdr, ©->cp_synchronous) < 0)
|
||||||
|
return nfserr_bad_xdr;
|
||||||
|
|
||||||
READ_BUF(8 + 8 + 8 + 4 + 4 + 4);
|
if (xdr_stream_decode_u32(argp->xdr, &count) < 0)
|
||||||
p = xdr_decode_hyper(p, ©->cp_src_pos);
|
return nfserr_bad_xdr;
|
||||||
p = xdr_decode_hyper(p, ©->cp_dst_pos);
|
|
||||||
p = xdr_decode_hyper(p, ©->cp_count);
|
|
||||||
p++; /* ca_consecutive: we always do consecutive copies */
|
|
||||||
copy->cp_synchronous = be32_to_cpup(p++);
|
|
||||||
|
|
||||||
count = be32_to_cpup(p++);
|
|
||||||
|
|
||||||
copy->cp_intra = false;
|
copy->cp_intra = false;
|
||||||
if (count == 0) { /* intra-server copy */
|
if (count == 0) { /* intra-server copy */
|
||||||
copy->cp_intra = true;
|
copy->cp_intra = true;
|
||||||
goto intra;
|
return nfs_ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* decode all the supplied server addresses but use first */
|
/* decode all the supplied server addresses but use only the first */
|
||||||
status = nfsd4_decode_nl4_server(argp, ©->cp_src);
|
status = nfsd4_decode_nl4_server(argp, ©->cp_src);
|
||||||
if (status)
|
if (status)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
ns_dummy = kmalloc(sizeof(struct nl4_server), GFP_KERNEL);
|
ns_dummy = kmalloc(sizeof(struct nl4_server), GFP_KERNEL);
|
||||||
if (ns_dummy == NULL)
|
if (ns_dummy == NULL)
|
||||||
return nfserrno(-ENOMEM);
|
return nfserrno(-ENOMEM); /* XXX: jukebox? */
|
||||||
for (i = 0; i < count - 1; i++) {
|
for (i = 0; i < count - 1; i++) {
|
||||||
status = nfsd4_decode_nl4_server(argp, ns_dummy);
|
status = nfsd4_decode_nl4_server(argp, ns_dummy);
|
||||||
if (status) {
|
if (status) {
|
||||||
@@ -2024,9 +2028,8 @@ nfsd4_decode_copy(struct nfsd4_compoundargs *argp, struct nfsd4_copy *copy)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
kfree(ns_dummy);
|
kfree(ns_dummy);
|
||||||
intra:
|
|
||||||
|
|
||||||
DECODE_TAIL;
|
return nfs_ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __be32
|
static __be32
|
||||||
@@ -4792,7 +4795,7 @@ nfsd4_encode_copy(struct nfsd4_compoundres *resp, __be32 nfserr,
|
|||||||
__be32 *p;
|
__be32 *p;
|
||||||
|
|
||||||
nfserr = nfsd42_encode_write_res(resp, ©->cp_res,
|
nfserr = nfsd42_encode_write_res(resp, ©->cp_res,
|
||||||
copy->cp_synchronous);
|
!!copy->cp_synchronous);
|
||||||
if (nfserr)
|
if (nfserr)
|
||||||
return nfserr;
|
return nfserr;
|
||||||
|
|
||||||
|
@@ -554,7 +554,7 @@ struct nfsd4_copy {
|
|||||||
bool cp_intra;
|
bool cp_intra;
|
||||||
|
|
||||||
/* both */
|
/* both */
|
||||||
bool cp_synchronous;
|
u32 cp_synchronous;
|
||||||
|
|
||||||
/* response */
|
/* response */
|
||||||
struct nfsd42_write_res cp_res;
|
struct nfsd42_write_res cp_res;
|
||||||
|
Reference in New Issue
Block a user