From: rick.macklem@gmail.com
To: linux-nfs@vger.kernel.org
Cc: Rick Macklem <rmacklem@uoguelph.ca>
Subject: [PATCH v1 4/7] Make three functions global and move them to acl.c
Date: Fri, 2 Jan 2026 15:29:31 -0800 [thread overview]
Message-ID: <20260102232934.1560-5-rick.macklem@gmail.com> (raw)
In-Reply-To: <20260102232934.1560-1-rick.macklem@gmail.com>
From: Rick Macklem <rmacklem@uoguelph.ca>
The three functions:
nfs3_prepare_get_acl()
nfs3_complete_get_acl()
nfs3_abort_get_acl()
have been moved to a new file called nfs34acl.c and renamed nfs34_XXX(),
so that they can be called from the NFSv4.2 client code
implementing the POSIX draft ACL attributes.
Signed-off-by: Rick Macklem <rmacklem@uoguelph.ca>
---
fs/nfs/Makefile | 2 +-
fs/nfs/nfs.h | 3 +++
fs/nfs/nfs34acl.c | 40 ++++++++++++++++++++++++++++++++++++++++
fs/nfs/nfs3acl.c | 44 +++++++-------------------------------------
4 files changed, 51 insertions(+), 38 deletions(-)
create mode 100644 fs/nfs/nfs34acl.c
diff --git a/fs/nfs/Makefile b/fs/nfs/Makefile
index 9fb2f2cac87e..afb84c44a019 100644
--- a/fs/nfs/Makefile
+++ b/fs/nfs/Makefile
@@ -9,7 +9,7 @@ CFLAGS_nfstrace.o += -I$(src)
nfs-y := client.o dir.o file.o getroot.o inode.o super.o \
io.o direct.o pagelist.o read.o symlink.o unlink.o \
write.o namespace.o mount_clnt.o nfstrace.o \
- export.o sysfs.o fs_context.o
+ export.o sysfs.o fs_context.o nfs34acl.o
nfs-$(CONFIG_ROOT_NFS) += nfsroot.o
nfs-$(CONFIG_SYSCTL) += sysctl.o
nfs-$(CONFIG_NFS_FSCACHE) += fscache.o
diff --git a/fs/nfs/nfs.h b/fs/nfs/nfs.h
index 8a5f51be013a..b5d1cfb92ab1 100644
--- a/fs/nfs/nfs.h
+++ b/fs/nfs/nfs.h
@@ -26,5 +26,8 @@ int get_nfs_version(struct nfs_subversion *);
void put_nfs_version(struct nfs_subversion *);
void register_nfs_version(struct nfs_subversion *);
void unregister_nfs_version(struct nfs_subversion *);
+void nfs34_prepare_get_acl(struct posix_acl **);
+void nfs34_complete_get_acl(struct posix_acl **, struct posix_acl *);
+void nfs34_abort_get_acl(struct posix_acl **);
#endif /* __LINUX_INTERNAL_NFS_H */
diff --git a/fs/nfs/nfs34acl.c b/fs/nfs/nfs34acl.c
new file mode 100644
index 000000000000..e3322f222c53
--- /dev/null
+++ b/fs/nfs/nfs34acl.c
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <linux/fs.h>
+#include <linux/nfs_fs.h>
+#include <linux/posix_acl.h>
+
+#include "nfs.h"
+
+/*
+ * nfs34_prepare_get_acl, nfs34_complete_get_acl, nfs34_abort_get_acl: Helpers
+ * for caching get_acl results in a race-free way. See fs/posix_acl.c:get_acl()
+ * for explanations.
+ */
+void nfs34_prepare_get_acl(struct posix_acl **p)
+{
+ struct posix_acl *sentinel = uncached_acl_sentinel(current);
+
+ /* If the ACL isn't being read yet, set our sentinel. */
+ cmpxchg(p, ACL_NOT_CACHED, sentinel);
+}
+EXPORT_SYMBOL_GPL(nfs34_prepare_get_acl);
+
+void nfs34_complete_get_acl(struct posix_acl **p, struct posix_acl *acl)
+{
+ struct posix_acl *sentinel = uncached_acl_sentinel(current);
+
+ /* Only cache the ACL if our sentinel is still in place. */
+ posix_acl_dup(acl);
+ if (cmpxchg(p, sentinel, acl) != sentinel)
+ posix_acl_release(acl);
+}
+EXPORT_SYMBOL_GPL(nfs34_complete_get_acl);
+
+void nfs34_abort_get_acl(struct posix_acl **p)
+{
+ struct posix_acl *sentinel = uncached_acl_sentinel(current);
+
+ /* Remove our sentinel upon failure. */
+ cmpxchg(p, sentinel, ACL_NOT_CACHED);
+}
+EXPORT_SYMBOL_GPL(nfs34_abort_get_acl);
diff --git a/fs/nfs/nfs3acl.c b/fs/nfs/nfs3acl.c
index a126eb31f62f..61aa56a632e3 100644
--- a/fs/nfs/nfs3acl.c
+++ b/fs/nfs/nfs3acl.c
@@ -8,41 +8,11 @@
#include <linux/nfsacl.h>
#include "internal.h"
+#include "nfs.h"
#include "nfs3_fs.h"
#define NFSDBG_FACILITY NFSDBG_PROC
-/*
- * nfs3_prepare_get_acl, nfs3_complete_get_acl, nfs3_abort_get_acl: Helpers for
- * caching get_acl results in a race-free way. See fs/posix_acl.c:get_acl()
- * for explanations.
- */
-static void nfs3_prepare_get_acl(struct posix_acl **p)
-{
- struct posix_acl *sentinel = uncached_acl_sentinel(current);
-
- /* If the ACL isn't being read yet, set our sentinel. */
- cmpxchg(p, ACL_NOT_CACHED, sentinel);
-}
-
-static void nfs3_complete_get_acl(struct posix_acl **p, struct posix_acl *acl)
-{
- struct posix_acl *sentinel = uncached_acl_sentinel(current);
-
- /* Only cache the ACL if our sentinel is still in place. */
- posix_acl_dup(acl);
- if (cmpxchg(p, sentinel, acl) != sentinel)
- posix_acl_release(acl);
-}
-
-static void nfs3_abort_get_acl(struct posix_acl **p)
-{
- struct posix_acl *sentinel = uncached_acl_sentinel(current);
-
- /* Remove our sentinel upon failure. */
- cmpxchg(p, sentinel, ACL_NOT_CACHED);
-}
-
struct posix_acl *nfs3_get_acl(struct inode *inode, int type, bool rcu)
{
struct nfs_server *server = NFS_SERVER(inode);
@@ -91,9 +61,9 @@ struct posix_acl *nfs3_get_acl(struct inode *inode, int type, bool rcu)
return ERR_PTR(-ENOMEM);
if (args.mask & NFS_ACL)
- nfs3_prepare_get_acl(&inode->i_acl);
+ nfs34_prepare_get_acl(&inode->i_acl);
if (args.mask & NFS_DFACL)
- nfs3_prepare_get_acl(&inode->i_default_acl);
+ nfs34_prepare_get_acl(&inode->i_default_acl);
status = rpc_call_sync(server->client_acl, &msg, 0);
dprintk("NFS reply getacl: %d\n", status);
@@ -131,12 +101,12 @@ struct posix_acl *nfs3_get_acl(struct inode *inode, int type, bool rcu)
}
if (res.mask & NFS_ACL)
- nfs3_complete_get_acl(&inode->i_acl, res.acl_access);
+ nfs34_complete_get_acl(&inode->i_acl, res.acl_access);
else
forget_cached_acl(inode, ACL_TYPE_ACCESS);
if (res.mask & NFS_DFACL)
- nfs3_complete_get_acl(&inode->i_default_acl, res.acl_default);
+ nfs34_complete_get_acl(&inode->i_default_acl, res.acl_default);
else
forget_cached_acl(inode, ACL_TYPE_DEFAULT);
@@ -150,8 +120,8 @@ struct posix_acl *nfs3_get_acl(struct inode *inode, int type, bool rcu)
}
getout:
- nfs3_abort_get_acl(&inode->i_acl);
- nfs3_abort_get_acl(&inode->i_default_acl);
+ nfs34_abort_get_acl(&inode->i_acl);
+ nfs34_abort_get_acl(&inode->i_default_acl);
posix_acl_release(res.acl_access);
posix_acl_release(res.acl_default);
nfs_free_fattr(res.fattr);
--
2.49.0
next prev parent reply other threads:[~2026-01-02 23:30 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-02 23:29 [PATCH v1 0/7] Add NFSv4.2 POSIX ACL support to the client rick.macklem
2026-01-02 23:29 ` [PATCH v1 1/7] Add entries to the predefined client operations enum rick.macklem
2026-01-02 23:29 ` [PATCH v1 2/7] Add new entries for handling POSIX draft ACLs rick.macklem
2026-01-02 23:29 ` [PATCH v1 3/7] Make posix_acl_from_nfsacl() global rick.macklem
2026-01-02 23:29 ` rick.macklem [this message]
2026-01-02 23:29 ` [PATCH v1 5/7] Make nfs4_server_supports_acls() global rick.macklem
2026-01-03 14:37 ` kernel test robot
2026-01-03 16:04 ` Rick Macklem
2026-01-03 15:15 ` kernel test robot
2026-01-09 21:14 ` kernel test robot
2026-01-09 21:55 ` kernel test robot
2026-01-09 23:06 ` Rick Macklem
2026-01-09 23:50 ` kernel test robot
2026-01-02 23:29 ` [PATCH v1 6/7] Set SB_POSIXACL if the server supports the extension rick.macklem
2026-01-03 16:25 ` kernel test robot
2026-01-03 16:38 ` Rick Macklem
2026-01-02 23:29 ` [PATCH v1 7/7] Add support for the NFSv4.2 POSIX draft ACL attributes rick.macklem
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260102232934.1560-5-rick.macklem@gmail.com \
--to=rick.macklem@gmail.com \
--cc=linux-nfs@vger.kernel.org \
--cc=rmacklem@uoguelph.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox