Subject: kern/10433: panic: lfs_updatemeta: negative bytes
To: None <>
From: None <>
List: netbsd-bugs
Date: 06/24/2000 06:18:21
>Number:         10433
>Category:       kern
>Synopsis:       panic: lfs_updatemeta: negative bytes
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jun 24 06:19:00 PDT 2000
>Originator:     Manuel Bouyer
>Release:        1.5_ALPHA checkout'd yesterday



System: NetBSD 1.5_ALPHA NetBSD 1.5_ALPHA (ROCHEBONNE) #0: Sat Jun 24 13:10:05 MEST 2000 i386

	My LFS filesystem got corrupted, possibly after an unclean shutdown
	(this was at last a week ago, maybe more).
	Now, when I mount it R/W, I get a panic a few seconds later:
# lfs_updatemeta: negative bytes (segment 661 short by 7168)
lfs_updatemeta: ino 51333, lbn 281, addr = 14ab98
panic: lfs_updatemeta: negative bytes
Stopped in lfs_cleanerd at      cpu_Debugger+0x4:       leave
db> tr
cpu_Debugger(d4737950,c0659000,400,d6992dac,c0251f05) at cpu_Debugger+0x4
panic(c02f27a0,c02f2760,c885,119,14ab98) at panic+0x64
lfs_updatemeta(c068f5c0,c065eee4,c068f5c0,c0659000,34) at lfs_updatemeta+0x499
lfs_gather(c0659000,c068f5c0,d69acb80,c0252bd0) at lfs_gather+0x171
lfs_writefile(c0659000,c068f5c0,d69acb80) at lfs_writefile+0xea
lfs_writevnodes(c0659000,c0669400,c068f5c0,3,d69acb80) at lfs_writevnodes+0x16

lfs_segwrite(c0669400,7,d6992f88,d6971af0,d6992f80) at lfs_segwrite+0xeb
sys_lfs_markv(d6971af0,d6992f88,d6992f80,0,8375000) at sys_lfs_markv+0x686
syscall() at syscall+0x200
--- syscall (number 185) ---

	fsck_lfs complains about invalid checksum, but nothing else:
# fsck /usr/src
** /dev/rwd0h
Superblock checksum (33611)does not match computed checksum 33652
Superblock checksum (33611)does not match computed checksum 33652
** Last Mounted on /usr/src
** Phase 0 - Check Segment Summaries and Inode Free List
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Segment Block Accounting
179287 files, 1475487 used, 0 free 


Note that fsck_lfs says it updates the superblock, but re-running it still
complains about the checksum mismatch.

	Not sure how it got corrupted, but now it's reproductible at will.
	Don't know. I'll leave this filesystem untouched for a while, so if
	someone wants me to test things just says so.
	Workaround: the LFS can be mounted RO, so it's possible to backup it,
	newfs_lfs and restore.