mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Tao Cui <cui.tao@linux.dev>, axboe@kernel.dk
Cc: hch@lst.de, Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
	cuitao@kylinos.cn, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Subject: Re: [PATCH v10] loop: defer the queue limits clear to a workqueue
Date: Thu, 3 Dec 2026 09:18:21 -0800	[thread overview]
Message-ID: <aa704a7a-32b3-4f7d-a18b-55a4966a727e@acm.org> (raw)
In-Reply-To: <20261203081657.2577866-1-cui.tao@linux.dev>


On 12/3/26 12:16 AM, Tao Cui wrote:
 > +		lo->clear_wq = alloc_workqueue("loopc%d",
 > +						WQ_UNBOUND | WQ_MEM_RECLAIM,
 > +						0, lo->lo_number);

WQ_MEM_RECLAIM creates a rescuer thread per loop device. Is that flag
really needed? Additionally, has it been considered to use a single
workqueue for all loop devices?

 > +	if (!file)
 > +		return false;

lo_fallocate() has already dereferenced 'file', so this can't happen.

 > +	if (!queue_work(lo->clear_wq, &w->clear_limits_work)) {

queue_work() cannot fail for a work item that has just been
initialized. Please remove this error path.

 > +		if (loop_clear_limits(lo, file, mode) &&
 > +		    test_and_set_bit(0, &lo->clear_limits_reported))
 > +			rq->rq_flags |= RQF_QUIET;

Please move the RQF_QUIET changes into a separate patch since these are
not needed to fix the race.

 > +	if (lo->clear_wq)
 > +		destroy_workqueue(lo->clear_wq);
 >  	if (lo->workqueue)
 >  		destroy_workqueue(lo->workqueue);

Work queued on lo->workqueue queues work on clear_wq, so please destroy
lo->workqueue first.

Thanks,

Bart.

      reply	other threads:[~2026-12-03 17:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26  5:42 [PATCH v8] " Tao Cui
2026-11-26 10:06 ` Tao Cui
2026-11-26 13:56 ` [PATCH v9] " Tao Cui
2026-11-26 15:32   ` Bart Van Assche
2026-11-30 10:20     ` Tao Cui
2026-11-30 14:04       ` Bart Van Assche
2026-11-30 14:57         ` Tao Cui
2026-11-30 16:34           ` Bart Van Assche
2026-12-01 13:14             ` Tao Cui
2026-12-02 15:13               ` Bart Van Assche
2026-12-03  8:08                 ` Tao Cui
2026-12-03  8:16 ` [PATCH v10] " Tao Cui
2026-12-03 17:18   ` Bart Van Assche [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=aa704a7a-32b3-4f7d-a18b-55a4966a727e@acm.org \
    --to=bvanassche@acm.org \
    --cc=axboe@kernel.dk \
    --cc=cui.tao@linux.dev \
    --cc=cuitao@kylinos.cn \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --cc=shinichiro.kawasaki@wdc.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

all inboxes | Powered by JetHome®