mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-04 09:34:12 +08:00
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>
This commit is contained in:
parent
6ea873d172
commit
9f20ed157d
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user