All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] btrfs-progs: check: original and lowmem mode fix
@ 2017-09-27  6:34 Su Yue
  2017-09-27  6:34 ` [PATCH 1/5] btrfs-progs: check: return value of check_extent_refs() Su Yue
                   ` (5 more replies)
  0 siblings, 6 replies; 14+ messages in thread
From: Su Yue @ 2017-09-27  6:34 UTC (permalink / raw)
  To: linux-btrfs

The head three patches is independent from later two.
Include:
1) Let check_extent_refs() return error instead of 0 if something wrong
   is found in original mode.
2) repair_root_items() should be called before any repair. Put it
   before do_check_chunks_and_extents();
3) Error status should not be modified if repair_root_items() succeeded
   in original repair.

The late two patches are about invalid type in extent_inline_ref.

Only original mode applied 001-003 patches can handle the case in the
last patch. So I gather those 5 patches together.


Su Yue (5):
  btrfs-progs: check: return value of check_extent_refs()
  btrfs-progs: check: call repair_root_items() before any repair
  btrfs-progs: check: error or return value of repair_root_items()
  btrfs-progs: check: check extent_inline_ref in lowmem
  btrfs-progs: fsck-tests: 027/bad_extent_inline_ref_type

 cmds-check.c                                       |  83 +++++++++++++++------
 .../bad-extent-inline-ref-type.raw.xz              | Bin 0 -> 17144 bytes
 2 files changed, 62 insertions(+), 21 deletions(-)
 create mode 100644 tests/fsck-tests/027-bad-extent-inline-ref-type/bad-extent-inline-ref-type.raw.xz

-- 
2.14.1




^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/5] btrfs-progs: check: return value of check_extent_refs()
  2017-09-27  6:34 [PATCH 0/5] btrfs-progs: check: original and lowmem mode fix Su Yue
@ 2017-09-27  6:34 ` Su Yue
  2017-10-05 17:46   ` David Sterba
  2017-09-27  6:34 ` [PATCH 2/5] btrfs-progs: check: call repair_root_items() before any repair Su Yue
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: Su Yue @ 2017-09-27  6:34 UTC (permalink / raw)
  To: linux-btrfs

In original check mode(without option "--repair"), check_extent_refs()
always returns 0.

Add a variable @error to record status while checking extents.
At the end of check_extent_refs(), let it return -EIO if @error is
nonzero.

Example:
$ btrfs check bad-extent-inline-ref-type.raw
Checking filesystem on bad-extent-inline-ref-type.raw
UUID: 1942d6fe-617b-4499-9982-cc8ffae5447f
checking extents
corrupt extent record: key 29360128 169 16384
ref mismatch on [29360128 16384] extent item 0, found 1
Backref 29360128 parent 5 root 5 not found in extent tree
backpointer mismatch on [29360128 16384]
bad extent [29360128, 29376512), type mismatch with chunk
checking free space cache
checking fs roots
checking csums
checking root refs
found 114688 bytes used, no error found
total csum bytes: 0
total tree bytes: 114688
total fs tree bytes: 32768
total extent tree bytes: 16384
btree space waste bytes: 109471
file data blocks allocated: 0
 referenced 0

Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com>
---
 cmds-check.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/cmds-check.c b/cmds-check.c
index 8aa136df..93b47194 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -10664,6 +10664,7 @@ static int check_extent_refs(struct btrfs_root *root,
 	struct cache_extent *cache;
 	int ret = 0;
 	int had_dups = 0;
+	int error = 0;
 
 	if (repair) {
 		/*
@@ -10807,6 +10808,7 @@ static int check_extent_refs(struct btrfs_root *root,
 			cur_err = 1;
 		}
 
+		error = cur_err;
 		remove_cache_extent(extent_cache, cache);
 		free_all_extent_backrefs(rec);
 		if (!init_extent_tree && repair && (!cur_err || fix))
@@ -10839,7 +10841,10 @@ repair_abort:
 		}
 		return ret;
 	}
-	return 0;
+
+	if (error)
+		error = -EIO;
+	return error;
 }
 
 u64 calc_stripe_length(u64 type, u64 length, int num_stripes)
-- 
2.14.1




^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/5] btrfs-progs: check: call repair_root_items() before any repair
  2017-09-27  6:34 [PATCH 0/5] btrfs-progs: check: original and lowmem mode fix Su Yue
  2017-09-27  6:34 ` [PATCH 1/5] btrfs-progs: check: return value of check_extent_refs() Su Yue
@ 2017-09-27  6:34 ` Su Yue
  2017-09-27  7:24   ` Qu Wenruo
                     ` (2 more replies)
  2017-09-27  6:34 ` [PATCH 3/5] btrfs-progs: check: error or return value of repair_root_items() Su Yue
                   ` (3 subsequent siblings)
  5 siblings, 3 replies; 14+ messages in thread
From: Su Yue @ 2017-09-27  6:34 UTC (permalink / raw)
  To: linux-btrfs

The Annotation of repair_root_items():
"This must be run before any other repair code - not doing it so,
makes other repair code delete or modify backrefs in the extent tree
for example, which will result in an inconsistent fs after repairing
the root items."

However, the rule was broken by commit
"6896ab801d47419fa06d886bae4bf31d0287ced1" which intends to fix
failure of test-fsck/013.
The correct way is to skip calling repair_root_item() when
init_extent_tree is nonzero.

Now put repair_root_items() before do_check_chunks_and_extents() and
not call repair_root_items() if do init_extent_tree.
Then test-fsck/013 works well.

Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com>
---
 cmds-check.c | 43 +++++++++++++++++++++++--------------------
 1 file changed, 23 insertions(+), 20 deletions(-)

diff --git a/cmds-check.c b/cmds-check.c
index 93b47194..3e2f9faa 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -14644,32 +14644,35 @@ int cmd_check(int argc, char **argv)
 		goto close_out;
 	}
 
+	if (!init_extent_tree) {
+		ret = repair_root_items(info);
+		err |= !!ret;
+		if (ret < 0) {
+			error("failed to repair root items: %s",
+			      strerror(-ret));
+			goto close_out;
+		}
+		if (repair) {
+			fprintf(stderr, "Fixed %d roots.\n", ret);
+			ret = 0;
+		} else if (ret > 0) {
+			fprintf(stderr,
+				"Found %d roots with an outdated root item.\n",
+				ret);
+			fprintf(stderr,
+				"Please run a filesystem check with the option --repair to fix them.\n");
+			ret = 1;
+			err |= !!ret;
+			goto close_out;
+		}
+	}
+
 	ret = do_check_chunks_and_extents(info);
 	err |= !!ret;
 	if (ret)
 		error(
 		"errors found in extent allocation tree or chunk allocation");
 
-	ret = repair_root_items(info);
-	err |= !!ret;
-	if (ret < 0) {
-		error("failed to repair root items: %s", strerror(-ret));
-		goto close_out;
-	}
-	if (repair) {
-		fprintf(stderr, "Fixed %d roots.\n", ret);
-		ret = 0;
-	} else if (ret > 0) {
-		fprintf(stderr,
-		       "Found %d roots with an outdated root item.\n",
-		       ret);
-		fprintf(stderr,
-			"Please run a filesystem check with the option --repair to fix them.\n");
-		ret = 1;
-		err |= !!ret;
-		goto close_out;
-	}
-
 	if (!ctx.progress_enabled) {
 		if (btrfs_fs_compat_ro(info, FREE_SPACE_TREE))
 			fprintf(stderr, "checking free space tree\n");
-- 
2.14.1




^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/5] btrfs-progs: check: error or return value of repair_root_items()
  2017-09-27  6:34 [PATCH 0/5] btrfs-progs: check: original and lowmem mode fix Su Yue
  2017-09-27  6:34 ` [PATCH 1/5] btrfs-progs: check: return value of check_extent_refs() Su Yue
  2017-09-27  6:34 ` [PATCH 2/5] btrfs-progs: check: call repair_root_items() before any repair Su Yue
@ 2017-09-27  6:34 ` Su Yue
  2017-09-27  6:34 ` [PATCH 4/5] btrfs-progs: check: check extent_inline_ref in lowmem Su Yue
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 14+ messages in thread
From: Su Yue @ 2017-09-27  6:34 UTC (permalink / raw)
  To: linux-btrfs

Return value of repair_root_items():
<0 on error
=0 does nothing
>0 if repair is enable, N roots is repaired;
   else N roots is corrupted.

In the repair mode, there should be no error if return value is bigger
than 0.

Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com>
---
 cmds-check.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmds-check.c b/cmds-check.c
index 3e2f9faa..adc4a934 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -14646,8 +14646,8 @@ int cmd_check(int argc, char **argv)
 
 	if (!init_extent_tree) {
 		ret = repair_root_items(info);
-		err |= !!ret;
 		if (ret < 0) {
+			err = !!ret;
 			error("failed to repair root items: %s",
 			      strerror(-ret));
 			goto close_out;
-- 
2.14.1




^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 4/5] btrfs-progs: check: check extent_inline_ref in lowmem
  2017-09-27  6:34 [PATCH 0/5] btrfs-progs: check: original and lowmem mode fix Su Yue
                   ` (2 preceding siblings ...)
  2017-09-27  6:34 ` [PATCH 3/5] btrfs-progs: check: error or return value of repair_root_items() Su Yue
@ 2017-09-27  6:34 ` Su Yue
  2017-09-27  6:34 ` [PATCH 5/5] btrfs-progs: fsck-tests: 027/bad_extent_inline_ref_type Su Yue
  2017-10-06 16:52 ` [PATCH 0/5] btrfs-progs: check: original and lowmem mode fix David Sterba
  5 siblings, 0 replies; 14+ messages in thread
From: Su Yue @ 2017-09-27  6:34 UTC (permalink / raw)
  To: linux-btrfs

Lowmem check does not skip invalid type in extent_inline_ref then
calls btrfs_extent_inline_ref_size(type) which causes crash.

Error:
$ btrfs check --mode=lowmem  /tmp/data_small
Checking filesystem on /tmp/data_small
UUID: ee205d69-8724-4aa2-a4f5-bc8558a62169
checking extents
ERROR: extent[20971520 16384] backref type mismatch, missing bit: 2
ERROR: extent[20971520 16384] backref generation mismatch,
wanted: 7, have: 0
ERROR: extent[20971520 16384] is referred by other roots than 3
ctree.h:1754: btrfs_extent_inline_ref_size: BUG_ON `1` triggered,
value 1
btrfs(+0x543db)[0x55fabc2ab3db]
btrfs(+0x587f7)[0x55fabc2af7f7]
btrfs(+0x5fa44)[0x55fabc2b6a44]
btrfs(cmd_check+0x194a)[0x55fabc2bd717]
btrfs(main+0x88)[0x55fabc2682e0]
/usr/lib/libc.so.6(__libc_start_main+0xea)[0x7f021c3824ca]
btrfs(_start+0x2a)[0x55fabc267e7a]
[1] 5188 abort (core dumped)  btrfs check --mode=lowmem /tmp/data_small

Solve it by introducing check_extent_inline_ref() to check type.
If the checker returns a nonzero value, we should not check the
corrupted extent item anymore.

Suggested-by: Qu Wenruo <quwenruo.btrfs@gmx.com>
Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com>
---
 cmds-check.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/cmds-check.c b/cmds-check.c
index adc4a934..aa054a19 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -11415,6 +11415,29 @@ loop:
 	goto again;
 }
 
+static int check_extent_inline_ref(struct extent_buffer *eb,
+		   struct btrfs_key *key, struct btrfs_extent_inline_ref *iref)
+{
+	int ret;
+	u8 type = btrfs_extent_inline_ref_type(eb, iref);
+
+	switch (type) {
+	case BTRFS_TREE_BLOCK_REF_KEY:
+	case BTRFS_EXTENT_DATA_REF_KEY:
+	case BTRFS_SHARED_BLOCK_REF_KEY:
+	case BTRFS_SHARED_DATA_REF_KEY:
+		ret = 0;
+		break;
+	default:
+		error("extent[%llu %u %llu] has unknown ref type: %d",
+		      key->objectid, key->type, key->offset, type);
+		ret = UNKNOWN_TYPE;
+		break;
+	}
+
+	return ret;
+}
+
 /*
  * Check backrefs of a tree block given by @bytenr or @eb.
  *
@@ -11549,6 +11572,11 @@ static int check_tree_block_ref(struct btrfs_root *root,
 		type = btrfs_extent_inline_ref_type(leaf, iref);
 		offset = btrfs_extent_inline_ref_offset(leaf, iref);
 
+		ret = check_extent_inline_ref(leaf, &key, iref);
+		if (ret) {
+			err |= ret;
+			break;
+		}
 		if (type == BTRFS_TREE_BLOCK_REF_KEY) {
 			if (offset == root->objectid)
 				found_ref = 1;
@@ -11826,6 +11854,11 @@ static int check_extent_data_item(struct btrfs_root *root,
 		type = btrfs_extent_inline_ref_type(leaf, iref);
 		dref = (struct btrfs_extent_data_ref *)(&iref->offset);
 
+		ret = check_extent_inline_ref(leaf, &dbref_key, iref);
+		if (ret) {
+			err |= ret;
+			break;
+		}
 		if (type == BTRFS_EXTENT_DATA_REF_KEY) {
 			ref_root = btrfs_extent_data_ref_root(leaf, dref);
 			if (ref_root == root->objectid)
-- 
2.14.1




^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 5/5] btrfs-progs: fsck-tests: 027/bad_extent_inline_ref_type
  2017-09-27  6:34 [PATCH 0/5] btrfs-progs: check: original and lowmem mode fix Su Yue
                   ` (3 preceding siblings ...)
  2017-09-27  6:34 ` [PATCH 4/5] btrfs-progs: check: check extent_inline_ref in lowmem Su Yue
@ 2017-09-27  6:34 ` Su Yue
  2017-10-06 16:52 ` [PATCH 0/5] btrfs-progs: check: original and lowmem mode fix David Sterba
  5 siblings, 0 replies; 14+ messages in thread
From: Su Yue @ 2017-09-27  6:34 UTC (permalink / raw)
  To: linux-btrfs

This case is for avoiding crash in lowmem check mode.
Field type of extent_inline_ref in an extent is corrupted.

Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com>
---
 .../bad-extent-inline-ref-type.raw.xz                   | Bin 0 -> 17144 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 tests/fsck-tests/027-bad-extent-inline-ref-type/bad-extent-inline-ref-type.raw.xz

diff --git a/tests/fsck-tests/027-bad-extent-inline-ref-type/bad-extent-inline-ref-type.raw.xz b/tests/fsck-tests/027-bad-extent-inline-ref-type/bad-extent-inline-ref-type.raw.xz
new file mode 100644
index 0000000000000000000000000000000000000000..09d820196b11a88557b4cb92b5b3533e80eb5d14
GIT binary patch
literal 17144
zcmeI4XHb*r7RM8$7l9xGOAEv(0Rd4&qzY(|q7Z_#pwa~u0trZw7O4RQsTV~7DJmdU
zK$>&~O(2L$k&aYpE@go=A<Mlxb7yDw&aUj$o!y!DTP9zgne+b7@0|Dlob%F-`B_+j
zK#Ws8<wypQ1Xu(F0`X8R$aFe^(fK?Ggr(8x*-z=Z8mIYj$8Awn2~tzp;Vher6Jj^s
z$Uj$60~?eEzKn`GBcILHAN1fu42%~&YAN{KD{9<(qcSOo^K#>`r=Ej#de0ut2}XJ-
z`*Lkj47tM~I~gIlfavCeyjo5A&Me9fe-{2xqU-FB`+}|aYc?tSUUK4I+*--pn!_!0
z(d6_>zh7c+RV5n38}0T9h4!>K6Yow(aRx;mZkK;xgq&8c>AVzlf&H=K{ICR9C8$o<
zq^%PvfVW|jNFs4$**?$WXpNf2;4}&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794_bYVAh_9ku=e$8+N*FjeIQa1Pe{tTEMSBEP5AE9i4Pvyk`Uwf&p78(x

literal 0
HcmV?d00001

-- 
2.14.1




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/5] btrfs-progs: check: call repair_root_items() before any repair
  2017-09-27  6:34 ` [PATCH 2/5] btrfs-progs: check: call repair_root_items() before any repair Su Yue
@ 2017-09-27  7:24   ` Qu Wenruo
  2017-09-27  7:58   ` [PATCH v2 " Su Yue
  2017-09-27  8:28   ` [PATCH v3 " Su Yue
  2 siblings, 0 replies; 14+ messages in thread
From: Qu Wenruo @ 2017-09-27  7:24 UTC (permalink / raw)
  To: Su Yue, linux-btrfs



On 2017年09月27日 14:34, Su Yue wrote:
> The Annotation of repair_root_items():
> "This must be run before any other repair code - not doing it so,
> makes other repair code delete or modify backrefs in the extent tree
> for example, which will result in an inconsistent fs after repairing
> the root items."
> 
> However, the rule was broken by commit
> "6896ab801d47419fa06d886bae4bf31d0287ced1" which intends to fix

Wrong commit.

commit 6896ab801d47419fa06d886bae4bf31d0287ced1
Author: Qu Wenruo <quwenruo.btrfs@gmx.com>
Date:   Mon Sep 11 15:36:12 2017 +0900

     btrfs-progs: docs: mkfs: Add extra condition for rootdir option

This commit has no way affect btrfs check.

Please use first 12 characters and one line summary to describe the commit.
And of course, use correct commit.

Thanks,
Qu


> failure of test-fsck/013.
> The correct way is to skip calling repair_root_item() when
> init_extent_tree is nonzero.
> 
> Now put repair_root_items() before do_check_chunks_and_extents() and
> not call repair_root_items() if do init_extent_tree.
> Then test-fsck/013 works well.
> 
> Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com>
> ---
>   cmds-check.c | 43 +++++++++++++++++++++++--------------------
>   1 file changed, 23 insertions(+), 20 deletions(-)
> 
> diff --git a/cmds-check.c b/cmds-check.c
> index 93b47194..3e2f9faa 100644
> --- a/cmds-check.c
> +++ b/cmds-check.c
> @@ -14644,32 +14644,35 @@ int cmd_check(int argc, char **argv)
>   		goto close_out;
>   	}
>   
> +	if (!init_extent_tree) {
> +		ret = repair_root_items(info);
> +		err |= !!ret;
> +		if (ret < 0) {
> +			error("failed to repair root items: %s",
> +			      strerror(-ret));
> +			goto close_out;
> +		}
> +		if (repair) {
> +			fprintf(stderr, "Fixed %d roots.\n", ret);
> +			ret = 0;
> +		} else if (ret > 0) {
> +			fprintf(stderr,
> +				"Found %d roots with an outdated root item.\n",
> +				ret);
> +			fprintf(stderr,
> +				"Please run a filesystem check with the option --repair to fix them.\n");
> +			ret = 1;
> +			err |= !!ret;
> +			goto close_out;
> +		}
> +	}
> +
>   	ret = do_check_chunks_and_extents(info);
>   	err |= !!ret;
>   	if (ret)
>   		error(
>   		"errors found in extent allocation tree or chunk allocation");
>   
> -	ret = repair_root_items(info);
> -	err |= !!ret;
> -	if (ret < 0) {
> -		error("failed to repair root items: %s", strerror(-ret));
> -		goto close_out;
> -	}
> -	if (repair) {
> -		fprintf(stderr, "Fixed %d roots.\n", ret);
> -		ret = 0;
> -	} else if (ret > 0) {
> -		fprintf(stderr,
> -		       "Found %d roots with an outdated root item.\n",
> -		       ret);
> -		fprintf(stderr,
> -			"Please run a filesystem check with the option --repair to fix them.\n");
> -		ret = 1;
> -		err |= !!ret;
> -		goto close_out;
> -	}
> -
>   	if (!ctx.progress_enabled) {
>   		if (btrfs_fs_compat_ro(info, FREE_SPACE_TREE))
>   			fprintf(stderr, "checking free space tree\n");
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v2 2/5] btrfs-progs: check: call repair_root_items() before any repair
  2017-09-27  6:34 ` [PATCH 2/5] btrfs-progs: check: call repair_root_items() before any repair Su Yue
  2017-09-27  7:24   ` Qu Wenruo
@ 2017-09-27  7:58   ` Su Yue
  2017-09-27  8:28   ` [PATCH v3 " Su Yue
  2 siblings, 0 replies; 14+ messages in thread
From: Su Yue @ 2017-09-27  7:58 UTC (permalink / raw)
  To: linux-btrfs; +Cc: quwenruo.btrfs

The Annotation of repair_root_items():
"This must be run before any other repair code - not doing it so,
makes other repair code delete or modify backrefs in the extent tree
for example, which will result in an inconsistent fs after repairing
the root items."

However, the rule was broken by commit 1f728b1a514f.
The commit intends to fix failure of test-fsck/013 so it moves
repair_root_items() after check_extents_and_chunks().

The correct way is to skip calling repair_root_item() when
init_extent_tree is nonzero.
Now put repair_root_items() before do_check_chunks_and_extents() and
not call repair_root_items() if do init_extent_tree.
Then test-fsck/013 works well.

---
Changelog:
v2:
   Correct commit number reported. (Suggested by Qu Wenruo)

   Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com>
---
 cmds-check.c | 43 +++++++++++++++++++++++--------------------
 1 file changed, 23 insertions(+), 20 deletions(-)

diff --git a/cmds-check.c b/cmds-check.c
index 93b47194..3e2f9faa 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -14644,32 +14644,35 @@ int cmd_check(int argc, char **argv)
 		goto close_out;
 	}
 
+	if (!init_extent_tree) {
+		ret = repair_root_items(info);
+		err |= !!ret;
+		if (ret < 0) {
+			error("failed to repair root items: %s",
+			      strerror(-ret));
+			goto close_out;
+		}
+		if (repair) {
+			fprintf(stderr, "Fixed %d roots.\n", ret);
+			ret = 0;
+		} else if (ret > 0) {
+			fprintf(stderr,
+				"Found %d roots with an outdated root item.\n",
+				ret);
+			fprintf(stderr,
+				"Please run a filesystem check with the option --repair to fix them.\n");
+			ret = 1;
+			err |= !!ret;
+			goto close_out;
+		}
+	}
+
 	ret = do_check_chunks_and_extents(info);
 	err |= !!ret;
 	if (ret)
 		error(
 		"errors found in extent allocation tree or chunk allocation");
 
-	ret = repair_root_items(info);
-	err |= !!ret;
-	if (ret < 0) {
-		error("failed to repair root items: %s", strerror(-ret));
-		goto close_out;
-	}
-	if (repair) {
-		fprintf(stderr, "Fixed %d roots.\n", ret);
-		ret = 0;
-	} else if (ret > 0) {
-		fprintf(stderr,
-		       "Found %d roots with an outdated root item.\n",
-		       ret);
-		fprintf(stderr,
-			"Please run a filesystem check with the option --repair to fix them.\n");
-		ret = 1;
-		err |= !!ret;
-		goto close_out;
-	}
-
 	if (!ctx.progress_enabled) {
 		if (btrfs_fs_compat_ro(info, FREE_SPACE_TREE))
 			fprintf(stderr, "checking free space tree\n");
-- 
2.14.1




^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v3 2/5] btrfs-progs: check: call repair_root_items() before any repair
  2017-09-27  6:34 ` [PATCH 2/5] btrfs-progs: check: call repair_root_items() before any repair Su Yue
  2017-09-27  7:24   ` Qu Wenruo
  2017-09-27  7:58   ` [PATCH v2 " Su Yue
@ 2017-09-27  8:28   ` Su Yue
  2 siblings, 0 replies; 14+ messages in thread
From: Su Yue @ 2017-09-27  8:28 UTC (permalink / raw)
  To: linux-btrfs; +Cc: quwenruo.btrfs

The Annotation of repair_root_items():
"This must be run before any other repair code - not doing it so,
makes other repair code delete or modify backrefs in the extent tree
for example, which will result in an inconsistent fs after repairing
the root items."

However, the rule was broken by commit 1f728b1a514f ("Btrfs-progs,
fsck: move root items repair after root rebuilding").
The commit intends to fix failure of test-fsck/013 so it moves
repair_root_items() after check_extents_and_chunks().

The correct way is to skip calling repair_root_item() when
init_extent_tree is nonzero.
Now put repair_root_items() before do_check_chunks_and_extents() and
not call repair_root_items() if do init_extent_tree.
Then test-fsck/013 works well.

Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com>
---
Changelog:
v2:
   Correct commit number reported. (Suggested by Qu Wenruo)
v3:
   Change commit format. (Suggested by Qu Wenruo)
   
 cmds-check.c | 43 +++++++++++++++++++++++--------------------
 1 file changed, 23 insertions(+), 20 deletions(-)

diff --git a/cmds-check.c b/cmds-check.c
index 93b47194..3e2f9faa 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -14644,32 +14644,35 @@ int cmd_check(int argc, char **argv)
 		goto close_out;
 	}
 
+	if (!init_extent_tree) {
+		ret = repair_root_items(info);
+		err |= !!ret;
+		if (ret < 0) {
+			error("failed to repair root items: %s",
+			      strerror(-ret));
+			goto close_out;
+		}
+		if (repair) {
+			fprintf(stderr, "Fixed %d roots.\n", ret);
+			ret = 0;
+		} else if (ret > 0) {
+			fprintf(stderr,
+				"Found %d roots with an outdated root item.\n",
+				ret);
+			fprintf(stderr,
+				"Please run a filesystem check with the option --repair to fix them.\n");
+			ret = 1;
+			err |= !!ret;
+			goto close_out;
+		}
+	}
+
 	ret = do_check_chunks_and_extents(info);
 	err |= !!ret;
 	if (ret)
 		error(
 		"errors found in extent allocation tree or chunk allocation");
 
-	ret = repair_root_items(info);
-	err |= !!ret;
-	if (ret < 0) {
-		error("failed to repair root items: %s", strerror(-ret));
-		goto close_out;
-	}
-	if (repair) {
-		fprintf(stderr, "Fixed %d roots.\n", ret);
-		ret = 0;
-	} else if (ret > 0) {
-		fprintf(stderr,
-		       "Found %d roots with an outdated root item.\n",
-		       ret);
-		fprintf(stderr,
-			"Please run a filesystem check with the option --repair to fix them.\n");
-		ret = 1;
-		err |= !!ret;
-		goto close_out;
-	}
-
 	if (!ctx.progress_enabled) {
 		if (btrfs_fs_compat_ro(info, FREE_SPACE_TREE))
 			fprintf(stderr, "checking free space tree\n");
-- 
2.14.1




^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/5] btrfs-progs: check: return value of check_extent_refs()
  2017-09-27  6:34 ` [PATCH 1/5] btrfs-progs: check: return value of check_extent_refs() Su Yue
@ 2017-10-05 17:46   ` David Sterba
  2017-10-06  1:38     ` Su Yue
  2017-10-06  1:42     ` Su Yue
  0 siblings, 2 replies; 14+ messages in thread
From: David Sterba @ 2017-10-05 17:46 UTC (permalink / raw)
  To: Su Yue; +Cc: linux-btrfs

On Wed, Sep 27, 2017 at 02:34:36PM +0800, Su Yue wrote:
> In original check mode(without option "--repair"), check_extent_refs()
> always returns 0.
> 
> Add a variable @error to record status while checking extents.
> At the end of check_extent_refs(), let it return -EIO if @error is
> nonzero.
> 
> Example:
> $ btrfs check bad-extent-inline-ref-type.raw
> Checking filesystem on bad-extent-inline-ref-type.raw
> UUID: 1942d6fe-617b-4499-9982-cc8ffae5447f
> checking extents
> corrupt extent record: key 29360128 169 16384
> ref mismatch on [29360128 16384] extent item 0, found 1
> Backref 29360128 parent 5 root 5 not found in extent tree
> backpointer mismatch on [29360128 16384]
> bad extent [29360128, 29376512), type mismatch with chunk
> checking free space cache
> checking fs roots
> checking csums
> checking root refs
> found 114688 bytes used, no error found
> total csum bytes: 0
> total tree bytes: 114688
> total fs tree bytes: 32768
> total extent tree bytes: 16384
> btree space waste bytes: 109471
> file data blocks allocated: 0
>  referenced 0
> 
> Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com>

With this patch applied, the test fsck/006 fails, is that intentional?

Log from the last failing testcase:

checking extents
ref mismatch on [15474688 905216] extent item 1, found 4
Data backref 15474688 parent 31817728 owner 0 offset 0 num_refs 0 not found in extent tree
Incorrect local backref count on 15474688 parent 31817728 owner 0 offset 0 found 1 wanted 0 back 0x12d02f0
Data backref 15474688 parent 30883840 owner 0 offset 0 num_refs 0 not found in extent tree
Incorrect local backref count on 15474688 parent 30883840 owner 0 offset 0 found 1 wanted 0 back 0x12cd710
Data backref 15474688 parent 31326208 owner 0 offset 0 num_refs 0 not found in extent tree
Incorrect local backref count on 15474688 parent 31326208 owner 0 offset 0 found 1 wanted 0 back 0x12d2b80
backpointer mismatch on [15474688 905216]
ERROR: errors found in extent allocation tree or chunk allocation
checking free space cache
checking fs roots
checking csums
checking root refs
Checking filesystem on test.img
UUID: 3857c23d-4219-4600-a636-ac7707dc4ff3
cache and super generation don't match, space cache will be invalidated
found 6291456 bytes used, error(s) found
total csum bytes: 660
total tree bytes: 786432
total fs tree bytes: 688128
total extent tree bytes: 16384
btree space waste bytes: 459860
file data blocks allocated: 35536896
 referenced 25890816
failed: /mnt/big/dsterba/backup-labs-subv/gits/btrfs-progs/btrfs check test.img

I haven't tried with the other patches applied, so it might get actually fixed.
Even in that case, I'd rather keep the branches bisectable.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/5] btrfs-progs: check: return value of check_extent_refs()
  2017-10-05 17:46   ` David Sterba
@ 2017-10-06  1:38     ` Su Yue
  2017-10-06 16:19       ` David Sterba
  2017-10-06  1:42     ` Su Yue
  1 sibling, 1 reply; 14+ messages in thread
From: Su Yue @ 2017-10-06  1:38 UTC (permalink / raw)
  To: dsterba, linux-btrfs



On 10/06/2017 01:46 AM, David Sterba wrote:
> On Wed, Sep 27, 2017 at 02:34:36PM +0800, Su Yue wrote:
>> In original check mode(without option "--repair"), check_extent_refs()
>> always returns 0.
>>
>> Add a variable @error to record status while checking extents.
>> At the end of check_extent_refs(), let it return -EIO if @error is
>> nonzero.
>>
>> Example:
>> $ btrfs check bad-extent-inline-ref-type.raw
>> Checking filesystem on bad-extent-inline-ref-type.raw
>> UUID: 1942d6fe-617b-4499-9982-cc8ffae5447f
>> checking extents
>> corrupt extent record: key 29360128 169 16384
>> ref mismatch on [29360128 16384] extent item 0, found 1
>> Backref 29360128 parent 5 root 5 not found in extent tree
>> backpointer mismatch on [29360128 16384]
>> bad extent [29360128, 29376512), type mismatch with chunk
>> checking free space cache
>> checking fs roots
>> checking csums
>> checking root refs
>> found 114688 bytes used, no error found
>> total csum bytes: 0
>> total tree bytes: 114688
>> total fs tree bytes: 32768
>> total extent tree bytes: 16384
>> btree space waste bytes: 109471
>> file data blocks allocated: 0
>>   referenced 0
>>
>> Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com>
> 
> With this patch applied, the test fsck/006 fails, is that intentional?
> 
Yes, it's expected. This patch just let btrfs-progs return a correct
value.

> Log from the last failing testcase:
> 
> checking extents
> ref mismatch on [15474688 905216] extent item 1, found 4
> Data backref 15474688 parent 31817728 owner 0 offset 0 num_refs 0 not found in extent tree
> Incorrect local backref count on 15474688 parent 31817728 owner 0 offset 0 found 1 wanted 0 back 0x12d02f0
> Data backref 15474688 parent 30883840 owner 0 offset 0 num_refs 0 not found in extent tree
> Incorrect local backref count on 15474688 parent 30883840 owner 0 offset 0 found 1 wanted 0 back 0x12cd710
> Data backref 15474688 parent 31326208 owner 0 offset 0 num_refs 0 not found in extent tree
> Incorrect local backref count on 15474688 parent 31326208 owner 0 offset 0 found 1 wanted 0 back 0x12d2b80
> backpointer mismatch on [15474688 905216]
> ERROR: errors found in extent allocation tree or chunk allocation
> checking free space cache
> checking fs roots
> checking csums
> checking root refs
> Checking filesystem on test.img
> UUID: 3857c23d-4219-4600-a636-ac7707dc4ff3
> cache and super generation don't match, space cache will be invalidated
> found 6291456 bytes used, error(s) found
> total csum bytes: 660
> total tree bytes: 786432
> total fs tree bytes: 688128
> total extent tree bytes: 16384
> btree space waste bytes: 459860
> file data blocks allocated: 35536896
>   referenced 25890816
> failed: /mnt/big/dsterba/backup-labs-subv/gits/btrfs-progs/btrfs check test.img
> 
The log shows that there are errors in the extent-tree but no error
value returned.

And the abormal output was caused by commit 1f728b1a514f ("Btrfs-
progs,fsck: move root items repair after root rebuilding").

> I haven't tried with the other patches applied, so it might get actually fixed.
> Even in that case, I'd rather keep the branches bisectable.
> 
It is described and fixed by the second and third patch in the
patchset.

Thanks,
Su
> 



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/5] btrfs-progs: check: return value of check_extent_refs()
  2017-10-05 17:46   ` David Sterba
  2017-10-06  1:38     ` Su Yue
@ 2017-10-06  1:42     ` Su Yue
  1 sibling, 0 replies; 14+ messages in thread
From: Su Yue @ 2017-10-06  1:42 UTC (permalink / raw)
  To: dsterba, linux-btrfs



On 10/06/2017 01:46 AM, David Sterba wrote:
> On Wed, Sep 27, 2017 at 02:34:36PM +0800, Su Yue wrote:
>> In original check mode(without option "--repair"), check_extent_refs()
>> always returns 0.
>>
>> Add a variable @error to record status while checking extents.
>> At the end of check_extent_refs(), let it return -EIO if @error is
>> nonzero.
>>
>> Example:
>> $ btrfs check bad-extent-inline-ref-type.raw
>> Checking filesystem on bad-extent-inline-ref-type.raw
>> UUID: 1942d6fe-617b-4499-9982-cc8ffae5447f
>> checking extents
>> corrupt extent record: key 29360128 169 16384
>> ref mismatch on [29360128 16384] extent item 0, found 1
>> Backref 29360128 parent 5 root 5 not found in extent tree
>> backpointer mismatch on [29360128 16384]
>> bad extent [29360128, 29376512), type mismatch with chunk
>> checking free space cache
>> checking fs roots
>> checking csums
>> checking root refs
>> found 114688 bytes used, no error found
>> total csum bytes: 0
>> total tree bytes: 114688
>> total fs tree bytes: 32768
>> total extent tree bytes: 16384
>> btree space waste bytes: 109471
>> file data blocks allocated: 0
>>   referenced 0
>>
>> Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com>
> 
> With this patch applied, the test fsck/006 fails, is that intentional?
> 
> Log from the last failing testcase:
> 
> checking extents
> ref mismatch on [15474688 905216] extent item 1, found 4
> Data backref 15474688 parent 31817728 owner 0 offset 0 num_refs 0 not found in extent tree
> Incorrect local backref count on 15474688 parent 31817728 owner 0 offset 0 found 1 wanted 0 back 0x12d02f0
> Data backref 15474688 parent 30883840 owner 0 offset 0 num_refs 0 not found in extent tree
> Incorrect local backref count on 15474688 parent 30883840 owner 0 offset 0 found 1 wanted 0 back 0x12cd710
> Data backref 15474688 parent 31326208 owner 0 offset 0 num_refs 0 not found in extent tree
> Incorrect local backref count on 15474688 parent 31326208 owner 0 offset 0 found 1 wanted 0 back 0x12d2b80
> backpointer mismatch on [15474688 905216]
> ERROR: errors found in extent allocation tree or chunk allocation
> checking free space cache
> checking fs roots
> checking csums
> checking root refs
> Checking filesystem on test.img
> UUID: 3857c23d-4219-4600-a636-ac7707dc4ff3
> cache and super generation don't match, space cache will be invalidated
> found 6291456 bytes used, error(s) found
> total csum bytes: 660
> total tree bytes: 786432
> total fs tree bytes: 688128
> total extent tree bytes: 16384
> btree space waste bytes: 459860
> file data blocks allocated: 35536896
>   referenced 25890816
> failed: /mnt/big/dsterba/backup-labs-subv/gits/btrfs-progs/btrfs check test.img
> 
> I haven't tried with the other patches applied, so it might get actually fixed.
> Even in that case, I'd rather keep the branches bisectable.
> 
Understood, I will do it in next version.
> 



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/5] btrfs-progs: check: return value of check_extent_refs()
  2017-10-06  1:38     ` Su Yue
@ 2017-10-06 16:19       ` David Sterba
  0 siblings, 0 replies; 14+ messages in thread
From: David Sterba @ 2017-10-06 16:19 UTC (permalink / raw)
  To: Su Yue; +Cc: dsterba, linux-btrfs

On Fri, Oct 06, 2017 at 09:38:05AM +0800, Su Yue wrote:
> 
> 
> On 10/06/2017 01:46 AM, David Sterba wrote:
> > On Wed, Sep 27, 2017 at 02:34:36PM +0800, Su Yue wrote:
> >> In original check mode(without option "--repair"), check_extent_refs()
> >> always returns 0.
> >>
> >> Add a variable @error to record status while checking extents.
> >> At the end of check_extent_refs(), let it return -EIO if @error is
> >> nonzero.
> >>
> >> Example:
> >> $ btrfs check bad-extent-inline-ref-type.raw
> >> Checking filesystem on bad-extent-inline-ref-type.raw
> >> UUID: 1942d6fe-617b-4499-9982-cc8ffae5447f
> >> checking extents
> >> corrupt extent record: key 29360128 169 16384
> >> ref mismatch on [29360128 16384] extent item 0, found 1
> >> Backref 29360128 parent 5 root 5 not found in extent tree
> >> backpointer mismatch on [29360128 16384]
> >> bad extent [29360128, 29376512), type mismatch with chunk
> >> checking free space cache
> >> checking fs roots
> >> checking csums
> >> checking root refs
> >> found 114688 bytes used, no error found
> >> total csum bytes: 0
> >> total tree bytes: 114688
> >> total fs tree bytes: 32768
> >> total extent tree bytes: 16384
> >> btree space waste bytes: 109471
> >> file data blocks allocated: 0
> >>   referenced 0
> >>
> >> Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com>
> > 
> > With this patch applied, the test fsck/006 fails, is that intentional?
> > 
> Yes, it's expected. This patch just let btrfs-progs return a correct
> value.

Ok thanks. I'll add a note about that to the changelog, this kind of
information is important when we knowingly break bisectability.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/5] btrfs-progs: check: original and lowmem mode fix
  2017-09-27  6:34 [PATCH 0/5] btrfs-progs: check: original and lowmem mode fix Su Yue
                   ` (4 preceding siblings ...)
  2017-09-27  6:34 ` [PATCH 5/5] btrfs-progs: fsck-tests: 027/bad_extent_inline_ref_type Su Yue
@ 2017-10-06 16:52 ` David Sterba
  5 siblings, 0 replies; 14+ messages in thread
From: David Sterba @ 2017-10-06 16:52 UTC (permalink / raw)
  To: Su Yue; +Cc: linux-btrfs

On Wed, Sep 27, 2017 at 02:34:35PM +0800, Su Yue wrote:
> The head three patches is independent from later two.
> Include:
> 1) Let check_extent_refs() return error instead of 0 if something wrong
>    is found in original mode.
> 2) repair_root_items() should be called before any repair. Put it
>    before do_check_chunks_and_extents();
> 3) Error status should not be modified if repair_root_items() succeeded
>    in original repair.
> 
> The late two patches are about invalid type in extent_inline_ref.
> 
> Only original mode applied 001-003 patches can handle the case in the
> last patch. So I gather those 5 patches together.
> 
> 
> Su Yue (5):
>   btrfs-progs: check: return value of check_extent_refs()
>   btrfs-progs: check: call repair_root_items() before any repair
>   btrfs-progs: check: error or return value of repair_root_items()
>   btrfs-progs: check: check extent_inline_ref in lowmem
>   btrfs-progs: fsck-tests: 027/bad_extent_inline_ref_type

1-5 applied, with minor adjustments. Thanks.

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2017-10-06 16:54 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-27  6:34 [PATCH 0/5] btrfs-progs: check: original and lowmem mode fix Su Yue
2017-09-27  6:34 ` [PATCH 1/5] btrfs-progs: check: return value of check_extent_refs() Su Yue
2017-10-05 17:46   ` David Sterba
2017-10-06  1:38     ` Su Yue
2017-10-06 16:19       ` David Sterba
2017-10-06  1:42     ` Su Yue
2017-09-27  6:34 ` [PATCH 2/5] btrfs-progs: check: call repair_root_items() before any repair Su Yue
2017-09-27  7:24   ` Qu Wenruo
2017-09-27  7:58   ` [PATCH v2 " Su Yue
2017-09-27  8:28   ` [PATCH v3 " Su Yue
2017-09-27  6:34 ` [PATCH 3/5] btrfs-progs: check: error or return value of repair_root_items() Su Yue
2017-09-27  6:34 ` [PATCH 4/5] btrfs-progs: check: check extent_inline_ref in lowmem Su Yue
2017-09-27  6:34 ` [PATCH 5/5] btrfs-progs: fsck-tests: 027/bad_extent_inline_ref_type Su Yue
2017-10-06 16:52 ` [PATCH 0/5] btrfs-progs: check: original and lowmem mode fix David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.