]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
mkfs: check that metadata updates have been committed
authorDarrick J. Wong <darrick.wong@oracle.com>
Sun, 1 Mar 2020 17:33:38 +0000 (12:33 -0500)
committerEric Sandeen <sandeen@sandeen.net>
Sun, 1 Mar 2020 17:33:38 +0000 (12:33 -0500)
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 <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
mkfs/xfs_mkfs.c

index e303519a17ec78466e1dd72dc5f7b4a14b613692..b70499d43ada5d52829659bf0f25ae841aecc71e 100644 (file)
@@ -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;
 }