diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2006-12-08 05:39:42 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-08 11:29:02 -0500 |
commit | de1ba09b214056365d9082982905b255caafb7a2 (patch) | |
tree | 6806f2abcfb9eee699424112a48c44edbbdff0c2 /Documentation/fault-injection/failmodule.sh | |
parent | 4b3bb06bea649396490094780f90d315c152f6ab (diff) |
[PATCH] fault injection: documentation and scripts
This patch set provides some fault-injection capabilities.
- kmalloc() failures
- alloc_pages() failures
- disk IO errors
We can see what really happens if those failures happen.
In order to enable these fault-injection capabilities:
1. Enable relevant config options (CONFIG_FAILSLAB, CONFIG_PAGE_ALLOC,
CONFIG_MAKE_REQUEST) and if you want to configure them via debugfs,
enable CONFIG_FAULT_INJECTION_DEBUG_FS.
2. Build and boot with this kernel
3. Configure fault-injection capabilities behavior by boot option or debugfs
- Boot option
failslab=
fail_page_alloc=
fail_make_request=
- Debugfs
/debug/failslab/*
/debug/fail_page_alloc/*
/debug/fail_make_request/*
Please refer to the Documentation/fault-injection/fault-injection.txt
for details.
4. See what really happens.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Don Mullis <dwm@meer.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'Documentation/fault-injection/failmodule.sh')
-rw-r--r-- | Documentation/fault-injection/failmodule.sh | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Documentation/fault-injection/failmodule.sh b/Documentation/fault-injection/failmodule.sh new file mode 100644 index 000000000000..9abac34633b9 --- /dev/null +++ b/Documentation/fault-injection/failmodule.sh | |||
@@ -0,0 +1,31 @@ | |||
1 | #!/bin/bash | ||
2 | # | ||
3 | # Usage: failmodule <failname> <modulename> [stacktrace-depth] | ||
4 | # | ||
5 | # <failname>: "failslab", "fail_alloc_page", or "fail_make_request" | ||
6 | # | ||
7 | # <modulename>: module name that you want to inject faults. | ||
8 | # | ||
9 | # [stacktrace-depth]: the maximum number of stacktrace walking allowed | ||
10 | # | ||
11 | |||
12 | STACKTRACE_DEPTH=5 | ||
13 | if [ $# -gt 2 ]; then | ||
14 | STACKTRACE_DEPTH=$3 | ||
15 | fi | ||
16 | |||
17 | if [ ! -d /debug/$1 ]; then | ||
18 | echo "Fault-injection $1 does not exist" >&2 | ||
19 | exit 1 | ||
20 | fi | ||
21 | if [ ! -d /sys/module/$2 ]; then | ||
22 | echo "Module $2 does not exist" >&2 | ||
23 | exit 1 | ||
24 | fi | ||
25 | |||
26 | # Disable any fault injection | ||
27 | echo 0 > /debug/$1/stacktrace-depth | ||
28 | |||
29 | echo `cat /sys/module/$2/sections/.text` > /debug/$1/address-start | ||
30 | echo `cat /sys/module/$2/sections/.exit.text` > /debug/$1/address-end | ||
31 | echo $STACKTRACE_DEPTH > /debug/$1/stacktrace-depth | ||