From owner-freebsd-current Tue Sep 22 16:34:22 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id QAA28786 for freebsd-current-outgoing; Tue, 22 Sep 1998 16:34:22 -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 QAA28781 for ; Tue, 22 Sep 1998 16:34:20 -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 QAA01910; Tue, 22 Sep 1998 16:33:49 -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 QAA04153; Tue, 22 Sep 1998 16:33:48 -0700 (PDT) Received: (from gdonl@localhost) by salsa.gv.tsc.tdk.com (8.8.5/8.8.5) id QAA19332; Tue, 22 Sep 1998 16:33:46 -0700 (PDT) From: Don Lewis Message-Id: <199809222333.QAA19332@salsa.gv.tsc.tdk.com> Date: Tue, 22 Sep 1998 16:33:46 -0700 In-Reply-To: Don Lewis "Re: softupdates & fsck" (Sep 21, 4:20am) X-Mailer: Mail User's Shell (7.2.6 alpha(3) 7/19/95) To: current@FreeBSD.ORG Subject: Re: softupdates & fsck Cc: mckusick@McKusick.COM Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG This problem appears to be caused by a bug fix to the linkup() function in fsck that was merged from Lite2 (please excuse the cut & paste) if (preen) printf(" (RECONNECTED)\n"); else if (reply("RECONNECT") == 0) return (0); + if (parentdir != 0) + lncntp[parentdir]++; if (lfdir == 0) { that more or less duplicates a previous bug fix from Terry Lambert. if (lostdir) { if ((changeino(orphan, "..", lfdir) & ALTERED) == 0 && parentdir != (ino_t)-1) (void)makeentry(orphan, lfdir, ".."); dp = ginode(lfdir); dp->di_nlink++; inodirty(); lncntp[lfdir]++; pwarn("DIR I=%lu CONNECTED. ", orphan); + if (parentdir != (ino_t)-1) { + printf("PARENT WAS I=%lu\n", (u_long)parentdir); + /* + * The parent directory, because of the ordering + * guarantees, has had the link count incremented + * for the child, but no entry was made. This + * fixes the parent link count so that fsck does + * not need to be rerun. + */ + lncntp[parentdir]++; + + } if (preen == 0) This duplicate adjustment causes the parent directory's link count to be decremented too much when the orphaned directory is reconnected under lost+found. I believe Terry's fix is the correct one, since we shouldn't muck with the link count of the parent directory unless we actually reconnect the orphan to lost+found and change where its .. link points. On Sep 21, 4:20am, Don Lewis wrote: } Subject: Re: softupdates & fsck } 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 }-- End of excerpt from Don Lewis To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message