Linux XFS filesystem development
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Hans Holmberg <hans.holmberg@wdc.com>
Cc: cem@kernel.org, linux-xfs@vger.kernel.org, hch@lst.de,
	djwong@kernel.org, dlemoal@kernel.org,
	shinichiro.kawasaki@wdc.com, sashiko-bot@kernel.org
Subject: Re: [PATCH] xfs: prevent race in zoned space reservations
Date: Mon, 31 Aug 2026 09:05:59 +0200	[thread overview]
Message-ID: <20260831070559.GA24988@lst.de> (raw)
In-Reply-To: <20260826123219.73978-1-hans.holmberg@wdc.com>

On Wed, Aug 26, 2026 at 02:32:19PM +0200, Hans Holmberg wrote:
> xfs_zoned_add_available() checks whether the reservation list is empty
> before adding blocks to the available-space counter.  This check is not
> serialized against a task adding itself to the reservation list however.
> 
> This allows the space provider to observe an empty list, after which a
> reserver can enqueue itself and retry the counter before the new space is
> added.  The provider then adds the space and returns without waking the
> now-eligible reserver, leaving it asleep until GC or another event
> provides a wakeup, potentially adding seconds to max write latency.
> 
> Take the reservation lock before updating the counter and checking the
> list.  Use list_empty() because the list is now inspected under its lock.
> 
> Taking a per-mount lock when handing back space is far from ideal, but
> benchmarking with null_blk showed no measurable performance regression.
> 

I kinda hate taking a global lock for each block free, but at least
the critical section is very small..

Reviewed-by: Christoph Hellwig <hch@lst.de>


  reply	other threads:[~2026-08-31  7:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-26 12:32 [PATCH] xfs: prevent race in zoned space reservations Hans Holmberg
2026-08-31  7:05 ` Christoph Hellwig [this message]
2026-08-31  7:19 ` Carlos Maiolino
2026-09-01  7:07   ` Hans Holmberg
2026-09-01  8:27     ` Carlos Maiolino
2026-09-03  6:05 ` Carlos Maiolino

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=20260831070559.GA24988@lst.de \
    --to=hch@lst.de \
    --cc=cem@kernel.org \
    --cc=djwong@kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=hans.holmberg@wdc.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sashiko-bot@kernel.org \
    --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