From: Bart Van Assche <bvanassche@acm.org>
To: Tao Cui <cui.tao@linux.dev>,
axboe@kernel.dk, hch@lst.de,
Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: cuitao@kylinos.cn, linux-block@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6] loop: defer the queue limits clear to a workqueue
Date: Mon, 28 Sep 2026 10:26:16 -0700 [thread overview]
Message-ID: <df36224b-7fcb-45c4-ab78-d7e726bfeb9d@acm.org> (raw)
In-Reply-To: <20260928093512.3153646-1-cui.tao@linux.dev>
On 9/28/26 2:35 AM, Tao Cui wrote:
> @@ -1148,6 +1182,16 @@ static void __loop_clr_fd(struct loop_device *lo)
> lo->lo_backing_file = NULL;
> spin_unlock_irq(&lo->lo_lock);
>
> + /*
> + * Invalidate any clear that was scheduled against the old backing
> + * file. Unbinding cannot race with in-flight I/O, so cancelling
> + * here leaves no work item behind.
> + */
This comment is wrong - asynchronous I/O can still be in progress here.
See also
https://lore.kernel.org/linux-block/69960302-1535-441a-be4e-d652766d65c2@I-love.SAKURA.ne.jp/
Should this patch perhaps be rebased on top of Tetsuo's series?
> @@ -1783,7 +1827,9 @@ static void lo_free_disk(struct gendisk *disk)
> destroy_workqueue(lo->workqueue);
> loop_free_idle_workers(lo, true);
> timer_shutdown_sync(&lo->timer);
> + cancel_work_sync(&lo->clear_limits_work);
> mutex_destroy(&lo->lo_mutex);
> + mutex_destroy(&lo->clear_limits_lock);
> kfree(lo);
> }
Is the above new cancel_work_sync() call really necessary?
> @@ -2140,6 +2188,12 @@ static int loop_add(int i)
>
> static void loop_remove(struct loop_device *lo)
> {
> + /*
> + * Cancel early: the queue may already be in RCU-delayed freeing
> + * by the time lo_free_disk() cancels the work item.
> + */
> + cancel_work_sync(&lo->clear_limits_work);
> +
> /* Make this loop device unreachable from pathname. */
> del_gendisk(lo->lo_disk);
> blk_mq_free_tag_set(&lo->tag_set);
Is the above new cancel_work_sync() call necessary since there is
already an identical call in __loop_clr_fd()?
Thanks,
Bart.
next prev parent reply other threads:[~2026-09-28 17:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 9:35 Tao Cui
2026-09-28 17:26 ` Bart Van Assche [this message]
2026-09-29 2:08 ` Tao Cui
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=df36224b-7fcb-45c4-ab78-d7e726bfeb9d@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 \
/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®