nfsd4: fix decoding of compounds across page boundaries
authorJ. Bruce Fields <bfields@redhat.com>
Fri, 21 Jun 2013 15:48:11 +0000 (11:48 -0400)
committerBen Hutchings <ben@decadent.org.uk>
Sat, 27 Jul 2013 04:34:26 +0000 (05:34 +0100)
commit 247500820ebd02ad87525db5d9b199e5b66f6636 upstream.

A freebsd NFSv4.0 client was getting rare IO errors expanding a tarball.
A network trace showed the server returning BAD_XDR on the final getattr
of a getattr+write+getattr compound.  The final getattr started on a
page boundary.

I believe the Linux client ignores errors on the post-write getattr, and
that that's why we haven't seen this before.

Reported-by: Rick Macklem <rmacklem@uoguelph.ca>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
fs/nfsd/nfs4xdr.c

index ade5316..99625b8 100644 (file)
@@ -177,8 +177,8 @@ static __be32 *read_buf(struct nfsd4_compoundargs *argp, u32 nbytes)
         */
        memcpy(p, argp->p, avail);
        /* step to next page */
-       argp->p = page_address(argp->pagelist[0]);
        argp->pagelist++;
+       argp->p = page_address(argp->pagelist[0]);
        if (argp->pagelen < PAGE_SIZE) {
                argp->end = argp->p + (argp->pagelen>>2);
                argp->pagelen = 0;