Subject: kern/26043: lfs and union mounts do not mix
To: None <gnats-bugs@gnats.NetBSD.org>
From: Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>
List: netbsd-bugs
Date: 06/24/2004 20:30:17
>Number:         26043
>Category:       kern
>Synopsis:       lfs and union mounts do not mix
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jun 24 18:58:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Hauke Fath
>Release:        NetBSD 2.0_BETA
>Organization:
Falling Raindrops
>Environment:
	
	
System: NetBSD pizza.causeuse.org 2.0_BETA NetBSD 2.0_BETA (PIZZA) #1: Sat Jun 5 22:11:30 CEST 2004 hauke@pizza.causeuse.org:/var/obj/netbsd-builds/2_0/sparc/obj/sys/arch/sparc/compile/PIZZA sparc
Architecture: sparc
Machine: sparc
>Description:

	Using an LFS partition as the top (writeable) part of a union
	mount quickly panics my MP ss10.

	The layout:

union mount with lfs participant

		</var/obj -- lfs>
<mount point>
		<sources>

[hauke@pizza] /home/hauke # df
Filesystem                     1K-blocks     Used     Avail Capacity  Mounted on
/dev/sd1d                         719135   342624    340554    50%    /usr
/dev/sd1f                        2440565   116745   2079764     5%    /var/obj
/dev/sd2e                        4964604  3931436    784936    83%    /u1
<below>:/u1/netbsd-20/src         456267    79756    340554    18%    /usr/src
<above>:/var/obj/netbsd-20/src   2520208   196509   2079654     8%    /usr/src


	First sample panic:

action: 'config KERNEL'

switching with held simple_lock 0xf45c7a30 CPU 0 /u1/netbsd-20/src/sys/fs/union/union_vnops.c:2056
0x0(0xf4b325e8, 0x0, 0x1ca, 0xf030e400, 0x152e, 0xf091a410) at netbsd:ltsleep+0x5cc
ltsleep(0xf0c9e214, 0x11, 0x0, 0x0, 0xf0c9e6ac, 0x1fff) at netbsd:lfs_writer_enter+0x58
lfs_writer_enter(0xf0c9e000, 0xf025ced0, 0xf4b325e8, 0x2, 0x0, 0x0) at netbsd:lfs_putpages+0x794
lfs_putpages(0xf4d255f8, 0x0, 0xffffffff, 0xffffe000, 0xf45c47b0, 0xf0c9e000) at netbsd:union_putpages+0x5c
union_putpages(0xf4d255f8, 0xf0265d40, 0x2d9, 0xf4d25e7c, 0xf0301c74, 0xf0298c00) at netbsd:vinvalbuf+0x54
vinvalbuf(0xf45c7690, 0x1, 0xffffffff, 0xf4d85c40, 0x0, 0x0) at netbsd:vclean+0xf8
vclean(0xf45c7690, 0x1, 0xf4d85c40, 0x0, 0x700, 0xf02b64fc) at netbsd:vgonel+0x4c
vgonel(0xf45c7690, 0xf4d85c40, 0x10e, 0xf0265d40, 0xf45c7690, 0xf0305ca0) at netbsd:getcleanvnode+0x174
getcleanvnode(0xf45c7690, 0xf0265d40, 0x226, 0xf475f2f0, 0x0, 0xf02b9000) at netbsd:getnewvnode+0x108
getnewvnode(0x0, 0xf0c98000, 0xf0b67e00, 0xf4d2589c, 0x20f, 0xf0235400) at netbsd:lfs_ialloc+0x14
lfs_ialloc(0xf0c9e000, 0xf6b244c8, 0x811, 0xe, 0xf4d2597c, 0xf4d2590c) at netbsd:lfs_valloc+0x26c
lfs_valloc(0xf4d259a8, 0xff, 0x1000000, 0x6, 0x8, 0xf0b67e00) at netbsd:ufs_makeinode+0x6c
ufs_makeinode(0x81a4, 0xf6b244c8, 0xf4d25c0c, 0xf4d25e7c, 0xf0301c74, 0xf0298c00) at netbsd:ufs_create+0x28
ufs_create(0xf4d25c10, 0x0, 0x50f, 0xffffffff, 0x0, 0xf6b244c8) at netbsd:lfs_create+0x30
lfs_create(0xf4d25c10, 0xf0265d40, 0x5ac, 0x0, 0x0, 0xf0b67e00) at netbsd:union_create+0x94
union_create(0xf4d25d00, 0xf0e39200, 0x2, 0x14, 0x14, 0xf57893f0) at netbsd:vn_open+0x18c
vn_open(0xf4d25d40, 0x602, 0x1a4, 0x0, 0xf4d25f28, 0xefffe730) at netbsd:sys_open+0x88
sys_open(0xf4b325e8, 0xf4d25f28, 0xf4d25f20, 0x0, 0xf4d85c40, 0xefffe9f0) at netbsd:syscall+0x1d0
syscall(0x5, 0xf4d25fb0, 0x100bec08, 0x0, 0x400, 0xf4d25f28) at 0xf0006524
Stopped in pid 2269.1 (nbconfig) at     netbsd:cpu_Debugger+0x4: or %o7, %g0, %g1
db{0}> 


	Second sample panic:

action: 'config KERNEL'

panic: lfs_valloc: inuse inode 14221 on the free list
Stopped in pid 615.1 (config) at  netbsd:cpu_Debugger+0x4:   or  %o7, %g0, %g1
db{1}> t
cpu_Debugger(0xf025ac30, 0x378d, 0x100, 0xf0bdcf18, 0xffffffff, 0xf029b400) at netbsd:lfs_valloc+0x28c
lfs_valloc(0xf4becab8, 0xff, 0x1000000, 0x2, 0x8, 0xf0b67e00) at netbsd:ufs_makeinode+0x6c
ufs_makeinode(0xa1ed, 0xf4e04740, 0xf4bece10, 0xf4bece24, 0xf0301c74, 0xf0298c00) at netbsd:ufs_symlink+0x20
ufs_symlink(0xf4becd28, 0x0, 0x50f, 0xffffffff, 0x0, 0xf4e04740) at netbsd:lfs_symlink+0x30
lfs_symlink(0xf4becd28, 0xf0265d40, 0x5ac, 0xf0b67e00, 0xf3ce7800, 0xf4bece48) at netbsd:union_symlink+0x90
union_symlink(0xf4becdb0, 0xf0e03e00, 0x2, 0xf4e04828, 0xf0b67700, 0xf4e04828) at netbsd:sys_symlink+0x1c8
sys_symlink(0x0, 0xf4becf28, 0xf4becf20, 0x0, 0xf3d07c48, 0x81c06000) at netbsd:syscall+0x1d0
syscall(0x39, 0xf4becfb0, 0x1009f428, 0xefffee50, 0x400, 0xf4becf28) at 0xf0006524
db{1}> sync
syncing disks... xcall(cpu1,0xf02132c8): couldn't ping cpus: cpu0
xcall(cpu1,0xf02132c8): couldn't ping cpus: cpu0
xcall(cpu1,0xf02132c8): couldn't ping cpus: cpu0

[...]

ad infinitum.

In both cases attempting to get a core dump locked the machine hard.


>How-To-Repeat:

	mount_union -b <NetBSD source dir> /usr/src
	mount_union <lfs scratch fs> /usr/src
	cd /usr/src/sys/arch/sparc/conf
	env USETOOLS=no config KERNEL

>Fix:

	No idea. *nix filesystems are a black art to me.

>Release-Note:
>Audit-Trail:
>Unformatted: