* Find the xattr_handler with the matching prefix.
*/
static const struct xattr_handler *
-xattr_resolve_name(const struct xattr_handler **handlers, const char **name)
+xattr_resolve_name(struct inode *inode, const char **name)
{
+ const struct xattr_handler **handlers = inode->i_sb->s_xattr;
const struct xattr_handler *handler;
+ if (!(inode->i_opflags & IOP_XATTR))
+ return ERR_PTR(-EOPNOTSUPP);
for_each_xattr_handler(handlers, handler) {
const char *n;
error = -EOPNOTSUPP;
return error;
+
}
EXPORT_SYMBOL_GPL(vfs_getxattr);
{
const struct xattr_handler *handler;
- handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name);
+ handler = xattr_resolve_name(inode, &name);
if (IS_ERR(handler))
return PTR_ERR(handler);
return handler->get(handler, dentry, inode,
if (size == 0)
value = ""; /* empty EA, do not remove */
- handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name);
+ handler = xattr_resolve_name(inode, &name);
if (IS_ERR(handler))
return PTR_ERR(handler);
return handler->set(handler, dentry, inode, name, value, size, flags);
{
const struct xattr_handler *handler;
- handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name);
+ handler = xattr_resolve_name(d_inode(dentry), &name);
if (IS_ERR(handler))
return PTR_ERR(handler);
return handler->set(handler, dentry, d_inode(dentry), name, NULL,