Whamcloud - gitweb
e2fsck: only retry to open the file system when the superblock is corrupt
authorTheodore Ts'o <tytso@mit.edu>
Mon, 25 Jun 2018 01:09:59 +0000 (21:09 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 25 Jun 2018 01:09:59 +0000 (21:09 -0400)
Previously we were always retrying the ext2fs_open2() call with the
EXT2_FLAG_IGNORE_SB_ERRORS flag.  It only makes sense to do this if
the superblock is reported as corrupt.  Otherwise, it's a waste of
time, and results in printing an extra set of error messages to annoy
the user.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
e2fsck/unix.c
tests/f_detect_xfs/expect
tests/j_ext_dumpe2fs/expect

index 42eef75..90065b3 100644 (file)
@@ -1584,7 +1584,8 @@ failure:
                         * so that we are able to recover from more errors
                         * (e.g. some tool messing up some value in the sb).
                         */
-                       if (!(flags & EXT2_FLAG_IGNORE_SB_ERRORS)) {
+                       if ((retval == EXT2_ET_CORRUPT_SUPERBLOCK) &&
+                           !(flags & EXT2_FLAG_IGNORE_SB_ERRORS)) {
                                if (fs)
                                        ext2fs_close_free(&fs);
                                log_out(ctx, _("%s: Trying to load superblock "
index f91010b..fb510d9 100644 (file)
@@ -2,10 +2,6 @@
 ext2fs_open2: Bad magic number in super-block
 ../e2fsck/e2fsck: Superblock invalid, trying backup blocks...
 ../e2fsck/e2fsck: Bad magic number in super-block while trying to open test.img
-../e2fsck/e2fsck: Trying to load superblock despite errors...
-ext2fs_open2: Bad magic number in super-block
-../e2fsck/e2fsck: Superblock invalid, trying backup blocks...
-../e2fsck/e2fsck: Bad magic number in super-block while trying to open test.img
 
 The superblock could not be read or does not describe a valid ext2/ext3/ext4
 filesystem.  If the device is valid and it really contains an ext2/ext3/ext4
index a703bcf..db77a36 100644 (file)
@@ -1,7 +1,5 @@
 e2fsck external journal
 ../e2fsck/e2fsck: Filesystem has unsupported feature(s) while trying to open test.img
-../e2fsck/e2fsck: Trying to load superblock despite errors...
-../e2fsck/e2fsck: Filesystem has unsupported feature(s) while trying to open test.img
 
 The superblock could not be read or does not describe a valid ext2/ext3/ext4
 filesystem.  If the device is valid and it really contains an ext2/ext3/ext4