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:
mckusick 2001-04-13 23:54:49 +00:00
parent 9c4024b5ed
commit 4cf28ecf05

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);