From 9a644843c4701f86594fe0386f00af6b847f747d Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Sat, 8 Jul 2023 22:21:45 -0400 Subject: bcachefs: Fix error path in bch2_journal_flush_device_pins() We need to always call bch2_replicas_gc_end() after we've called bch2_replicas_gc_start(), else we leave state around that needs to be cleaned up. Partial fix for: https://github.com/koverstreet/bcachefs/issues/560 Signed-off-by: Kent Overstreet --- fs/bcachefs/replicas.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'fs/bcachefs/replicas.c') diff --git a/fs/bcachefs/replicas.c b/fs/bcachefs/replicas.c index d4c1d43e8c41..5b591c59bc3e 100644 --- a/fs/bcachefs/replicas.c +++ b/fs/bcachefs/replicas.c @@ -462,6 +462,9 @@ 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); -- cgit v1.2.3