summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-04-16 01:31:58 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:00 +0300
commit3e07a7300f0684f7c77485e65a1ae97c7ab2514f (patch)
treea3baa216dbb17a5294c32f183edc0b8178af9604
parent633632ef1be790af24897cfcf165d936ca379b45 (diff)
downloadlinux-3e07a7300f0684f7c77485e65a1ae97c7ab2514f.tar.xz
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>
-rw-r--r--fs/bcachefs/alloc_foreground.c9
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)