nfsd41: SUPPATTR_EXCLCREAT attribute
authorBenny Halevy <bhalevy@panasas.com>
Fri, 3 Apr 2009 05:29:14 +0000 (08:29 +0300)
committerJ. Bruce Fields <bfields@citi.umich.edu>
Sat, 4 Apr 2009 00:41:23 +0000 (17:41 -0700)
Return bitmask for supported EXCLUSIVE4_1 create attributes.

Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
fs/nfsd/nfs4xdr.c
include/linux/nfs4.h
include/linux/nfsd/nfsd.h

index 70296fedee417ecf5a6d323cee1a858bf9989fe3..533d14fec99e9dbe8ffe7358e7456f2ab280cf7e 100644 (file)
@@ -2148,7 +2148,12 @@ out_acl:
                }
                WRITE64(stat.ino);
        }
-       BUG_ON(bmval2); /* FIXME: not implemented yet */
+       if (bmval2 & FATTR4_WORD2_SUPPATTR_EXCLCREAT) {
+               WRITE32(3);
+               WRITE32(NFSD_SUPPATTR_EXCLCREAT_WORD0);
+               WRITE32(NFSD_SUPPATTR_EXCLCREAT_WORD1);
+               WRITE32(NFSD_SUPPATTR_EXCLCREAT_WORD2);
+       }
 
        *attrlenp = htonl((char *)p - (char *)attrlenp - 4);
        *countp = p - buffer;
index 29ed600e193b5df7605d60ec57cd7897e4337cff..ec3cd49b04f5ce2197e897ab828a5e58fecb8ce2 100644 (file)
@@ -404,6 +404,8 @@ enum lock_type4 {
 #define FATTR4_WORD0_UNIQUE_HANDLES     (1UL << 9)
 #define FATTR4_WORD0_LEASE_TIME         (1UL << 10)
 #define FATTR4_WORD0_RDATTR_ERROR       (1UL << 11)
+/* Mandatory in NFSv4.1 */
+#define FATTR4_WORD2_SUPPATTR_EXCLCREAT (1UL << 11)
 
 /* Recommended Attributes */
 #define FATTR4_WORD0_ACL                (1UL << 12)
index 69ca788f8fc59e052fb493337cd6c2b1c19c9ca4..0ec4d142c50345bafce7d04a62c49e5f4e2a4af7 100644 (file)
@@ -375,7 +375,7 @@ extern struct timeval       nfssvc_boot;
        NFSD4_SUPPORTED_ATTRS_WORD1
 
 #define NFSD4_1_SUPPORTED_ATTRS_WORD2 \
-       NFSD4_SUPPORTED_ATTRS_WORD2
+       (NFSD4_SUPPORTED_ATTRS_WORD2 | FATTR4_WORD2_SUPPATTR_EXCLCREAT)
 
 static inline u32 nfsd_suppattrs0(u32 minorversion)
 {
@@ -407,6 +407,18 @@ static inline u32 nfsd_suppattrs2(u32 minorversion)
  | FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET)
 #define NFSD_WRITEABLE_ATTRS_WORD2 0
 
+#define NFSD_SUPPATTR_EXCLCREAT_WORD0 \
+       NFSD_WRITEABLE_ATTRS_WORD0
+/*
+ * we currently store the exclusive create verifier in the v_{a,m}time
+ * attributes so the client can't set these at create time using EXCLUSIVE4_1
+ */
+#define NFSD_SUPPATTR_EXCLCREAT_WORD1 \
+       (NFSD_WRITEABLE_ATTRS_WORD1 & \
+        ~(FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET))
+#define NFSD_SUPPATTR_EXCLCREAT_WORD2 \
+       NFSD_WRITEABLE_ATTRS_WORD2
+
 #endif /* CONFIG_NFSD_V4 */
 
 #endif /* LINUX_NFSD_NFSD_H */