Date: Sat, 19 Sep 1998 16:17:37 -0700 From: Don Lewis <Don.Lewis@tsc.tdk.com> To: Don Lewis <Don.Lewis@tsc.tdk.com>, current@FreeBSD.ORG Subject: Re: softupdates & fsck Message-ID: <199809192317.QAA11186@salsa.gv.tsc.tdk.com> In-Reply-To: Don Lewis <Don.Lewis@tsc.tdk.com> "softupdates & fsck" (Sep 18, 10:20pm)
next in thread | previous in thread | raw e-mail | index | archive | help
On Sep 18, 10:20pm, Don Lewis wrote:
} Subject: softupdates & fsck
} My suspicion is that the first fsck run is getting the link counts wrong
} when it repairs the filesystem. I've taked a look at the fsck code, but
} haven't gotten too far, mostly because the code is so well commented -- NOT!
Yup, fsck is definitely screwing up the filesystem when it tries to repair
it. The following transcripts were all taken while running single-user
after a panic.
# fsck -n /dev/rda0s1h
** /dev/rda0s1h (NO WRITE)
** Last Mounted on /home
** Phase 1 - Check Blocks and Sizes
INCORRECT BLOCK COUNT I=139897 (4 should be 0)
CORRECT? no
# fsck -n /dev/rda0s1h
** /dev/rda0s1h (NO WRITE)
** Last Mounted on /home
** Phase 1 - Check Blocks and Sizes
INCORRECT BLOCK COUNT I=139897 (4 should be 0)
CORRECT? no
[ snip ]
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
UNREF DIR I=139883 OWNER=root MODE=40755
SIZE=1024 MTIME=Sep 19 11:47 1998
RECONNECT? no
** Phase 4 - Check Reference Counts
LINK COUNT DIR I=139883 OWNER=root MODE=40755
SIZE=1024 MTIME=Sep 19 11:47 1998 COUNT 2 SHOULD BE 1
ADJUST? no
UNREF FILE I=139947 OWNER=root MODE=100644
SIZE=0 MTIME=Sep 19 11:47 1998
CLEAR? no
[ snip ]
# fsdb -r /dev/rda0s1h
** /dev/rda0s1h (NO WRITE)
Examining file system `/dev/rda0s1h'
Last Mounted on /home
current inode: directory
I=2 MODE=40755 SIZE=512
MTIME=Sep 9 17:35:37 1998 [0 nsec]
CTIME=Sep 9 17:35:37 1998 [0 nsec]
ATIME=Sep 19 11:23:21 1998 [0 nsec]
OWNER=root GRP=wheel LINKCNT=6 FLAGS=0 BLKCNT=2 GEN=4b328c71
fsdb (inum: 2)> inode 139883
current inode: directory
I=139883 MODE=40755 SIZE=1024
MTIME=Sep 19 11:47:17 1998 [0 nsec]
CTIME=Sep 19 11:47:17 1998 [0 nsec]
ATIME=Sep 19 11:46:53 1998 [0 nsec]
OWNER=root GRP=wheel LINKCNT=2 FLAGS=0 BLKCNT=2 GEN=36ac6ad3
fsdb (inum: 139883)> ls
slot 0 ino 139883 reclen 12: directory, `.'
slot 1 ino 285639 reclen 12: directory, `..'
slot 2 ino 139931 reclen 16: regular, `add.o'
slot 3 ino 139921 reclen 16: regular, `cmp.o'
slot 4 ino 139984 reclen 16: regular, `gcd.o'
slot 5 ino 139978 reclen 16: regular, `mul.o'
slot 6 ino 139985 reclen 20: regular, `pow_ui.o'
[ snip ]
fsdb (inum: 2)> inode 285639
current inode: directory
I=285639 MODE=40755 SIZE=1024
MTIME=Sep 19 11:47:09 1998 [0 nsec]
CTIME=Sep 19 11:47:09 1998 [0 nsec]
ATIME=Sep 19 11:46:53 1998 [0 nsec]
OWNER=root GRP=wheel LINKCNT=3 FLAGS=0 BLKCNT=6 GEN=74aa357e
fsdb (inum: 285639)> ls
slot 0 ino 285639 reclen 12: directory, `.'
slot 1 ino 254952 reclen 12: directory, `..'
slot 2 ino 0 reclen 12: directory, `mpz'
slot 3 ino 0 reclen 24: regular, `asm-syntax.h'
slot 4 ino 0 reclen 20: regular, `sysdep.h'
slot 5 ino 0 reclen 20: regular, `memory.o'
slot 6 ino 0 reclen 24: regular, `mp_set_fns.o'
slot 7 ino 0 reclen 24: regular, `mp_clz_tab.o'
slot 8 ino 0 reclen 20: regular, `version.o'
slot 9 ino 0 reclen 20: regular, `mp_bpl.o'
[ snip ]
[ commentary ] The directories for inodes 139883 and 285639 contain no
other directories than what are shown in these listings. The filesystem
is in a somewhat inconsistent state. The link from the inode 285639 to
inode 139883 has been removed, but the link count of inode 139883 has
not yet been decremented. Link counts that are too big are safe for
fsck to correct. The link count of inode 285639 is correct because the
link from the inode 139883 directory has not yet been removed.
# fsck -p /dev/rda01s1h
/dev/rda0s1h: INCORRECT BLOCK COUNT I=139897 (4 should be 0) (CORRECTED)
/dev/rda0s1h: INCORRECT BLOCK COUNT I=139921 (2 should be 0) (CORRECTED)
/dev/rda0s1h: INCORRECT BLOCK COUNT I=139931 (4 should be 0) (CORRECTED)
/dev/rda0s1h: INCORRECT BLOCK COUNT I=139945 (2 should be 0) (CORRECTED)
[ snip ]
/dev/rda0s1h: INCORRECT BLOCK COUNT I=287226 (4 should be 0) (CORRECTED)
/dev/rda0s1h: UNREF DIR I=139883 OWNER=root MODE=40755
/dev/rda0s1h: SIZE=1024 MTIME=Sep 19 11:47 1998 (RECONNECTED)
/dev/rda0s1h: DIR I=139883 CONNECTED. PARENT WAS I=285639
/dev/rda0s1h: UNREF FILE I=139947 OWNER=root MODE=100644
/dev/rda0s1h: SIZE=0 MTIME=Sep 19 11:47 1998 (CLEARED)
/dev/rda0s1h: UNREF FILE I=139948 OWNER=root MODE=100644
/dev/rda0s1h: SIZE=0 MTIME=Sep 19 11:47 1998 (CLEARED)
/dev/rda0s1h: UNREF FILE I=139967 OWNER=root MODE=100644
/dev/rda0s1h: SIZE=0 MTIME=Sep 19 11:47 1998 (CLEARED)
/dev/rda0s1h: UNREF FILE I=139968 OWNER=root MODE=100644
/dev/rda0s1h: SIZE=0 MTIME=Sep 19 11:47 1998 (CLEARED)
/dev/rda0s1h: LINK COUNT FILE I=139986 OWNER=root MODE=100644
/dev/rda0s1h: SIZE=0 MTIME=Sep 19 11:47 1998 COUNT 2 SHOULD BE 1 (ADJUSTED)
/dev/rda0s1h: LINK COUNT FILE I=139987 OWNER=root MODE=100644
/dev/rda0s1h: SIZE=0 MTIME=Sep 19 11:47 1998 COUNT 2 SHOULD BE 1 (ADJUSTED)
/dev/rda0s1h: LINK COUNT FILE I=139990 OWNER=root MODE=100644
/dev/rda0s1h: SIZE=0 MTIME=Sep 19 11:47 1998 COUNT 2 SHOULD BE 1 (ADJUSTED)
/dev/rda0s1h: LINK COUNT FILE I=139992 OWNER=root MODE=100644
/dev/rda0s1h: SIZE=0 MTIME=Sep 19 11:47 1998 COUNT 2 SHOULD BE 1 (ADJUSTED)
/dev/rda0s1h: LINK COUNT DIR I=285639 OWNER=root MODE=40755
/dev/rda0s1h: SIZE=1024 MTIME=Sep 19 11:47 1998 COUNT 3 SHOULD BE 1 (ADJUSTED)
/dev/rda0s1h: UNREF FILE I=286704 OWNER=root MODE=100644
/dev/rda0s1h: SIZE=0 MTIME=Sep 19 11:46 1998 (CLEARED)
[ snip ]
/dev/rda0s1h: FREE BLK COUNT(S) WRONG IN SUPERBLK (SALVAGED)
/dev/rda0s1h: SUMMARY INFORMATION BAD (SALVAGED)
/dev/rda0s1h: BLK(S) MISSING IN BIT MAPS (SALVAGED)
/dev/rda0s1h: CLEAN FLAG NOT SET IN SUPERBLOCK (FIXED)
/dev/rda0s1h: 96299 files, 971360 used, 391085 free (13085 frags, 47250 blocks,
1.0% fragmentation)
# fsdb -r /dev/rda0s1h
** /dev/rda0s1h (NO WRITE)
Examining file system `/dev/rda0s1h'
Last Mounted on /home
current inode: directory
I=2 MODE=40755 SIZE=512
MTIME=Sep 9 17:35:37 1998 [0 nsec]
CTIME=Sep 9 17:35:37 1998 [0 nsec]
ATIME=Sep 19 11:23:21 1998 [0 nsec]
OWNER=root GRP=wheel LINKCNT=6 FLAGS=0 BLKCNT=2 GEN=4b328c71
fsdb (inum: 2)> inode 138^H^[[K9883^M
current inode: directory
I=139883 MODE=40755 SIZE=1024
MTIME=Sep 19 11:47:17 1998 [0 nsec]
CTIME=Sep 19 11:47:17 1998 [0 nsec]
ATIME=Sep 19 11:46:53 1998 [0 nsec]
fsdb (inum: 139883)> ls
slot 0 ino 139883 reclen 12: directory, `.'
slot 1 ino 1471 reclen 12: directory, `..'
slot 2 ino 139931 reclen 16: regular, `add.o'
slot 3 ino 139921 reclen 16: regular, `cmp.o'
slot 4 ino 139984 reclen 16: regular, `gcd.o'
[ snip ]
fsdb (inum: 139883)> inode 285639
current inode: directory
I=285639 MODE=40755 SIZE=1024
MTIME=Sep 19 11:47:09 1998 [0 nsec]
CTIME=Sep 19 11:47:09 1998 [0 nsec]
ATIME=Sep 19 11:46:53 1998 [0 nsec]
OWNER=root GRP=wheel LINKCNT=1 FLAGS=0 BLKCNT=2 GEN=74aa357e
fsdb (inum: 285639)> ls
slot 0 ino 285639 reclen 12: directory, `.'
slot 1 ino 254952 reclen 12: directory, `..'
slot 2 ino 0 reclen 12: directory, `mpz'
slot 3 ino 0 reclen 24: regular, `asm-syntax.h'
slot 4 ino 0 reclen 20: regular, `sysdep.h'
slot 5 ino 0 reclen 20: regular, `memory.o'
[ snip ]
fsdb (inum: 2)> ls
slot 0 ino 2 reclen 12: directory, `.'
slot 1 ino 2 reclen 12: directory, `..'
slot 2 ino 7680 reclen 16: directory, `gdonl'
slot 3 ino 15360 reclen 16: directory, `release'
slot 4 ino 247212 reclen 12: directory, `obj'
slot 5 ino 1471 reclen 444: directory, `lost+found'
fsdb (inum: 2)> inode 1471
current inode: directory
I=1471 MODE=41777 SIZE=17408
MTIME=Sep 19 00:34:31 1998 [0 nsec]
CTIME=Sep 19 00:34:36 1998 [0 nsec]
ATIME=Sep 19 03:34:14 1998 [0 nsec]
OWNER=gdonl GRP=wheel LINKCNT=3 FLAGS=0 BLKCNT=22 GEN=2dc4339e
fsdb (inum: 1471)> ls
slot 0 ino 1471 reclen 12: directory, `.'
slot 1 ino 2 reclen 12: directory, `..'
slot 2 ino 139883 reclen 488: directory, `#139883'
slot 3 ino 0 reclen 512: regular, `#018192'
slot 4 ino 0 reclen 512: regular, `#018223'
[ snip ]
[ commentary ] fsck -p has attempted to repair the filesystem damage. It
reconnected the directory to lost+found, *but* it screwed up the link
on inode 285639.
# fsck -p /dev/rda0s1h
/dev/rda0s1h: clean, 391085 free (13085 frags, 47250 blocks, 1.0% fragmentation)
[ commentary ] BAD NEWS - the clean flag has been set even though the
filesystem is corrupt!
# fsck /dev/rda0s1h
** /dev/rda0s1h
** Last Mounted on /home
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
LINK COUNT DIR I=285639 OWNER=root MODE=40755
SIZE=1024 MTIME=Sep 19 11:47 1998 COUNT 1 SHOULD BE 2
LINK COUNT INCREASING
UNEXPECTED SOFTDEP INCONSISTENCY
ADJUST? [yn] y
** Phase 5 - Check Cyl groups
96299 files, 971360 used, 391085 free (13085 frags, 47250 blocks, 1.0% fragmentation)
***** FILE SYSTEM WAS MODIFIED *****
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199809192317.QAA11186>
