From owner-freebsd-current Mon Sep 21 04:20:40 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id EAA19775 for freebsd-current-outgoing; Mon, 21 Sep 1998 04:20:40 -0700 (PDT) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from gatekeeper.tsc.tdk.com (gatekeeper.tsc.tdk.com [207.113.159.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id EAA19770 for ; Mon, 21 Sep 1998 04:20:38 -0700 (PDT) (envelope-from gdonl@tsc.tdk.com) Received: from sunrise.gv.tsc.tdk.com (root@sunrise.gv.tsc.tdk.com [192.168.241.191]) by gatekeeper.tsc.tdk.com (8.8.8/8.8.8) with ESMTP id EAA05555 for ; Mon, 21 Sep 1998 04:20:10 -0700 (PDT) (envelope-from gdonl@tsc.tdk.com) Received: from salsa.gv.tsc.tdk.com (salsa.gv.tsc.tdk.com [192.168.241.194]) by sunrise.gv.tsc.tdk.com (8.8.5/8.8.5) with ESMTP id EAA27912 for ; Mon, 21 Sep 1998 04:20:09 -0700 (PDT) Received: (from gdonl@localhost) by salsa.gv.tsc.tdk.com (8.8.5/8.8.5) id EAA13929 for current@FreeBSD.ORG; Mon, 21 Sep 1998 04:20:07 -0700 (PDT) From: Don Lewis Message-Id: <199809211120.EAA13929@salsa.gv.tsc.tdk.com> Date: Mon, 21 Sep 1998 04:20:07 -0700 In-Reply-To: Don Lewis "Re: softupdates & fsck" (Sep 19, 4:17pm) X-Mailer: Mail User's Shell (7.2.6 alpha(3) 7/19/95) To: current@FreeBSD.ORG Subject: Re: softupdates & fsck Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sep 19, 4:17pm, Don Lewis wrote: } Subject: Re: softupdates & fsck } 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. You too can easily reproduce this fsck bug at home, though I still haven't figure out how to reproduce the bug that causes some directories to get extra links. The following transcript shows "fsck -p" taking a slighty but safely munged filesystem, mangling it into an unsafe state, and then setting the filesystem clean flag. I don't know if softupdates should be leaving the filesystem in the initial munged state after a panic, but it seems to to it frequently for me. Start with an ordinary formatted floppy and ... # newfs -t 2 -u 18 -l 1 fd0 /dev/rfd0: 2880 sectors in 80 cylinders of 2 tracks, 18 sectors 1.4MB in 5 cyl groups (16 c/g, 0.28MB/g, 128 i/g) super-block backups (for fsck -b #) at: 32, 632, 1184, 1784, 2336, # mount /dev/fd0 /mnt # mkdir /mnt/a /mnt/a/b # umount /dev/fd0 # fsck /dev/fd0 ** /dev/rfd0 ** Last Mounted on /mnt ** Phase 1 - Check Blocks and Sizes ** Phase 2 - Check Pathnames ** Phase 3 - Check Connectivity ** Phase 4 - Check Reference Counts ** Phase 5 - Check Cyl groups 3 files, 3 used, 2564 free (28 frags, 317 blocks, 1.1% fragmentation) # fsdb /dev/rfd0 ** /dev/rfd0 Editing file system `/dev/rfd0' Last Mounted on /mnt current inode: directory I=2 MODE=40755 SIZE=512 MTIME=Sep 21 03:32:40 1998 [0 nsec] CTIME=Sep 21 03:32:40 1998 [0 nsec] ATIME=Sep 21 03:32:11 1998 [0 nsec] OWNER=root GRP=wheel LINKCNT=3 FLAGS=0 BLKCNT=1 GEN=1477cd92 fsdb (inum: 2)> ls slot 0 ino 2 reclen 12: directory, `.' slot 1 ino 2 reclen 12: directory, `..' slot 2 ino 128 reclen 488: directory, `a' fsdb (inum: 2)> cd a component `a': current inode: directory I=128 MODE=40755 SIZE=512 MTIME=Sep 21 03:32:41 1998 [0 nsec] CTIME=Sep 21 03:32:41 1998 [0 nsec] ATIME=Sep 21 03:32:40 1998 [0 nsec] OWNER=root GRP=wheel LINKCNT=3 FLAGS=0 BLKCNT=1 GEN=1d5472a1 fsdb (inum: 128)> ls slot 0 ino 128 reclen 12: directory, `.' slot 1 ino 2 reclen 12: directory, `..' slot 2 ino 256 reclen 488: directory, `b' fsdb (inum: 128)> cd b component `b': current inode: directory I=256 MODE=40755 SIZE=512 MTIME=Sep 21 03:32:41 1998 [0 nsec] CTIME=Sep 21 03:32:41 1998 [0 nsec] ATIME=Sep 21 03:32:41 1998 [0 nsec] OWNER=root GRP=wheel LINKCNT=2 FLAGS=0 BLKCNT=1 GEN=6a4b4a86 fsdb (inum: 256)> ls slot 0 ino 256 reclen 12: directory, `.' slot 1 ino 128 reclen 500: directory, `..' fsdb (inum: 256)> cd /a component `a': current inode: directory I=128 MODE=40755 SIZE=512 MTIME=Sep 21 03:32:41 1998 [0 nsec] CTIME=Sep 21 03:32:41 1998 [0 nsec] ATIME=Sep 21 03:32:40 1998 [0 nsec] OWNER=root GRP=wheel LINKCNT=3 FLAGS=0 BLKCNT=1 GEN=1d5472a1 fsdb (inum: 128)> rm b Name `b' removed fsdb (inum: 128)> ls slot 0 ino 128 reclen 12: directory, `.' slot 1 ino 2 reclen 12: directory, `..' slot 2 ino 0 reclen 488: unknown, `b' fsdb (inum: 128)> inode 256 current inode: directory I=256 MODE=40755 SIZE=512 MTIME=Sep 21 03:32:41 1998 [0 nsec] CTIME=Sep 21 03:32:41 1998 [0 nsec] ATIME=Sep 21 03:32:41 1998 [0 nsec] OWNER=root GRP=wheel LINKCNT=2 FLAGS=0 BLKCNT=1 GEN=6a4b4a86 fsdb (inum: 256)> quit *** FILE SYSTEM MARKED DIRTY *** BE SURE TO RUN FSCK TO CLEAN UP ANY DAMAGE *** IF IT WAS MOUNTED, RE-MOUNT WITH -u -o reload # fsck -p /dev/rfd0 /dev/rfd0: UNREF DIR I=256 OWNER=root MODE=40755 /dev/rfd0: SIZE=512 MTIME=Sep 21 03:32 1998 (RECONNECTED) /dev/rfd0: NO lost+found DIRECTORY (CREATED) /dev/rfd0: DIR I=256 CONNECTED. PARENT WAS I=128 /dev/rfd0: LINK COUNT DIR I=128 OWNER=root MODE=40755 /dev/rfd0: SIZE=512 MTIME=Sep 21 03:32 1998 COUNT 3 SHOULD BE 1 (ADJUSTED) /dev/rfd0: FREE BLK COUNT(S) WRONG IN SUPERBLK (SALVAGED) /dev/rfd0: SUMMARY INFORMATION BAD (SALVAGED) /dev/rfd0: CLEAN FLAG NOT SET IN SUPERBLOCK (FIXED) /dev/rfd0: 4 files, 4 used, 2563 free (27 frags, 317 blocks, 1.1% fragmentation) # fsck -p /dev/rfd0 /dev/rfd0: clean, 2563 free (27 frags, 317 blocks, 1.1% fragmentation) # fsdb -r /dev/rfd0 ** /dev/rfd0 (NO WRITE) Examining file system `/dev/rfd0' Last Mounted on /mnt current inode: directory I=2 MODE=40755 SIZE=512 MTIME=Sep 21 03:32:40 1998 [0 nsec] CTIME=Sep 21 03:32:40 1998 [0 nsec] ATIME=Sep 21 03:32:11 1998 [0 nsec] OWNER=root GRP=wheel LINKCNT=4 FLAGS=0 BLKCNT=1 GEN=1477cd92 fsdb (inum: 2)> ls slot 0 ino 2 reclen 12: directory, `.' slot 1 ino 2 reclen 12: directory, `..' slot 2 ino 128 reclen 12: directory, `a' slot 3 ino 3 reclen 476: directory, `lost+found' fsdb (inum: 2)> cd a component `a': current inode: directory I=128 MODE=40755 SIZE=512 MTIME=Sep 21 03:32:41 1998 [0 nsec] CTIME=Sep 21 03:32:41 1998 [0 nsec] ATIME=Sep 21 03:32:40 1998 [0 nsec] OWNER=root GRP=wheel LINKCNT=1 FLAGS=0 BLKCNT=1 GEN=1d5472a1 fsdb (inum: 128)> ls slot 0 ino 128 reclen 12: directory, `.' slot 1 ino 2 reclen 12: directory, `..' slot 2 ino 0 reclen 488: unknown, `b' fsdb (inum: 128)> cd /lost+found component `lost+found': current inode: directory I=3 MODE=41777 SIZE=512 MTIME=Sep 21 03:34:14 1998 [0 nsec] CTIME=Sep 21 03:34:14 1998 [0 nsec] ATIME=Sep 21 03:34:14 1998 [0 nsec] OWNER=root GRP=wheel LINKCNT=3 FLAGS=0 BLKCNT=1 GEN=3b0651c fsdb (inum: 3)> ls slot 0 ino 3 reclen 12: directory, `.' slot 1 ino 2 reclen 12: directory, `..' slot 2 ino 256 reclen 488: directory, `#256' fsdb (inum: 3)> cd #256 component `#256': ls current inode: directory I=256 MODE=40755 SIZE=512 MTIME=Sep 21 03:32:41 1998 [0 nsec] CTIME=Sep 21 03:32:41 1998 [0 nsec] ATIME=Sep 21 03:32:41 1998 [0 nsec] OWNER=root GRP=wheel LINKCNT=2 FLAGS=0 BLKCNT=1 GEN=6a4b4a86 fsdb (inum: 256)> ls slot 0 ino 256 reclen 12: directory, `.' slot 1 ino 3 reclen 500: directory, `..' fsdb (inum: 256)> quit # fsck /dev/rfd0 ** /dev/rfd0 ** Last Mounted on /mnt ** Phase 1 - Check Blocks and Sizes ** Phase 2 - Check Pathnames ** Phase 3 - Check Connectivity ** Phase 4 - Check Reference Counts LINK COUNT DIR I=128 OWNER=root MODE=40755 SIZE=512 MTIME=Sep 21 03:32 1998 COUNT 1 SHOULD BE 2 ADJUST? [yn] y ** Phase 5 - Check Cyl groups 4 files, 4 used, 2563 free (27 frags, 317 blocks, 1.1% fragmentation) ***** FILE SYSTEM WAS MODIFIED ***** To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message