[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140801181206.12496.84778.stgit@birch.djwong.org>
Date: Fri, 01 Aug 2014 11:12:06 -0700
From: "Darrick J. Wong" <darrick.wong@...cle.com>
To: tytso@....edu, darrick.wong@...cle.com
Cc: linux-ext4@...r.kernel.org
Subject: [PATCH 04/19] dumpe2fs: complain when checksum verification fails
From: Darrick J. Wong <darrick.wong@...cle.com>
Warn the user to run e2fsck if the superblock or bitmaps fails
checksum verification.
Signed-off-by: Darrick J. Wong <darrick.wong@...cle.com>
---
misc/dumpe2fs.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/misc/dumpe2fs.c b/misc/dumpe2fs.c
index 0b84ece..7cbb99b 100644
--- a/misc/dumpe2fs.c
+++ b/misc/dumpe2fs.c
@@ -620,7 +620,7 @@ int main (int argc, char ** argv)
flags |= EXT2_FLAG_FORCE;
if (image_dump)
flags |= EXT2_FLAG_IMAGE_FILE;
-
+try_open_again:
if (use_superblock && !use_blocksize) {
for (use_blocksize = EXT2_MIN_BLOCK_SIZE;
use_blocksize <= EXT2_MAX_BLOCK_SIZE;
@@ -635,6 +635,13 @@ int main (int argc, char ** argv)
} else
retval = ext2fs_open (device_name, flags, use_superblock,
use_blocksize, unix_io_manager, &fs);
+ if (retval && !(flags & EXT2_FLAG_IGNORE_CSUM_ERRORS)) {
+ flags |= EXT2_FLAG_IGNORE_CSUM_ERRORS;
+ goto try_open_again;
+ }
+ if (!retval && (fs->flags & EXT2_FLAG_IGNORE_CSUM_ERRORS))
+ printf("%s", _("\n*** Checksum errors detected in filesystem! Run e2fsck now!\n\n"));
+ flags |= EXT2_FLAG_IGNORE_CSUM_ERRORS;
if (retval) {
com_err (program_name, retval, _("while trying to open %s"),
device_name);
@@ -663,7 +670,15 @@ int main (int argc, char ** argv)
ext2fs_close_free(&fs);
exit (0);
}
+ fs->flags &= ~EXT2_FLAG_IGNORE_CSUM_ERRORS;
+try_bitmaps_again:
retval = ext2fs_read_bitmaps (fs);
+ if (retval && !(fs->flags & EXT2_FLAG_IGNORE_CSUM_ERRORS)) {
+ fs->flags |= EXT2_FLAG_IGNORE_CSUM_ERRORS;
+ goto try_bitmaps_again;
+ }
+ if (!retval && (fs->flags & EXT2_FLAG_IGNORE_CSUM_ERRORS))
+ printf("%s", _("\n*** Checksum errors detected in bitmaps! Run e2fsck now!\n\n"));
list_desc (fs);
if (retval) {
printf(_("\n%s: %s: error reading bitmaps: %s\n"),
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists