From: Kent Overstreet Date: Thu, 15 Apr 2021 22:31:58 +0000 (-0400) Subject: bcachefs: Fix an RCU splat X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=3e07a7300f0684f7c77485e65a1ae97c7ab2514f;p=linux.git 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 Signed-off-by: Kent Overstreet --- diff --git a/fs/bcachefs/alloc_foreground.c b/fs/bcachefs/alloc_foreground.c index 4834ac798b9e9..56b114888e49a 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)