summaryrefslogtreecommitdiff
path: root/fs/bcachefs/fs-common.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-06-14 18:16:10 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:06 -0400
commit8c3f6da9fc526e7ba0f6449efa1040084406e9ba (patch)
tree6106b0097c188e1acb746de16468c28f095aad40 /fs/bcachefs/fs-common.c
parentb89726ab86aab15ea8526fb365da6a0f5d474241 (diff)
bcachefs: Improve iter->should_be_locked
Adding iter->should_be_locked introduced a regression where it ended up not being set on the iterator passed to bch2_btree_update_start(), which is definitely not what we want. This patch requires it to be set when calling bch2_trans_update(), and adds various fixups to make that happen. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/fs-common.c')
-rw-r--r--fs/bcachefs/fs-common.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/bcachefs/fs-common.c b/fs/bcachefs/fs-common.c
index 00a63fecb976..60c54438074e 100644
--- a/fs/bcachefs/fs-common.c
+++ b/fs/bcachefs/fs-common.c
@@ -85,7 +85,8 @@ int bch2_create_trans(struct btree_trans *trans, u64 dir_inum,
inode_iter->snapshot = U32_MAX;
bch2_btree_iter_set_pos(inode_iter, SPOS(0, new_inode->bi_inum, U32_MAX));
- ret = bch2_inode_write(trans, inode_iter, new_inode);
+ ret = bch2_btree_iter_traverse(inode_iter) ?:
+ bch2_inode_write(trans, inode_iter, new_inode);
err:
bch2_trans_iter_put(trans, inode_iter);
bch2_trans_iter_put(trans, dir_iter);