Skip to content

Commit e939bd6

Browse files
committed
NFSD: Add POSIX ACL file attributes to SUPPATTR bitmasks
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>
1 parent 318579c commit e939bd6

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

fs/nfsd/nfsd.h

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,16 @@ enum {
454454
#define NFSD4_2_SECURITY_ATTRS 0
455455
#endif
456456

457+
#ifdef CONFIG_NFSD_V4_POSIX_ACLS
458+
#define NFSD4_2_POSIX_ACL_ATTRS \
459+
(FATTR4_WORD2_ACL_TRUEFORM | \
460+
FATTR4_WORD2_ACL_TRUEFORM_SCOPE | \
461+
FATTR4_WORD2_POSIX_DEFAULT_ACL | \
462+
FATTR4_WORD2_POSIX_ACCESS_ACL)
463+
#else
464+
#define NFSD4_2_POSIX_ACL_ATTRS 0
465+
#endif
466+
457467
#define NFSD4_2_SUPPORTED_ATTRS_WORD2 \
458468
(NFSD4_1_SUPPORTED_ATTRS_WORD2 | \
459469
FATTR4_WORD2_MODE_UMASK | \
@@ -462,7 +472,8 @@ enum {
462472
FATTR4_WORD2_XATTR_SUPPORT | \
463473
FATTR4_WORD2_TIME_DELEG_ACCESS | \
464474
FATTR4_WORD2_TIME_DELEG_MODIFY | \
465-
FATTR4_WORD2_OPEN_ARGUMENTS)
475+
FATTR4_WORD2_OPEN_ARGUMENTS | \
476+
NFSD4_2_POSIX_ACL_ATTRS)
466477

467478
extern const u32 nfsd_suppattrs[3][3];
468479

@@ -530,11 +541,18 @@ static inline bool nfsd_attrs_supported(u32 minorversion, const u32 *bmval)
530541
#else
531542
#define MAYBE_FATTR4_WORD2_SECURITY_LABEL 0
532543
#endif
544+
#ifdef CONFIG_NFSD_V4_POSIX_ACLS
545+
#define MAYBE_FATTR4_WORD2_POSIX_ACL_ATTRS \
546+
FATTR4_WORD2_POSIX_DEFAULT_ACL | FATTR4_WORD2_POSIX_ACCESS_ACL
547+
#else
548+
#define MAYBE_FATTR4_WORD2_POSIX_ACL_ATTRS 0
549+
#endif
533550
#define NFSD_WRITEABLE_ATTRS_WORD2 \
534551
(FATTR4_WORD2_MODE_UMASK \
535552
| MAYBE_FATTR4_WORD2_SECURITY_LABEL \
536553
| FATTR4_WORD2_TIME_DELEG_ACCESS \
537554
| FATTR4_WORD2_TIME_DELEG_MODIFY \
555+
| MAYBE_FATTR4_WORD2_POSIX_ACL_ATTRS \
538556
)
539557

540558
#define NFSD_SUPPATTR_EXCLCREAT_WORD0 \
@@ -550,6 +568,10 @@ static inline bool nfsd_attrs_supported(u32 minorversion, const u32 *bmval)
550568
* The FATTR4_WORD2_TIME_DELEG attributes are not to be allowed for
551569
* OPEN(create) with EXCLUSIVE4_1. It doesn't make sense to set a
552570
* delegated timestamp on a new file.
571+
*
572+
* This mask includes NFSv4.2-only attributes (e.g., POSIX ACLs).
573+
* Version filtering occurs via nfsd_suppattrs[] before this mask
574+
* is applied, so pre-4.2 clients never see unsupported attributes.
553575
*/
554576
#define NFSD_SUPPATTR_EXCLCREAT_WORD2 \
555577
(NFSD_WRITEABLE_ATTRS_WORD2 & \

0 commit comments

Comments
 (0)