summaryrefslogtreecommitdiffstats
path: root/sbin/fsck_ffs/dir.c
diff options
context:
space:
mode:
authornate <nate@FreeBSD.org>1996-05-09 16:38:27 +0000
committernate <nate@FreeBSD.org>1996-05-09 16:38:27 +0000
commit71859c694bcd981fe39ce9fb5485e60ebafff7a9 (patch)
tree77c450ef002d5fb9e5a734746dbdf99c856a68a5 /sbin/fsck_ffs/dir.c
parenta6c3d6a66128f8bb06503f9a5f09b71f89e78d71 (diff)
downloadFreeBSD-src-71859c694bcd981fe39ce9fb5485e60ebafff7a9.zip
FreeBSD-src-71859c694bcd981fe39ce9fb5485e60ebafff7a9.tar.gz
From: Terry Lambert <terry@lambert.org>
Subject: Fix for annoying fsck bug Date: Wed, 24 Jan 1996 13:33:29 -0700 (MST) The following small diff fixes the annoying fsck bug that causes it to need to be run twice to end up with correct reference counts for inodes for directories that had subdirectories relocated into the lost+found directory. I found the need to rerun *extremely* annoying. This fix causes the count to be correctly adjusted later in pass 4 by correctly stating the parent reference count. Note that the parent reference count is incremented when the directory entry is made (for ".."), but is not really there in the case of a directory that does not make an entry in its parent dir. This can be tested by waiting for the inode sync after cd'ing from a shell into a test fs. Then you "mkdir xxx yyy zzz", wait a second, and hit the machine reset button. Reviewed by: nate (Tested lots of crashes :) Submitted by: Terry Lambert <terry@lambert.org>
Diffstat (limited to 'sbin/fsck_ffs/dir.c')
-rw-r--r--sbin/fsck_ffs/dir.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/sbin/fsck_ffs/dir.c b/sbin/fsck_ffs/dir.c
index 888bad2..9a2b923 100644
--- a/sbin/fsck_ffs/dir.c
+++ b/sbin/fsck_ffs/dir.c
@@ -472,8 +472,18 @@ linkup(orphan, parentdir)
inodirty();
lncntp[lfdir]++;
pwarn("DIR I=%lu CONNECTED. ", orphan);
- if (parentdir != (ino_t)-1)
+ if (parentdir != (ino_t)-1) {
printf("PARENT WAS I=%lu\n", 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)
printf("\n");
}
OpenPOWER on IntegriCloud