btrfs: tree-checker: Allow error injection for tree-checker
PATCH 1/1 btrfs: tree-checker: Allow error injection for tree-checker
Allowing error injection for btrfs_check_leaf_full() and btrfs_check_node() is useful to test the failure path of btrfs write time tree check.
--- fs/btrfs/tree-checker.c | 3 +++ 1 file changed, 3 insertions(+)
fs/btrfs/tree-checker.c +3 -0
@@ -15,6 +15,7 @@* carefully reviewed otherwise so it does not prevent mount of valid images. */ +#include <linux/error-injection.h> #include "ctree.h" #include "tree-checker.h" #include "disk-io.h"
@@ -942,6 +943,7 @@ int btrfs_check_leaf_full(struct extent_buffer *leaf) {return check_leaf (leaf, true); } +ALLOW_ERROR_INJECTION (btrfs_check_leaf_full,ERRNO );int btrfs_check_leaf_relaxed (struct extent_buffer *leaf) {
@@ -1005,3 +1007,4 @@ int btrfs_check_node(struct extent_buffer *node) out:return ret; } +ALLOW_ERROR_INJECTION (btrfs_check_node,ERRNO );
Signature · 1 line
2.21.0
Quoted 5 lines · Qu Wenruo
Allowing error injection for
btrfs_check_leaf_full()andbtrfs_check_node()is useful to test the failure path of btrfs write time tree check.Signed-off-by Qu Wenruo <[email protected]>
Does not compile:
CC [M] fs/btrfs/tests/extent-map-tests.o
In file included from fs/btrfs/tree-checker.c:18:./include/linux/error-injection.h:15:15: error: unknown type name ‘bool’
static inline bool within_error_injection_list(unsigned long addr)
^~~~
./include/linux/error-injection.h: In function ‘within_error_injection_list’:
./include/linux/error-injection.h:17:9: error: ‘false’ undeclared (first use in this function)
return false;
^~~~~./include/linux/error-injection.h:17:9: note: each undeclared identifier is reported only once for each function it appears in make[1]: *** [scripts/Makefile.build:275: fs/btrfs/tree-checker.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1737: fs/btrfs/] Error 2
gcc is 8.3.1
Quoted 18 lines · David Sterba
Quoted 5 lines · Qu Wenruo
Allowing error injection for
btrfs_check_leaf_full()andbtrfs_check_node()is useful to test the failure path of btrfs write time tree check.Signed-off-by Qu Wenruo <[email protected]>Does not compile:
CC [M]
fs/btrfs/tests/extent-map-tests.o
In file included fromfs/btrfs/tree-checker.c:18:./include/linux/error-injection.h:15:15: error: unknown type name ‘bool’
static inline boolwithin_error_injection_list(unsigned long addr)^~~~ ./include/linux/error-injection.h: In function ‘within_error_injection_list’: ./include/linux/error-injection.h:17:9: error: ‘false’ undeclared (first use in this function) return false; ^~~~~
Quoted 4 lines
./include/linux/error-injection.h:17:9: note: each undeclared identifier is reported only once for each function it appears in make[1]: *** [scripts/Makefile.build:275:fs/btrfs/tree-checker.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1737:fs/btrfs/] Error 2
Compiles without problem here using 8.2.1 gcc.
...
CC [M] fs/btrfs/check-integrity.o CC [M] fs/btrfs/ref-verify.o CC [M] fs/btrfs/tests/free-space-tests.o CC [M] fs/btrfs/tests/extent-buffer-tests.o CC [M] fs/btrfs/tests/btrfs-tests.o CC [M] fs/btrfs/tests/extent-io-tests.o CC [M] fs/btrfs/tests/inode-tests.o CC [M] fs/btrfs/tests/qgroup-tests.o CC [M] fs/btrfs/tests/free-space-tree-tests.o CC [M] fs/btrfs/tests/extent-map-tests.o LD [M] fs/btrfs/btrfs.o
Building modules, stage 2.
MODPOST 1 modules
CC fs/btrfs/btrfs.mod.o
LD [M] fs/btrfs/btrfs.ko
Quoted 4 lines
gcc is 8.3.1
Upgrading to gcc 8.3.0, still passes.
Is that a regression in gcc 8.3.1?
Thanks,
Qu
Quoted 47 lines · Qu Wenruo
Quoted 18 lines · David Sterba
Quoted 5 lines · Qu Wenruo
Allowing error injection for
btrfs_check_leaf_full()andbtrfs_check_node()is useful to test the failure path of btrfs write time tree check.Signed-off-by Qu Wenruo <[email protected]>Does not compile:
CC [M]
fs/btrfs/tests/extent-map-tests.o
In file included fromfs/btrfs/tree-checker.c:18:./include/linux/error-injection.h:15:15: error: unknown type name ‘bool’
static inline boolwithin_error_injection_list(unsigned long addr)^~~~ ./include/linux/error-injection.h: In function ‘within_error_injection_list’: ./include/linux/error-injection.h:17:9: error: ‘false’ undeclared (first use in this function) return false; ^~~~~Quoted 4 lines
./include/linux/error-injection.h:17:9: note: each undeclared identifier is reported only once for each function it appears in make[1]: *** [scripts/Makefile.build:275:fs/btrfs/tree-checker.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1737:fs/btrfs/] Error 2Compiles without problem here using 8.2.1 gcc.
...
CC [M] fs/btrfs/check-integrity.o CC [M] fs/btrfs/ref-verify.o CC [M] fs/btrfs/tests/free-space-tests.o CC [M] fs/btrfs/tests/extent-buffer-tests.o CC [M] fs/btrfs/tests/btrfs-tests.o CC [M] fs/btrfs/tests/extent-io-tests.o CC [M] fs/btrfs/tests/inode-tests.o CC [M] fs/btrfs/tests/qgroup-tests.o CC [M] fs/btrfs/tests/free-space-tree-tests.o CC [M] fs/btrfs/tests/extent-map-tests.o LD [M] fs/btrfs/btrfs.oBuilding modules, stage 2.
MODPOST 1 modules
CCfs/btrfs/btrfs.mod.o
LD [M]fs/btrfs/btrfs.koQuoted 2 lines
Quoted 6 lines
Quoted 2 lines
gcc is 8.3.1
Upgrading to gcc 8.3.0, still passes.
Is that a regression in gcc 8.3.1?
I don't think it's caused by compiler but config options. And the build bot sees the compilation failure too, so it's not specific to my setup:
https://lists.01.org/pipermail/kbuild-all/2019-April/060303.html
Quoted 51 lines · David Sterba
Quoted 50 lines · Qu Wenruo
Quoted 18 lines · David Sterba
Quoted 5 lines · Qu Wenruo
Allowing error injection for
btrfs_check_leaf_full()andbtrfs_check_node()is useful to test the failure path of btrfs write time tree check.Signed-off-by Qu Wenruo <[email protected]>Does not compile:
CC [M]
fs/btrfs/tests/extent-map-tests.o
In file included fromfs/btrfs/tree-checker.c:18:./include/linux/error-injection.h:15:15: error: unknown type name ‘bool’
static inline boolwithin_error_injection_list(unsigned long addr)^~~~ ./include/linux/error-injection.h: In function ‘within_error_injection_list’: ./include/linux/error-injection.h:17:9: error: ‘false’ undeclared (first use in this function) return false; ^~~~~Quoted 4 lines
./include/linux/error-injection.h:17:9: note: each undeclared identifier is reported only once for each function it appears in make[1]: *** [scripts/Makefile.build:275:fs/btrfs/tree-checker.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1737:fs/btrfs/] Error 2Compiles without problem here using 8.2.1 gcc.
...
CC [M] fs/btrfs/check-integrity.o CC [M] fs/btrfs/ref-verify.o CC [M] fs/btrfs/tests/free-space-tests.o CC [M] fs/btrfs/tests/extent-buffer-tests.o CC [M] fs/btrfs/tests/btrfs-tests.o CC [M] fs/btrfs/tests/extent-io-tests.o CC [M] fs/btrfs/tests/inode-tests.o CC [M] fs/btrfs/tests/qgroup-tests.o CC [M] fs/btrfs/tests/free-space-tree-tests.o CC [M] fs/btrfs/tests/extent-map-tests.o LD [M] fs/btrfs/btrfs.oBuilding modules, stage 2.
MODPOST 1 modules
CCfs/btrfs/btrfs.mod.o
LD [M]fs/btrfs/btrfs.koQuoted 4 lines
gcc is 8.3.1
Quoted 9 lines
Quoted 3 lines
Upgrading to gcc 8.3.0, still passes.
Is that a regression in gcc 8.3.1?
I don't think it's caused by compiler but config options. And the build bot sees the compilation failure too, so it's not specific to my setup:
https://lists.01.org/pipermail/kbuild-all/2019-April/060303.html
Got it reproduced, not sure why the config could affect this problem.
But the fix is always straightforward, include types for bool and stddef for true/false.
Thanks,
Qu
Quoted 61 lines · Qu Wenruo
Quoted 58 lines · David Sterba
Quoted 47 lines · Qu Wenruo
Quoted 18 lines · David Sterba
Quoted 5 lines · Qu Wenruo
Allowing error injection for
btrfs_check_leaf_full()andbtrfs_check_node()is useful to test the failure path of btrfs write time tree check.Signed-off-by Qu Wenruo <[email protected]>Does not compile:
CC [M]
fs/btrfs/tests/extent-map-tests.o
In file included fromfs/btrfs/tree-checker.c:18:./include/linux/error-injection.h:15:15: error: unknown type name ‘bool’
static inline boolwithin_error_injection_list(unsigned long addr)^~~~ ./include/linux/error-injection.h: In function ‘within_error_injection_list’: ./include/linux/error-injection.h:17:9: error: ‘false’ undeclared (first use in this function) return false; ^~~~~Quoted 4 lines
./include/linux/error-injection.h:17:9: note: each undeclared identifier is reported only once for each function it appears in make[1]: *** [scripts/Makefile.build:275:fs/btrfs/tree-checker.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1737:fs/btrfs/] Error 2Compiles without problem here using 8.2.1 gcc.
...
CC [M] fs/btrfs/check-integrity.o CC [M] fs/btrfs/ref-verify.o CC [M] fs/btrfs/tests/free-space-tests.o CC [M] fs/btrfs/tests/extent-buffer-tests.o CC [M] fs/btrfs/tests/btrfs-tests.o CC [M] fs/btrfs/tests/extent-io-tests.o CC [M] fs/btrfs/tests/inode-tests.o CC [M] fs/btrfs/tests/qgroup-tests.o CC [M] fs/btrfs/tests/free-space-tree-tests.o CC [M] fs/btrfs/tests/extent-map-tests.o LD [M] fs/btrfs/btrfs.oBuilding modules, stage 2.
MODPOST 1 modules
CCfs/btrfs/btrfs.mod.o
LD [M]fs/btrfs/btrfs.koQuoted 2 lines
Quoted 6 lines
Quoted 2 lines
gcc is 8.3.1
Upgrading to gcc 8.3.0, still passes.
Is that a regression in gcc 8.3.1?
I don't think it's caused by compiler but config options. And the build bot sees the compilation failure too, so it's not specific to my setup:
Quoted 7 lines
Got it reproduced, not sure why the config could affect this problem.
But the fix is always straightforward, include types for bool and stddef for true/false.
As this is only a minor compilation issue, I'll add the includes so we don't have to wait on the proper fix to land and you can use the injection.
Quoted 5 lines · Qu Wenruo
Allowing error injection for
btrfs_check_leaf_full()andbtrfs_check_node()is useful to test the failure path of btrfs write time tree check.Signed-off-by Qu Wenruo <[email protected]>
Added to misc-next, thanks.