]> www.infradead.org Git - users/hch/misc.git/commit
bcachefs: Fix deadlock
authorAlan Huang <mmpgouride@gmail.com>
Wed, 26 Feb 2025 09:33:22 +0000 (17:33 +0800)
committerKent Overstreet <kent.overstreet@linux.dev>
Thu, 27 Feb 2025 00:31:05 +0000 (19:31 -0500)
commit677bdb7346b6fd806ea45b11cbfe36de0b0cd644
tree7d3444ff37a1d2ba06d4b7da078f1fc0de9d86c2
parent7909d1fb90e290ffd7b8570f4e2f97fe2fb381d0
bcachefs: Fix deadlock

This fixes two deadlocks:

1.pcpu_alloc_mutex involved one as pointed by syzbot[1]
2.recursion deadlock.

The root cause is that we hold the bc lock during alloc_percpu, fix it
by following the pattern used by __btree_node_mem_alloc().

[1] https://lore.kernel.org/all/66f97d9a.050a0220.6bad9.001d.GAE@google.com/T/

Reported-by: syzbot+fe63f377148a6371a9db@syzkaller.appspotmail.com
Tested-by: syzbot+fe63f377148a6371a9db@syzkaller.appspotmail.com
Signed-off-by: Alan Huang <mmpgouride@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/btree_cache.c
fs/bcachefs/btree_key_cache.c
fs/bcachefs/btree_locking.c
fs/bcachefs/btree_locking.h
fs/bcachefs/six.c
fs/bcachefs/six.h