Hi,

在 2026/2/13 12:43, Ming Lei 写道:
> On Thu, Feb 12, 2026 at 04:01:35PM +0800, Yu Kuai wrote:
>> Creating debugfs entries can trigger fs reclaim, which can enter back
>> into the block layer request_queue. This can cause deadlock if the
>> queue is frozen.
>>
>> Previously, a WARN_ON_ONCE check was used in debugfs_create_files()
>> to detect this condition, but it was racy since the queue can be frozen
>> from another context at any time.
> debugfs lock doesn't depend on queue freeze, so the implied deadlock isn't
> obvious.
>
> Can you explain a bit why freeze from another context may cause dead lock?

It's probably fine to freeze from another context concurrently, I mean the
checking will cause the false warning like:

Re: [bug report] WARNING: block/blk-mq-debugfs.c:620 at 
debugfs_create_files.isra.0+0x54/0x60, CPU#220: kworker/u1036:7/70421 - 
Shinichiro Kawasaki <https://lore.kernel.org/all/aYWQR7CtYdk3K39g@shinmob/>

So checking itself is racy and should be removed, meanwhile there are two 
options:

1) use noio for debugfs creation;
2) move debugfs creation out of queue frozen from nvme target;

BTW, I added the blk_queue_enter/exit() protection for 2 because I think it's
safe, and can prevent deadlock if there are any implied deadlock related to
queue frozen.

>
>
> Thanks,
> Ming
>
>
-- 
Thansk,
Kuai

Reply via email to