Merge tag 'nfsd-4.12' of git://linux-nfs.org/~bfields/linux
[sfrench/cifs-2.6.git] / fs / nfsd / nfs4xdr.c
index 33017d652b1da23165ff75ef0c8abb529ac55234..26780d53a6f9412ba50cf3b3711b32d53d061723 100644 (file)
@@ -2831,9 +2831,14 @@ out_acl:
        }
 #endif /* CONFIG_NFSD_PNFS */
        if (bmval2 & FATTR4_WORD2_SUPPATTR_EXCLCREAT) {
-               status = nfsd4_encode_bitmap(xdr, NFSD_SUPPATTR_EXCLCREAT_WORD0,
-                                                 NFSD_SUPPATTR_EXCLCREAT_WORD1,
-                                                 NFSD_SUPPATTR_EXCLCREAT_WORD2);
+               u32 supp[3];
+
+               memcpy(supp, nfsd_suppattrs[minorversion], sizeof(supp));
+               supp[0] &= NFSD_SUPPATTR_EXCLCREAT_WORD0;
+               supp[1] &= NFSD_SUPPATTR_EXCLCREAT_WORD1;
+               supp[2] &= NFSD_SUPPATTR_EXCLCREAT_WORD2;
+
+               status = nfsd4_encode_bitmap(xdr, supp[0], supp[1], supp[2]);
                if (status)
                        goto out;
        }
@@ -4119,8 +4124,7 @@ nfsd4_encode_getdeviceinfo(struct nfsd4_compoundres *resp, __be32 nfserr,
                struct nfsd4_getdeviceinfo *gdev)
 {
        struct xdr_stream *xdr = &resp->xdr;
-       const struct nfsd4_layout_ops *ops =
-               nfsd4_layout_ops[gdev->gd_layout_type];
+       const struct nfsd4_layout_ops *ops;
        u32 starting_len = xdr->buf->len, needed_len;
        __be32 *p;
 
@@ -4137,6 +4141,7 @@ nfsd4_encode_getdeviceinfo(struct nfsd4_compoundres *resp, __be32 nfserr,
 
        /* If maxcount is 0 then just update notifications */
        if (gdev->gd_maxcount != 0) {
+               ops = nfsd4_layout_ops[gdev->gd_layout_type];
                nfserr = ops->encode_getdeviceinfo(xdr, gdev);
                if (nfserr) {
                        /*
@@ -4189,8 +4194,7 @@ nfsd4_encode_layoutget(struct nfsd4_compoundres *resp, __be32 nfserr,
                struct nfsd4_layoutget *lgp)
 {
        struct xdr_stream *xdr = &resp->xdr;
-       const struct nfsd4_layout_ops *ops =
-               nfsd4_layout_ops[lgp->lg_layout_type];
+       const struct nfsd4_layout_ops *ops;
        __be32 *p;
 
        dprintk("%s: err %d\n", __func__, nfserr);
@@ -4213,6 +4217,7 @@ nfsd4_encode_layoutget(struct nfsd4_compoundres *resp, __be32 nfserr,
        *p++ = cpu_to_be32(lgp->lg_seg.iomode);
        *p++ = cpu_to_be32(lgp->lg_layout_type);
 
+       ops = nfsd4_layout_ops[lgp->lg_layout_type];
        nfserr = ops->encode_layoutget(xdr, lgp);
 out:
        kfree(lgp->lg_content);