summaryrefslogtreecommitdiff
path: root/fs/bcachefs/alloc_background.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2020-10-16 05:50:48 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:08:44 +0300
commit9f20ed157d521c7a1af0fe01e80d9e0ee880f9f7 (patch)
tree9e0ed729e946a6e248820cf2e24b6e0b69f48af3 /fs/bcachefs/alloc_background.h
parent6ea873d1727af15ae429882737e8848492b63595 (diff)
downloadlinux-9f20ed157d521c7a1af0fe01e80d9e0ee880f9f7.tar.xz
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/alloc_background.h')
-rw-r--r--fs/bcachefs/alloc_background.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/bcachefs/alloc_background.h b/fs/bcachefs/alloc_background.h
index f6b9f27f0713..4f462696b747 100644
--- a/fs/bcachefs/alloc_background.h
+++ b/fs/bcachefs/alloc_background.h
@@ -61,8 +61,10 @@ static inline void bch2_wake_allocator(struct bch_dev *ca)
rcu_read_lock();
p = rcu_dereference(ca->alloc_thread);
- if (p)
+ if (p) {
wake_up_process(p);
+ ca->allocator_state = ALLOCATOR_RUNNING;
+ }
rcu_read_unlock();
}