mirror of
https://github.com/versity/scoutfs.git
synced 2026-07-20 06:52:20 +00:00
b261616a18
The trace events added in the subsequent change take recinf->lock while in timer_callback() to iterate recinf->pending, but it does so in softirq context. To do this safely, it has to use the _bh() spin_lock variant. Convert the other lock takers, too. ``` ================================ WARNING: inconsistent lock state 5.14.0-427.35.1.el9_4.x86_64+debug #1 Tainted: G OE ------- --- -------------------------------- inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage. swapper/2/0 [HC0[0]:SC1[1]:HE1:SE0] takes: ffff88813cdd9c20 (&recinf->lock){+.?.}-{2:2}, at: timer_callback+0x26/0x380 [scoutfs] {SOFTIRQ-ON-W} state was registered at: __lock_acquire+0x7d0/0x1900 lock_acquire+0x1da/0x640 _raw_spin_lock+0x34/0x80 scoutfs_recov_finish+0x80/0x830 [scoutfs] server_greeting+0x244/0xe60 [scoutfs] scoutfs_net_proc_worker+0x28a/0xce0 [scoutfs] recv_one_message+0x7e3/0xd10 [scoutfs] scoutfs_net_recv_worker+0x441/0xe00 [scoutfs] process_one_work+0x8e5/0x1530 worker_thread+0x598/0xf70 kthread+0x2a4/0x350 ret_from_fork+0x29/0x50 irq event stamp: 549813370 hardirqs last enabled at (549813370): [<ffffffffabe25cb4>] _raw_spin_unlock_irq+0x24/0x50 hardirqs last disabled at (549813369): [<ffffffffabe2594e>] _raw_spin_lock_irq+0x5e/0x90 softirqs last enabled at (549813356): [<ffffffffabe28c91>] __do_softirq+0x621/0x9c2 softirqs last disabled at (549813363): [<ffffffffa9a44665>] __irq_exit_rcu+0x185/0x230 other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(&recinf->lock); <Interrupt> lock(&recinf->lock); *** DEADLOCK *** ``` Signed-off-by: Auke Kok <auke.kok@versity.com>