Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>

authored by

Chuck Lever and committed by
J. Bruce Fields
3b0ebb25 c44b31c2

+10 -4
+1 -1
fs/nfsd/nfs4proc.c
··· 2461 2461 __be32 status; 2462 2462 2463 2463 resp->xdr = &rqstp->rq_res_stream; 2464 + resp->statusp = resp->xdr->p; 2464 2465 2465 2466 /* reserve space for: NFS status code */ 2466 2467 xdr_reserve_space(resp->xdr, XDR_UNIT); 2467 2468 2468 - resp->tagp = resp->xdr->p; 2469 2469 /* reserve space for: taglen, tag, and opcnt */ 2470 2470 xdr_reserve_space(resp->xdr, XDR_UNIT * 2 + args->taglen); 2471 2471 resp->taglen = args->taglen;
+7 -2
fs/nfsd/nfs4xdr.c
··· 5435 5435 WARN_ON_ONCE(buf->len != buf->head[0].iov_len + buf->page_len + 5436 5436 buf->tail[0].iov_len); 5437 5437 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; 5439 5445 5440 5446 rqstp->rq_next_page = resp->xdr->page_ptr + 1; 5441 5447 5442 - p = resp->tagp; 5443 5448 *p++ = htonl(resp->taglen); 5444 5449 memcpy(p, resp->tag, resp->taglen); 5445 5450 p += XDR_QUADLEN(resp->taglen);
+2 -1
fs/nfsd/xdr4.h
··· 702 702 struct xdr_stream *xdr; 703 703 struct svc_rqst * rqstp; 704 704 705 + __be32 *statusp; 705 706 u32 taglen; 706 707 char * tag; 707 708 u32 opcnt; 708 - __be32 * tagp; /* tag, opcount encode location */ 709 + 709 710 struct nfsd4_compound_state cstate; 710 711 }; 711 712