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.

Signed-off-by: Qu Wenruo <w...@suse.com>
---
 fs/btrfs/tree-checker.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/btrfs/tree-checker.c b/fs/btrfs/tree-checker.c
index b9dd2a6e133f..9c22a1fe38c1 100644
--- a/fs/btrfs/tree-checker.c
+++ b/fs/btrfs/tree-checker.c
@@ -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);
-- 
2.21.0

Reply via email to