mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Yu Kuai" <yukuai@fnnas.com>
To: "Ming Lei" <ming.lei@redhat.com>
Cc: "Jens Axboe" <axboe@kernel.dk>, <nilay@linux.ibm.com>,
	<hch@lst.de>,  "Steven Rostedt" <rostedt@goodmis.org>,
	 "Masami Hiramatsu" <mhiramat@kernel.org>,
	 "Mathieu Desnoyers" <mathieu.desnoyers@efficios.com>,
	 "Yi Zhang" <yi.zhang@redhat.com>,
	 "Shinichiro Kawasaki" <shinichiro.kawasaki@wdc.com>,
	 "Keith Busch" <kbusch@kernel.org>,
	"Sagi Grimberg" <sagi@grimberg.me>,
	 <linux-block@vger.kernel.org>, <linux-nvme@lists.infradead.org>,
	 <linux-trace-kernel@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,  <yukuai@fnnas.com>
Subject: Re: [PATCH] blk-mq: use NOIO context to prevent deadlock during debugfs creation
Date: Fri, 13 Feb 2026 13:39:58 +0800	[thread overview]
Message-ID: <5c47b46d-1aa7-4ce6-baa8-97f8a3ecc327@fnnas.com> (raw)
In-Reply-To: <aY6sDstii_R_zOfs@fedora>

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	other threads:[~2026-02-13  5:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-12  8:01 Yu Kuai
2026-02-12  8:46 ` Nilay Shroff
2026-02-13  4:08   ` Yu Kuai
2026-02-13  4:43 ` Ming Lei
2026-02-13  5:39   ` Yu Kuai [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5c47b46d-1aa7-4ce6-baa8-97f8a3ecc327@fnnas.com \
    --to=yukuai@fnnas.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=ming.lei@redhat.com \
    --cc=nilay@linux.ibm.com \
    --cc=rostedt@goodmis.org \
    --cc=sagi@grimberg.me \
    --cc=shinichiro.kawasaki@wdc.com \
    --cc=yi.zhang@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®