SCSI circular lock dependency with current mainline

From: Steve French
Date: Tue Apr 01 2025 - 00:59:09 EST


I saw the following circular lock dependency when running tests with
current mainline from today. The tests were not related to local fs
(they were for smb3.1.1 mounts but the bug is not related to cifs.ko).
Presumably bug is due to locking problems for local I/O.

[Mon Mar 31 23:12:21 2025] sd 0:0:0:0: [sda] Attached SCSI disk
[Mon Mar 31 23:12:21 2025]
======================================================
[Mon Mar 31 23:12:21 2025] WARNING: possible circular locking
dependency detected
[Mon Mar 31 23:12:21 2025] 6.14.0 #1 Not tainted
[Mon Mar 31 23:12:21 2025]
------------------------------------------------------
[Mon Mar 31 23:12:21 2025] (udev-worker)/423143 is trying to acquire lock:
[Mon Mar 31 23:12:21 2025] ff1100013840f118
(&q->elevator_lock){+.+.}-{4:4}, at: elv_iosched_store+0x13b/0x370
[Mon Mar 31 23:12:21 2025]
but task is already holding lock:
[Mon Mar 31 23:12:21 2025] ff1100013840ebe8
(&q->q_usage_counter(io)#13){++++}-{0:0}, at:
blk_mq_freeze_queue_nomemsave+0x12/0x20
[Mon Mar 31 23:12:21 2025]
which lock already depends on the new lock.
[Mon Mar 31 23:12:21 2025]
the existing dependency chain (in reverse order) is:
[Mon Mar 31 23:12:21 2025]
-> #2 (&q->q_usage_counter(io)#13){++++}-{0:0}:
[Mon Mar 31 23:12:21 2025] blk_alloc_queue+0x3f4/0x440
[Mon Mar 31 23:12:21 2025] blk_mq_alloc_queue+0xd6/0x160
[Mon Mar 31 23:12:21 2025] scsi_alloc_sdev+0x4c0/0x660
[Mon Mar 31 23:12:21 2025] scsi_probe_and_add_lun+0x2f4/0x690
...

More details on the log message:

http://smb311-linux-testing.southcentralus.cloudapp.azure.com/#/builders/3/builds/438/steps/205/logs/stdio

--
Thanks,

Steve