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: Youling Tang <tangyouling@kylinos.cn>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Youling Tang 2024-04-30 11:28:39 +08:00 committed by Kent Overstreet
parent 36aa49d33e
commit 9862022d09

View File

@ -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);
if (ret)
goto err;
return ret;
inode_u->bi_ctime = now;
ret = bch2_inode_nlink_inc(inode_u);
if (ret)
return ret;
goto err;
ret = bch2_inode_peek(trans, &dir_iter, dir_u, dir, BTREE_ITER_intent);
if (ret)