Skip to content

Commit f39bae2

Browse files
author
Kent Overstreet
committed
bcachefs: Switch to .get_inode_acl()
.set_acl() requires a dentry, and if one isn't passed it marks the VFS inode as not having an ACL. This has been causing inodes with ACLs to have them "disappear" on bcachefs filesystem, depending on which path those inodes get pulled into the cache from. Switching to .get_inode_acl(), like other local filesystems, fixes this. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
1 parent 73dc165 commit f39bae2

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

fs/bcachefs/acl.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -272,16 +272,19 @@ bch2_acl_to_xattr(struct btree_trans *trans,
272272
return xattr;
273273
}
274274

275-
struct posix_acl *bch2_get_acl(struct mnt_idmap *idmap,
276-
struct dentry *dentry, int type)
275+
struct posix_acl *bch2_get_acl(struct inode *vinode, int type, bool rcu)
277276
{
278-
struct bch_inode_info *inode = to_bch_ei(dentry->d_inode);
277+
struct bch_inode_info *inode = to_bch_ei(vinode);
279278
struct bch_fs *c = inode->v.i_sb->s_fs_info;
280279
struct bch_hash_info hash = bch2_hash_info_init(c, &inode->ei_inode);
281280
struct xattr_search_key search = X_SEARCH(acl_to_xattr_type(type), "", 0);
282-
struct btree_trans *trans = bch2_trans_get(c);
283281
struct btree_iter iter = { NULL };
284282
struct posix_acl *acl = NULL;
283+
284+
if (rcu)
285+
return ERR_PTR(-ECHILD);
286+
287+
struct btree_trans *trans = bch2_trans_get(c);
285288
retry:
286289
bch2_trans_begin(trans);
287290

fs/bcachefs/acl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ void bch2_acl_to_text(struct printbuf *, const void *, size_t);
2828

2929
#ifdef CONFIG_BCACHEFS_POSIX_ACL
3030

31-
struct posix_acl *bch2_get_acl(struct mnt_idmap *, struct dentry *, int);
31+
struct posix_acl *bch2_get_acl(struct inode *, int, bool);
3232

3333
int bch2_set_acl_trans(struct btree_trans *, subvol_inum,
3434
struct bch_inode_unpacked *,

fs/bcachefs/fs.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,7 +1199,7 @@ static const struct inode_operations bch_file_inode_operations = {
11991199
.fiemap = bch2_fiemap,
12001200
.listxattr = bch2_xattr_list,
12011201
#ifdef CONFIG_BCACHEFS_POSIX_ACL
1202-
.get_acl = bch2_get_acl,
1202+
.get_inode_acl = bch2_get_acl,
12031203
.set_acl = bch2_set_acl,
12041204
#endif
12051205
};
@@ -1219,7 +1219,7 @@ static const struct inode_operations bch_dir_inode_operations = {
12191219
.tmpfile = bch2_tmpfile,
12201220
.listxattr = bch2_xattr_list,
12211221
#ifdef CONFIG_BCACHEFS_POSIX_ACL
1222-
.get_acl = bch2_get_acl,
1222+
.get_inode_acl = bch2_get_acl,
12231223
.set_acl = bch2_set_acl,
12241224
#endif
12251225
};
@@ -1241,7 +1241,7 @@ static const struct inode_operations bch_symlink_inode_operations = {
12411241
.setattr = bch2_setattr,
12421242
.listxattr = bch2_xattr_list,
12431243
#ifdef CONFIG_BCACHEFS_POSIX_ACL
1244-
.get_acl = bch2_get_acl,
1244+
.get_inode_acl = bch2_get_acl,
12451245
.set_acl = bch2_set_acl,
12461246
#endif
12471247
};
@@ -1251,7 +1251,7 @@ static const struct inode_operations bch_special_inode_operations = {
12511251
.setattr = bch2_setattr,
12521252
.listxattr = bch2_xattr_list,
12531253
#ifdef CONFIG_BCACHEFS_POSIX_ACL
1254-
.get_acl = bch2_get_acl,
1254+
.get_inode_acl = bch2_get_acl,
12551255
.set_acl = bch2_set_acl,
12561256
#endif
12571257
};

0 commit comments

Comments
 (0)