btrfs: allow us to inject errors at io_ctl_init
authorJosef Bacik <jbacik@fb.com>
Mon, 11 Dec 2017 16:36:50 +0000 (11:36 -0500)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 12 Dec 2017 17:02:40 +0000 (09:02 -0800)
This was instrumental in reproducing a space cache bug.

Signed-off-by: Josef Bacik <jbacik@fb.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
fs/btrfs/free-space-cache.c

index 4426d1c73e50f1d1b1105a182d9c982a28b8ff08..fb1382893bfc253b9f392613aaba3a7c621ab5f0 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/slab.h>
 #include <linux/math64.h>
 #include <linux/ratelimit.h>
+#include <linux/bpf.h>
 #include "ctree.h"
 #include "free-space-cache.h"
 #include "transaction.h"
@@ -332,6 +333,7 @@ static int io_ctl_init(struct btrfs_io_ctl *io_ctl, struct inode *inode,
 
        return 0;
 }
+BPF_ALLOW_ERROR_INJECTION(io_ctl_init);
 
 static void io_ctl_free(struct btrfs_io_ctl *io_ctl)
 {