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>
This commit is contained in:
Kent Overstreet 2024-08-07 15:42:23 -04:00
parent 73dc1656f4
commit f39bae2e02
3 changed files with 12 additions and 9 deletions

View File

@ -272,16 +272,19 @@ bch2_acl_to_xattr(struct btree_trans *trans,
return xattr; return xattr;
} }
struct posix_acl *bch2_get_acl(struct mnt_idmap *idmap, struct posix_acl *bch2_get_acl(struct inode *vinode, int type, bool rcu)
struct dentry *dentry, int type)
{ {
struct bch_inode_info *inode = to_bch_ei(dentry->d_inode); struct bch_inode_info *inode = to_bch_ei(vinode);
struct bch_fs *c = inode->v.i_sb->s_fs_info; struct bch_fs *c = inode->v.i_sb->s_fs_info;
struct bch_hash_info hash = bch2_hash_info_init(c, &inode->ei_inode); struct bch_hash_info hash = bch2_hash_info_init(c, &inode->ei_inode);
struct xattr_search_key search = X_SEARCH(acl_to_xattr_type(type), "", 0); struct xattr_search_key search = X_SEARCH(acl_to_xattr_type(type), "", 0);
struct btree_trans *trans = bch2_trans_get(c);
struct btree_iter iter = { NULL }; struct btree_iter iter = { NULL };
struct posix_acl *acl = NULL; struct posix_acl *acl = NULL;
if (rcu)
return ERR_PTR(-ECHILD);
struct btree_trans *trans = bch2_trans_get(c);
retry: retry:
bch2_trans_begin(trans); bch2_trans_begin(trans);

View File

@ -28,7 +28,7 @@ void bch2_acl_to_text(struct printbuf *, const void *, size_t);
#ifdef CONFIG_BCACHEFS_POSIX_ACL #ifdef CONFIG_BCACHEFS_POSIX_ACL
struct posix_acl *bch2_get_acl(struct mnt_idmap *, struct dentry *, int); struct posix_acl *bch2_get_acl(struct inode *, int, bool);
int bch2_set_acl_trans(struct btree_trans *, subvol_inum, int bch2_set_acl_trans(struct btree_trans *, subvol_inum,
struct bch_inode_unpacked *, struct bch_inode_unpacked *,

View File

@ -1199,7 +1199,7 @@ static const struct inode_operations bch_file_inode_operations = {
.fiemap = bch2_fiemap, .fiemap = bch2_fiemap,
.listxattr = bch2_xattr_list, .listxattr = bch2_xattr_list,
#ifdef CONFIG_BCACHEFS_POSIX_ACL #ifdef CONFIG_BCACHEFS_POSIX_ACL
.get_acl = bch2_get_acl, .get_inode_acl = bch2_get_acl,
.set_acl = bch2_set_acl, .set_acl = bch2_set_acl,
#endif #endif
}; };
@ -1219,7 +1219,7 @@ static const struct inode_operations bch_dir_inode_operations = {
.tmpfile = bch2_tmpfile, .tmpfile = bch2_tmpfile,
.listxattr = bch2_xattr_list, .listxattr = bch2_xattr_list,
#ifdef CONFIG_BCACHEFS_POSIX_ACL #ifdef CONFIG_BCACHEFS_POSIX_ACL
.get_acl = bch2_get_acl, .get_inode_acl = bch2_get_acl,
.set_acl = bch2_set_acl, .set_acl = bch2_set_acl,
#endif #endif
}; };
@ -1241,7 +1241,7 @@ static const struct inode_operations bch_symlink_inode_operations = {
.setattr = bch2_setattr, .setattr = bch2_setattr,
.listxattr = bch2_xattr_list, .listxattr = bch2_xattr_list,
#ifdef CONFIG_BCACHEFS_POSIX_ACL #ifdef CONFIG_BCACHEFS_POSIX_ACL
.get_acl = bch2_get_acl, .get_inode_acl = bch2_get_acl,
.set_acl = bch2_set_acl, .set_acl = bch2_set_acl,
#endif #endif
}; };
@ -1251,7 +1251,7 @@ static const struct inode_operations bch_special_inode_operations = {
.setattr = bch2_setattr, .setattr = bch2_setattr,
.listxattr = bch2_xattr_list, .listxattr = bch2_xattr_list,
#ifdef CONFIG_BCACHEFS_POSIX_ACL #ifdef CONFIG_BCACHEFS_POSIX_ACL
.get_acl = bch2_get_acl, .get_inode_acl = bch2_get_acl,
.set_acl = bch2_set_acl, .set_acl = bch2_set_acl,
#endif #endif
}; };