Filesystem utilities that modify the filesystem (growfs(8), tunefs(8),

and fsirand(8)) should check the filesystem status and require that
fsck(8) be run if it is unclean. This requirement is not imposed on
fsdb(8) or clri(8) since they may be used to clean up a filesystem.

MFC after:    2 weeks
Sponsored by: Netflix
This commit is contained in:
Kirk McKusick
2020-10-25 01:36:33 +00:00
parent 996d40f91d
commit 6eb925f845
3 changed files with 36 additions and 17 deletions
+6
View File
@@ -1460,6 +1460,12 @@ main(int argc, char **argv)
errc(1, ret, "unable to read superblock");
}
}
/*
* Check for unclean filesystem.
*/
if (fs->fs_clean == 0 ||
(fs->fs_flags & (FS_UNCLEAN | FS_NEEDSFSCK)) != 0)
errx(1, "%s is not clean - run fsck.\n", *argv);
memcpy(&osblock, fs, fs->fs_sbsize);
free(fs);
memcpy((void *)&fsun1, (void *)&fsun2, osblock.fs_sbsize);