From: Darrick J. Wong Date: Wed, 30 Sep 2020 14:59:15 +0000 (-0400) Subject: mkfs: set required parts of the realtime geometry before computing log geometry X-Git-Tag: xfsprogs-5.9-fixes2_2020-10-10~12 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=31409f488954cf71526018e02f772c98b60bd544;p=thirdparty%2Fxfsprogs-dev.git mkfs: set required parts of the realtime geometry before computing log geometry 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 Reviewed-by: Christoph Hellwig Reviewed-by: Allison Collins Signed-off-by: Eric Sandeen --- diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index 0b9cbdbe1..1d370fa30 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -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;