]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
e2fsck: check xattr 'system.data' before setting inline_data feature
authorLi Dongyang <dongyangli@ddn.com>
Tue, 13 Nov 2018 04:46:03 +0000 (15:46 +1100)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 15 Nov 2018 18:02:34 +0000 (13:02 -0500)
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>
e2fsck/pass1.c
e2fsck/problem.c
tests/f_inlinedata_flags/expect.1 [new file with mode: 0644]
tests/f_inlinedata_flags/expect.2 [new file with mode: 0644]
tests/f_inlinedata_flags/image.gz [new file with mode: 0644]
tests/f_inlinedata_flags/name [new file with mode: 0644]

index 8abf0c33a1d365651a3fef5ddfd36612ee65e0e1..45534388a90dd0f9364f8c50cf679eea255541bc 100644 (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);
index 932cad3cdd872a98860ba463cab61ef9f54f7941..4082e373e3700709b8325f5b340adf0a1206c33c 100644 (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,
diff --git a/tests/f_inlinedata_flags/expect.1 b/tests/f_inlinedata_flags/expect.1
new file mode 100644 (file)
index 0000000..86eba88
--- /dev/null
@@ -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
diff --git a/tests/f_inlinedata_flags/expect.2 b/tests/f_inlinedata_flags/expect.2
new file mode 100644 (file)
index 0000000..87b3f18
--- /dev/null
@@ -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
diff --git a/tests/f_inlinedata_flags/image.gz b/tests/f_inlinedata_flags/image.gz
new file mode 100644 (file)
index 0000000..4344a0a
Binary files /dev/null and b/tests/f_inlinedata_flags/image.gz differ
diff --git a/tests/f_inlinedata_flags/name b/tests/f_inlinedata_flags/name
new file mode 100644 (file)
index 0000000..66b7676
--- /dev/null
@@ -0,0 +1 @@
+check incorrect inline_data flags