From 7f93f2a0fbbde16b4e9d7b5ea20a2a441c42967b Mon Sep 17 00:00:00 2001 From: Rick Macklem Date: Mon, 28 Oct 2024 12:19:46 -0700 Subject: [PATCH 1/3] Add include entries for NFSv4 POSIX draft ACLs Add definitions for new NFSv4.2 POSIX draft ACLs as defined in the internet draft "POSIX draft ACL support for Netwok File System Version 4, Minor Version 2" Signed-off-by: Rick Macklem --- include/linux/nfs4.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h index 8d7430d9f218..e6c77c32ee16 100644 --- a/include/linux/nfs4.h +++ b/include/linux/nfs4.h @@ -518,6 +518,38 @@ enum { FATTR4_OPEN_ARGUMENTS = 86, }; +/* + * Symbol names and values are from draft-rmacklem-nfsv4-posix-acls Sec. X. + * "POSIX Draft ACL support for NFSv4.2" + */ +enum { + ACL_MODEL_NFS4 = 1, + ACL_MODEL_POSIX_DRAFT = 2, + ACL_MODEL_NONE = 3, +}; + +enum { + ACL_SCOPE_FILE_OBJECT = 1, + ACL_SCOPE_FILE_SYSTEM = 2, + ACL_SCOPE_SERVER = 3, +}; + +enum { + POSIXACE4_TAG_USER_OBJ = 1, + POSIXACE4_TAG_USER = 2, + POSIXACE4_TAG_GROUP_OBJ = 3, + POSIXACE4_TAG_GROUP = 4, + POSIXACE4_TAG_MASK = 5, + POSIXACE4_TAG_OTHER = 6, +}; + +enum { + FATTR4_ACL_TRUEFORM = 88, + FATTR4_ACL_TRUEFORM_SCOPE = 89, + FATTR4_POSIX_DEFAULT_ACL = 90, + FATTR4_POSIX_ACCESS_ACL = 91, +}; + /* * The following internal definitions enable processing the above * attribute bits within 32-bit word boundaries. @@ -600,6 +632,10 @@ enum { #define FATTR4_WORD2_TIME_DELEG_ACCESS BIT(FATTR4_TIME_DELEG_ACCESS - 64) #define FATTR4_WORD2_TIME_DELEG_MODIFY BIT(FATTR4_TIME_DELEG_MODIFY - 64) #define FATTR4_WORD2_OPEN_ARGUMENTS BIT(FATTR4_OPEN_ARGUMENTS - 64) +#define FATTR4_WORD2_ACL_TRUEFORM BIT(FATTR4_ACL_TRUEFORM - 64) +#define FATTR4_WORD2_ACL_TRUEFORM_SCOPE BIT(FATTR4_ACL_TRUEFORM_SCOPE - 64) +#define FATTR4_WORD2_POSIX_DEFAULT_ACL BIT(FATTR4_POSIX_DEFAULT_ACL - 64) +#define FATTR4_WORD2_POSIX_ACCESS_ACL BIT(FATTR4_POSIX_ACCESS_ACL - 64) /* MDS threshold bitmap bits */ #define THRESHOLD_RD (1UL << 0) @@ -695,6 +731,8 @@ enum { NFSPROC4_CLNT_LISTXATTRS, NFSPROC4_CLNT_REMOVEXATTR, NFSPROC4_CLNT_READ_PLUS, + NFSPROC4_CLNT_GETPOSIXACL, + NFSPROC4_CLNT_SETPOSIXACL, }; /* nfs41 types */ -- 2.34.1 From 7db20385680c6b436461787ee7002e46383eef31 Mon Sep 17 00:00:00 2001 From: Rick Macklem Date: Mon, 28 Oct 2024 12:25:17 -0700 Subject: [PATCH 2/3] Add include entries for the POSIX draft ACL attributes Signed-off-by: Rick Macklem --- include/linux/nfs_xdr.h | 49 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 12d8e47bc5a3..89ea0f258bd3 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h @@ -1616,6 +1616,46 @@ struct nfs42_removexattrres { struct nfs4_change_info cinfo; }; +struct nfs42_getposixaclargs { + struct nfs4_sequence_args seq_args; + struct nfs_fh * fh; + int mask; + struct page ** pages; +}; + +struct nfs42_getposixaclres { + struct nfs4_sequence_res seq_res; + const struct nfs_server * server; + int mask; + unsigned int acl_access_count; + unsigned int acl_default_count; + struct posix_acl * acl_access; + struct posix_acl * acl_default; +}; + +struct nfs42_setposixaclargs { + struct nfs4_sequence_args seq_args; + struct nfs_fh * fh; + const struct nfs_server * server; + struct inode * inode; + int mask; + struct posix_acl * acl_access; + struct posix_acl * acl_default; + size_t len; + struct page ** pages; +}; + +struct nfs42_setposixaclres { + struct nfs4_sequence_res seq_res; + const struct nfs_server * server; +}; + +#define NFS4_ACL_INLINE_BUFSIZE ((2*(1+3*4+35*(NFS_ACL_MAX_ENTRIES_INLINE-4))) \ + << 2) +#define NFS4_ACL_MAXPAGES ((2*(4+12*NFS_ACL_MAX_ENTRIES+ \ + IDMAP_NAMESZ*(NFS_ACL_MAX_ENTRIES-4))+ \ + PAGE_SIZE - 1) >> PAGE_SHIFT) + #endif /* CONFIG_NFS_V4_2 */ struct nfs_page; @@ -1757,6 +1797,15 @@ struct nfs_renamedata { bool cancelled; }; +struct nfs_xdr_putpage_desc { + struct page **pages; + void *p; + void *endp; + size_t npages; + size_t page_pos; + size_t max_npages; +}; + struct nfs_access_entry; struct nfs_client; struct rpc_timeout; -- 2.34.1 From c3b1ebb7cf987155a00dcb510aae92e95e93c15d Mon Sep 17 00:00:00 2001 From: Rick Macklem Date: Mon, 28 Oct 2024 12:30:47 -0700 Subject: [PATCH 3/3] Fix up a comment that specifies the draft Signed-off-by: Rick Macklem --- include/linux/nfs4.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h index e6c77c32ee16..f5ccc79772d4 100644 --- a/include/linux/nfs4.h +++ b/include/linux/nfs4.h @@ -519,8 +519,9 @@ enum { }; /* - * Symbol names and values are from draft-rmacklem-nfsv4-posix-acls Sec. X. - * "POSIX Draft ACL support for NFSv4.2" + * Symbol names and values are from draft-rmacklem-nfsv4-posix-acls + * "POSIX Draft ACL support for Network File System Version 4, Minor version 2" + * Section 4. */ enum { ACL_MODEL_NFS4 = 1, -- 2.34.1