]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
mkfs: set required parts of the realtime geometry before computing log geometry xfsprogs-5.9-fixes_2020-09-14
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 4 Sep 2020 02:48:35 +0000 (19:48 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Tue, 15 Sep 2020 01:46:37 +0000 (18:46 -0700)
The minimum log size depends on the transaction reservation sizes, which
in turn depend on the realtime device geometry.  Therefore, we need to
set up some of the rt geometry before we can compute the real minimum
log size.

This fixes a problem where mkfs, given a small data device and a
realtime volume, formats a filesystem with a log that is too small to
pass the mount time log size checks.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
mkfs/xfs_mkfs.c

index 6b55ca3e4c57869b3a4524930147bf22c3bd6a36..408198e9ec709124fb888e6179e9ccda11367964 100644 (file)
@@ -3237,6 +3237,9 @@ start_superblock_setup(
        } else
                sbp->sb_logsunit = 0;
 
+       /* log reservation calculations depend on rt geometry */
+       sbp->sb_rblocks = cfg->rtblocks;
+       sbp->sb_rextsize = cfg->rtextblocks;
 }
 
 static void
@@ -3274,14 +3277,12 @@ finish_superblock_setup(
        }
 
        sbp->sb_dblocks = cfg->dblocks;
-       sbp->sb_rblocks = cfg->rtblocks;
        sbp->sb_rextents = cfg->rtextents;
        platform_uuid_copy(&sbp->sb_uuid, &cfg->uuid);
        /* Only in memory; libxfs expects this as if read from disk */
        platform_uuid_copy(&sbp->sb_meta_uuid, &cfg->uuid);
        sbp->sb_logstart = cfg->logstart;
        sbp->sb_rootino = sbp->sb_rbmino = sbp->sb_rsumino = NULLFSINO;
-       sbp->sb_rextsize = cfg->rtextblocks;
        sbp->sb_agcount = (xfs_agnumber_t)cfg->agcount;
        sbp->sb_rbmblocks = cfg->rtbmblocks;
        sbp->sb_logblocks = (xfs_extlen_t)cfg->logblocks;