[PATCH v2] e2fsck: check xattr 'system.data' before setting inline_data feature

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
---
 e2fsck/pass1.c                    |   4 ++--
 e2fsck/problem.c                  |   2 +-
 tests/f_inlinedata_flags/expect.1 |  26 ++++++++++++++++++++++++++
 tests/f_inlinedata_flags/expect.2 |   7 +++++++
 tests/f_inlinedata_flags/image.gz | Bin 0 -> 11226 bytes
 tests/f_inlinedata_flags/name     |   1 +
 6 files changed, 37 insertions(+), 3 deletions(-)
 create mode 100644 tests/f_inlinedata_flags/expect.1
 create mode 100644 tests/f_inlinedata_flags/expect.2
 create mode 100644 tests/f_inlinedata_flags/image.gz
 create mode 100644 tests/f_inlinedata_flags/name

v2:
- Add tests/f_inlinedata_flags

diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
index 8abf0c33..45534388 100644
--- a/e2fsck/pass1.c
+++ b/e2fsck/pass1.c
@@ -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);
diff --git a/e2fsck/problem.c b/e2fsck/problem.c
index 932cad3c..4082e373 100644
--- a/e2fsck/problem.c
+++ b/e2fsck/problem.c
@@ -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
index 00000000..86eba883
--- /dev/null
+++ b/tests/f_inlinedata_flags/expect.1
@@ -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
index 00000000..87b3f18b
--- /dev/null
+++ b/tests/f_inlinedata_flags/expect.2
@@ -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
index 0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0R-co;G2WV!V2
zc(IC(+*nuc_k1MxLLc(9Rym_7;!f0pGvIU3JHhGydfPxB1ZPAecc5Lt%mL&H^qx9>
zGjg5MnkrA>K@43$vX6#>y++((w4sVpq?c!5G^1*Q>k@oGJ0FnZ2RGnbp*^(rZHfx~
z0P)n+xJ~^L@s&v>O|LUnbISw=Y3JHi&FC=p3zR}@XxHR&59TsQ5eM`>txcLTq%p(a
z3-V~7loKNJMJtIPP4Xsm5Q?@ix)Ccy?U2!UpsCv-7xD}y!)n<tK&F4PxA8ULGyl|5
z;|sv2{wYz$t-$PdGyQkF{wyDulCs~<dvm*<owx~(#`glB=z3xm)%eTAbwP?w%T8*B
zc{l)YC8;172LD3zQ5z<b^EIJ(Fp#Q)CQ@^ZI|zp$O4l~1E=0O<8o<_d41#mWGQzEG
ziHP?_yz!s4jS<O#nkqO7&mtacFGM8NAe-<cph&3I$cEq?{JK`5(F`GGd?gSgY}F@o
zG(3DWfjAjLojzewg=0)WI36E{cHrT}xRWh3h~mSLn?$cOVLXwpd6lSkem>5iD@QRi
zQRdt`&Mt&OY|sg~nnX;4a?%)xRT0g#86}TPE<I}j-4|ZJ<XOI)p4vPD9s!SlN5CWC
z5%36j1Uv#B0gr%3z$4%h@CbMWJOUm8kAO$OBj6G62t2C-<Z!_H7ynt@3MXlr{r~-4
V@~rmvf2^)8M{d!Byu6Nh{T;dpI4%GH

literal 0
HcmV?d00001

diff --git a/tests/f_inlinedata_flags/name b/tests/f_inlinedata_flags/name
new file mode 100644
index 00000000..66b7676a
--- /dev/null
+++ b/tests/f_inlinedata_flags/name
@@ -0,0 +1 @@
+check incorrect inline_data flags
-- 
2.19.1




[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux