diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-04-15 18:31:58 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:00 -0400 |
commit | 3e07a7300f0684f7c77485e65a1ae97c7ab2514f (patch) | |
tree | a3baa216dbb17a5294c32f183edc0b8178af9604 /fs/bcachefs/alloc_foreground.c | |
parent | 633632ef1be790af24897cfcf165d936ca379b45 (diff) |
bcachefs: Fix an RCU splat
Writepoints are never deallocated so the rcu_read_lock() isn't really
needed, but we are doing lockless list traversal.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/alloc_foreground.c')
-rw-r--r-- | fs/bcachefs/alloc_foreground.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/bcachefs/alloc_foreground.c b/fs/bcachefs/alloc_foreground.c index 4834ac798b9e..56b114888e49 100644 --- a/fs/bcachefs/alloc_foreground.c +++ b/fs/bcachefs/alloc_foreground.c @@ -683,11 +683,14 @@ static struct write_point *__writepoint_find(struct hlist_head *head, { struct write_point *wp; + rcu_read_lock(); hlist_for_each_entry_rcu(wp, head, node) if (wp->write_point == write_point) - return wp; - - return NULL; + goto out; + wp = NULL; +out: + rcu_read_unlock(); + return wp; } static inline bool too_many_writepoints(struct bch_fs *c, unsigned factor) |