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>
This commit is contained in:
parent
e9679b4a06
commit
ff5b741c25
@ -2898,12 +2898,14 @@ static void bch2_trans_alloc_paths(struct btree_trans *trans, struct bch_fs *c)
|
|||||||
#ifdef __KERNEL__
|
#ifdef __KERNEL__
|
||||||
p = this_cpu_xchg(c->btree_paths_bufs->path, NULL);
|
p = this_cpu_xchg(c->btree_paths_bufs->path, NULL);
|
||||||
#endif
|
#endif
|
||||||
if (!p)
|
if (!p) {
|
||||||
p = mempool_alloc(&trans->c->btree_paths_pool, GFP_NOFS);
|
p = mempool_alloc(&trans->c->btree_paths_pool, GFP_NOFS);
|
||||||
/*
|
/*
|
||||||
* paths need to be zeroed, bch2_check_for_deadlock looks at paths in
|
* paths need to be zeroed, bch2_check_for_deadlock looks at
|
||||||
* other threads
|
* paths in other threads
|
||||||
*/
|
*/
|
||||||
|
memset(p, 0, paths_bytes);
|
||||||
|
}
|
||||||
|
|
||||||
trans->paths = p; p += paths_bytes;
|
trans->paths = p; p += paths_bytes;
|
||||||
trans->updates = p; p += updates_bytes;
|
trans->updates = p; p += updates_bytes;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user