Whamcloud - gitweb
Fix bug in e2fsck: When reconnecting a directory, we may
authorTheodore Ts'o <tytso@mit.edu>
Fri, 12 Dec 2003 08:00:56 +0000 (03:00 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 12 Dec 2003 08:00:56 +0000 (03:00 -0500)
need to create a lost+found directory.  This may
invalidate our pointer to the directory information, so we
must look it up again after calling
e2fsck_reconnect_file().  (Addresses Debian bug #219640).

e2fsck/ChangeLog
e2fsck/pass3.c
tests/ChangeLog
tests/f_lpf2/expect.1 [new file with mode: 0644]
tests/f_lpf2/expect.2 [new file with mode: 0644]
tests/f_lpf2/image.gz [new file with mode: 0644]
tests/f_lpf2/name [new file with mode: 0644]

index b30d4c2..754a688 100644 (file)
@@ -1,3 +1,11 @@
+2003-12-12  Theodore Ts'o  <tytso@mit.edu>
+
+       * pass3.c (check_directory): When reconnecting a directory, we may
+               need to create a lost+found directory.  This may
+               invalidate our pointer to the directory information, so we
+               must look it up again after calling
+               e2fsck_reconnect_file().  (Addresses Debian bug #219640).
+
 2003-12-10  Theodore Ts'o  <tytso@mit.edu>
 
        * e2fsck.h (E2F_FLAG_RESTARTED): Assign a unique flag bitfield to
index e2bdd54..6ae87a4 100644 (file)
@@ -302,9 +302,10 @@ static int check_directory(e2fsck_t ctx, struct dir_info *dir,
                                              p->parent)))) {
                        pctx->ino = p->ino;
                        if (fix_problem(ctx, PR_3_UNCONNECTED_DIR, pctx)) {
-                               if (e2fsck_reconnect_file(ctx, p->ino))
+                               if (e2fsck_reconnect_file(ctx, pctx->ino))
                                        ext2fs_unmark_valid(fs);
                                else {
+                                       p = e2fsck_get_dir_info(ctx, pctx->ino);
                                        p->parent = ctx->lost_and_found;
                                        fix_dotdot(ctx, p, ctx->lost_and_found);
                                }
index 26605c4..2012374 100644 (file)
@@ -1,3 +1,8 @@
+2003-12-12  Theodore Ts'o  <tytso@mit.edu>
+
+       * f_lpf2: New test case to validate reconnecting a directory after
+               creating /lost+found.
+
 2003-09-03  Theodore Ts'o  <tytso@mit.edu>
 
        * m_meta_bg: New test case to test the meta block group feature.
diff --git a/tests/f_lpf2/expect.1 b/tests/f_lpf2/expect.1
new file mode 100644 (file)
index 0000000..633586c
--- /dev/null
@@ -0,0 +1,41 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Unconnected directory inode 12 (/???)
+Connect to /lost+found? yes
+
+/lost+found not found.  Create? yes
+
+Unconnected directory inode 13 (/???)
+Connect to /lost+found? yes
+
+Pass 4: Checking reference counts
+Inode 2 ref count is 4, should be 3.  Fix? yes
+
+Inode 12 ref count is 3, should be 2.  Fix? yes
+
+Inode 13 ref count is 3, should be 2.  Fix? yes
+
+Pass 5: Checking group summary information
+Block bitmap differences:  -(9--19)
+Fix? yes
+
+Free blocks count wrong for group #0 (77, counted=89).
+Fix? yes
+
+Free blocks count wrong (77, counted=89).
+Fix? yes
+
+Free inodes count wrong for group #0 (2, counted=3).
+Fix? yes
+
+Directories count wrong for group #0 (5, counted=4).
+Fix? yes
+
+Free inodes count wrong (2, counted=3).
+Fix? yes
+
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 13/16 files (0.0% non-contiguous), 11/100 blocks
+Exit status is 1
diff --git a/tests/f_lpf2/expect.2 b/tests/f_lpf2/expect.2
new file mode 100644 (file)
index 0000000..e551932
--- /dev/null
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 13/16 files (0.0% non-contiguous), 11/100 blocks
+Exit status is 0
diff --git a/tests/f_lpf2/image.gz b/tests/f_lpf2/image.gz
new file mode 100644 (file)
index 0000000..f703fb3
Binary files /dev/null and b/tests/f_lpf2/image.gz differ
diff --git a/tests/f_lpf2/name b/tests/f_lpf2/name
new file mode 100644 (file)
index 0000000..63da315
--- /dev/null
@@ -0,0 +1 @@
+create lost+found and reconnect lost directory