diff options
Diffstat (limited to 'fs/bcachefs/alloc.c')
-rw-r--r-- | fs/bcachefs/alloc.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/bcachefs/alloc.c b/fs/bcachefs/alloc.c index 24a22f1b7128..44f9479eecd1 100644 --- a/fs/bcachefs/alloc.c +++ b/fs/bcachefs/alloc.c @@ -1889,8 +1889,9 @@ void bch2_dev_allocator_add(struct bch_fs *c, struct bch_dev *ca) /* stop allocator thread: */ void bch2_dev_allocator_stop(struct bch_dev *ca) { - struct task_struct *p = ca->alloc_thread; + struct task_struct *p; + p = rcu_dereference_protected(ca->alloc_thread, 1); ca->alloc_thread = NULL; /* @@ -1925,7 +1926,7 @@ int bch2_dev_allocator_start(struct bch_dev *ca) return PTR_ERR(p); get_task_struct(p); - ca->alloc_thread = p; + rcu_assign_pointer(ca->alloc_thread, p); wake_up_process(p); return 0; } |