aboutsummaryrefslogtreecommitdiffstats
path: root/sbin/growfs
diff options
context:
space:
mode:
authorKirk McKusick <mckusick@FreeBSD.org>2020-10-25 01:36:33 +0000
committerKirk McKusick <mckusick@FreeBSD.org>2020-10-25 01:36:33 +0000
commit6eb925f8450ffbb849195f26e26bfd4eadbcfb1d (patch)
tree5b66b6c812f36de7bae2ed24e8a3b5b14e0b3879 /sbin/growfs
parent996d40f91d7c3ca1b4efa11a4f59ee47c924eab1 (diff)
downloadsrc-6eb925f8450ffbb849195f26e26bfd4eadbcfb1d.tar.gz
src-6eb925f8450ffbb849195f26e26bfd4eadbcfb1d.zip
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
Notes
Notes: svn path=/head/; revision=367035
Diffstat (limited to 'sbin/growfs')
-rw-r--r--sbin/growfs/growfs.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sbin/growfs/growfs.c b/sbin/growfs/growfs.c
index 45d5f258c8ed..d1098210f088 100644
--- a/sbin/growfs/growfs.c
+++ b/sbin/growfs/growfs.c
@@ -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);