Subject: Re: bogus "/dev/wd0c: file system not clean (fs_flags=1); please fsck(8)"
To: None <tech-kern@netbsd.org>
From: Tad Hunt <tad@entrisphere.com>
List: tech-kern
Date: 02/19/2002 16:42:42
My question was why do I see the "file system not clean" warning
(from sys/ufs/ffs/ffs_vfsops.c) when I'm simply changing the mounted
partition from read/write to readonly (the "-u" flag to mount(8)).
without unmounting it first. I would expect the switch to readonly
to have flushed any pending writes, and then switch the filesystem
to readonly mode.

The mount(8) manpage says this about the "-u" flag:

> -u      The -u flag indicates that the status of an already mounted file
>         system should be changed.  Any of the options discussed above
>         (the -o option) may be changed; also a file system can be changed
>         from read-only to read-write or vice versa.  An attempt to change
>         from read-write to read-only will fail if any files on the
>         filesystem are currently open for writing unless the -f flag is
>         also specified. ...

If I do the following:

	# newfs /dev/rwd0c
	# mount /dev/wd0c /mnt
	# mount -u -o ro /dev/wd0c /mnt
	# 

I do not get the warning.

If I change something on the filesystem before I do the "mount -u"
to switch the fs to readonly, I get the warning:

	# newfs /dev/rwd0
	# mount /dev/wd0c /mnt
	# echo foo > /mnt/foo
	# mount -o ro /dev/wd0c /mnt
	/dev/wd0c: file system not clean (fs_flags=1); please fsck(8)
	# 

I do not get the warning when I:

	# newfs /dev/rwd0
	# mount /dev/wd0c /mnt
	# echo foo > /mnt/foo
	# umount /mnt
	# mount -o ro /dev/wd0c /mnt
	# 

Am I wrong in thinking that I should not see the warning from ffs?

-Tad

In message <GrMrzv.I5G@tac.nyc.ny.us>, you said:
;In article <MOBYDICKAkK5LqN33HF0000022a@mobydick.int.entrisphere.com>,
;Tad Hunt <tad@entrisphere.com> wrote:
;>
;>I do the following:
;>
;>	sh# newfs /dev/rwd0c
;>	[newfs output elided]
;>	sh# mount /dev/wd0c /mnt
;>	sh# echo foo > /mnt/xxx
;>	sh# mount -u -o ro /mnt
;>	/dev/wd0c: file system not clean (fs_flags=1); please fsck(8)
;>	sh# fsck /dev/rwd0c
;>	** /dev/rwd0c (NO WRITE)
;>	** File system is clean; not checking
;>	sh#
;>
;>I don't expect to see that warning, since I'm simply downgrading
;>the access to read only, without unmounting the partition.
;>
;>Furthermore, if I run an fsck at the subsequent shell prompt, it
;>tells me the filesystem is clean.
;>
;>Is this the correct behavior, or am I just on crack?
;>
;>I'm running NetBSD-1.5.  Is this problem fixed on a more recent
;>version?
;
;The NO WRITE should be a hint, unmount it and then try fsck again.
;
;christos