From: Christoph Hellwig <hch@infradead.org>
To: Ming Lei <ming.lei@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org, Yi Zhang <yi.zhang@redhat.com>,
Tejun Heo <tj@kernel.org>
Subject: Re: [PATCH] blk-cgroup: wait for blkcg cleanup before initializing new disk
Date: Tue, 10 Mar 2026 06:20:25 -0700 [thread overview]
Message-ID: <abAamVMoIHncU29q@infradead.org> (raw)
In-Reply-To: <20260309100906.1740351-1-ming.lei@redhat.com>
On Mon, Mar 09, 2026 at 06:09:06PM +0800, Ming Lei wrote:
> + if (READ_ONCE(q->root_blkg)) {
> + /* 20s is a random timeout, disk_release() should be done well before */
> + unsigned long end = jiffies + msecs_to_jiffies(20000);
> +
> + while (READ_ONCE(q->root_blkg) &&
> + time_before(jiffies, end))
> + msleep(1);
> + if (READ_ONCE(q->root_blkg))
> + return -EEXIST;
Random sleeps are almost never a good idea. If you don't want to waste
a waitqueue on this use wake_up_var/wait_on_var, but make it properly
wait for an event.
next prev parent reply other threads:[~2026-03-10 13:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-09 10:09 [PATCH] blk-cgroup: wait for blkcg cleanup before initializing new disk Ming Lei
2026-03-10 13:20 ` Christoph Hellwig [this message]
2026-03-11 2:13 ` Ming Lei
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=abAamVMoIHncU29q@infradead.org \
--to=hch@infradead.org \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=ming.lei@redhat.com \
--cc=tj@kernel.org \
--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