Subject: Re: FFS update doesn't sync metadata?
To: Jaromir Dolecek <jdolecek@NetBSD.org>
From: Frederick Bruckman <fredb@immanent.net>
List: tech-kern
Date: 12/05/2004 11:12:23
In article <20041205135743.10000492192@s102-n054.tele2.cz>,
	jdolecek@NetBSD.org (Jaromir Dolecek) writes:
> 
> it seems that when a filesystem is downgraded from rw to ro mount
> using mount -o ro,update, the metadata are not flushed automatically.
> If I copy files on a filesystem, then do a mount -o ro,update and
> run fsck on it, it reports incorrect block counts etc. If I do
> sync followed by the mount -o ro,update, it works fine. This
> is easily repeatable for me.
> 
> Perhaps more problematic is that when the filesystem is remounted
> ro, it's marked clean and no further data is synced - i.e. if I do
> the remount (without syncing first), further sync doesn't actually
> write the data to disk, only after I actually unmount the filesystem.

I'm sure you meant to say, "when the filesystem is remounted rw".
 
> If the system crashes at this point (say, I'm testing new kernel
> feature), the filesystem ends up damanged, but marked clean.
> 
> Is this a bug or a feature?

What would be the use of such a feature?. To freeze the filesystem
to operate on it with "fsdb"? But then the changes would be
overwritten on unmounting, so that doesn't make any sense. I think
the intuitive thing would be to flush the buffer cache *after* the
filesystem is marked "rw", if that's possible.


Frederick