e2fsck: check xattr 'system.data' before setting inline_data feature

ext2fs_inline_data_size will happy return 0 and set size to
EXT4_MIN_INLINE_DATA_SIZE even when inode doesn't have
xattr 'system.data', a corrupted i_flags could make e2fsck
enable the inline_data on the superblock.

We should only offer to enable inline_data when i_flags is set
and xattr 'system.data' can be found.

Also use correct prompt for PR_1_INLINE_DATA_FEATURE.

Signed-off-by: Li Dongyang <dongyangli@ddn.com>
This commit is contained in:
Li Dongyang 2018-11-13 15:46:03 +11:00 committed by Theodore Ts'o
parent 1dc6d6e33a
commit 4a11f49957
6 changed files with 37 additions and 3 deletions

View File

@ -1496,8 +1496,8 @@ void e2fsck_pass1(e2fsck_t ctx)
(ino >= EXT2_FIRST_INODE(fs->super))) {
size_t size = 0;
pctx.errcode = ext2fs_inline_data_size(fs, ino, &size);
if (!pctx.errcode && size &&
pctx.errcode = get_inline_data_ea_size(fs, ino, &size);
if (!pctx.errcode &&
fix_problem(ctx, PR_1_INLINE_DATA_FEATURE, &pctx)) {
ext2fs_set_feature_inline_data(sb);
ext2fs_mark_super_dirty(fs);

View File

@ -1063,7 +1063,7 @@ static struct e2fsck_problem problem_table[] = {
/* Inode has inline data, but superblock is missing INLINE_DATA feature */
{ PR_1_INLINE_DATA_FEATURE,
N_("@i %i has inline data, but @S is missing INLINE_DATA feature\n"),
PROMPT_CLEAR, PR_PREEN_OK, 0, 0, 0 },
PROMPT_FIX, PR_PREEN_OK, 0, 0, 0 },
/* inode has INLINE_DATA_FL flag on filesystem without inline data */
{ PR_1_INLINE_DATA_SET,

View File

@ -0,0 +1,26 @@
Pass 1: Checking inodes, blocks, and sizes
Inode 12 has INLINE_DATA_FL flag on filesystem without inline data support.
Clear? yes
Inode 13 has inline data, but superblock is missing INLINE_DATA feature
Fix? yes
Pass 2: Checking directory structure
Entry '1' 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 (243, counted=244).
Fix? yes
Free inodes count wrong (243, counted=244).
Fix? yes
test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
test_filesys: 12/256 files (0.0% non-contiguous), 1143/8192 blocks
Exit status is 1

View File

@ -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/256 files (0.0% non-contiguous), 1143/8192 blocks
Exit status is 0

Binary file not shown.

View File

@ -0,0 +1 @@
check incorrect inline_data flags