diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-04-19 00:26:34 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:09:01 +0300 |
commit | 04903131db3e09a6a074755071c46febc7e2449f (patch) | |
tree | 05f525ca6830b64e44d4e4d39884daf2bda8c5d1 | |
parent | 6ad060b0eb45d2eaa5411be042bd3b53900f992e (diff) | |
download | linux-04903131db3e09a6a074755071c46febc7e2449f.tar.xz |
bcachefs: Handle errors in bch2_trans_mark_update()
It's not actually the case that iterators are always checked here -
__bch2_trans_commit() checks for that after running triggers.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r-- | fs/bcachefs/alloc_background.c | 2 | ||||
-rw-r--r-- | fs/bcachefs/buckets.c | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c index 84a560659413..ab60bf259b0c 100644 --- a/fs/bcachefs/alloc_background.c +++ b/fs/bcachefs/alloc_background.c @@ -293,8 +293,10 @@ int bch2_alloc_read(struct bch_fs *c, struct journal_keys *journal_keys) { int ret; + down_read(&c->gc_lock); ret = bch2_btree_and_journal_walk(c, journal_keys, BTREE_ID_alloc, NULL, bch2_alloc_read_fn); + up_read(&c->gc_lock); if (ret) { bch_err(c, "error reading alloc info: %i", ret); return ret; diff --git a/fs/bcachefs/buckets.c b/fs/bcachefs/buckets.c index 3f68a30acd5b..b51f311ad60e 100644 --- a/fs/bcachefs/buckets.c +++ b/fs/bcachefs/buckets.c @@ -1836,10 +1836,11 @@ int bch2_trans_mark_update(struct btree_trans *trans, return 0; if (!btree_node_type_is_extents(iter->btree_id)) { - /* iterators should be uptodate, shouldn't get errors here: */ if (btree_iter_type(iter) != BTREE_ITER_CACHED) { old = bch2_btree_iter_peek_slot(iter); - BUG_ON(bkey_err(old)); + ret = bkey_err(old); + if (ret) + return ret; } else { struct bkey_cached *ck = (void *) iter->l[0].b; |