Subject: Re: bogus "/dev/wd0c: file system not clean (fs_flags=1); please fsck(8)"
To: None <tech-kern@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-kern
Date: 02/20/2002 16:29:28
>>> My question was why do I see the "file system not clean" [...]
>> No, [flushing dirty blocks] is not done automaticaly.
>> man sync(8) and sync(2).
> Would your opinion be that mount -u call sync(2) before attempting a
> switch from rw->ro?  It would seem to me to be The Right Thing To Do.

It doesn't seem that way to me, largely because sync(2) _starts_
writing dirty blocks but doesn't wait for the process to finish.  If
there are "enough" dirty blocks to be written, it could easily happen
that sync(2) starts the process, but then mount(2) happens and the
filesystem goes readonly with some of the dirty blocks still unflushed.

Or has sync(2) changed to block until the flush is finished?  In that
case, there's a window between sync returning and mount happening when
some other process could dirty the filesystem again.

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B