From: Keith Busch <kbusch@kernel.org>
To: Bart Van Assche <bvanassche@acm.org>
Cc: Yu Kuai <yukuai@fnnas.com>,
axboe@kernel.dk, hch@lst.de, sagi@grimberg.me, sven@kernel.org,
j@jannau.net, linux-block@vger.kernel.org,
linux-nvme@lists.infradead.org, tj@kernel.org,
nilay@linux.ibm.com, ming.lei@redhat.com, neal@gompa.dev,
asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 4/4] blk-mq: use blk_queue_enter/exit to protect debugfs file creation
Date: Mon, 9 Feb 2026 10:33:15 -0700 [thread overview]
Message-ID: <aYoaWwI-sl5hK6s_@kbusch-mbp> (raw)
In-Reply-To: <6b18e0bc-efa7-4bd5-b12b-a313941d2ba1@acm.org>
On Mon, Feb 09, 2026 at 08:40:29AM -0800, Bart Van Assche wrote:
> On 2/9/26 12:29 AM, Yu Kuai wrote:
> > diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c
> > index faeaa1fc86a7..03583d0d3972 100644
> > --- a/block/blk-mq-debugfs.c
> > +++ b/block/blk-mq-debugfs.c
> > @@ -613,11 +613,6 @@ static void debugfs_create_files(struct request_queue *q, struct dentry *parent,
> > const struct blk_mq_debugfs_attr *attr)
> > {
> > lockdep_assert_held(&q->debugfs_mutex);
> > - /*
> > - * Creating new debugfs entries with queue freezed has the risk of
> > - * deadlock.
> > - */
> > - WARN_ON_ONCE(q->mq_freeze_depth != 0);
> > /*
> > * debugfs_mutex should not be nested under other locks that can be
> > * grabbed while queue is frozen.
>
> The above looks fine to me.
>
> > @@ -628,9 +623,19 @@ static void debugfs_create_files(struct request_queue *q, struct dentry *parent,
> > if (IS_ERR_OR_NULL(parent))
> > return;
> > + /*
> > + * Avoid creating debugfs files while the queue is frozen, wait for
> > + * the queue to be unfrozen and prevent new freeze while creating
> > + * debugfs files.
> > + */
> > + if (blk_queue_enter(q, 0))
> > + return;
> > +
> > for (; attr->name; attr++)
> > debugfs_create_file_aux(attr->name, attr->mode, parent,
> > (void *)attr, data, &blk_mq_debugfs_fops);
> > +
> > + blk_queue_exit(q);
> > }
>
> This is not clear to me. Why are concurrent queue freezes not allowed
> while debugfs attributes are created? I don't see any code in debugfs
> that calls back into the block layer while creating debugfs attributes?
> Did I perhaps overlook something?
I had to look up the original commit that introduced the WARN,
65d466b629847. The commit message says "Creating new debugfs entries can
trigger fs reclaim", so that must be the path that enters back into the
blaock layer request_queue.
next prev parent reply other threads:[~2026-02-09 17:33 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-09 8:29 [PATCH 0/4] blk-mq/nvme: fix debugfs creation with frozen queue Yu Kuai
2026-02-09 8:29 ` [PATCH 1/4] nvme-rdma: move blk_mq_update_nr_hw_queues after nvme_unfreeze Yu Kuai
2026-02-09 14:57 ` Christoph Hellwig
2026-02-11 7:21 ` Nilay Shroff
2026-02-09 8:29 ` [PATCH 2/4] nvme-tcp: " Yu Kuai
2026-02-09 14:57 ` Christoph Hellwig
2026-02-11 7:22 ` Nilay Shroff
2026-02-09 8:29 ` [PATCH 3/4] nvme-apple: " Yu Kuai
2026-02-09 14:58 ` Christoph Hellwig
2026-02-09 15:35 ` Keith Busch
2026-02-10 6:47 ` Yu Kuai
2026-02-10 15:09 ` Keith Busch
2026-02-10 15:41 ` Christoph Hellwig
2026-02-10 16:01 ` Keith Busch
2026-02-10 16:28 ` Daniel Wagner
2026-02-11 1:57 ` Yu Kuai
2026-02-11 12:57 ` Keith Busch
2026-02-10 8:10 ` Nilay Shroff
2026-02-10 15:12 ` Keith Busch
2026-02-11 7:23 ` Nilay Shroff
2026-02-09 8:29 ` [PATCH 4/4] blk-mq: use blk_queue_enter/exit to protect debugfs file creation Yu Kuai
2026-02-09 14:59 ` Christoph Hellwig
2026-02-09 16:40 ` Bart Van Assche
2026-02-09 17:33 ` Keith Busch [this message]
2026-02-09 17:51 ` Bart Van Assche
2026-02-10 6:59 ` Yu Kuai
2026-02-10 15:41 ` Christoph Hellwig
2026-02-11 7:20 ` Nilay Shroff
2026-02-11 8:06 ` Yu Kuai
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=aYoaWwI-sl5hK6s_@kbusch-mbp \
--to=kbusch@kernel.org \
--cc=asahi@lists.linux.dev \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=hch@lst.de \
--cc=j@jannau.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=ming.lei@redhat.com \
--cc=neal@gompa.dev \
--cc=nilay@linux.ibm.com \
--cc=sagi@grimberg.me \
--cc=sven@kernel.org \
--cc=tj@kernel.org \
--cc=yukuai@fnnas.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