From: Jens Axboe <axboe@kernel.dk>
To: Ming Lei <ming.lei@redhat.com>, linux-block@vger.kernel.org
Cc: Yi Zhang <yi.zhang@redhat.com>
Subject: Re: [PATCH] block: use trylock to avoid lockdep circular dependency in sysfs
Date: Thu, 5 Mar 2026 04:08:50 -0700 [thread overview]
Message-ID: <6d40385d-e447-4cb4-b327-bb10aa6a8563@kernel.dk> (raw)
In-Reply-To: <20260305031550.1161328-1-ming.lei@redhat.com>
On 3/4/26 8:15 PM, Ming Lei wrote:
> Use trylock instead of blocking lock acquisition for update_nr_hwq_lock
> in queue_requests_store() and elv_iosched_store() to avoid circular lock
> dependency with kernfs active reference during concurrent disk deletion:
>
> update_nr_hwq_lock -> kn->active (via del_gendisk -> kobject_del)
> kn->active -> update_nr_hwq_lock (via sysfs write path)
>
> Return -EBUSY when the lock is not immediately available.
This does mean that scripts can get spurious -EBUSY they now need to
handle. Which probably isn't a big real world problem. While it isn't a
hard thing to fix up in a script, it can potentially break existing
setups.
Not sure I see a good way around that however, without queueing these
to a clean context and having the store helpers wait on eg work item
being processed and completed.
Hopefully this will never be a thing and we'll never need to discuss
this issue, I'll get this one applied for now.
--
Jens Axboe
prev parent reply other threads:[~2026-03-05 11:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-05 3:15 [PATCH] block: use trylock to avoid lockdep circular dependency in sysfs Ming Lei
2026-03-05 11:02 ` Jens Axboe
2026-03-05 11:08 ` Jens Axboe [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=6d40385d-e447-4cb4-b327-bb10aa6a8563@kernel.dk \
--to=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=ming.lei@redhat.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