]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: mask off the rtbitmap and summary inodes when metadir in use
authorDarrick J. Wong <djwong@kernel.org>
Mon, 25 Nov 2024 21:14:25 +0000 (13:14 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 24 Dec 2024 02:01:30 +0000 (18:01 -0800)
Source kernel commit: ea99122b18ca6cf902417e1acbc19a197f662299

Set the rtbitmap and summary file inumbers to NULLFSINO in the
superblock and make sure they're zeroed whenever we write the superblock
to disk, to mimic mkfs behavior.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
libxfs/xfs_sb.c

index 87be47083aa5714d91f63ebaccf70d52c00ae910..fe760d38fd7673b67ab35cebfc1f6ad57249c5f2 100644 (file)
@@ -666,6 +666,14 @@ xfs_validate_sb_common(
 void
 xfs_sb_quota_from_disk(struct xfs_sb *sbp)
 {
+       if (xfs_sb_is_v5(sbp) &&
+           (sbp->sb_features_incompat & XFS_SB_FEAT_INCOMPAT_METADIR)) {
+               sbp->sb_uquotino = NULLFSINO;
+               sbp->sb_gquotino = NULLFSINO;
+               sbp->sb_pquotino = NULLFSINO;
+               return;
+       }
+
        /*
         * older mkfs doesn't initialize quota inodes to NULLFSINO. This
         * leads to in-core values having two different values for a quota
@@ -794,6 +802,8 @@ __xfs_sb_from_disk(
                to->sb_metadirino = be64_to_cpu(from->sb_metadirino);
                to->sb_rgcount = be32_to_cpu(from->sb_rgcount);
                to->sb_rgextents = be32_to_cpu(from->sb_rgextents);
+               to->sb_rbmino = NULLFSINO;
+               to->sb_rsumino = NULLFSINO;
        } else {
                to->sb_metadirino = NULLFSINO;
                to->sb_rgcount = 1;
@@ -816,6 +826,14 @@ xfs_sb_quota_to_disk(
 {
        uint16_t        qflags = from->sb_qflags;
 
+       if (xfs_sb_is_v5(from) &&
+           (from->sb_features_incompat & XFS_SB_FEAT_INCOMPAT_METADIR)) {
+               to->sb_uquotino = cpu_to_be64(0);
+               to->sb_gquotino = cpu_to_be64(0);
+               to->sb_pquotino = cpu_to_be64(0);
+               return;
+       }
+
        to->sb_uquotino = cpu_to_be64(from->sb_uquotino);
 
        /*
@@ -951,6 +969,8 @@ xfs_sb_to_disk(
                to->sb_metadirino = cpu_to_be64(from->sb_metadirino);
                to->sb_rgcount = cpu_to_be32(from->sb_rgcount);
                to->sb_rgextents = cpu_to_be32(from->sb_rgextents);
+               to->sb_rbmino = cpu_to_be64(0);
+               to->sb_rsumino = cpu_to_be64(0);
        }
 }