mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-07 21:53:44 +00:00
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>
This commit is contained in:
parent
b65db750e2
commit
85103d15ca
@ -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 @@ int bch2_replicas_gc2(struct bch_fs *c)
|
||||
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user