Do not allow the soft updates flag to be set if the filesystem is dirty.

Because the kernel will allow the mounting of unclean filesystems when
the soft updates flag is set, it is important that only soft updates
style inconsistencies (missing blocks and inodes) be present. Otherwise
a panic may ensue. It is also important that the filesystem be in a clean
state when the soft updates flag is set because the background fsck uses
the fact that the flag is set to indicate that it is safe to run. If
background fsck encounters non-soft updates style inconsistencies, it
will exit with unexpected inconsistencies.
This commit is contained in:
Kirk McKusick 2001-04-13 23:54:49 +00:00
parent f0cad56fd7
commit 1c2665d807
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=75498

View File

@ -285,8 +285,11 @@ main(argc, argv)
if (nflag) {
name = "soft updates";
if (strcmp(nvalue, "enable") == 0) {
if ( sblock.fs_flags & FS_DOSOFTDEP ) {
if (sblock.fs_flags & FS_DOSOFTDEP) {
warnx("%s remains unchanged as enabled", name);
} else if (sblock.fs_clean == 0) {
warnx("%s cannot be enabled until fsck is run",
name);
} else {
sblock.fs_flags |= FS_DOSOFTDEP;
warnx("%s set", name);