mirror of https://github.com/vitalif/e2fsprogs
e2fsck: zap extent-format inode with no extent header
The kernel requires all inodes with the extent flag set to have a valid extent tree header in i_block. The ext2fs_extent_open2 prefers to initialize the header if i_block is zeroed, but e2fsck never writes the new header to disk. Since the kernel won't create inodes with the flag and no header anyway, zap such files. Reported-by: Bo Branten <bosse@acc.umu.se> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>test-maint
parent
c5b3ae7fb5
commit
f680db654b
|
@ -2138,7 +2138,20 @@ static void check_blocks_extents(e2fsck_t ctx, struct problem_context *pctx,
|
||||||
ext2_ino_t ino = pctx->ino;
|
ext2_ino_t ino = pctx->ino;
|
||||||
errcode_t retval;
|
errcode_t retval;
|
||||||
blk64_t eof_lblk;
|
blk64_t eof_lblk;
|
||||||
|
struct ext3_extent_header *eh;
|
||||||
|
|
||||||
|
/* Check for a proper extent header... */
|
||||||
|
eh = (struct ext3_extent_header *) &inode->i_block[0];
|
||||||
|
retval = ext2fs_extent_header_verify(eh, sizeof(inode->i_block));
|
||||||
|
if (retval) {
|
||||||
|
if (fix_problem(ctx, PR_1_MISSING_EXTENT_HEADER, pctx))
|
||||||
|
e2fsck_clear_inode(ctx, ino, inode, 0,
|
||||||
|
"check_blocks_extents");
|
||||||
|
pctx->errcode = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ...since this function doesn't fail if i_block is zeroed. */
|
||||||
pctx->errcode = ext2fs_extent_open2(fs, ino, inode, &ehandle);
|
pctx->errcode = ext2fs_extent_open2(fs, ino, inode, &ehandle);
|
||||||
if (pctx->errcode) {
|
if (pctx->errcode) {
|
||||||
if (fix_problem(ctx, PR_1_READ_EXTENT, pctx))
|
if (fix_problem(ctx, PR_1_READ_EXTENT, pctx))
|
||||||
|
|
|
@ -987,6 +987,11 @@ static struct e2fsck_problem problem_table[] = {
|
||||||
N_("@i %i logical @b %b (physical @b %c) violates cluster allocation rules.\nWill fix in pass 1B.\n"),
|
N_("@i %i logical @b %b (physical @b %c) violates cluster allocation rules.\nWill fix in pass 1B.\n"),
|
||||||
PROMPT_NONE, 0 },
|
PROMPT_NONE, 0 },
|
||||||
|
|
||||||
|
/* Inode has corrupt extent header */
|
||||||
|
{ PR_1_MISSING_EXTENT_HEADER,
|
||||||
|
N_("@i %i has corrupt @x header. "),
|
||||||
|
PROMPT_CLEAR_INODE, 0 },
|
||||||
|
|
||||||
/* Pass 1b errors */
|
/* Pass 1b errors */
|
||||||
|
|
||||||
/* Pass 1B: Rescan for duplicate/bad blocks */
|
/* Pass 1B: Rescan for duplicate/bad blocks */
|
||||||
|
|
|
@ -587,6 +587,45 @@ struct problem_context {
|
||||||
/* Inode logical block is misaligned */
|
/* Inode logical block is misaligned */
|
||||||
#define PR_1_MISALIGNED_CLUSTER 0x010074
|
#define PR_1_MISALIGNED_CLUSTER 0x010074
|
||||||
|
|
||||||
|
/* Inode has INLINE_DATA_FL flag but extended attribute not found */
|
||||||
|
#define PR_1_INLINE_DATA_NO_ATTR 0x010075
|
||||||
|
|
||||||
|
/* extents/inlinedata set on fifo/socket/device */
|
||||||
|
#define PR_1_SPECIAL_EXTENTS_IDATA 0x010076
|
||||||
|
|
||||||
|
/* idata/extent flag set and extent header found, clear idata flag */
|
||||||
|
#define PR_1_CLEAR_INLINE_DATA_FOR_EXTENT 0x010077
|
||||||
|
|
||||||
|
/* inlinedata/extent set and no extent header found, clear extent flag */
|
||||||
|
#define PR_1_CLEAR_EXTENT_FOR_INLINE_DATA 0x010078
|
||||||
|
|
||||||
|
/* inlinedata/extent set, clear both flags */
|
||||||
|
#define PR_1_CLEAR_EXTENT_INLINE_DATA_FLAGS 0x010079
|
||||||
|
|
||||||
|
/* inlinedata/extent set, clear inode */
|
||||||
|
#define PR_1_CLEAR_EXTENT_INLINE_DATA_INODE 0x01007A
|
||||||
|
|
||||||
|
/* badblocks is in badblocks */
|
||||||
|
#define PR_1_BADBLOCKS_IN_BADBLOCKS 0x01007B
|
||||||
|
|
||||||
|
/* can't allocate extent region */
|
||||||
|
#define PR_1_EXTENT_ALLOC_REGION_ABORT 0x01007C
|
||||||
|
|
||||||
|
/* leaf extent collision */
|
||||||
|
#define PR_1_EXTENT_COLLISION 0x01007D
|
||||||
|
|
||||||
|
/* Error allocating memory for encrypted directory list */
|
||||||
|
#define PR_1_ALLOCATE_ENCRYPTED_DIRLIST 0x01007E
|
||||||
|
|
||||||
|
/* extent tree max depth too big */
|
||||||
|
#define PR_1_EXTENT_BAD_MAX_DEPTH 0x01007F
|
||||||
|
|
||||||
|
/* bigalloc fs cannot have blockmap files */
|
||||||
|
#define PR_1_NO_BIGALLOC_BLOCKMAP_FILES 0x010080
|
||||||
|
|
||||||
|
/* Missing extent header */
|
||||||
|
#define PR_1_MISSING_EXTENT_HEADER 0x010081
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Pass 1b errors
|
* Pass 1b errors
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -17,8 +17,7 @@ Clear? yes
|
||||||
|
|
||||||
Inode 17, i_blocks is 32, should be 0. Fix? yes
|
Inode 17, i_blocks is 32, should be 0. Fix? yes
|
||||||
|
|
||||||
Error while reading over extent tree in inode 18: Corrupt extent header
|
Inode 18 has corrupt extent header. Clear inode? yes
|
||||||
Clear inode? yes
|
|
||||||
|
|
||||||
Inode 18, i_blocks is 2, should be 0. Fix? yes
|
Inode 18, i_blocks is 2, should be 0. Fix? yes
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
Pass 1: Checking inodes, blocks, and sizes
|
||||||
|
Inode 12 has corrupt extent header. Clear inode? yes
|
||||||
|
|
||||||
|
Pass 2: Checking directory structure
|
||||||
|
Entry 'testa' in / (2) has deleted/unused inode 12. Clear? yes
|
||||||
|
|
||||||
|
Pass 3: Checking directory connectivity
|
||||||
|
Pass 4: Checking reference counts
|
||||||
|
Pass 5: Checking group summary information
|
||||||
|
Inode bitmap differences: -12
|
||||||
|
Fix? yes
|
||||||
|
|
||||||
|
Free inodes count wrong for group #0 (115, counted=116).
|
||||||
|
Fix? yes
|
||||||
|
|
||||||
|
Free inodes count wrong (115, counted=116).
|
||||||
|
Fix? yes
|
||||||
|
|
||||||
|
|
||||||
|
test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
|
||||||
|
test_filesys: 12/128 files (0.0% non-contiguous), 15/256 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/128 files (0.0% non-contiguous), 15/256 blocks
|
||||||
|
Exit status is 0
|
Binary file not shown.
|
@ -0,0 +1 @@
|
||||||
|
zap inode with zeroed extent header
|
Loading…
Reference in New Issue