Subject: Corrupted disks again
To: None <netbsd-bugs@sun-lamp.cs.berkeley.edu>
From: Dan Bornstein <danfuzz@wastelands.kaleida.com>
List: netbsd-bugs
Date: 08/05/1994 14:50:39
Remember the old problem of new fsck messing up old filesystems?
Well, I'm seeing pretty much the same symptoms even though I have
new fsck and new filesystems! I had rebooted successfully a couple
of times, but then, I rebooted and got the same old "DIRECTORY 
CORRUPTED...DIR=?" stuff. I recompiled fsck with debugging and got
a backtrace (attached below). Help?

You should note that if I run fsck normally and answer "yes" to
everything, it says "FILESYSTEM WAS MODIFIED" and yet if I re-do
the fsck, all the same problems recur.

Also note that this only started happening after I started putting
a lot of files on to the partition (namely a source distribution).
 
-dan
 
########## cut here ##########
 
Script started on Fri Aug  5 21:31:56 1994
sh: warning: running as root with dot in PATH
# cd /usr/src/sbin/fsck
# gdb fsck
(gdb) run /dev/sd0e
Starting program: /usr/src/sbin/fsck/fsck /dev/sd0e
sh: warning: running as root with dot in PATH
** /dev/rsd0e
** Last Mounted on /usr
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
DIRECTORY CORRUPTED  I=58058  OWNER=root MODE=40755
SIZE=512 MTIME=Jun  5 03:23 1994 
DIR=?
 
SALVAGE? [yn] ^C
Program received signal SIGINT (2), Interrupt
0x25224 in read ()
(gdb) where
#0  0x25224 in read ()
#1  0x22dfd in __sread ()
#2  0x199e7 in __srefill ()
#3  0x198b1 in __srget ()
#4  0xe035 in reply (question=0xf0d8 "SALVAGE") at utilities.c:94
#5  0xf18a in dofix (idesc=0xf7bfdd40, msg=0x1b53 "DIRECTORY CORRUPTED")
    at utilities.c:494
#6  0x1c1b in fsck_readdir (idesc=0xf7bfdd40) at dir.c:167
#7  0x199d in dirscan (idesc=0xf7bfdd40) at dir.c:111
#8  0x3632 in ckinode (dp=0xf7bfdcc0, idesc=0xf7bfdd40) at inode.c:86
#9  0x731a in pass2 () at pass2.c:153
#10 0x53ee in checkfilesys (filesys=0x2aae4 "/dev/rsd0e", mntpt=0x0, 
    auxdata=0, child=0) at main.c:212
#11 0x4f4b in main (argc=0, argv=0xf7bfdf68) at main.c:125
(gdb) up 5
#5  0xf18a in dofix (idesc=0xf7bfdd40, msg=0x1b53 "DIRECTORY CORRUPTED")
    at utilities.c:494
494                     if (reply("SALVAGE") == 0) {
(gdb) list
489                     if (preen) {
490                             printf(" (SALVAGED)\n");
491                             idesc->id_fix = FIX;
492                             return (ALTERED);
493                     }
494                     if (reply("SALVAGE") == 0) {
495                             idesc->id_fix = NOFIX;
496                             return (0);
497                     }
498                     idesc->id_fix = FIX;
(gdb) up
#6  0x1c1b in fsck_readdir (idesc=0xf7bfdd40) at dir.c:167
167                     fix = dofix(idesc, "DIRECTORY CORRUPTED");
(gdb) list
162             if (idesc->id_loc % DIRBLKSIZ == 0 && idesc->id_filesize > 0 &&
163                 idesc->id_loc < blksiz) {
164                     dp = (struct direct *)(bp->b_un.b_buf + idesc->id_loc);
165                     if (dircheck(idesc, dp))
166                             goto dpok;
167                     fix = dofix(idesc, "DIRECTORY CORRUPTED");
168                     bp = getdirblk(idesc->id_blkno, blksiz);
169                     dp = (struct direct *)(bp->b_un.b_buf + idesc->id_loc);
170                     dp->d_reclen = DIRBLKSIZ;
171                     dp->d_ino = 0;
(gdb) print *idesc
$1 = {id_fix = DONTKNOW, id_func = 0x77cc <pass2check>, id_number = 58058, 
  id_parent = 0, id_blkno = 248670, id_numfrags = 1, 
  id_filesize = 0x0000000000000200, id_loc = 0, id_entryno = 0, 
  id_dirp = 0xf7bfd55c, id_name = 0x0, id_type = 1 '\001'}
(gdb) print *dp
$2 = {d_ino = 0, d_reclen = 512, d_type = 0 '\000', d_namlen = 0 '\000', 
  d_name = '\000' <repeats 255 times>}
(gdb) info frame 1
Stack frame at 0xf7bfd47c:
 eip = 0x22dfd in __sread; saved eip 0x199e7
 called by frame at 0xf7bfd494, caller of frame at 0xf7bfd47c
 Arglist at 0xf7bfd47c, args: 
 Locals at 0xf7bfd47c, Previous frame's sp is 0x0
 Saved registers:
  ebx at 0xf7bfd470, ebp at 0xf7bfd47c, esi at 0xf7bfd474, edi at 0xf7bfd478,
  eip at 0xf7bfd480
(gdb) info frame 2
Stack frame at 0xf7bfd494:
 eip = 0x199e7 in __srefill; saved eip 0x198b1
 called by frame at 0xf7bfd4a4, caller of frame at 0xf7bfd47c
 Arglist at 0xf7bfd494, args: 
 Locals at 0xf7bfd494, Previous frame's sp is 0x0
 Saved registers:
  ebx at 0xf7bfd490, ebp at 0xf7bfd494, eip at 0xf7bfd498
(gdb) info frame 3
Stack frame at 0xf7bfd4a4:
 eip = 0x198b1 in __srget; saved eip 0xe035
 called by frame at 0xf7bfd4b8, caller of frame at 0xf7bfd494
 Arglist at 0xf7bfd4a4, args: 
 Locals at 0xf7bfd4a4, Previous frame's sp is 0x0
 Saved registers:
  ebx at 0xf7bfd4a0, ebp at 0xf7bfd4a4, eip at 0xf7bfd4a8
(gdb) info frame 4
Stack frame at 0xf7bfd4b8:
 eip = 0xe035 in reply (utilities.c:94); saved eip 0xf18a
 called by frame at 0xf7bfd4c8, caller of frame at 0xf7bfd4a4
 source language c.
 Arglist at 0xf7bfd4b8, args: question=0xf0d8 "SALVAGE"
 Locals at 0xf7bfd4b8, Previous frame's sp is 0x0
 Saved registers:
  ebp at 0xf7bfd4b8, eip at 0xf7bfd4bc
(gdb) info frame 5
Stack frame at 0xf7bfd4c8:
 eip = 0xf18a in dofix (utilities.c:494); saved eip 0x1c1b
 called by frame at 0xf7bfd514, caller of frame at 0xf7bfd4b8
 source language c.
 Arglist at 0xf7bfd4c8, args: idesc=0xf7bfdd40, 
    msg=0x1b53 "DIRECTORY CORRUPTED"
 Locals at 0xf7bfd4c8, Previous frame's sp is 0x0
 Saved registers:
  ebx at 0xf7bfd4c4, ebp at 0xf7bfd4c8, eip at 0xf7bfd4cc
(gdb) info frame 6
Stack frame at 0xf7bfd514:
 eip = 0x1c1b in fsck_readdir (dir.c:167); saved eip 0x199d
 called by frame at 0xf7bfd768, caller of frame at 0xf7bfd4c8
 source language c.
 Arglist at 0xf7bfd514, args: idesc=0xf7bfdd40
 Locals at 0xf7bfd514, Previous frame's sp is 0x0
 Saved registers:
  ebx at 0xf7bfd4d8, ebp at 0xf7bfd514, esi at 0xf7bfd4dc, edi at 0xf7bfd4e0,
  eip at 0xf7bfd518
(gdb) info frame 7
Stack frame at 0xf7bfd768:
 eip = 0x199d in dirscan (dir.c:111); saved eip 0x3632
 called by frame at 0xf7bfd864, caller of frame at 0xf7bfd514
 source language c.
 Arglist at 0xf7bfd768, args: idesc=0xf7bfdd40
 Locals at 0xf7bfd768, Previous frame's sp is 0x0
 Saved registers:
  ebx at 0xf7bfd520, ebp at 0xf7bfd768, esi at 0xf7bfd524, edi at 0xf7bfd528,
  eip at 0xf7bfd76c
(gdb) info frame 8
Stack frame at 0xf7bfd864:
 eip = 0x3632 in ckinode (inode.c:86); saved eip 0x731a
 called by frame at 0xf7bfdd78, caller of frame at 0xf7bfd768
 source language c.
 Arglist at 0xf7bfd864, args: dp=0xf7bfdcc0, idesc=0xf7bfdd40
 Locals at 0xf7bfd864, Previous frame's sp is 0x0
 Saved registers:
  ebx at 0xf7bfd774, ebp at 0xf7bfd864, esi at 0xf7bfd778, edi at 0xf7bfd77c,
  eip at 0xf7bfd868
(gdb) info frame 9
Stack frame at 0xf7bfdd78:
 eip = 0x731a in pass2 (pass2.c:153); saved eip 0x53ee
 called by frame at 0xf7bfdf14, caller of frame at 0xf7bfd864
 source language c.
 Arglist at 0xf7bfdd78, args: 
 Locals at 0xf7bfdd78, Previous frame's sp is 0x0
 Saved registers:
  ebx at 0xf7bfd874, ebp at 0xf7bfdd78, esi at 0xf7bfd878, edi at 0xf7bfd87c,
  eip at 0xf7bfdd7c
(gdb) info frame 10
Stack frame at 0xf7bfdf14:
 eip = 0x53ee in checkfilesys (main.c:212); saved eip 0x4f4b
 called by frame at 0xf7bfdf38, caller of frame at 0xf7bfdd78
 source language c.
 Arglist at 0xf7bfdf14, args: filesys=0x2aae4 "/dev/rsd0e", mntpt=0x0, 
    auxdata=0, child=0
 Locals at 0xf7bfdf14, Previous frame's sp is 0x0
 Saved registers:
  ebx at 0xf7bfdd80, ebp at 0xf7bfdf14, esi at 0xf7bfdd84, eip at 0xf7bfdf18
(gdb) info frame 11
Stack frame at 0xf7bfdf38:
 eip = 0x4f4b in main (main.c:125); saved eip 0x109b
 caller of frame at 0xf7bfdf14
 source language c.
 Arglist at 0xf7bfdf38, args: argc=0, argv=0xf7bfdf68
 Locals at 0xf7bfdf38, Previous frame's sp is 0x0
 Saved registers:
  ebp at 0xf7bfdf38, eip at 0xf7bfdf3c
(gdb) quit
The program is running.  Quit anyway (and kill it)? (y or n) y
# exit

Script done on Fri Aug  5 21:36:34 1994

------------------------------------------------------------------------------