bcachefs: fix ei_update_lock lock ordering
ei_update_lock is largely vestigal and will probably be removed, but we're not ready for that just yet. this fixes some lockdep splats with the new lockdep support for btree node locks; they're harmless, since we were taking ei_update_lock before actually locking any btree nodes, but "any btree nodes locked" are now tracked at the btree_trans level. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
cdda2126ab
commit
f369de8267
@ -346,7 +346,6 @@ int bch2_set_acl(struct mnt_idmap *idmap,
|
||||
{
|
||||
struct bch_inode_info *inode = to_bch_ei(dentry->d_inode);
|
||||
struct bch_fs *c = inode->v.i_sb->s_fs_info;
|
||||
struct btree_trans *trans = bch2_trans_get(c);
|
||||
struct btree_iter inode_iter = { NULL };
|
||||
struct bch_inode_unpacked inode_u;
|
||||
struct posix_acl *acl;
|
||||
@ -354,6 +353,7 @@ int bch2_set_acl(struct mnt_idmap *idmap,
|
||||
int ret;
|
||||
|
||||
mutex_lock(&inode->ei_update_lock);
|
||||
struct btree_trans *trans = bch2_trans_get(c);
|
||||
retry:
|
||||
bch2_trans_begin(trans);
|
||||
acl = _acl;
|
||||
@ -394,8 +394,8 @@ btree_err:
|
||||
|
||||
set_cached_acl(&inode->v, type, acl);
|
||||
err:
|
||||
mutex_unlock(&inode->ei_update_lock);
|
||||
bch2_trans_put(trans);
|
||||
mutex_unlock(&inode->ei_update_lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -517,11 +517,11 @@ static int __bch2_link(struct bch_fs *c,
|
||||
struct bch_inode_info *dir,
|
||||
struct dentry *dentry)
|
||||
{
|
||||
struct btree_trans *trans = bch2_trans_get(c);
|
||||
struct bch_inode_unpacked dir_u, inode_u;
|
||||
int ret;
|
||||
|
||||
mutex_lock(&inode->ei_update_lock);
|
||||
struct btree_trans *trans = bch2_trans_get(c);
|
||||
|
||||
ret = commit_do(trans, NULL, NULL, 0,
|
||||
bch2_link_trans(trans,
|
||||
@ -568,11 +568,12 @@ int __bch2_unlink(struct inode *vdir, struct dentry *dentry,
|
||||
struct bch_inode_info *dir = to_bch_ei(vdir);
|
||||
struct bch_inode_info *inode = to_bch_ei(dentry->d_inode);
|
||||
struct bch_inode_unpacked dir_u, inode_u;
|
||||
struct btree_trans *trans = bch2_trans_get(c);
|
||||
int ret;
|
||||
|
||||
bch2_lock_inodes(INODE_UPDATE_LOCK, dir, inode);
|
||||
|
||||
struct btree_trans *trans = bch2_trans_get(c);
|
||||
|
||||
ret = commit_do(trans, NULL, NULL,
|
||||
BCH_TRANS_COMMIT_no_enospc,
|
||||
bch2_unlink_trans(trans,
|
||||
@ -595,8 +596,8 @@ int __bch2_unlink(struct inode *vdir, struct dentry *dentry,
|
||||
set_nlink(&inode->v, 0);
|
||||
}
|
||||
err:
|
||||
bch2_unlock_inodes(INODE_UPDATE_LOCK, dir, inode);
|
||||
bch2_trans_put(trans);
|
||||
bch2_unlock_inodes(INODE_UPDATE_LOCK, dir, inode);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -681,14 +682,14 @@ static int bch2_rename2(struct mnt_idmap *idmap,
|
||||
return ret;
|
||||
}
|
||||
|
||||
trans = bch2_trans_get(c);
|
||||
|
||||
bch2_lock_inodes(INODE_UPDATE_LOCK,
|
||||
src_dir,
|
||||
dst_dir,
|
||||
src_inode,
|
||||
dst_inode);
|
||||
|
||||
trans = bch2_trans_get(c);
|
||||
|
||||
ret = bch2_subvol_is_ro_trans(trans, src_dir->ei_subvol) ?:
|
||||
bch2_subvol_is_ro_trans(trans, dst_dir->ei_subvol);
|
||||
if (ret)
|
||||
|
Loading…
x
Reference in New Issue
Block a user