Linux XFS filesystem development
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Carlos Maiolino <cem@kernel.org>, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 1/2] xfs: validate that zoned RT devices are zone aligned
Date: Mon, 15 Dec 2025 11:15:06 -0800	[thread overview]
Message-ID: <20251215191506.GI7725@frogsfrogsfrogs> (raw)
In-Reply-To: <20251215094843.537721-2-hch@lst.de>

On Mon, Dec 15, 2025 at 10:48:36AM +0100, Christoph Hellwig wrote:
> Garbage collection assumes all zones contain the full amount of blocks.
> Mkfs already ensures this happens, but make the kernel check it as well
> to avoid getting into trouble due to fuzzers or mkfs bugs.
> 

If this gets merged, please add this so the new requirements are
autobackported to stable:
Cc: <stable@vger.kernel.org> # v6.15

> Fixes: 2167eaabe2fa ("xfs: define the zoned on-disk format")
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  fs/xfs/libxfs/xfs_sb.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/fs/xfs/libxfs/xfs_sb.c b/fs/xfs/libxfs/xfs_sb.c
> index cdd16dd805d7..db5231f846ea 100644
> --- a/fs/xfs/libxfs/xfs_sb.c
> +++ b/fs/xfs/libxfs/xfs_sb.c
> @@ -301,6 +301,19 @@ xfs_validate_rt_geometry(
>  	    sbp->sb_rbmblocks != xfs_expected_rbmblocks(sbp))
>  		return false;
>  
> +	if (xfs_sb_is_v5(sbp) &&
> +	    (sbp->sb_features_incompat & XFS_SB_FEAT_INCOMPAT_ZONED)) {
> +		uint32_t		mod;
> +
> +		/*
> +		 * Zoned RT devices must be aligned to the rtgroup size, because
> +		 * garbage collection can't deal with rump RT groups.

I've decided that I'm ok with imposing this new restriction after the
fact, but only because actual zoned hardware will never expose a runt
group, so the only way you could end up with one now is if you formatted
with zoned=1 without a hardware-zoned storage device.

Could this comment be expanded to say that explicitly?

		/*
		 * Zoned RT devices must be aligned to the rtgroup size,
		 * because garbage collection can't deal with rump RT
		 * groups.  Hardware-zoned storage will never expose a
		 * runt group, so this is only possible with soft-zoned
		 * filesystems, which are not created by default.
		 */

With that change (and a corresponding mkfs enforcement patch),
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D


> +		 */
> +		div_u64_rem(sbp->sb_rextents, sbp->sb_rgextents, &mod);
> +		if (mod)
> +			return false;
> +	}
> +
>  	return true;
>  }
>  
> -- 
> 2.47.3
> 
> 

  reply	other threads:[~2025-12-15 19:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-15  9:48 reject non-zone aligned RT subvolumes Christoph Hellwig
2025-12-15  9:48 ` [PATCH 1/2] xfs: validate that zoned RT devices are zone aligned Christoph Hellwig
2025-12-15 19:15   ` Darrick J. Wong [this message]
2025-12-16  5:10     ` Christoph Hellwig
2025-12-16 15:59       ` Darrick J. Wong
2025-12-15  9:48 ` [PATCH 2/2] xfs: fix the zoned RT growfs check for zone alignment Christoph Hellwig
2025-12-15 19:09   ` Darrick J. Wong
  -- strict thread matches above, loose matches on Subject: below --
2025-12-16 17:30 reject non-zone aligned RT subvolumes v2 Christoph Hellwig
2025-12-16 17:30 ` [PATCH 1/2] xfs: validate that zoned RT devices are zone aligned Christoph Hellwig

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=20251215191506.GI7725@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=cem@kernel.org \
    --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