bcachefs: Fix a null ptr deref

We start doing allocations before the GC thread is created, which means
we need to check for that to avoid a null ptr deref.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
This commit is contained in:
Kent Overstreet 2022-04-10 14:36:10 -04:00 committed by Kent Overstreet
parent cf0dd697eb
commit 6e811bbbc2

View File

@ -105,7 +105,8 @@ static inline bool gc_visited(struct bch_fs *c, struct gc_pos pos)
static inline void bch2_do_gc_gens(struct bch_fs *c)
{
atomic_inc(&c->kick_gc);
wake_up_process(c->gc_thread);
if (c->gc_thread)
wake_up_process(c->gc_thread);
}
#endif /* _BCACHEFS_BTREE_GC_H */