[PATCH v1 06/17] Add na_dpaclerr and na_paclerr for file creation

rick.macklem
2025-12-31T02:22:17Z

When new file objects are created, a client might choose to specify
POSIX draft ACLs for it. If the set_posix_acl() fails, note the
failure in these fields. The file object has already been created,
so the creation cannot now fail, but the attribute bits can be cleared
in the reply.

Signed-off-by: Rick Macklem <rmacklem@uoguelph.ca>
---
fs/nfsd/vfs.c | 6 +++---
fs/nfsd/vfs.h | 2 ++
2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 168d3ccc8155..146483bf8a65 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -597,12 +597,12 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp,
attr->na_labelerr = security_inode_setsecctx(dentry,
attr->na_seclabel->data, attr->na_seclabel->len);
if (IS_ENABLED(CONFIG_FS_POSIX_ACL) && attr->na_pacl)
- attr->na_aclerr = set_posix_acl(&nop_mnt_idmap,
+ attr->na_paclerr = set_posix_acl(&nop_mnt_idmap,
dentry, ACL_TYPE_ACCESS,
attr->na_pacl);
if (IS_ENABLED(CONFIG_FS_POSIX_ACL) &&
- !attr->na_aclerr && attr->na_dpacl && S_ISDIR(inode->i_mode))
- attr->na_aclerr = set_posix_acl(&nop_mnt_idmap,
+ attr->na_dpacl && S_ISDIR(inode->i_mode))
+ attr->na_dpaclerr = set_posix_acl(&nop_mnt_idmap,
dentry, ACL_TYPE_DEFAULT,
attr->na_dpacl);
out_fill_attrs:
diff --git a/fs/nfsd/vfs.h b/fs/nfsd/vfs.h
index e192dca4a679..26c4b396558a 100644
--- a/fs/nfsd/vfs.h
+++ b/fs/nfsd/vfs.h
@@ -54,6 +54,8 @@ struct nfsd_attrs {

int na_labelerr; /* output */
int na_aclerr; /* output */
+ int na_dpaclerr; /* output */
+ int na_paclerr; /* output */
};

static inline void nfsd_attrs_free(struct nfsd_attrs *attrs)
--
2.49.0