Subject: kern/6760: NetBSD reports bogus FFS problem during remount from RW to RO
To: None <gnats-bugs@gnats.netbsd.org>
From: Erik E. Fair <fair@chronos.clock.org>
List: netbsd-bugs
Date: 01/07/1999 13:57:53
>Number:         6760
>Category:       kern
>Synopsis:       NetBSD reports bogus FFS problem during remount from RW to RO
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan  7 14:05:02 1999
>Last-Modified:
>Originator:     Erik E. Fair
>Organization:
International Organization of Internet Clock Watchers
>Release:        NetBSD-current 19990103
>Environment:
	
System: NetBSD chronos.clock.org 1.3I NetBSD 1.3I (CHRONOS) #8: Sun Jan 3 19:10:12 PST 1999 root@chronos.clock.org:/usr/obj/sys/arch/sun3/compile/CHRONOS sun3

NetBSD 1.3I (CHRONOS) #1: Tue Dec 22 21:52:23 PST 1998
    root@chronos.clock.org:/usr/obj/sys/arch/sun3/compile/CHRONOS
Model: Sun-3 (3/60)
fpu: mc68881
real  mem = 24576K (0x1800000)
avail mem = 21680K (0x152c000)
using 166 buffers containing 1359872 bytes of memory
mainbus0 (root)
obio0 at mainbus0
zsc0 at obio0 addr 0x0 ipl 6: (softpri 3)
kbd0 at zsc0 channel 0 (console)
ms0 at zsc0 channel 1
zsc1 at obio0 addr 0x20000 ipl 6: (softpri 3)
zstty0 at zsc1 channel 0
zstty1 at zsc1 channel 1
eeprom0 at obio0 addr 0x40000
clock0 at obio0 addr 0x60000 ipl 5
memerr0 at obio0 addr 0x80000 ipl 7: (Parity memory)
intreg0 at obio0 addr 0xa0000
le0 at obio0 addr 0x120000 ipl 3: address 08:00:20:00:f8:73
le0: 8 receive buffers, 2 transmit buffers
si0 at obio0 addr 0x140000 ipl 2: options=0x8
scsibus0 at si0: 8 targets, 8 luns per target
sd0 at scsibus0 targ 0 lun 0: <SEAGATE, ST42100, 7614> SCSI2 0/direct fixed
sd0: 1813MB, 2574 cyl, 15 head, 96 sec, 512 bytes/sect x 3713130 sectors
obmem0 at mainbus0
bwtwo0 at obmem0 addr 0xff000000 (1152x900)
enabling interrupts
boot device: sd0a
root on sd0a dumps on sd0b
mountroot: trying cd9660...
mountroot: trying nfs...
mountroot: trying ffs...
root file system type: ffs
init: copying out path `/sbin/init' 11
/dev/sd0h: file system not clean (fs_flags=1); please fsck(8)
uid 13507 on /tmp: file system full
uid 13507 on /tmp: file system full
/dev/sd0h: file system not clean (fs_flags=1); please fsck(8)
/dev/sd0h: file system not clean (fs_flags=1); please fsck(8)
/dev/sd0h: file system not clean (fs_flags=1); please fsck(8)
/usr: optimization changed from SPACE to TIME
/dev/sd0h: file system not clean (fs_flags=1); please fsck(8)
/dev/sd0h: file system not clean (fs_flags=1); please fsck(8)
/dev/sd0h: file system not clean (fs_flags=1); please fsck(8)
/dev/sd0h: file system not clean (fs_flags=1); please fsck(8)
syncing disks... 18 18 16 10 2 done
unmounting /nbsd (digital:/nfs/nbsd)...
unmounting /home (digital:/home)...
unmounting /usr/src (/dev/sd0h)...
unmounting /altroot (/dev/sd0g)...
unmounting /usr/obj (/dev/sd0f)...
unmounting /usr (/dev/sd0e)...
unmounting /var (/dev/sd0d)...
unmounting /kern (kernfs)...
unmounting /proc (procfs)...
unmounting / (/dev/sd0a)...
uvm_vnp_terminate(0xf214d6c): terminating active vnode (refs=2)
uvm_vnp_terminate(0xf1ea444): terminating active vnode (refs=2)
Kernel rebooting...

NetBSD 1.3I (CHRONOS) #8: Sun Jan  3 19:10:12 PST 1999
    root@chronos.clock.org:/usr/obj/sys/arch/sun3/compile/CHRONOS
Model: Sun-3 (3/60)
fpu: mc68881
real  mem = 24576K (0x1800000)
avail mem = 21688K (0x152e000)
using 166 buffers containing 1359872 bytes of memory
mainbus0 (root)
obio0 at mainbus0
zsc0 at obio0 addr 0x0 ipl 6: (softpri 3)
kbd0 at zsc0 channel 0 (console)
ms0 at zsc0 channel 1
zsc1 at obio0 addr 0x20000 ipl 6: (softpri 3)
zstty0 at zsc1 channel 0
zstty1 at zsc1 channel 1
eeprom0 at obio0 addr 0x40000
clock0 at obio0 addr 0x60000 ipl 5
memerr0 at obio0 addr 0x80000 ipl 7: (Parity memory)
intreg0 at obio0 addr 0xa0000
le0 at obio0 addr 0x120000 ipl 3: address 08:00:20:00:f8:73
le0: 8 receive buffers, 2 transmit buffers
si0 at obio0 addr 0x140000 ipl 2: options=0xf
scsibus0 at si0: 8 targets, 8 luns per target
sd0 at scsibus0 targ 0 lun 0: <SEAGATE, ST42100, 7614> SCSI2 0/direct fixed
sd0: 1813MB, 2574 cyl, 15 head, 96 sec, 512 bytes/sect x 3713130 sectors
obmem0 at mainbus0
bwtwo0 at obmem0 addr 0xff000000 (1152x900)
enabling interrupts
boot device: sd0a
root on sd0a dumps on sd0b
root file system type: ffs
/dev/sd0h: file system not clean (fs_flags=1); please fsck(8)

Filesystem        1K-blocks     Used    Avail Capacity  Mounted on
/dev/sd0a             22303    11997     9190    56%    /
mfs:21                 7911       12     7503     0%    /tmp
procfs                    8        8        0   100%    /proc
kernfs                    1        1        0   100%    /kern
/dev/sd0d            178543    24671   144944    14%    /var
/dev/sd0e            178543   151313    18302    89%    /usr
/dev/sd0f            178415   149584    19910    88%    /usr/obj
/dev/sd0g            535279    85033   423482    16%    /altroot
/dev/sd0h            535663   239113   269766    46%    /usr/src
digital:/home       2861568  2398262   320227    88%    /home
digital:/nfs/nbsd   4060928  2009295  1848586    52%    /nbsd

>Description:
	My build script for NetBSD (more or less) does:

		mount -u -o rw /usr/src
		sup
		make obj
		mount -u -o ro /usr/src
		make build
		make snapshot

	At the change of /usr/src from Read/Write to Read-Only,
	the kernel reports:

	/dev/sd0h: file system not clean (fs_flags=1); please fsck(8)

	However, subsequent forced fsck never reports any problems.

	This bespeaks of a race condition in the kernel between
	the unmount/sync code, and the code that is producing this
	diagnostic, and the checker is checking (and complaining)
	before all the relevant buffers have been flushed to disk.

	Please note that we're talking about a Sun 3/60 workstation
	with a 20 MHz mc68020 CPU, and a 3600 rpm, 2Gbyte disk. It's
	old, it's slow, and that's probably what tickled the race
	condition.

	This problem should be fixed because the diagnostic is
	incorrect, and will confuse NetBSD's users.

>How-To-Repeat:
	
>Fix:
	
>Audit-Trail:
>Unformatted: