aboutsummaryrefslogtreecommitdiff
path: root/sbin/fsirand/fsirand.c
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/fsirand/fsirand.c
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/fsirand/fsirand.c')
-rw-r--r--sbin/fsirand/fsirand.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sbin/fsirand/fsirand.c b/sbin/fsirand/fsirand.c
index 48ffcbaf0665..c4db8848f18b 100644
--- a/sbin/fsirand/fsirand.c
+++ b/sbin/fsirand/fsirand.c
@@ -134,6 +134,12 @@ fsirand(char *device)
return (1);
}
}
+ /*
+ * Check for unclean filesystem.
+ */
+ if (sblock->fs_clean == 0 ||
+ (sblock->fs_flags & (FS_UNCLEAN | FS_NEEDSFSCK)) != 0)
+ errx(1, "%s is not clean - run fsck.\n", device);
if (sblock->fs_magic == FS_UFS1_MAGIC &&
sblock->fs_old_inodefmt < FS_44INODEFMT) {