Subject: kern/34147: genfs_gop_write panic "bytes != 0"
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Juergen Hannken-Illjes <hannken@eis.cs.tu-bs.de>
List: netbsd-bugs
Date: 08/06/2006 10:20:00
>Number:         34147
>Category:       kern
>Synopsis:       genfs_gop_write panic "bytes != 0"
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Aug 06 10:20:00 +0000 2006
>Originator:     Juergen Hannken-Illjes
>Release:        NetBSD 3.99.23
>Organization:
	
>Environment:
	
	
System: NetBSD/sparc64
Architecture: sparc64
Machine: sparc64
>Description:
	
Got this panic while one thread was truncating a vnode to 0 and another
thread run ffs_fsync.  The vnode has "size == 0" and "npages != 0".

panic: kernel diagnostic assertion "bytes != 0" failed:
	file "...sys/miscfs/genfs/genfs_vnops.c", line 1521

vnode:
OBJECT 0xd7dcc80: locked=0, pgops=0x1818e80, npages=1, refs=0
  PAGES <pg,offset>:
  <0xc813498,0xffffffffffffffff> <0x1e01880,0x0> <0xc982c68,0xffffffffffffffff>
  <0xc813428,0xffffffffffffffff> <0xc982bf8,0xffffffffffffffff>

VNODE flags 4080<LOCKSWORK,ONWORKLIST>
mp 0x2707000 numoutput 0 size 0x0
data 0xe156dd0 usecount 0 writecount 0 holdcnt 1 numoutput 0
tag VT_UFS(1) type VREG(1) mount 0x2707000 typedata 0x0
clean bufs:
dirty bufs:

trace through ffs_sync:
__assert(159e968, 15e4120, 5f1, 15cfdc8, c982923, c982973) at netbsd:__assert+0x18
genfs_gop_write(d7dcc80, c982b60, 1, 11, 13, c982a68) at netbsd:genfs_gop_write+0x3c0
genfs_putpages(0, cb1a340, 0, 11, 1, 0) at netbsd:genfs_putpages+0x9a8
VOP_PUTPAGES(d7dcc80, 0, 0, 11, 181e3d8, e06c340) at netbsd:VOP_PUTPAGES+0x28
flush_inodedep_deps(0, 24e56, 2e9, c982fa8, 918, 2000) at netbsd:flush_inodedep_deps+0x260
softdep_sync_metadata(0, c983188, ce38100, 0, 181e3d8, 1818000) at netbsd:softdep_sync_metadata+0x3e4
ffs_fsync(0, 0, c7f3130, 15cc800, c983188, 0) at netbsd:ffs_fsync+0x234
VOP_FSYNC(c7f3130, cb31a50, 1, 0, 0, cb1a340) at netbsd:VOP_FSYNC+0x30
ffs_sync(26cc000, 1, cb31a50, cb1a340, 26c5200, 15cc800) at netbsd:ffs_sync+0x264
ffs_suspendctl(0, 1, 0, 15e3a08, c8, 4) at netbsd:ffs_suspendctl+0x60
vfs_suspend(26cc000, 23, 1, 0, 0, cb1a340) at netbsd:vfs_suspend+0x168
ffs_snapshot(0, e1589c0, c983850, 80005000, d8266f0, 6baa8) at netbsd:ffs_snapshot+0x684
fss_ioctl(0, 1879520, c983c70, c9837b0, cb1a340, badcafe) at netbsd:fss_ioctl+0x848
spec_ioctl(c9839e8, 7f, 4020a400, 1, badcafe, badcafe) at netbsd:spec_ioctl+0xb8
VOP_IOCTL(c928500, 80184600, c983c70, 3, cb31a50, cb1a340) at netbsd:VOP_IOCTL+0x30
vn_ioctl(cb7a5d0, 80184600, c983c70, cb1a340, 48, badcafe) at netbsd:vn_ioctl+0x44
sys_ioctl(0, c983dc0, c983e00, 1, 18, 0) at netbsd:sys_ioctl+0x168
syscall_plain(c983ed0, c983f58, 4073a994, 4073a998, 2, 4073a994) at netbsd:syscall_plain+0x130

trace through ffs_truncate:
preempt(cd13120, 15e4120, 4ca, c8131b9, c813252, c81325c) at netbsd:preempt+0x74
genfs_putpages(0, cd13120, 1, a, 1, 0) at netbsd:genfs_putpages+0x474
VOP_PUTPAGES(d7dcc80, 0, 0, a, 40500, ffffffffffffffff) at netbsd:VOP_PUTPAGES+0x28
uvn_put(d7dcc80, 0, 0, a, 125, cb317d0) at netbsd:uvn_put+0x24
ffs_truncate(1b, 0, 0, ffffffffffffffff, cd13120, 400) at netbsd:ffs_truncate+0xe80
ufs_inactive(0, 15e2ef8, 4e7, cc8f810, 79, 58) at netbsd:ufs_inactive+0x280
VOP_INACTIVE(d7dcc80, cd13120, 0, 0, cd13120, 0) at netbsd:VOP_INACTIVE+0x20
ufs_remove(0, 15deee8, 84e, 0, 8, 0) at netbsd:ufs_remove+0xa4
VOP_REMOVE(e151ad0, d7dcc80, c813cb0, 2, c813c68, 10) at netbsd:VOP_REMOVE+0x24
sys_unlink(0, c813dc0, c813e00, 405392a0, ca, 4053929c) at netbsd:sys_unlink+0x168
syscall_plain(c813ed0, c813f48, 40538ffc, 40539000, ca, 40538ffc) at netbsd:syscall_plain+0x130
>How-To-Repeat:
	
Difficult, got it once in a test run over > 24 hours.
>Fix:
	

>Unformatted: