diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2022-03-28 23:31:26 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:09:28 +0300 |
commit | 81cdc8f3070561786a906c66d697666e6a3319b9 (patch) | |
tree | 455c370956b19f0270283f3ed1f1bbe09d2b9c08 | |
parent | 7fda0f08fa86731f057367ca36054d29d0c0344c (diff) | |
download | linux-81cdc8f3070561786a906c66d697666e6a3319b9.tar.xz |
bcachefs: Fix error path in bch2_snapshot_set_equiv()
We weren't properly catching errors from snapshot_live() - oops.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
-rw-r--r-- | fs/bcachefs/subvolume.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/bcachefs/subvolume.c b/fs/bcachefs/subvolume.c index 2c5f7e7793a7..20c6b21e54d3 100644 --- a/fs/bcachefs/subvolume.c +++ b/fs/bcachefs/subvolume.c @@ -139,7 +139,7 @@ static int bch2_snapshots_set_equiv(struct btree_trans *trans) for_each_btree_key(trans, iter, BTREE_ID_snapshots, POS_MIN, 0, k, ret) { u32 id = k.k->p.offset, child[2]; - unsigned nr_live = 0, live_idx; + unsigned nr_live = 0, live_idx = 0; if (k.k->type != KEY_TYPE_snapshot) continue; @@ -151,7 +151,7 @@ static int bch2_snapshots_set_equiv(struct btree_trans *trans) for (i = 0; i < 2; i++) { ret = snapshot_live(trans, child[i]); if (ret < 0) - break; + goto err; if (ret) live_idx = i; @@ -162,6 +162,7 @@ static int bch2_snapshots_set_equiv(struct btree_trans *trans) ? snapshot_t(c, child[live_idx])->equiv : id; } +err: bch2_trans_iter_exit(trans, &iter); if (ret) |