[v3,1/4] btrfs-progs: lowmem check: Fix false alert about file extent interrupt
diff mbox

Message ID 20170626103727.8945-1-lufq.fnst@cn.fujitsu.com
State New
Headers show

Commit Message

Lu Fengqi June 26, 2017, 10:37 a.m. UTC
As Qu mentioned in this thread
(https://www.spinics.net/lists/linux-btrfs/msg64469.html), compression
can cause regular extent to co-exist with inlined extent. This coexistence
makes things confusing. Since it was permitted currently, so fix
btrfsck to prevent a bunch of error logs that will make user feel
panic.

When check file extent, record the extent_end of regular extent to check
if there is a gap between the regular extents. Normally there is only one
inlined extent, so the extent_end of inlined extent is useless. However,
if regular extent can co-exist with inlined extent, the extent_end of
inlined extent also need to record.

Reported-by: Marc MERLIN <marc@merlins.org>
Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
---

Changlog:
v2: Just fix reported-by
v3: Output verbose information when file extent interrupt

 cmds-check.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Lu Fengqi June 26, 2017, 10:37 a.m. UTC | #1
Add a image that the inlined extent coexist with the regular extent.

Reported-by: Marc MERLIN <marc@merlins.org>
Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
---
 .../020-extent-ref-cases/inline_regular_coexist.img      | Bin 0 -> 4096 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 tests/fsck-tests/020-extent-ref-cases/inline_regular_coexist.img

diff --git a/tests/fsck-tests/020-extent-ref-cases/inline_regular_coexist.img b/tests/fsck-tests/020-extent-ref-cases/inline_regular_coexist.img
new file mode 100644
index 0000000000000000000000000000000000000000..cf15cc14539f8759d18457d66b1f604244375b73
GIT binary patch
literal 4096
zcmeH|c{tSF9>6C`42^1Zkx@}1WS!6q##qwGGL|M~r)(kHSYPWHC2J^pTa+a<vSw>+
zgX}{^WlR{mcQE#SnHTr|)xG!s``pL(InOzt^F7b=`<?SS-{(2e_D?;BMa-)K{|ffq
z@z8$Th2_1Zn%eFh0AShc)#~=ye=ng%+ULT3uHWbH``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RAx9Xp9dFj5E;kj|*1pRg%P6l_YX>x<2{6
zkoH_ZBr@I^%tnx>f(E;ZQ;Yqa>{iqi$WH&FCsE_py<g!n&JMlazE+Ft@`xK6S#4_>
zwB88;MgLMPCV{Uk*C+C_sc;EJGSlP+uY*9EExpHdy%AqBfko-?0E5T@^lwViO!v7K
z+ZDJBx9Ifdmn?tBf#v&5+cRa(<(U3&#GUWt>X-3hXfH-c2m%$%Wdfg<txL&gv|ZGB
zN98Y@KFMFEi1(G}9E)0J(#uNkFbh()CPp=&<<-(`qc;8~k3JkjR=rB4UOj%4FzW7y
zk;%iM*|?XEjE`8qn$|2&5M`>Qn`!z)$De<X-{^A<=e?NIM{))0Qb=0ho@rVkNLW;i
zuGX&&&V&9ZJG+9G{<OS3E5#r3()lLIOZ>1K-kSgnGZq@b%)J8Em?4>Cf!$}8(mr!;
zOCaesEq`5|QPAD;41Zr~nZn&WMrK5+=BE;eD1trQOaMJ1t#{A)K^z!3Fz|n1;BUuR
B^{)T`

literal 0
HcmV?d00001
Lu Fengqi June 26, 2017, 10:37 a.m. UTC | #2
Add a image which can reproduce the extent item referencer count
mismatch false alert for lowmem mode.

Reported-by: Marc MERLIN <marc@merlins.org>
Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
---
 .../ref_count_mismatch_false_alert.img                   | Bin 0 -> 4096 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 tests/fsck-tests/020-extent-ref-cases/ref_count_mismatch_false_alert.img

diff --git a/tests/fsck-tests/020-extent-ref-cases/ref_count_mismatch_false_alert.img b/tests/fsck-tests/020-extent-ref-cases/ref_count_mismatch_false_alert.img
new file mode 100644
index 0000000000000000000000000000000000000000..85110a813b5d00cb35d23babc70d57510cae19b0
GIT binary patch
literal 4096
zcmeH}c|6oxAIE>Q7>1#-&$wtTF}mEwgG?nemXMMqOIb3S>}eQX#*#aBGA>1k8`<TG
zA;}WPTDq!fWJyVuP}UIH?mX1J&(rgI_5A%jfAo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y1|VUOz?<vt*+COK
zjqTIJB4-qfJ4}VZR6Y`K6DIKeO%gBRRv*atc4|T{)rOy%Tp1Z9tvCa4^Pk!JWZyQK
zdeC|`@yDfCXO!G(v&XdHn?ZGv{+5ptANneAhT>v|;(~|bL@pR+{$Tkk5o>i3DU;B8
pB=&&shK%CyY`zVVP-=alYtc5n=A0!L?2z<PaOW(2xBo*0{s|Bl)(`*y

literal 0
HcmV?d00001

Patch
diff mbox

diff --git a/cmds-check.c b/cmds-check.c
index c052f66e..70d2b7f2 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -4782,6 +4782,7 @@  static int check_file_extent(struct btrfs_root *root, struct btrfs_key *fkey,
 				extent_num_bytes, item_inline_len);
 			err |= FILE_EXTENT_ERROR;
 		}
+		*end += extent_num_bytes;
 		*size += extent_num_bytes;
 		return err;
 	}
@@ -4847,8 +4848,8 @@  static int check_file_extent(struct btrfs_root *root, struct btrfs_key *fkey,
 		      root->objectid, fkey->objectid, fkey->offset);
 	} else if (!no_holes && *end != fkey->offset) {
 		err |= FILE_EXTENT_ERROR;
-		error("root %llu EXTENT_DATA[%llu %llu] interrupt",
-		      root->objectid, fkey->objectid, fkey->offset);
+		error("root %llu EXTENT_DATA[%llu %llu] interrupt, should start at %llu",
+		      root->objectid, fkey->objectid, fkey->offset, *end);
 	}
 
 	*end += extent_num_bytes;