diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-26 23:02:42 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-11-01 21:11:08 -0400 |
commit | 85103d15ca3fe3b987f912873cb4f91b6f557c6c (patch) | |
tree | cd3824e6ab3a8c3ea6c87735f0cfec36ca3c9dde /fs/bcachefs/replicas.c | |
parent | b65db750e2bb9252321fd54c284edd73c1595a09 (diff) | |
download | linux-85103d15ca3fe3b987f912873cb4f91b6f557c6c.tar.gz linux-85103d15ca3fe3b987f912873cb4f91b6f557c6c.tar.bz2 linux-85103d15ca3fe3b987f912873cb4f91b6f557c6c.zip |
bcachefs: Fix error path in bch2_replicas_gc_end()
We were dropping a lock we hadn't taken when entering with an error.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/replicas.c')
-rw-r--r-- | fs/bcachefs/replicas.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/fs/bcachefs/replicas.c b/fs/bcachefs/replicas.c index cef2a0447b86..1c3ae13bfced 100644 --- a/fs/bcachefs/replicas.c +++ b/fs/bcachefs/replicas.c @@ -462,18 +462,13 @@ int bch2_replicas_gc_end(struct bch_fs *c, int ret) { lockdep_assert_held(&c->replicas_gc_lock); - if (ret) - goto err; - mutex_lock(&c->sb_lock); percpu_down_write(&c->mark_lock); - ret = bch2_cpu_replicas_to_sb_replicas(c, &c->replicas_gc); - if (ret) - goto err; + ret = ret ?: + bch2_cpu_replicas_to_sb_replicas(c, &c->replicas_gc) ?: + replicas_table_update(c, &c->replicas_gc); - ret = replicas_table_update(c, &c->replicas_gc); -err: kfree(c->replicas_gc.entries); c->replicas_gc.entries = NULL; @@ -579,12 +574,9 @@ retry: bch2_cpu_replicas_sort(&new); - ret = bch2_cpu_replicas_to_sb_replicas(c, &new); - if (ret) - goto err; + ret = bch2_cpu_replicas_to_sb_replicas(c, &new) ?: + replicas_table_update(c, &new); - ret = replicas_table_update(c, &new); -err: kfree(new.entries); percpu_up_write(&c->mark_lock); |