diff options
author | Youling Tang <tangyouling@kylinos.cn> | 2024-04-30 11:28:39 +0800 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-05-08 17:29:21 -0400 |
commit | 9862022d09f785088619fd3c14063592fddc2aa5 (patch) | |
tree | 459e021685677b0cbc0aaf5c394e6f14b40f9b86 | |
parent | 36aa49d33e8d59246bd338064d6a516f693954e5 (diff) | |
download | linux-stable-9862022d09f785088619fd3c14063592fddc2aa5.tar.gz linux-stable-9862022d09f785088619fd3c14063592fddc2aa5.tar.bz2 linux-stable-9862022d09f785088619fd3c14063592fddc2aa5.zip |
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>
-rw-r--r-- | fs/bcachefs/fs-common.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/bcachefs/fs-common.c b/fs/bcachefs/fs-common.c index 6c737def357e..508d029ac53d 100644 --- a/fs/bcachefs/fs-common.c +++ b/fs/bcachefs/fs-common.c @@ -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) |