mirror of https://github.com/vitalif/e2fsprogs
e2fsck: check for zero length extent
If an extent has e_len set to zero, the kernel will oops with a BUG_ON. Unfortunately, e2fsck wasn't catching this case. The kernel needs to be fixed to notice this case and call ext4_error() instead of failing an assertion check, but e2fsck should catch this case and repair it (by deleting the errant extent). Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>bitmap-optimize
parent
c15386cdee
commit
26c09eb814
|
@ -1778,6 +1778,8 @@ static void scan_extent_node(e2fsck_t ctx, struct problem_context *pctx,
|
||||||
problem = PR_1_EXTENT_BAD_START_BLK;
|
problem = PR_1_EXTENT_BAD_START_BLK;
|
||||||
else if (extent.e_lblk < start_block)
|
else if (extent.e_lblk < start_block)
|
||||||
problem = PR_1_OUT_OF_ORDER_EXTENTS;
|
problem = PR_1_OUT_OF_ORDER_EXTENTS;
|
||||||
|
else if (extent.e_len == 0)
|
||||||
|
problem = PR_1_EXTENT_LENGTH_ZERO;
|
||||||
else if (is_leaf &&
|
else if (is_leaf &&
|
||||||
(extent.e_pblk + extent.e_len) >
|
(extent.e_pblk + extent.e_len) >
|
||||||
ext2fs_blocks_count(ctx->fs->super))
|
ext2fs_blocks_count(ctx->fs->super))
|
||||||
|
|
|
@ -936,6 +936,11 @@ static struct e2fsck_problem problem_table[] = {
|
||||||
N_("The bad @b @i looks @n. "),
|
N_("The bad @b @i looks @n. "),
|
||||||
PROMPT_CLEAR, 0 },
|
PROMPT_CLEAR, 0 },
|
||||||
|
|
||||||
|
/* Extent has zero length */
|
||||||
|
{ PR_1_EXTENT_LENGTH_ZERO,
|
||||||
|
N_("@i %i has zero length extent\n\t(@n logical @b %c, physical @b %b)\n"),
|
||||||
|
PROMPT_CLEAR, 0 },
|
||||||
|
|
||||||
/* Pass 1b errors */
|
/* Pass 1b errors */
|
||||||
|
|
||||||
/* Pass 1B: Rescan for duplicate/bad blocks */
|
/* Pass 1B: Rescan for duplicate/bad blocks */
|
||||||
|
|
|
@ -550,6 +550,9 @@ struct problem_context {
|
||||||
/* Invalid bad inode */
|
/* Invalid bad inode */
|
||||||
#define PR_1_INVALID_BAD_INODE 0x010065
|
#define PR_1_INVALID_BAD_INODE 0x010065
|
||||||
|
|
||||||
|
/* Extent has zero length */
|
||||||
|
#define PR_1_EXTENT_LENGTH_ZERO 0x010066
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Pass 1b errors
|
* Pass 1b errors
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
Pass 1: Checking inodes, blocks, and sizes
|
||||||
|
Inode 12 has zero length extent
|
||||||
|
(invalid logical block 0, physical block 37)
|
||||||
|
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: 12/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: 12/16 files (0.0% non-contiguous), 21/100 blocks
|
||||||
|
Exit status is 0
|
Binary file not shown.
|
@ -0,0 +1 @@
|
||||||
|
extent with zero length
|
Loading…
Reference in New Issue