Skip to content

Commit 1a4431a

Browse files
committed
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: RsyncProject/rsync#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
2 parents 1e28eed + a7889c6 commit 1a4431a

File tree

7 files changed

+12
-31
lines changed

7 files changed

+12
-31
lines changed

fs/afs/dir.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ const struct inode_operations afs_dir_inode_operations = {
7070
.permission = afs_permission,
7171
.getattr = afs_getattr,
7272
.setattr = afs_setattr,
73-
.listxattr = afs_listxattr,
7473
};
7574

7675
const struct address_space_operations afs_dir_aops = {

fs/afs/file.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ const struct inode_operations afs_file_inode_operations = {
4343
.getattr = afs_getattr,
4444
.setattr = afs_setattr,
4545
.permission = afs_permission,
46-
.listxattr = afs_listxattr,
4746
};
4847

4948
const struct address_space_operations afs_fs_aops = {

fs/afs/fs_operation.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,13 @@ void afs_wait_for_operation(struct afs_operation *op)
181181
if (test_bit(AFS_SERVER_FL_IS_YFS, &op->server->flags) &&
182182
op->ops->issue_yfs_rpc)
183183
op->ops->issue_yfs_rpc(op);
184-
else
184+
else if (op->ops->issue_afs_rpc)
185185
op->ops->issue_afs_rpc(op);
186+
else
187+
op->ac.error = -ENOTSUPP;
186188

187-
op->error = afs_wait_for_call_to_complete(op->call, &op->ac);
189+
if (op->call)
190+
op->error = afs_wait_for_call_to_complete(op->call, &op->ac);
188191
}
189192

190193
switch (op->error) {

fs/afs/inode.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828
static const struct inode_operations afs_symlink_inode_operations = {
2929
.get_link = page_get_link,
30-
.listxattr = afs_listxattr,
3130
};
3231

3332
static noinline void dump_vnode(struct afs_vnode *vnode, struct afs_vnode *parent_vnode)

fs/afs/internal.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1509,7 +1509,6 @@ extern int afs_launder_page(struct page *);
15091509
* xattr.c
15101510
*/
15111511
extern const struct xattr_handler *afs_xattr_handlers[];
1512-
extern ssize_t afs_listxattr(struct dentry *, char *, size_t);
15131512

15141513
/*
15151514
* yfsclient.c

fs/afs/mntpt.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ const struct inode_operations afs_mntpt_inode_operations = {
3232
.lookup = afs_mntpt_lookup,
3333
.readlink = page_readlink,
3434
.getattr = afs_getattr,
35-
.listxattr = afs_listxattr,
3635
};
3736

3837
const struct inode_operations afs_autocell_inode_operations = {

fs/afs/xattr.c

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,6 @@
1111
#include <linux/xattr.h>
1212
#include "internal.h"
1313

14-
static const char afs_xattr_list[] =
15-
"afs.acl\0"
16-
"afs.cell\0"
17-
"afs.fid\0"
18-
"afs.volume\0"
19-
"afs.yfs.acl\0"
20-
"afs.yfs.acl_inherited\0"
21-
"afs.yfs.acl_num_cleaned\0"
22-
"afs.yfs.vol_acl";
23-
24-
/*
25-
* Retrieve a list of the supported xattrs.
26-
*/
27-
ssize_t afs_listxattr(struct dentry *dentry, char *buffer, size_t size)
28-
{
29-
if (size == 0)
30-
return sizeof(afs_xattr_list);
31-
if (size < sizeof(afs_xattr_list))
32-
return -ERANGE;
33-
memcpy(buffer, afs_xattr_list, sizeof(afs_xattr_list));
34-
return sizeof(afs_xattr_list);
35-
}
36-
3714
/*
3815
* Deal with the result of a successful fetch ACL operation.
3916
*/
@@ -231,6 +208,8 @@ static int afs_xattr_get_yfs(const struct xattr_handler *handler,
231208
else
232209
ret = -ERANGE;
233210
}
211+
} else if (ret == -ENOTSUPP) {
212+
ret = -ENODATA;
234213
}
235214

236215
error_yacl:
@@ -256,6 +235,7 @@ static int afs_xattr_set_yfs(const struct xattr_handler *handler,
256235
{
257236
struct afs_operation *op;
258237
struct afs_vnode *vnode = AFS_FS_I(inode);
238+
int ret;
259239

260240
if (flags == XATTR_CREATE ||
261241
strcmp(name, "acl") != 0)
@@ -270,7 +250,10 @@ static int afs_xattr_set_yfs(const struct xattr_handler *handler,
270250
return afs_put_operation(op);
271251

272252
op->ops = &yfs_store_opaque_acl2_operation;
273-
return afs_do_sync_operation(op);
253+
ret = afs_do_sync_operation(op);
254+
if (ret == -ENOTSUPP)
255+
ret = -ENODATA;
256+
return ret;
274257
}
275258

276259
static const struct xattr_handler afs_xattr_yfs_handler = {

0 commit comments

Comments
 (0)