From: Christian Brauner <brauner@kernel.org>
To: linux-fsdevel@vger.kernel.org, Christoph Hellwig <hch@lst.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
Seth Forshee <sforshee@kernel.org>,
"Christian Brauner (Microsoft)" <brauner@kernel.org>,
reiserfs-devel@vger.kernel.org
Subject: [PATCH 11/12] reiserfs: drop posix acl handlers
Date: Wed, 25 Jan 2023 12:28:56 +0100 [thread overview]
Message-ID: <20230125-fs-acl-remove-generic-xattr-handlers-v1-11-6cf155b492b6@kernel.org> (raw)
In-Reply-To: <20230125-fs-acl-remove-generic-xattr-handlers-v1-0-6cf155b492b6@kernel.org>
Last cycle we introduced a new posix acl api. Filesystems now only need
to implement the inode operations for posix acls. The generic xattr
handlers aren't used anymore by the vfs and will be completely removed.
Keeping the handler around is confusing and gives the false impression
that the xattr infrastructure of the vfs is used to interact with posix
acls when it really isn't anymore.
For this to work we simply rework the ->listxattr() inode operation to
not rely on the generix posix acl handlers anymore.
Cc: <reiserfs-devel@vger.kernel.org>
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
---
fs/reiserfs/xattr.c | 38 +++++++++++++++++---------------------
1 file changed, 17 insertions(+), 21 deletions(-)
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index 8b2d52443f41..cc6f42128031 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -52,6 +52,7 @@
#include <linux/quotaops.h>
#include <linux/security.h>
#include <linux/posix_acl_xattr.h>
+#include <linux/xattr.h>
#define PRIVROOT_NAME ".reiserfs_priv"
#define XAROOT_NAME "xattrs"
@@ -771,22 +772,26 @@ reiserfs_xattr_get(struct inode *inode, const char *name, void *buffer,
(handler) = *(handlers)++)
/* This is the implementation for the xattr plugin infrastructure */
-static inline const struct xattr_handler *
-find_xattr_handler_prefix(const struct xattr_handler **handlers,
- const char *name)
+static inline bool reiserfs_xattr_list(const struct xattr_handler **handlers,
+ const char *name, struct dentry *dentry)
{
- const struct xattr_handler *xah;
+ const struct xattr_handler *xah = NULL;
- if (!handlers)
- return NULL;
+ if (handlers) {
+ for_each_xattr_handler(handlers, xah) {
+ const char *prefix = xattr_prefix(xah);
- for_each_xattr_handler(handlers, xah) {
- const char *prefix = xattr_prefix(xah);
- if (strncmp(prefix, name, strlen(prefix)) == 0)
- break;
+ if (strncmp(prefix, name, strlen(prefix)))
+ continue;
+
+ if (!xattr_dentry_list(xah, dentry))
+ return false;
+
+ return true;
+ }
}
- return xah;
+ return (posix_acl_type(name) >= 0) && posix_acl_dentry_list(dentry);
}
struct listxattr_buf {
@@ -807,12 +812,7 @@ static bool listxattr_filler(struct dir_context *ctx, const char *name,
if (name[0] != '.' ||
(namelen != 1 && (name[1] != '.' || namelen != 2))) {
- const struct xattr_handler *handler;
-
- handler = find_xattr_handler_prefix(b->dentry->d_sb->s_xattr,
- name);
- if (!handler /* Unsupported xattr name */ ||
- (handler->list && !handler->list(b->dentry)))
+ if (!reiserfs_xattr_list(b->dentry->d_sb->s_xattr, name, b->dentry))
return true;
size = namelen + 1;
if (b->buf) {
@@ -910,10 +910,6 @@ const struct xattr_handler *reiserfs_xattr_handlers[] = {
#endif
#ifdef CONFIG_REISERFS_FS_SECURITY
&reiserfs_xattr_security_handler,
-#endif
-#ifdef CONFIG_REISERFS_FS_POSIX_ACL
- &posix_acl_access_xattr_handler,
- &posix_acl_default_xattr_handler,
#endif
NULL
};
--
2.34.1
next prev parent reply other threads:[~2023-01-25 11:30 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-25 11:28 [PATCH 00/12] acl: remove remaining posix acl handlers Christian Brauner
2023-01-25 11:28 ` [PATCH 01/12] xattr: simplify listxattr helpers Christian Brauner
2023-01-30 6:35 ` Christoph Hellwig
2023-01-25 11:28 ` [PATCH 02/12] xattr, posix acl: add " Christian Brauner
2023-01-30 6:37 ` Christoph Hellwig
2023-01-25 11:28 ` [PATCH 03/12] xattr: remove unused argument Christian Brauner
2023-01-30 6:37 ` Christoph Hellwig
2023-01-25 11:28 ` [PATCH 04/12] fs: drop unused posix acl handlers Christian Brauner
2023-01-30 6:38 ` Christoph Hellwig
2023-01-25 11:28 ` [PATCH 05/12] erofs: drop " Christian Brauner
2023-01-30 6:43 ` Christoph Hellwig
2023-01-30 9:00 ` Christian Brauner
2023-01-30 9:11 ` Christoph Hellwig
2023-01-25 11:28 ` [PATCH 06/12] ext2: " Christian Brauner
2023-01-25 13:03 ` Jan Kara
2023-01-25 11:28 ` [PATCH 07/12] ext4: " Christian Brauner
2023-01-25 11:28 ` [PATCH 08/12] f2fs: " Christian Brauner
2023-01-25 11:28 ` [PATCH 09/12] jffs2: " Christian Brauner
2023-01-25 11:28 ` [PATCH 10/12] ocfs2: " Christian Brauner
2023-01-25 11:28 ` Christian Brauner [this message]
2023-01-25 11:28 ` [PATCH 12/12] acl: remove " Christian Brauner
2023-01-30 9:10 ` [PATCH 00/12] acl: remove remaining " Christian Brauner
2023-01-30 9:16 ` Christoph Hellwig
2023-01-30 10:23 ` Christian Brauner
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=20230125-fs-acl-remove-generic-xattr-handlers-v1-11-6cf155b492b6@kernel.org \
--to=brauner@kernel.org \
--cc=hch@lst.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=reiserfs-devel@vger.kernel.org \
--cc=sforshee@kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).