From: Christoph Hellwig <hch@lst.de>
To: Jack Wang <jinpu.wang@ionos.com>
Cc: Nilay Shroff <nilay@linux.ibm.com>,
abd.masalkhi@gmail.com, linux-raid <linux-raid@vger.kernel.org>,
linux-block <linux-block@vger.kernel.org>,
Song Liu <song@kernel.org>, Jens Axboe <axboe@kernel.dk>,
Christoph Hellwig <hch@lst.de>,
Damien Le Moal <dlemoal@kernel.org>, Yu Kuai <yukuai@fygo.io>,
tom.leiming@gmail.com, Jack Wang <jinpu.wang@cloud.ionos.com>
Subject: Re: [PATCH 1/6] block: add queue_limits_start_update_trylock()
Date: Wed, 9 Sep 2026 08:29:23 +0200 [thread overview]
Message-ID: <20260909062923.GB29874@lst.de> (raw)
In-Reply-To: <20260907133929.1081540-2-jinpu.wang@ionos.com>
On Mon, Sep 07, 2026 at 03:39:24PM +0200, Jack Wang wrote:
> From: Jack Wang <jinpu.wang@cloud.ionos.com>
>
> Some callers must not wait for q->limits_lock, because they hold
> something the current holder waits for. md is one: its
> check_sb_changes() runs with reconfig_mutex held, while a
> queue_attr_store() holding limits_lock waits in blk_mq_freeze_queue()
> for I/O that can be waiting for a superblock update needing that mutex.
>
> Add a trylock variant of queue_limits_start_update() for them.
I don't think this is a good idea, please fix the lock ordering
instead.
> Assisted-by: Claude:claude-opus-5
But if not please try to come up with helpers like this based on
your own. We don't really need this amount of AI slop.
> + * Like queue_limits_start_update(), but fails instead of waiting when another
> + * update is in flight. For callers that must not block on q->limits_lock
> + * because they hold something its current owner is waiting for.
> + *
> + * Context: process context.
> + */
> +static inline bool
> +queue_limits_start_update_trylock(struct request_queue *q,
> + struct queue_limits *lim)
> + __cond_acquires(true, &q->limits_lock)
> +{
> + if (!mutex_trylock(&q->limits_lock))
> + return false;
> +
> + *lim = q->limits;
> +
> + return true;
> +}
> +
> int queue_limits_commit_update_frozen(struct request_queue *q,
> struct queue_limits *lim) __releases(&q->limits_lock);
> int queue_limits_commit_update(struct request_queue *q,
> --
> 2.43.0
---end quoted text---
next prev parent reply other threads:[~2026-09-09 6:29 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-07 13:39 [PATCH 0/6] md: don't wait for q->limits_lock while md holds back I/O Jack Wang
2026-09-07 13:39 ` [PATCH 1/6] block: add queue_limits_start_update_trylock() Jack Wang
2026-09-09 6:29 ` Christoph Hellwig [this message]
2026-09-09 10:35 ` Jinpu Wang
2026-09-07 13:39 ` [PATCH 2/6] md: pass a queue_limits down to ->hot_add_disk() Jack Wang
2026-09-07 13:56 ` sashiko-bot
2026-09-08 4:43 ` Jinpu Wang
2026-09-07 13:39 ` [PATCH 3/6] md: don't wait for q->limits_lock in check_sb_changes() Jack Wang
2026-09-07 13:56 ` sashiko-bot
2026-09-08 4:41 ` Jinpu Wang
2026-09-07 13:39 ` [PATCH 4/6] md: pass a queue_limits through the rdev sysfs stores Jack Wang
2026-09-07 13:39 ` [PATCH 5/6] md: don't wait for q->limits_lock in mddev_update_io_opt() Jack Wang
2026-09-07 13:39 ` [PATCH 6/6] md: take q->limits_lock before locking and suspending the array Jack Wang
2026-09-07 14:00 ` sashiko-bot
2026-09-08 4:44 ` Jinpu Wang
2026-09-08 11:15 ` [PATCH 0/6] md: don't wait for q->limits_lock while md holds back I/O Nilay Shroff
2026-09-08 12:09 ` Jinpu Wang
2026-09-08 18:25 ` Nilay Shroff
2026-09-09 4:25 ` Jinpu Wang
2026-09-08 18:37 ` Abd-Alrhman Masalkhi
2026-09-08 21:51 ` Abd-Alrhman Masalkhi
2026-09-09 4:28 ` Jinpu Wang
2026-09-08 17:00 ` Johannes Thumshirn
2026-09-09 6:30 ` Christoph Hellwig
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=20260909062923.GB29874@lst.de \
--to=hch@lst.de \
--cc=abd.masalkhi@gmail.com \
--cc=axboe@kernel.dk \
--cc=dlemoal@kernel.org \
--cc=jinpu.wang@cloud.ionos.com \
--cc=jinpu.wang@ionos.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=nilay@linux.ibm.com \
--cc=song@kernel.org \
--cc=tom.leiming@gmail.com \
--cc=yukuai@fygo.io \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.