]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
NFSD: Save location of NFSv4 COMPOUND status
authorChuck Lever <chuck.lever@oracle.com>
Wed, 13 Oct 2021 14:40:59 +0000 (10:40 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Apr 2024 14:18:53 +0000 (16:18 +0200)
[ Upstream commit 3b0ebb255fdc49a3d340846deebf045ef58ec744 ]

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>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/nfs4proc.c
fs/nfsd/nfs4xdr.c
fs/nfsd/xdr4.h

index bc7ae9a8604ecb93351d16ab1a4def051447c532..002473c59fc6f8a326746429d78a9d0eee8c78c6 100644 (file)
@@ -2462,11 +2462,11 @@ nfsd4_proc_compound(struct svc_rqst *rqstp)
        __be32          status;
 
        resp->xdr = &rqstp->rq_res_stream;
+       resp->statusp = resp->xdr->p;
 
        /* reserve space for: NFS status code */
        xdr_reserve_space(resp->xdr, XDR_UNIT);
 
-       resp->tagp = resp->xdr->p;
        /* reserve space for: taglen, tag, and opcnt */
        xdr_reserve_space(resp->xdr, XDR_UNIT * 2 + args->taglen);
        resp->taglen = args->taglen;
index 9fcaf5f93f75d1ac92a50c028f40d64edb2308c6..e94f57f174f127c1d4e8a7d3f0f5f04499d18754 100644 (file)
@@ -5436,11 +5436,16 @@ nfs4svc_encode_compoundres(struct svc_rqst *rqstp, __be32 *p)
        WARN_ON_ONCE(buf->len != buf->head[0].iov_len + buf->page_len +
                                 buf->tail[0].iov_len);
 
-       *p = resp->cstate.status;
+       /*
+        * Send buffer space for the following items is reserved
+        * at the top of nfsd4_proc_compound().
+        */
+       p = resp->statusp;
+
+       *p++ = resp->cstate.status;
 
        rqstp->rq_next_page = resp->xdr->page_ptr + 1;
 
-       p = resp->tagp;
        *p++ = htonl(resp->taglen);
        memcpy(p, resp->tag, resp->taglen);
        p += XDR_QUADLEN(resp->taglen);
index 50242d8cd09e83cc555ae74e5f4ae4d6dee039be..f20c1ae97fec5aa6aad4dedbf1315ac6e1106f6a 100644 (file)
@@ -703,10 +703,11 @@ struct nfsd4_compoundres {
        struct xdr_stream               *xdr;
        struct svc_rqst *               rqstp;
 
+       __be32                          *statusp;
        u32                             taglen;
        char *                          tag;
        u32                             opcnt;
-       __be32 *                        tagp; /* tag, opcount encode location */
+
        struct nfsd4_compound_state     cstate;
 };