Skip to content

Commit 0cad624

Browse files
author
Miklos Szeredi
committed
vfs: add rcu argument to ->get_acl() callback
Add a rcu argument to the ->get_acl() callback to allow get_cached_acl_rcu() to call the ->get_acl() method in the next patch. Signed-off-by: Miklos Szeredi <[email protected]>
1 parent 52d5a0c commit 0cad624

File tree

39 files changed

+91
-40
lines changed

39 files changed

+91
-40
lines changed

Documentation/filesystems/locking.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ prototypes::
7070
const char *(*get_link) (struct dentry *, struct inode *, struct delayed_call *);
7171
void (*truncate) (struct inode *);
7272
int (*permission) (struct inode *, int, unsigned int);
73-
int (*get_acl)(struct inode *, int);
73+
struct posix_acl * (*get_acl)(struct inode *, int, bool);
7474
int (*setattr) (struct dentry *, struct iattr *);
7575
int (*getattr) (const struct path *, struct kstat *, u32, unsigned int);
7676
ssize_t (*listxattr) (struct dentry *, char *, size_t);

Documentation/filesystems/vfs.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ As of kernel 2.6.22, the following members are defined:
432432
const char *(*get_link) (struct dentry *, struct inode *,
433433
struct delayed_call *);
434434
int (*permission) (struct user_namespace *, struct inode *, int);
435-
int (*get_acl)(struct inode *, int);
435+
struct posix_acl * (*get_acl)(struct inode *, int, bool);
436436
int (*setattr) (struct user_namespace *, struct dentry *, struct iattr *);
437437
int (*getattr) (struct user_namespace *, const struct path *, struct kstat *, u32, unsigned int);
438438
ssize_t (*listxattr) (struct dentry *, char *, size_t);

fs/9p/acl.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,13 @@ static struct posix_acl *v9fs_get_cached_acl(struct inode *inode, int type)
9797
return acl;
9898
}
9999

100-
struct posix_acl *v9fs_iop_get_acl(struct inode *inode, int type)
100+
struct posix_acl *v9fs_iop_get_acl(struct inode *inode, int type, bool rcu)
101101
{
102102
struct v9fs_session_info *v9ses;
103103

104+
if (rcu)
105+
return ERR_PTR(-ECHILD);
106+
104107
v9ses = v9fs_inode2v9ses(inode);
105108
if (((v9ses->flags & V9FS_ACCESS_MASK) != V9FS_ACCESS_CLIENT) ||
106109
((v9ses->flags & V9FS_ACL_MASK) != V9FS_POSIX_ACL)) {

fs/9p/acl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
#ifdef CONFIG_9P_FS_POSIX_ACL
1818
extern int v9fs_get_acl(struct inode *, struct p9_fid *);
19-
extern struct posix_acl *v9fs_iop_get_acl(struct inode *inode, int type);
19+
extern struct posix_acl *v9fs_iop_get_acl(struct inode *inode, int type, bool rcu);
2020
extern int v9fs_acl_chmod(struct inode *, struct p9_fid *);
2121
extern int v9fs_set_create_acl(struct inode *, struct p9_fid *,
2222
struct posix_acl *, struct posix_acl *);

fs/bad_inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ static const char *bad_inode_get_link(struct dentry *dentry,
121121
return ERR_PTR(-EIO);
122122
}
123123

124-
static struct posix_acl *bad_inode_get_acl(struct inode *inode, int type)
124+
static struct posix_acl *bad_inode_get_acl(struct inode *inode, int type, bool rcu)
125125
{
126126
return ERR_PTR(-EIO);
127127
}

fs/btrfs/acl.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,16 @@
1616
#include "btrfs_inode.h"
1717
#include "xattr.h"
1818

19-
struct posix_acl *btrfs_get_acl(struct inode *inode, int type)
19+
struct posix_acl *btrfs_get_acl(struct inode *inode, int type, bool rcu)
2020
{
2121
int size;
2222
const char *name;
2323
char *value = NULL;
2424
struct posix_acl *acl;
2525

26+
if (rcu)
27+
return ERR_PTR(-ECHILD);
28+
2629
switch (type) {
2730
case ACL_TYPE_ACCESS:
2831
name = XATTR_NAME_POSIX_ACL_ACCESS;

fs/btrfs/ctree.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3686,7 +3686,7 @@ static inline int __btrfs_fs_compat_ro(struct btrfs_fs_info *fs_info, u64 flag)
36863686

36873687
/* acl.c */
36883688
#ifdef CONFIG_BTRFS_FS_POSIX_ACL
3689-
struct posix_acl *btrfs_get_acl(struct inode *inode, int type);
3689+
struct posix_acl *btrfs_get_acl(struct inode *inode, int type, bool rcu);
36903690
int btrfs_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
36913691
struct posix_acl *acl, int type);
36923692
int btrfs_init_acl(struct btrfs_trans_handle *trans,

fs/ceph/acl.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,17 @@ static inline void ceph_set_cached_acl(struct inode *inode,
2929
spin_unlock(&ci->i_ceph_lock);
3030
}
3131

32-
struct posix_acl *ceph_get_acl(struct inode *inode, int type)
32+
struct posix_acl *ceph_get_acl(struct inode *inode, int type, bool rcu)
3333
{
3434
int size;
3535
unsigned int retry_cnt = 0;
3636
const char *name;
3737
char *value = NULL;
3838
struct posix_acl *acl;
3939

40+
if (rcu)
41+
return ERR_PTR(-ECHILD);
42+
4043
switch (type) {
4144
case ACL_TYPE_ACCESS:
4245
name = XATTR_NAME_POSIX_ACL_ACCESS;

fs/ceph/super.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1087,7 +1087,7 @@ void ceph_release_acl_sec_ctx(struct ceph_acl_sec_ctx *as_ctx);
10871087
/* acl.c */
10881088
#ifdef CONFIG_CEPH_FS_POSIX_ACL
10891089

1090-
struct posix_acl *ceph_get_acl(struct inode *, int);
1090+
struct posix_acl *ceph_get_acl(struct inode *, int, bool);
10911091
int ceph_set_acl(struct user_namespace *mnt_userns,
10921092
struct inode *inode, struct posix_acl *acl, int type);
10931093
int ceph_pre_init_acls(struct inode *dir, umode_t *mode,

fs/erofs/xattr.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,12 +673,15 @@ ssize_t erofs_listxattr(struct dentry *dentry,
673673
}
674674

675675
#ifdef CONFIG_EROFS_FS_POSIX_ACL
676-
struct posix_acl *erofs_get_acl(struct inode *inode, int type)
676+
struct posix_acl *erofs_get_acl(struct inode *inode, int type, bool rcu)
677677
{
678678
struct posix_acl *acl;
679679
int prefix, rc;
680680
char *value = NULL;
681681

682+
if (rcu)
683+
return ERR_PTR(-ECHILD);
684+
682685
switch (type) {
683686
case ACL_TYPE_ACCESS:
684687
prefix = EROFS_XATTR_INDEX_POSIX_ACL_ACCESS;

0 commit comments

Comments
 (0)