Subject: Question about superblock softupdate bit
To: None <current-users@netbsd.org>
From: BOUWSMA Beery <netbsd-user@dcf77-zeit.netscum.dyndns.dk>
List: current-users
Date: 02/07/2002 12:57:58
Howdy
I'm looking at the patches I've applied to -current to make it work
the way I want, and one of them has to do with maintaining filesystem
compatibility with FreeBSD and softupdates.
The problem I had is that normally, at filesystem unmount time, the
bit in the superblock that indicates a softupdates-enabled filesystem
gets cleared. This is a problem when FreeBSD uses this bit and the
`tunefs -n enable' command to indicate whether softupdates should be
used on a particular filesystem, and NetBSD uses a mount option.
src/sys/ufs/ffs/ffs_vfsops.c:
858 * XXXX don't mark fs clean in the case of softdep
859 * pending block errors, until they are fixed.
860 */
861 if (penderr == 0) {
862 if (mp->mnt_flag & MNT_SOFTDEP)
863 fs->fs_flags &= ~FS_DOSOFTDEP;
864 fs->fs_clean = FS_ISCLEAN;
865 }
866 (void) ffs_sbupdate(ump, MNT_WAIT);
What this means is that next time I boot this machine into FreeBSD, the
filesystem is mounted without softupdates. Meaning in case of a crash,
I cannot use the background-fsck ability to be able to `work' immediately
when booting without waiting many minutes for hundreds of gigs of unclean
filesystem to be checked. On a really old slow machine.
I'm probably missing something, but what's the purpose behind clearing
this bit at umount time? It seems to me that --
* at mount, if the softdep option is not given, the flag is cleared.
* at mount, if the softdep option is given, the flag is set.
* in case of a crash, the flag needs to be set if softupdates were in
effect in order for fsck to handle the filesystem right, but if the
option was given, both the filesystem will be marked unclean and
softdep-enabled
* in case of a non-crash, I don't see how it would make any real difference
to NetBSD whether the flag is set on the unmounted filesystem...
I share several partitions on my disks between NetBSD and two FreeBSDen,
and I have softupdates enabled on all but the r00t filesystems for all.
I can get away with read-only mounts of the FreeBSD base system without
clearing this flag, but partitions containing home dirs and /usr/obj are
shared read-write by all.
Because I couldn't see how it would damage things, if NetBSD's filesystem
mounts work as I expect, and it was causing me grief and headaches with
trying to maintain compatibility with FreeBSD, I commented out the two
lines that test and clear the flag, which gives me the desired result so
far -- if I've `tunefs -n enable'd the bit with FreeBSD, the filesystem
always gets mounted with softupdates there after a NetBSD mount with the
softdep option.
So I've certainly got to be missing something. What danger lurks in not
clearing the softupdates flag in NetBSD at clean unmount time?
thanks
barry bouwsma