]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
e2fsck: report ext2fs_open2() and ext2fs_check_desc() errors
authorTheodore Ts'o <tytso@mit.edu>
Thu, 22 Mar 2012 03:40:24 +0000 (23:40 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 22 Mar 2012 03:40:24 +0000 (23:40 -0400)
Print the actual errors returned by ext2fs_open2() and
ext2fs_check_desc() before we fall back to the backup block group
descriptors so that it's easier to see if there is some obscure
failure that is causing e2fsck to think that it should use the backup
block group descriptors.

Addresses-Google-Bug: #6208183

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 files changed:
e2fsck/problem.c
e2fsck/problem.h
e2fsck/unix.c
tests/f_crashdisk/expect.1
tests/f_illbbitmap/expect.1
tests/f_illibitmap/expect.1
tests/f_illitable/expect.1
tests/f_illitable_flexbg/expect.1
tests/f_miss_blk_bmap/expect.1
tests/f_misstable/expect.1
tests/f_overfsblks/expect.1
tests/f_resize_inode/expect
tests/f_zero_group/expect.1
tests/f_zero_inode_size/expect.1
tests/f_zero_super/expect.1

index 56d10b157f9e1562b52cb90b1624ef4663a2ce93..f5c0554c917096b5dda7485f20ce002366beb5b9 100644 (file)
@@ -423,6 +423,16 @@ static struct e2fsck_problem problem_table[] = {
          N_("@S has invalid MMP magic.  "),
          PROMPT_FIX, PR_PREEN_OK | PR_NO_OK},
 
+       /* Opening file system failed */
+       { PR_0_OPEN_FAILED,
+         N_("ext2fs_open2: %m\n"),
+         PROMPT_NONE, 0 },
+
+       /* Checking group descriptor failed */
+       { PR_0_CHECK_DESC_FAILED,
+         N_("ext2fs_check_desc: %m\n"),
+         PROMPT_NONE, 0 },
+
        /* Pass 1 errors */
 
        /* Pass 1: Checking inodes, blocks, and sizes */
index 66330559dcc6e7c17a1a89825cb09dd1e834554d..348cfbce6993c7132d64cde256c88ba894e579df 100644 (file)
@@ -243,6 +243,11 @@ struct problem_context {
 /* Superblock has invalid MMP magic. */
 #define PR_0_MMP_INVALID_MAGIC                 0x000043
 
+/* Opening file system failed */
+#define PR_0_OPEN_FAILED                       0x000044
+
+/* Checking group descriptor failed */
+#define PR_0_CHECK_DESC_FAILED                 0x000045
 
 /*
  * Pass 1 errors
index d0b10d49433414c29acd4231334838931511ffe3..190deaf9b25f294aeb1f64f50fb6ee638752eddc 100644 (file)
@@ -1232,6 +1232,15 @@ restart:
            ((retval == EXT2_ET_BAD_MAGIC) ||
             (retval == EXT2_ET_CORRUPT_SUPERBLOCK) ||
             ((retval == 0) && (retval2 = ext2fs_check_desc(fs))))) {
+               if (retval) {
+                       pctx.errcode = retval;
+                       fix_problem(ctx, PR_0_OPEN_FAILED, &pctx);
+               }
+               if (retval2) {
+                       pctx.errcode = retval2;
+                       fix_problem(ctx, PR_0_CHECK_DESC_FAILED, &pctx);
+               }
+               pctx.errcode = 0;
                if (retval2 == ENOMEM || retval2 == EXT2_ET_NO_MEMORY) {
                        retval = retval2;
                        goto failure;
index 132d49af9d7d8012080ac5415e293255567c3d01..70ddf2ecb5c253ef1a275bfd0c0412f319d85126 100644 (file)
@@ -1,3 +1,4 @@
+ext2fs_open2: The ext2 superblock is corrupt
 ../e2fsck/e2fsck: Superblock invalid, trying backup blocks...
 ../e2fsck/e2fsck: The ext2 superblock is corrupt while trying to open test.img
 
index ae61bf528d0cbc2309bcbc23c644eed0d899e6e8..8746d23a5fd544316d91b2e03b3624af2cb9496e 100644 (file)
@@ -1,3 +1,4 @@
+ext2fs_check_desc: Corrupt group descriptor: bad block for block bitmap
 Note: if several inode or block bitmap blocks or part
 of the inode table require relocation, you may wish to try
 running e2fsck with the '-b 8193' option first.  The problem
index 2ed55b67e83152b089e3e5a980f29607348755b6..5bae25d140082743c7d2c1b894195b3e82aa700e 100644 (file)
@@ -1,3 +1,4 @@
+ext2fs_check_desc: Corrupt group descriptor: bad block for inode bitmap
 Note: if several inode or block bitmap blocks or part
 of the inode table require relocation, you may wish to try
 running e2fsck with the '-b 8193' option first.  The problem
index fbb3aefa968b60606b079fb3907f486d9dac99fe..552a2e794b2733c654cd4664152f06f1e531046a 100644 (file)
@@ -1,3 +1,4 @@
+ext2fs_check_desc: Corrupt group descriptor: bad block for inode table
 Note: if several inode or block bitmap blocks or part
 of the inode table require relocation, you may wish to try
 running e2fsck with the '-b 8193' option first.  The problem
index 2d54728578141f4f47e87c95a6718afacc7cda4f..fa42a0f8b1b8b21dde97d17579607ca98a2bdfd4 100644 (file)
@@ -1,3 +1,4 @@
+ext2fs_check_desc: Corrupt group descriptor: bad block for inode table
 ../e2fsck/e2fsck: Group descriptors look bad... trying backup blocks...
 Inode table for group 1 is not in group.  (block 0)
 WARNING: SEVERE DATA LOSS POSSIBLE.
index 4c51a16e524ae04ee88e47431b8239bb92b5c366..998b61ad6f22dbe44afbb7ad293d7d05076ade0f 100644 (file)
@@ -1,3 +1,4 @@
+ext2fs_check_desc: Corrupt group descriptor: bad block for block bitmap
 Pass 1: Checking inodes, blocks, and sizes
 Relocating group 0's block bitmap to 2...
 Pass 2: Checking directory structure
index 93d4e8996a532b1b2a4bc4cfaa3f292c0bde7251..a8cf264e9860958070eac67d2185c6b806e15552 100644 (file)
@@ -1,3 +1,4 @@
+ext2fs_check_desc: Corrupt group descriptor: bad block for inode table
 ../e2fsck/e2fsck: Group descriptors look bad... trying backup blocks...
 Inode table for group 1 is not in group.  (block 0)
 WARNING: SEVERE DATA LOSS POSSIBLE.
index 60f77d55749cdff52af0400b08269212b9a8719f..e5b93f0d552af115d98a3c9abe9286f0640d1c7f 100644 (file)
@@ -1,3 +1,4 @@
+ext2fs_check_desc: Corrupt group descriptor: bad block for inode bitmap
 Filesystem did not have a UUID; generating one.
 
 Pass 1: Checking inodes, blocks, and sizes
index a396927c8131ecb8e8a2f720fbf5c4eaa79c7a7d..84618d4d306c4167dca324769527be3ba9eae15b 100644 (file)
@@ -113,6 +113,7 @@ Exit status is 0
  
 debugfs -R ''set_super_value reserved_gdt_blocks 15679'' -w test.img
 Exit status is 0
+ext2fs_check_desc: Corrupt group descriptor: bad block for block bitmap
 ../e2fsck/e2fsck: Group descriptors look bad... trying backup blocks...
 Pass 1: Checking inodes, blocks, and sizes
 Pass 2: Checking directory structure
index 577dadd46e9b98a379397683bd10ece3b6b55145..2a077674f6120468df3a150cc8905a781b9ba81e 100644 (file)
@@ -1,3 +1,4 @@
+ext2fs_check_desc: Corrupt group descriptor: bad block for block bitmap
 ../e2fsck/e2fsck: Group descriptors look bad... trying backup blocks...
 Pass 1: Checking inodes, blocks, and sizes
 Pass 2: Checking directory structure
index 9202131f8387b0f6affd6ad338fc7c59ed53b2af..b8bd7da20d52c79d9fc1205589579479c97aea6e 100644 (file)
@@ -1,3 +1,4 @@
+ext2fs_open2: The ext2 superblock is corrupt
 ../e2fsck/e2fsck: Superblock invalid, trying backup blocks...
 Pass 1: Checking inodes, blocks, and sizes
 Pass 2: Checking directory structure
index 029f3f1497a5f011d9cbde3529e2f47f0ead42b0..e2b954d005eec8634bb38268f5a2da12f6cc3b4d 100644 (file)
@@ -1,3 +1,4 @@
+ext2fs_open2: Bad magic number in super-block
 ../e2fsck/e2fsck: Superblock invalid, trying backup blocks...
 Pass 1: Checking inodes, blocks, and sizes
 Pass 2: Checking directory structure