public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Christoph Hellwig <hch@infradead.org>
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: Wed, 11 Mar 2026 10:13:46 +0800	[thread overview]
Message-ID: <abDP2r1SwmHI0hfh@fedora> (raw)
In-Reply-To: <abAamVMoIHncU29q@infradead.org>

On Tue, Mar 10, 2026 at 06:20:25AM -0700, Christoph Hellwig wrote:
> 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.

The two wait variable helpers looks pretty handy, will take it in V2.

Thanks,
Ming


      reply	other threads:[~2026-03-11  2:14 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
2026-03-11  2:13   ` Ming Lei [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=abDP2r1SwmHI0hfh@fedora \
    --to=ming.lei@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=hch@infradead.org \
    --cc=linux-block@vger.kernel.org \
    --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