summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-08-13 18:15:53 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-08-14 12:28:45 -0400
commit14bd13c17b4e10c42c1826ecb89f4d35d4dbc043 (patch)
tree1cdef63958b01b2b97f4cd2c0f25e944c657e0ae
parente32a551afafd55001e0e30967c32750f7eb2837a (diff)
bcachefs: Zero btree_paths on allocation
This fixes a bug in the cycle detector, bch2_check_for_deadlock() - we have to make sure the node pointers in the btree paths array are set to something not-garbage before another thread may see them. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r--fs/bcachefs/btree_iter.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
index 9b6807f67355..f5b17938b063 100644
--- a/fs/bcachefs/btree_iter.c
+++ b/fs/bcachefs/btree_iter.c
@@ -2899,7 +2899,7 @@ static void bch2_trans_alloc_paths(struct btree_trans *trans, struct bch_fs *c)
p = this_cpu_xchg(c->btree_paths_bufs->path, NULL);
#endif
if (!p)
- p = mempool_alloc(&trans->c->btree_paths_pool, GFP_NOFS);
+ p = mempool_alloc(&trans->c->btree_paths_pool, GFP_NOFS|__GFP_ZERO);
/*
* paths need to be zeroed, bch2_check_for_deadlock looks at paths in
* other threads