Linux XFS filesystem development
 help / color / mirror / Atom feed
From: Dave Chinner <dgc@kernel.org>
To: Hans Holmberg <hans.holmberg@wdc.com>
Cc: Carlos Maiolino <cem@kernel.org>,
	"Darrick J . Wong" <djwong@kernel.org>,
	Dave Chinner <david@fromorbit.com>,
	Christoph Hellwig <hch@lst.de>,
	Damien Le Moal <dlemoal@kernel.org>,
	linux-xfs@vger.kernel.org
Subject: Re: [PATCH v2] xfs: handle racing deletions in xfs_zone_gc_iter_irec
Date: Mon, 18 May 2026 17:48:22 +1000	[thread overview]
Message-ID: <agrERjRq10bm0rrY@dread> (raw)
In-Reply-To: <20260518065224.9066-1-hans.holmberg@wdc.com>

On Mon, May 18, 2026 at 08:52:24AM +0200, Hans Holmberg wrote:
> Under heavy garbage collection pressure from RocksDB workloads,
> filesystem shutdowns can occur in xfs_zone_gc_iter_irec when
> xfs_iget() returns -EINVAL for deleted files.
> 
> Fix this by handling -EINVAL just like we handle -ENOENT, allowing
> zone GC to safely ignore stale mappings.
> 
> Fixes: 080d01c41d44 ("xfs: implement zoned garbage collection")
> Signed-off-by: Hans Holmberg <hans.holmberg@wdc.com>
> ---
> 
> v2:
> - handle -EINVAL in the the caller in stead of switching error code
>   in xfs_imap_lookup
> 
> v1:
> https://lore.kernel.org/linux-xfs/20260513063745.8067-1-hans.holmberg@wdc.com/
> 
> 
>  fs/xfs/xfs_zone_gc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_zone_gc.c b/fs/xfs/xfs_zone_gc.c
> index fedcc47048af..96f14d811db2 100644
> --- a/fs/xfs/xfs_zone_gc.c
> +++ b/fs/xfs/xfs_zone_gc.c
> @@ -400,7 +400,7 @@ xfs_zone_gc_iter_irec(
>  		/*
>  		 * If the inode was already deleted, skip over it.
>  		 */
> -		if (error == -ENOENT) {
> +		if (error == -ENOENT || error == -EINVAL) {
>  			iter->rec_idx++;
>  			goto retry;
>  		}

Why did you choose to do this? I was expecting the updated fix to be
dropping XFS_IGET_UNTRUSTED from the xfs_iget() call because the
inode numbers are coming from a trusted source (i.e. the rmapbt) and
this would then return the expected -ENOENT on unlink races instead
of -EINVAL....

-Dave.
-- 
Dave Chinner
dgc@kernel.org

  reply	other threads:[~2026-05-18  7:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-18  6:52 [PATCH v2] xfs: handle racing deletions in xfs_zone_gc_iter_irec Hans Holmberg
2026-05-18  7:48 ` Dave Chinner [this message]
2026-05-18  8:55   ` Hans Holmberg
2026-05-18  9:17     ` Damien Le Moal
2026-05-18  9:44     ` Dave Chinner
2026-05-18 12:45       ` Christoph Hellwig
2026-05-18 12:43   ` Christoph Hellwig
2026-05-19  7:15 ` Christoph Hellwig
2026-05-30  6:35 ` 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=agrERjRq10bm0rrY@dread \
    --to=dgc@kernel.org \
    --cc=cem@kernel.org \
    --cc=david@fromorbit.com \
    --cc=djwong@kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=hans.holmberg@wdc.com \
    --cc=hch@lst.de \
    --cc=linux-xfs@vger.kernel.org \
    /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