Subject: fsck problems
To: None <current-users@sun-lamp.cs.berkeley.edu>
From: Alan Barrett <barrett@daisy.ee.und.ac.za>
List: current-users
Date: 07/27/1994 10:00:40
I have been having trouble with fsck for several weeks now.  My root
partition is in a state that the current fsck is unable to fix, and I
don't like that.  Sometimes fsck core dumps with SIGSEGV, and sometimes
it doesn't.  On the occasions that it doesn't coredump, it leaves the
disk in an inconsistent state, which sometimes leads to kernel panics
(something about "mangled directory").  An old fsck from -0.9 also
SIGSEGV's.

I am not sure, but it looks somewhat as though, when fsck reconnects an
unreferenced file and/or directory to lost+found, it leaves lost+found
and/or the root directory in a bad state.

I tried running fsck under gdb, and at the point where the SIGSEGV
occurs, gdb becomes unable to display a traceback, which leads me to
suspect that the stack is getting clobbered.

I tried compiling fsck with CFLAGS= "-g -ansi -pedantic -Wall
-Wtraditional -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align
-Wconversion -Wredundant-decls", and I fixed averything it complained
about (except a few things that I judged to be harmless).  That didn't
help.

I append a transcript illustrating the problem.  Help!  What do I do
now?

--apb (Alan Barrett)

# ./fsck /dev/rsd0a
** /dev/rsd0a
** Last Mounted on /
** Root file system
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
UNREF DIR  I=80648  OWNER=barrett MODE=40777
SIZE=512 MTIME=Jul  5 13:31 1994 
RECONNECT? [yn] y

[*** note: inode 80648 was a previous incarnation of /lost+found,
 *** which I zapped with clri because it was bad and was causing kernel
 *** panics.]

NO lost+found DIRECTORY
CREATE? [yn] y

DIR I=80648 CONNECTED. PARENT WAS I=2886

UNREF DIR  I=72002  OWNER=cschle MODE=40777
SIZE=512 MTIME=Jul  5 13:10 1994 
RECONNECT? [yn] y

DIRECTORY CORRUPTED  I=15  OWNER=barrett MODE=41777
SIZE=1024 MTIME=Jul 25 21:42 1994 
DIR=?

SALVAGE? [yn] y

Segmentation fault - core dumped
# ./fsck /dev/rsd0a
** /dev/rsd0a
** Last Mounted on /
** Root file system
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
DIRECTORY CORRUPTED  I=2  OWNER=root MODE=40755
SIZE=1024 MTIME=Jul 24 14:14 1994 
DIR=/

SALVAGE? [yn] y

** Phase 3 - Check Connectivity
UNREF DIR  I=80648  OWNER=barrett MODE=40777
SIZE=512 MTIME=Jul  5 13:31 1994 
RECONNECT? [yn] n

UNREF DIR  I=80648  OWNER=barrett MODE=40777
SIZE=512 MTIME=Jul  5 13:31 1994 
RECONNECT? [yn] n

UNREF DIR  I=72002  OWNER=cschle MODE=40777
SIZE=512 MTIME=Jul  5 13:10 1994 
RECONNECT? [yn] n

UNREF DIR  I=72002  OWNER=cschle MODE=40777
SIZE=512 MTIME=Jul  5 13:10 1994 
RECONNECT? [yn] n

UNREF DIR  I=69151  OWNER=root MODE=40755
SIZE=1024 MTIME=Feb 14 11:31 1994 
RECONNECT? [yn] n

UNREF DIR  I=66252  OWNER=barrett MODE=40777
SIZE=512 MTIME=Jul  5 12:04 1994 
RECONNECT? [yn] n

UNREF DIR  I=66252  OWNER=barrett MODE=40777
SIZE=512 MTIME=Jul  5 12:04 1994 
RECONNECT? [yn] n

UNREF DIR  I=51842  OWNER=barrett MODE=40777
SIZE=512 MTIME=Jul  5 11:15 1994 
RECONNECT? [yn] n

UNREF DIR  I=60480  OWNER=barrett MODE=40777
SIZE=512 MTIME=Jul  5 02:14 1994 
RECONNECT? [yn] n

UNREF DIR  I=51842  OWNER=barrett MODE=40777
SIZE=512 MTIME=Jul  5 11:15 1994 
RECONNECT? [yn] n

UNREF DIR  I=48962  OWNER=root MODE=40755
SIZE=512 MTIME=Jul 15 01:41 1994 
RECONNECT? [yn] n

UNREF DIR  I=34562  OWNER=barrett MODE=40700
SIZE=512 MTIME=Jul  4 10:32 1994 
RECONNECT? [yn] q
RECONNECT? [yn] q
RECONNECT? [yn] ^C# 

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