Whamcloud - gitweb
Fixed the journal handling so that an offer is made to clear the
authorTheodore Ts'o <tytso@mit.edu>
Thu, 7 Mar 2002 08:13:07 +0000 (03:13 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 7 Mar 2002 08:13:07 +0000 (03:13 -0500)
journal filesystem in all cases.

Fixed a bug in e2fsck which caused it to give spurious I/O manager
bad messages right before crashes.

13 files changed:
e2fsck/ChangeLog
e2fsck/journal.c
e2fsck/unix.c
tests/ChangeLog
tests/f_extra_journal/expect.1 [new file with mode: 0644]
tests/f_extra_journal/expect.2 [new file with mode: 0644]
tests/f_extra_journal/image.gz [new file with mode: 0644]
tests/f_extra_journal/name [new file with mode: 0644]
tests/f_miss_journal/expect.1 [new file with mode: 0644]
tests/f_miss_journal/expect.2 [new file with mode: 0644]
tests/f_miss_journal/image.gz [new file with mode: 0644]
tests/f_miss_journal/name [new file with mode: 0644]
tests/f_swapfs/image [new file with mode: 0644]

index 1bb4191..747f1fc 100644 (file)
@@ -1,4 +1,14 @@
-2002-03-06    <tytso@snap.thunk.org>
+2002-03-07    <tytso@snap.thunk.org>
+
+       * unix.c (main): Don't close the filesystem before calling
+               fatal_error(); this just causes a needless warning about a
+               bad I/O manager magic number.
+
+       * journal.c (e2fsck_check_ext3_journal): Offer to clear the inode
+               in case the journal is too small, or the inode number in
+               the superblock doesn't appear to be random.
+
+2002-03-06    <tytso@mit.edu>
 
        * problem.h, problem.c: PR_5_BLOCK_RANGE_UNUSED,
                PR_5_BLOCK_RANGE_USED, PR_5_INODE_RANGE_UNUSED,
index ec575ee..6597d57 100644 (file)
@@ -620,7 +620,9 @@ int e2fsck_check_ext3_journal(e2fsck_t ctx)
 
        retval = e2fsck_get_journal(ctx, &journal);
        if (retval) {
-               if (retval == EXT2_ET_BAD_INODE_NUM)
+               if ((retval == EXT2_ET_BAD_INODE_NUM) ||
+                   (retval == EXT2_ET_JOURNAL_TOO_SMALL) ||
+                   (retval == EXT2_ET_NO_JOURNAL))
                        return e2fsck_journal_fix_bad_inode(ctx, &pctx);
                return retval;
        }
index 1eac497..e424ac7 100644 (file)
@@ -831,7 +831,6 @@ restart:
                com_err(ctx->program_name, retval,
                        _("while checking ext3 journal for %s"),
                        ctx->device_name);
-               ext2fs_close(ctx->fs);
                fatal_error(ctx, 0);
        }
 
index 7d16aee..71c1eb2 100644 (file)
@@ -1,4 +1,8 @@
-2002-03-06    <tytso@snap.thunk.org>
+2002-03-07    <tytso@mit.edu>
+
+       * f_miss_journal, f_extra_journal: Added new test cases.
+
+2002-03-06    <tytso@mit.edu>
 
        * f_badorphan, f_badtable, f_bbinode, f_dupsuper, f_expand,
                f_illbbitmap, f_illibitmap, f_illitable, f_imagic, 
diff --git a/tests/f_extra_journal/expect.1 b/tests/f_extra_journal/expect.1
new file mode 100644 (file)
index 0000000..f8ccd64
--- /dev/null
@@ -0,0 +1,23 @@
+Superblock doesn't have has_journal flag, but has ext3 journal inode.
+Clear? yes
+
+Pass 1: Checking inodes, blocks, and sizes
+Journal inode is not in use, but contains data.  Clear? yes
+
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+Block bitmap differences:  -(50--1079)
+Fix? yes
+
+Free blocks count wrong for group #0 (968, counted=1998).
+Fix? yes
+
+Free blocks count wrong (968, counted=1998).
+Fix? yes
+
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 11/256 files (0.0% non-contiguous), 50/2048 blocks
+Exit status is 1
diff --git a/tests/f_extra_journal/expect.2 b/tests/f_extra_journal/expect.2
new file mode 100644 (file)
index 0000000..834a120
--- /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: 11/256 files (0.0% non-contiguous), 50/2048 blocks
+Exit status is 0
diff --git a/tests/f_extra_journal/image.gz b/tests/f_extra_journal/image.gz
new file mode 100644 (file)
index 0000000..1139619
Binary files /dev/null and b/tests/f_extra_journal/image.gz differ
diff --git a/tests/f_extra_journal/name b/tests/f_extra_journal/name
new file mode 100644 (file)
index 0000000..c5540e2
--- /dev/null
@@ -0,0 +1 @@
+Valid journal inode, but has_journal feature not present
diff --git a/tests/f_miss_journal/expect.1 b/tests/f_miss_journal/expect.1
new file mode 100644 (file)
index 0000000..8aebe44
--- /dev/null
@@ -0,0 +1,23 @@
+Superblock has a bad ext3 journal (inode 8).
+Clear? yes
+
+*** ext3 journal has been deleted - filesystem is now ext2 only ***
+
+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
+Block bitmap differences:  -(50--1079)
+Fix? yes
+
+Free blocks count wrong for group #0 (968, counted=1998).
+Fix? yes
+
+Free blocks count wrong (968, counted=1998).
+Fix? yes
+
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 11/256 files (0.0% non-contiguous), 50/2048 blocks
+Exit status is 1
diff --git a/tests/f_miss_journal/expect.2 b/tests/f_miss_journal/expect.2
new file mode 100644 (file)
index 0000000..834a120
--- /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: 11/256 files (0.0% non-contiguous), 50/2048 blocks
+Exit status is 0
diff --git a/tests/f_miss_journal/image.gz b/tests/f_miss_journal/image.gz
new file mode 100644 (file)
index 0000000..674d348
Binary files /dev/null and b/tests/f_miss_journal/image.gz differ
diff --git a/tests/f_miss_journal/name b/tests/f_miss_journal/name
new file mode 100644 (file)
index 0000000..599be52
--- /dev/null
@@ -0,0 +1 @@
+Non-existent journal inode
diff --git a/tests/f_swapfs/image b/tests/f_swapfs/image
new file mode 100644 (file)
index 0000000..e7b24b9
Binary files /dev/null and b/tests/f_swapfs/image differ