Commit 9862022d authored by Youling Tang's avatar Youling Tang Committed by Kent Overstreet

bcachefs: Fix error path of bch2_link_trans()

In bch2_link_trans(), if bch2_inode_nlink_inc() fails, it needs to
call bch2_trans_iter_exit() in the error path.
Signed-off-by: default avatarYouling Tang <tangyouling@kylinos.cn>
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 36aa49d3
...@@ -200,12 +200,12 @@ int bch2_link_trans(struct btree_trans *trans, ...@@ -200,12 +200,12 @@ int bch2_link_trans(struct btree_trans *trans,
ret = bch2_inode_peek(trans, &inode_iter, inode_u, inum, BTREE_ITER_intent); ret = bch2_inode_peek(trans, &inode_iter, inode_u, inum, BTREE_ITER_intent);
if (ret) if (ret)
goto err; return ret;
inode_u->bi_ctime = now; inode_u->bi_ctime = now;
ret = bch2_inode_nlink_inc(inode_u); ret = bch2_inode_nlink_inc(inode_u);
if (ret) if (ret)
return ret; goto err;
ret = bch2_inode_peek(trans, &dir_iter, dir_u, dir, BTREE_ITER_intent); ret = bch2_inode_peek(trans, &dir_iter, dir_u, dir, BTREE_ITER_intent);
if (ret) if (ret)
......
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