Linux-Fsdevel Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Frank van der Linden <fllinden@amazon.com>
To: <bfields@fieldses.org>, <chuck.lever@oracle.com>,
	Al Viro <viro@zeniv.linux.org.uk>
Cc: <linux-fsdevel@vger.kernel.org>, <torvalds@linux-foundation.org>
Subject: Re: [PATCH v3 02/10] xattr: add a function to check if a namespace is supported
Date: Tue, 14 Jul 2020 17:13:28 +0000	[thread overview]
Message-ID: <20200714171328.GB24687@dev-dsk-fllinden-2c-c1893d73.us-west-2.amazon.com> (raw)
In-Reply-To: <20200625204157.GB10231@dev-dsk-fllinden-2c-c1893d73.us-west-2.amazon.com>

On Thu, Jun 25, 2020 at 08:41:57PM +0000, Frank van der Linden wrote:
> Hi Al,
> 
> ..and here is the other xattr change that was part of the nfsd user xattr
> support series that I mentioned in my previous email.
> 
> Full series here:
> 
> https://lore.kernel.org/linux-nfs/20200623223927.31795-1-fllinden@amazon.com/
> 
> Any comments / concerned about this one?
> 
> Thanks,
> 
> - Frank

Hi Al,

Here's the other one I'm just sending a quick ping on. It's a simple change -
just add a little new function that enables nfsd to check if the "user."
namespace is at all supported by a filesystem.

Any comments?

Again, Linus - this is a pretty small change, doesn't affect any existing
codepaths, and it's already in the tree Chuck is setting up for 5.9. Could
this go in through that directly?

Thanks,

- Frank
> 
> On Tue, Jun 23, 2020 at 10:39:19PM +0000, Frank van der Linden wrote:
> > Add a function that checks is an extended attribute namespace is
> > supported for an inode, meaning that a handler must be present
> > for either the whole namespace, or at least one synthetic
> > xattr in the namespace.
> > 
> > To be used by the nfs server code when being queried for extended
> > attributes support.
> > 
> > Cc: linux-fsdevel@vger.kernel.org
> > Cc: Al Viro <viro@zeniv.linux.org.uk>
> > Signed-off-by: Frank van der Linden <fllinden@amazon.com>
> > ---
> >  fs/xattr.c            | 27 +++++++++++++++++++++++++++
> >  include/linux/xattr.h |  2 ++
> >  2 files changed, 29 insertions(+)
> > 
> > diff --git a/fs/xattr.c b/fs/xattr.c
> > index 95f38f57347f..386b45676d7e 100644
> > --- a/fs/xattr.c
> > +++ b/fs/xattr.c
> > @@ -134,6 +134,33 @@ xattr_permission(struct inode *inode, const char *name, int mask)
> >  	return inode_permission(inode, mask);
> >  }
> >  
> > +/*
> > + * Look for any handler that deals with the specified namespace.
> > + */
> > +int
> > +xattr_supported_namespace(struct inode *inode, const char *prefix)
> > +{
> > +	const struct xattr_handler **handlers = inode->i_sb->s_xattr;
> > +	const struct xattr_handler *handler;
> > +	size_t preflen;
> > +
> > +	if (!(inode->i_opflags & IOP_XATTR)) {
> > +		if (unlikely(is_bad_inode(inode)))
> > +			return -EIO;
> > +		return -EOPNOTSUPP;
> > +	}
> > +
> > +	preflen = strlen(prefix);
> > +
> > +	for_each_xattr_handler(handlers, handler) {
> > +		if (!strncmp(xattr_prefix(handler), prefix, preflen))
> > +			return 0;
> > +	}
> > +
> > +	return -EOPNOTSUPP;
> > +}
> > +EXPORT_SYMBOL(xattr_supported_namespace);
> > +
> >  int
> >  __vfs_setxattr(struct dentry *dentry, struct inode *inode, const char *name,
> >  	       const void *value, size_t size, int flags)
> > diff --git a/include/linux/xattr.h b/include/linux/xattr.h
> > index a2f3cd02653c..fac75810d9d3 100644
> > --- a/include/linux/xattr.h
> > +++ b/include/linux/xattr.h
> > @@ -61,6 +61,8 @@ ssize_t generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_siz
> >  ssize_t vfs_getxattr_alloc(struct dentry *dentry, const char *name,
> >  			   char **xattr_value, size_t size, gfp_t flags);
> >  
> > +int xattr_supported_namespace(struct inode *inode, const char *prefix);
> > +
> >  static inline const char *xattr_prefix(const struct xattr_handler *handler)
> >  {
> >  	return handler->prefix ?: handler->name;
> > -- 
> > 2.17.2
> > 

  reply	other threads:[~2020-07-14 17:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200623223927.31795-1-fllinden@amazon.com>
2020-06-23 22:39 ` [PATCH v3 01/10] xattr: break delegations in {set,remove}xattr Frank van der Linden
2020-06-25 20:39   ` Frank van der Linden
2020-07-14 17:11     ` Frank van der Linden
2020-07-01 19:33   ` Sasha Levin
2020-07-10 14:03   ` Sasha Levin
2020-07-10 14:08     ` Chuck Lever
2020-06-23 22:39 ` [PATCH v3 02/10] xattr: add a function to check if a namespace is supported Frank van der Linden
2020-06-25 20:41   ` Frank van der Linden
2020-07-14 17:13     ` Frank van der Linden [this message]
2020-07-14 18:46       ` Linus Torvalds
2020-07-28 14:17         ` Chuck Lever
2020-07-28 14:33           ` Al Viro
2020-07-29 12:23             ` Chuck Lever
2020-07-04 14:37 ` [PATCH v3 00/10] server side user xattr support (RFC 8276) Chuck Lever

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=20200714171328.GB24687@dev-dsk-fllinden-2c-c1893d73.us-west-2.amazon.com \
    --to=fllinden@amazon.com \
    --cc=bfields@fieldses.org \
    --cc=chuck.lever@oracle.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    --subject='Re: [PATCH v3 02/10] xattr: add a function to check if a namespace is supported' \
    /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

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).