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, 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,
	Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Subject: Re: [PATCH v7] loop: defer the queue limits clear to a workqueue
Date: Tue, 24 Nov 2026 08:56:45 -0800	[thread overview]
Message-ID: <f8d3056d-2950-428c-b5f3-c41b5fa10eb2@acm.org> (raw)
In-Reply-To: <b48806fb-22a5-40da-a682-22e010c8316d@linux.dev>

On 11/24/26 12:10 AM, Tao Cui wrote:
 > For v8, my plan is to stop deciding whether to quiet a request at
 > queue_rq() time and instead quiet repeated failures at the point of
 > failure. The verdicts remain recorded for the lifetime of the backing
 > file and are cleared only on rebind or unbind. loop_clear_limits()
 > reports whether a verdict is new, and repeated failures mark only
 > their own request quiet. That guarantees the first failure for each
 > mode is reported, regardless of how dispatch and queue freezing
 > interleave.
 >
 > [ ... ]
 >
 > Does this approach look reasonable to you? If so, I'll send the
 > already tested patch as v8.

That approach sounds reasonable to me. If the verdicts are kept for the
lifetime of the backing file, I think the following simplifications are
possible:
- The clear_limits_pending member variable is no longer needed. The
   work function can read the mask with the unsupported modes without
   resetting it.
- lo_fallocate() can return -EOPNOTSUPP without calling
   file->f_op->fallocate() if the mode is already known to be
   unsupported.

Tracking the verdicts per mode also fixes the following issue in v7:
clear_limits_pending is not per mode, so a failed discard suppresses
the error message for the first write-zeroes failure.

A few more comments about v7 that also apply to v8:
- loop_clear_limits() calls schedule_work() after clear_limits_lock has
   been unlocked. Can a request that passed the lo->lo_backing_file
   check queue the work item after cancel_work_sync() has been called
   by __loop_clr_fd() or loop_remove()? Since lo_free_disk() no longer
   cancels the work item, I think that would result in a use-after-free.
   How about calling schedule_work() while holding clear_limits_lock and
   resetting the state before calling cancel_work_sync() in
   __loop_clr_fd()?
- The code that resets clear_limits_mode occurs three times. Please
   introduce a helper function. Is the reset in
   loop_assign_backing_file() needed since __loop_clr_fd() already
   resets the state and since loop_clear_limits() ignores failures for
   a backing file that is no longer current?
- The work function freezes the queue and commits the queue limits even
   if no mode has been recorded. Please return early in that case.
- The changelog for v7 is missing. Please include a "Changes since v7"
   and a "Changes since v6" section in v8.

Thanks,

Bart.

      reply	other threads:[~2026-11-24 16:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24  3:12 Tao Cui
2026-11-24  8:10 ` Tao Cui
2026-11-24 16:56   ` 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=f8d3056d-2950-428c-b5f3-c41b5fa10eb2@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®