From: Christoph Hellwig Date: Sun, 22 Feb 2026 22:41:01 +0000 (-0800) Subject: xfs: validate that zoned RT devices are zone aligned X-Git-Tag: v6.19.0~11 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6aa2b48a6b668a0031bbbae895d60c0187569da0;p=xfsprogs-dev.git xfs: validate that zoned RT devices are zone aligned Source kernel commit: 982d2616a2906113e433fdc0cfcc122f8d1bb60a 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. Fixes: 2167eaabe2fa ("xfs: define the zoned on-disk format") Signed-off-by: Christoph Hellwig Reviewed-by: Darrick J. Wong Signed-off-by: Carlos Maiolino --- diff --git a/libxfs/xfs_sb.c b/libxfs/xfs_sb.c index dd14c3ab..3e2d3c6d 100644 --- a/libxfs/xfs_sb.c +++ b/libxfs/xfs_sb.c @@ -299,6 +299,21 @@ 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 RT group size, + * because garbage collection assumes that all zones have the + * same size to avoid insane complexity if that weren't the + * case. + */ + div_u64_rem(sbp->sb_rextents, sbp->sb_rgextents, &mod); + if (mod) + return false; + } + return true; }