]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
NFSD: Set the attributes used to store the verifier for EXCLUSIVE4_1
authorKinglong Mee <kinglongmee@gmail.com>
Thu, 30 Jul 2015 13:55:02 +0000 (21:55 +0800)
committerBrian Maly <brian.maly@oracle.com>
Tue, 22 Jan 2019 19:05:31 +0000 (14:05 -0500)
According to rfc5661 18.16.4,
"If EXCLUSIVE4_1 was used, the client determines the attributes
 used for the verifier by comparing attrset with cva_attrs.attrmask;"

So, EXCLUSIVE4_1 also needs those bitmask used to store the verifier.

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Orabug: 29204157

(cherry picked from commit ead8fb8c24411722b92198b3dccd102a76cdd050)
Signed-off-by: Calum Mackay <calum.mackay@oracle.com>
Reviewed-by: Bill Baker <Bill.Baker@oracle.com>
Signed-off-by: Brian Maly <brian.maly@oracle.com>
fs/nfsd/nfs4proc.c
fs/nfsd/vfs.c
fs/nfsd/vfs.h

index 75cca7e38ce2ab0c9cf2803466bfa75e4be94d03..7c6e3bc27625f83534f332f329df6486f069b67c 100644 (file)
@@ -276,13 +276,13 @@ do_open_lookup(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, stru
                        nfsd4_security_inode_setsecctx(*resfh, &open->op_label, open->op_bmval);
 
                /*
-                * Following rfc 3530 14.2.16, use the returned bitmask
-                * to indicate which attributes we used to store the
-                * verifier:
+                * Following rfc 3530 14.2.16, and rfc 5661 18.16.4
+                * use the returned bitmask to indicate which attributes
+                * we used to store the verifier:
                 */
-               if (open->op_createmode == NFS4_CREATE_EXCLUSIVE && status == 0)
-                       open->op_bmval[1] = (FATTR4_WORD1_TIME_ACCESS |
-                                                       FATTR4_WORD1_TIME_MODIFY);
+               if (nfsd_create_is_exclusive(open->op_createmode) && status == 0)
+                       open->op_bmval[1] |= (FATTR4_WORD1_TIME_ACCESS |
+                                               FATTR4_WORD1_TIME_MODIFY);
        } else
                /*
                 * Note this may exit with the parent still locked.
index e87a26f6549958c7c79933c53e2c337ccb263d9b..21ae8c8b188c597a75e9f1d7d9cc5ba5668f89e8 100644 (file)
@@ -1325,12 +1325,6 @@ out_nfserr:
 
 #ifdef CONFIG_NFSD_V3
 
-static inline int nfsd_create_is_exclusive(int createmode)
-{
-       return createmode == NFS3_CREATE_EXCLUSIVE
-              || createmode == NFS4_CREATE_EXCLUSIVE4_1;
-}
-
 /*
  * NFSv3 and NFSv4 version of nfsd_create
  */
index 2050cb016998fd55dacc854bbc95f484c5f4c341..636b5533f397cda2142b8604aa090c431f92a501 100644 (file)
@@ -128,4 +128,10 @@ static inline __be32 fh_getattr(struct svc_fh *fh, struct kstat *stat)
        return nfserrno(vfs_getattr(&p, stat));
 }
 
+static inline int nfsd_create_is_exclusive(int createmode)
+{
+       return createmode == NFS3_CREATE_EXCLUSIVE
+              || createmode == NFS4_CREATE_EXCLUSIVE4_1;
+}
+
 #endif /* LINUX_NFSD_VFS_H */