]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
NFSD: Add POSIX ACL file attributes to SUPPATTR bitmasks
authorChuck Lever <chuck.lever@oracle.com>
Fri, 9 Jan 2026 16:21:42 +0000 (11:21 -0500)
committerChuck Lever <chuck.lever@oracle.com>
Thu, 29 Jan 2026 14:48:33 +0000 (09:48 -0500)
Now that infrastructure for NFSv4 POSIX draft ACL has been added
to NFSD, it should be safe to advertise support to NFS clients.

NFSD_SUPPATTR_EXCLCREAT_WORD2 includes NFSv4.2-only attributes,
but version filtering occurs via nfsd_suppattrs[] before this
mask is applied, ensuring pre-4.2 clients never see unsupported
attributes.

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/nfsd.h

index b0283213a8f542160b16aa057007d5f668462ef9..a01d709533585f09df1399b85eecc36ea7c466c5 100644 (file)
@@ -454,6 +454,16 @@ enum {
 #define NFSD4_2_SECURITY_ATTRS         0
 #endif
 
+#ifdef CONFIG_NFSD_V4_POSIX_ACLS
+#define NFSD4_2_POSIX_ACL_ATTRS \
+       (FATTR4_WORD2_ACL_TRUEFORM | \
+       FATTR4_WORD2_ACL_TRUEFORM_SCOPE | \
+       FATTR4_WORD2_POSIX_DEFAULT_ACL | \
+       FATTR4_WORD2_POSIX_ACCESS_ACL)
+#else
+#define NFSD4_2_POSIX_ACL_ATTRS                0
+#endif
+
 #define NFSD4_2_SUPPORTED_ATTRS_WORD2 \
        (NFSD4_1_SUPPORTED_ATTRS_WORD2 | \
        FATTR4_WORD2_MODE_UMASK | \
@@ -462,7 +472,8 @@ enum {
        FATTR4_WORD2_XATTR_SUPPORT | \
        FATTR4_WORD2_TIME_DELEG_ACCESS | \
        FATTR4_WORD2_TIME_DELEG_MODIFY | \
-       FATTR4_WORD2_OPEN_ARGUMENTS)
+       FATTR4_WORD2_OPEN_ARGUMENTS | \
+       NFSD4_2_POSIX_ACL_ATTRS)
 
 extern const u32 nfsd_suppattrs[3][3];
 
@@ -530,11 +541,18 @@ static inline bool nfsd_attrs_supported(u32 minorversion, const u32 *bmval)
 #else
 #define MAYBE_FATTR4_WORD2_SECURITY_LABEL 0
 #endif
+#ifdef CONFIG_NFSD_V4_POSIX_ACLS
+#define MAYBE_FATTR4_WORD2_POSIX_ACL_ATTRS \
+       FATTR4_WORD2_POSIX_DEFAULT_ACL | FATTR4_WORD2_POSIX_ACCESS_ACL
+#else
+#define MAYBE_FATTR4_WORD2_POSIX_ACL_ATTRS 0
+#endif
 #define NFSD_WRITEABLE_ATTRS_WORD2 \
        (FATTR4_WORD2_MODE_UMASK \
        | MAYBE_FATTR4_WORD2_SECURITY_LABEL \
        | FATTR4_WORD2_TIME_DELEG_ACCESS \
        | FATTR4_WORD2_TIME_DELEG_MODIFY \
+       | MAYBE_FATTR4_WORD2_POSIX_ACL_ATTRS \
        )
 
 #define NFSD_SUPPATTR_EXCLCREAT_WORD0 \
@@ -550,6 +568,10 @@ static inline bool nfsd_attrs_supported(u32 minorversion, const u32 *bmval)
  * The FATTR4_WORD2_TIME_DELEG attributes are not to be allowed for
  * OPEN(create) with EXCLUSIVE4_1. It doesn't make sense to set a
  * delegated timestamp on a new file.
+ *
+ * This mask includes NFSv4.2-only attributes (e.g., POSIX ACLs).
+ * Version filtering occurs via nfsd_suppattrs[] before this mask
+ * is applied, so pre-4.2 clients never see unsupported attributes.
  */
 #define NFSD_SUPPATTR_EXCLCREAT_WORD2 \
        (NFSD_WRITEABLE_ATTRS_WORD2 & \