summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/super.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2020-10-15 22:50:48 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:08:44 -0400
commit9f20ed157d521c7a1af0fe01e80d9e0ee880f9f7 (patch)
tree9e0ed729e946a6e248820cf2e24b6e0b69f48af3 /fs/bcachefs/super.c
parent6ea873d1727af15ae429882737e8848492b63595 (diff)
downloadlinux-stable-9f20ed157d521c7a1af0fe01e80d9e0ee880f9f7.tar.gz
linux-stable-9f20ed157d521c7a1af0fe01e80d9e0ee880f9f7.tar.bz2
linux-stable-9f20ed157d521c7a1af0fe01e80d9e0ee880f9f7.zip
bcachefs: Fix copygc dying on startup
The copygc threads errors out and makes the filesystem go RO if it ever tries to run and discovers it has no reserve allocated - which is a problem if it races with the allocator thread and its reserve hasn't been filled yet. The allocator thread doesn't start filling the copygc reserve until after BCH_FS_STARTED has been set, so make sure to wake up the allocator threads after setting that and before starting copygc. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/super.c')
-rw-r--r--fs/bcachefs/super.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c
index 988c678de9fc..85ba96cb2292 100644
--- a/fs/bcachefs/super.c
+++ b/fs/bcachefs/super.c
@@ -888,6 +888,13 @@ int bch2_fs_start(struct bch_fs *c)
set_bit(BCH_FS_STARTED, &c->flags);
+ /*
+ * Allocator threads don't start filling copygc reserve until after we
+ * set BCH_FS_STARTED - wake them now:
+ */
+ for_each_online_member(ca, c, i)
+ bch2_wake_allocator(ca);
+
if (c->opts.read_only || c->opts.nochanges) {
bch2_fs_read_only(c);
} else {