Skip to content

Commit 3b0ebb2

Browse files
chuckleverJ. Bruce Fields
authored andcommitted
NFSD: Save location of NFSv4 COMPOUND status
Refactor: Currently nfs4svc_encode_compoundres() relies on the NFS dispatcher to pass in the buffer location of the COMPOUND status. Instead, save that buffer location in struct nfsd4_compoundres. The compound tag follows immediately after. Signed-off-by: Chuck Lever <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
1 parent c44b31c commit 3b0ebb2

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

fs/nfsd/nfs4proc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2461,11 +2461,11 @@ nfsd4_proc_compound(struct svc_rqst *rqstp)
24612461
__be32 status;
24622462

24632463
resp->xdr = &rqstp->rq_res_stream;
2464+
resp->statusp = resp->xdr->p;
24642465

24652466
/* reserve space for: NFS status code */
24662467
xdr_reserve_space(resp->xdr, XDR_UNIT);
24672468

2468-
resp->tagp = resp->xdr->p;
24692469
/* reserve space for: taglen, tag, and opcnt */
24702470
xdr_reserve_space(resp->xdr, XDR_UNIT * 2 + args->taglen);
24712471
resp->taglen = args->taglen;

fs/nfsd/nfs4xdr.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5435,11 +5435,16 @@ nfs4svc_encode_compoundres(struct svc_rqst *rqstp, __be32 *p)
54355435
WARN_ON_ONCE(buf->len != buf->head[0].iov_len + buf->page_len +
54365436
buf->tail[0].iov_len);
54375437

5438-
*p = resp->cstate.status;
5438+
/*
5439+
* Send buffer space for the following items is reserved
5440+
* at the top of nfsd4_proc_compound().
5441+
*/
5442+
p = resp->statusp;
5443+
5444+
*p++ = resp->cstate.status;
54395445

54405446
rqstp->rq_next_page = resp->xdr->page_ptr + 1;
54415447

5442-
p = resp->tagp;
54435448
*p++ = htonl(resp->taglen);
54445449
memcpy(p, resp->tag, resp->taglen);
54455450
p += XDR_QUADLEN(resp->taglen);

fs/nfsd/xdr4.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,10 +702,11 @@ struct nfsd4_compoundres {
702702
struct xdr_stream *xdr;
703703
struct svc_rqst * rqstp;
704704

705+
__be32 *statusp;
705706
u32 taglen;
706707
char * tag;
707708
u32 opcnt;
708-
__be32 * tagp; /* tag, opcount encode location */
709+
709710
struct nfsd4_compound_state cstate;
710711
};
711712

0 commit comments

Comments
 (0)