Commit f39bae2e authored by Kent Overstreet's avatar Kent Overstreet

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: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 73dc1656
...@@ -272,16 +272,19 @@ bch2_acl_to_xattr(struct btree_trans *trans, ...@@ -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);
......
...@@ -28,7 +28,7 @@ void bch2_acl_to_text(struct printbuf *, const void *, size_t); ...@@ -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 *,
......
...@@ -1199,7 +1199,7 @@ static const struct inode_operations bch_file_inode_operations = { ...@@ -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 = { ...@@ -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 = { ...@@ -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 = { ...@@ -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
}; };
......
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