mirror of https://github.com/vitalif/e2fsprogs
e2fsck: check for invalid bad block inode
In some cases the bad block inode gets corrupted. If it looks insane, offer to clear it before trying to interpret it does more harm than good. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>bitmap-optimize
parent
20d7949583
commit
96a8afa7c1
|
@ -821,6 +821,14 @@ 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) &&
|
||||
fix_problem(ctx, PR_1_INVALID_BAD_INODE, &pctx)) {
|
||||
memset(inode, 0, sizeof(struct ext2_inode));
|
||||
e2fsck_write_inode(ctx, ino, inode,
|
||||
"clear bad inode");
|
||||
}
|
||||
|
||||
pctx.errcode = ext2fs_copy_bitmap(ctx->block_found_map,
|
||||
&pb.fs_meta_blocks);
|
||||
if (pctx.errcode) {
|
||||
|
@ -1715,6 +1723,9 @@ void e2fsck_clear_inode(e2fsck_t ctx, ext2_ino_t ino,
|
|||
*/
|
||||
ctx->flags |= restart_flag;
|
||||
|
||||
if (ino == EXT2_BAD_INO)
|
||||
memset(inode, 0, sizeof(struct ext2_inode));
|
||||
|
||||
e2fsck_write_inode(ctx, ino, inode, source);
|
||||
}
|
||||
|
||||
|
|
|
@ -936,6 +936,11 @@ static struct e2fsck_problem problem_table[] = {
|
|||
N_("@q @i is visible to the user. "),
|
||||
PROMPT_CLEAR, PR_PREEN_OK },
|
||||
|
||||
/* Invalid bad inode */
|
||||
{ PR_1_INVALID_BAD_INODE,
|
||||
N_("The bad @b @i looks @n. "),
|
||||
PROMPT_CLEAR, 0 },
|
||||
|
||||
/* Pass 1b errors */
|
||||
|
||||
/* Pass 1B: Rescan for duplicate/bad blocks */
|
||||
|
|
|
@ -547,6 +547,9 @@ struct problem_context {
|
|||
/* Quota inode is user visible */
|
||||
#define PR_1_QUOTA_INODE_NOT_HIDDEN 0x010064
|
||||
|
||||
/* Invalid bad inode */
|
||||
#define PR_1_INVALID_BAD_INODE 0x010065
|
||||
|
||||
/*
|
||||
* Pass 1b errors
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
Pass 1: Checking inodes, blocks, and sizes
|
||||
The bad block inode looks invalid. Clear? yes
|
||||
|
||||
Pass 2: Checking directory structure
|
||||
Pass 3: Checking directory connectivity
|
||||
Pass 4: Checking reference counts
|
||||
Pass 5: Checking group summary information
|
||||
|
||||
test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
|
||||
test_filesys: 11/16 files (0.0% non-contiguous), 21/100 blocks
|
||||
Exit status is 1
|
|
@ -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/16 files (0.0% non-contiguous), 21/100 blocks
|
||||
Exit status is 0
|
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
check for bogus bad inode
|
Loading…
Reference in New Issue