panic again
Don Lewis
truckman at FreeBSD.org
Wed Oct 27 09:48:14 PDT 2004
On 27 Oct, Pavel Merdine wrote:
> Hello ,
>
> Maybe I was wrong, but looking at the FFS code I see that softupdates
> does not work without -f :
> if (fs->fs_clean == 0) {
> fs->fs_flags |= FS_UNCLEAN;
> if (ronly || (mp->mnt_flag & MNT_FORCE)) {
> printf( "WARNING: %s was not properly dismounted\n",
> fs->fs_fsmnt);
> } else {
> printf("WARNING: R/W mount of %s denied. Filesystem is not clean - run fsck\n",
> fs->fs_fsmnt);
> error = EPERM;
> goto out;
> }
> }
> The clean flag does not seem to be affected by softupdates.
>
> My practice tells me that fsck is always required after unclean
> shutdown if I dont use -f. So what is the purpose of softupdates then?
> I repeat that maybe I'm wrong. But I just didn't see it working.
This appears to be the code from FreeBSD 4.x, which does not have the
background fsck feature, so any unclean file systems must be fsck'ed
before they are mounted. This does not depend on whether or not
softupdates is enabled. Softupdates in FreeBSD 4.x is primarily just
enhances file system write performance.
Background fsck also requires the file system to have a snapshot
capability so that fsck can run on the snapshot while the file system is
mounted and possibly being modifed by other processes on the system. The
snapshot feature is only present in FreeBSD 6.x and recent versions of
FreeBSD 5.x. The equivalent block of code in FreeBSD 6-CURRENT is:
if (fs->fs_clean == 0) {
fs->fs_flags |= FS_UNCLEAN;
if (ronly || (mp->mnt_flag & MNT_FORCE) ||
((fs->fs_flags & FS_NEEDSFSCK) == 0 &&
(fs->fs_flags & FS_DOSOFTDEP))) {
printf(
"WARNING: %s was not properly dismounted\n",
fs->fs_fsmnt);
} else {
printf(
"WARNING: R/W mount of %s denied. Filesystem is not clean - run fsck\n",
fs->fs_fsmnt);
error = EPERM;
goto out;
}
if ((fs->fs_pendingblocks != 0 || fs->fs_pendinginodes != 0) &&
(mp->mnt_flag & MNT_FORCE)) {
printf("%s: lost blocks %jd files %d\n", fs->fs_fsmnt,
(intmax_t)fs->fs_pendingblocks,
fs->fs_pendinginodes);
fs->fs_pendingblocks = 0;
fs->fs_pendinginodes = 0;
}
}
This code permits the file system to be mounted even if it is unclean as
long as softupdates is enabled.
More information about the freebsd-fs
mailing list