]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
e2fsck: clear badblocks inode when checksum fails
authorDarrick J. Wong <darrick.wong@oracle.com>
Sat, 26 Jul 2014 00:35:12 +0000 (17:35 -0700)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 27 Jul 2014 23:42:11 +0000 (19:42 -0400)
If the badblocks inode fails checksum verification, just clear the
inode and move on.  If we don't do this, we can end up importing a lot
of garbage into the badblocks list, which will then cause fsck to try
to regenerate anything that was sitting atop the supposedly damaged
blocks.  Given that most hardware will remap bad sectors transparently
from ext4, the number of people this could affect adversely is pretty
low.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
e2fsck/pass1.c

index fcaa6799f69b1f1f31502ea44a0310f49e24b974..f90261b4ed15722b0692e4e094ac0acb8a292d76 100644 (file)
@@ -970,8 +970,10 @@ void e2fsck_pass1(e2fsck_t ctx)
                if (ino == EXT2_BAD_INO) {
                        struct process_block_struct pb;
 
-                       if ((inode->i_mode || inode->i_uid || inode->i_gid ||
-                            inode->i_links_count || inode->i_file_acl) &&
+                       if ((failed_csum || inode->i_mode || inode->i_uid ||
+                            inode->i_gid || inode->i_links_count ||
+                            (inode->i_flags & EXT4_INLINE_DATA_FL) ||
+                            inode->i_file_acl) &&
                            fix_problem(ctx, PR_1_INVALID_BAD_INODE, &pctx)) {
                                memset(inode, 0, sizeof(struct ext2_inode));
                                e2fsck_write_inode(ctx, ino, inode,