From: Darrick J. Wong Date: Sun, 1 Mar 2020 17:33:38 +0000 (-0500) Subject: mkfs: check that metadata updates have been committed X-Git-Tag: v5.5.0-rc1~30 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=10fc0759444f35f868ce1a0e300a89ec0846331b;p=users%2Fhch%2Fxfsprogs.git mkfs: check that metadata updates have been committed Make sure that all the metadata we wrote in the process of formatting the filesystem have been written correctly, or exit with failure. Signed-off-by: Darrick J. Wong Reviewed-by: Brian Foster Reviewed-by: Christoph Hellwig Signed-off-by: Eric Sandeen --- diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index e303519a1..b70499d43 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -3895,8 +3895,11 @@ main( (XFS_BUF_TO_SBP(buf))->sb_inprogress = 0; libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE); - libxfs_umount(mp); - libxfs_destroy(&xi); + /* Exit w/ failure if anything failed to get written to our new fs. */ + error = -libxfs_umount(mp); + if (error) + exit(1); + libxfs_destroy(&xi); return 0; }