Commit 1a4431a5 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'afs-fixes-20210315' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs

Pull AFS fixes from David Howells:

 - Fix an oops in AFS that can be triggered by accessing one of the
   afs.yfs.* xattrs against an OpenAFS server - for instance by commands
   like "cp -a"[1], "rsync -X" or getfattr[2]. These try and copy all of
   the xattrs.

   cp and rsync should pay attention to the list in /etc/xattr.conf, but
   cp doesn't on Ubuntu and rsync doesn't seem to on Ubuntu or Fedora.
   xattr.conf has been modified upstream[3], and a new version has just
   been cut that includes it. I've logged a bug against rsync for the
   problem there[4].

 - Stop listing "afs.*" xattrs[5][6][7], but particularly ACL ones[8] so
   that they don't confuse cp and rsync.

   This removes them from the list returned by listxattr(), but they're
   still available to get/set.

Link: http://lists.infradead.org/pipermail/linux-afs/2021-March/003498.html [1]
Link: http://lists.infradead.org/pipermail/linux-afs/2021-March/003501.html [2]
Link: https://git.savannah.nongnu.org/cgit/attr.git/commit/?id=74da517cc655a82ded715dea7245ce88ebc91b98 [3]
Link: https://github.com/WayneD/rsync/issues/163 [4]
Link: http://lists.infradead.org/pipermail/linux-afs/2021-March/003516.html [5]
Link: http://lists.infradead.org/pipermail/linux-afs/2021-March/003524.html [6]
Link: http://lists.infradead.org/pipermail/linux-afs/2021-March/003565.html # v1
Link: http://lists.infradead.org/pipermail/linux-afs/2021-March/003568.html [7]
Link: http://lists.infradead.org/pipermail/linux-afs/2021-March/003570.html [8]
Link: http://lists.infradead.org/pipermail/linux-afs/2021-March/003571.html # v2

* tag 'afs-fixes-20210315' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs:
  afs: Stop listxattr() from listing "afs.*" attributes
  afs: Fix accessing YFS xattrs on a non-YFS server
parents 1e28eed1 a7889c63
...@@ -70,7 +70,6 @@ const struct inode_operations afs_dir_inode_operations = { ...@@ -70,7 +70,6 @@ const struct inode_operations afs_dir_inode_operations = {
.permission = afs_permission, .permission = afs_permission,
.getattr = afs_getattr, .getattr = afs_getattr,
.setattr = afs_setattr, .setattr = afs_setattr,
.listxattr = afs_listxattr,
}; };
const struct address_space_operations afs_dir_aops = { const struct address_space_operations afs_dir_aops = {
......
...@@ -43,7 +43,6 @@ const struct inode_operations afs_file_inode_operations = { ...@@ -43,7 +43,6 @@ const struct inode_operations afs_file_inode_operations = {
.getattr = afs_getattr, .getattr = afs_getattr,
.setattr = afs_setattr, .setattr = afs_setattr,
.permission = afs_permission, .permission = afs_permission,
.listxattr = afs_listxattr,
}; };
const struct address_space_operations afs_fs_aops = { const struct address_space_operations afs_fs_aops = {
......
...@@ -181,9 +181,12 @@ void afs_wait_for_operation(struct afs_operation *op) ...@@ -181,9 +181,12 @@ void afs_wait_for_operation(struct afs_operation *op)
if (test_bit(AFS_SERVER_FL_IS_YFS, &op->server->flags) && if (test_bit(AFS_SERVER_FL_IS_YFS, &op->server->flags) &&
op->ops->issue_yfs_rpc) op->ops->issue_yfs_rpc)
op->ops->issue_yfs_rpc(op); op->ops->issue_yfs_rpc(op);
else else if (op->ops->issue_afs_rpc)
op->ops->issue_afs_rpc(op); op->ops->issue_afs_rpc(op);
else
op->ac.error = -ENOTSUPP;
if (op->call)
op->error = afs_wait_for_call_to_complete(op->call, &op->ac); op->error = afs_wait_for_call_to_complete(op->call, &op->ac);
} }
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
static const struct inode_operations afs_symlink_inode_operations = { static const struct inode_operations afs_symlink_inode_operations = {
.get_link = page_get_link, .get_link = page_get_link,
.listxattr = afs_listxattr,
}; };
static noinline void dump_vnode(struct afs_vnode *vnode, struct afs_vnode *parent_vnode) static noinline void dump_vnode(struct afs_vnode *vnode, struct afs_vnode *parent_vnode)
......
...@@ -1509,7 +1509,6 @@ extern int afs_launder_page(struct page *); ...@@ -1509,7 +1509,6 @@ extern int afs_launder_page(struct page *);
* xattr.c * xattr.c
*/ */
extern const struct xattr_handler *afs_xattr_handlers[]; extern const struct xattr_handler *afs_xattr_handlers[];
extern ssize_t afs_listxattr(struct dentry *, char *, size_t);
/* /*
* yfsclient.c * yfsclient.c
......
...@@ -32,7 +32,6 @@ const struct inode_operations afs_mntpt_inode_operations = { ...@@ -32,7 +32,6 @@ const struct inode_operations afs_mntpt_inode_operations = {
.lookup = afs_mntpt_lookup, .lookup = afs_mntpt_lookup,
.readlink = page_readlink, .readlink = page_readlink,
.getattr = afs_getattr, .getattr = afs_getattr,
.listxattr = afs_listxattr,
}; };
const struct inode_operations afs_autocell_inode_operations = { const struct inode_operations afs_autocell_inode_operations = {
......
...@@ -11,29 +11,6 @@ ...@@ -11,29 +11,6 @@
#include <linux/xattr.h> #include <linux/xattr.h>
#include "internal.h" #include "internal.h"
static const char afs_xattr_list[] =
"afs.acl\0"
"afs.cell\0"
"afs.fid\0"
"afs.volume\0"
"afs.yfs.acl\0"
"afs.yfs.acl_inherited\0"
"afs.yfs.acl_num_cleaned\0"
"afs.yfs.vol_acl";
/*
* Retrieve a list of the supported xattrs.
*/
ssize_t afs_listxattr(struct dentry *dentry, char *buffer, size_t size)
{
if (size == 0)
return sizeof(afs_xattr_list);
if (size < sizeof(afs_xattr_list))
return -ERANGE;
memcpy(buffer, afs_xattr_list, sizeof(afs_xattr_list));
return sizeof(afs_xattr_list);
}
/* /*
* Deal with the result of a successful fetch ACL operation. * Deal with the result of a successful fetch ACL operation.
*/ */
...@@ -231,6 +208,8 @@ static int afs_xattr_get_yfs(const struct xattr_handler *handler, ...@@ -231,6 +208,8 @@ static int afs_xattr_get_yfs(const struct xattr_handler *handler,
else else
ret = -ERANGE; ret = -ERANGE;
} }
} else if (ret == -ENOTSUPP) {
ret = -ENODATA;
} }
error_yacl: error_yacl:
...@@ -256,6 +235,7 @@ static int afs_xattr_set_yfs(const struct xattr_handler *handler, ...@@ -256,6 +235,7 @@ static int afs_xattr_set_yfs(const struct xattr_handler *handler,
{ {
struct afs_operation *op; struct afs_operation *op;
struct afs_vnode *vnode = AFS_FS_I(inode); struct afs_vnode *vnode = AFS_FS_I(inode);
int ret;
if (flags == XATTR_CREATE || if (flags == XATTR_CREATE ||
strcmp(name, "acl") != 0) strcmp(name, "acl") != 0)
...@@ -270,7 +250,10 @@ static int afs_xattr_set_yfs(const struct xattr_handler *handler, ...@@ -270,7 +250,10 @@ static int afs_xattr_set_yfs(const struct xattr_handler *handler,
return afs_put_operation(op); return afs_put_operation(op);
op->ops = &yfs_store_opaque_acl2_operation; op->ops = &yfs_store_opaque_acl2_operation;
return afs_do_sync_operation(op); ret = afs_do_sync_operation(op);
if (ret == -ENOTSUPP)
ret = -ENODATA;
return ret;
} }
static const struct xattr_handler afs_xattr_yfs_handler = { static const struct xattr_handler afs_xattr_yfs_handler = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment