summaryrefslogtreecommitdiffstats
path: root/Documentation/fault-injection
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2017-07-14 14:49:52 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2017-07-14 15:05:13 -0700
commit9049f2f6e7bdfb5de0c63c2635bf3cdb70c4efb5 (patch)
tree718c3ee2245ca615b30d4bef469f3ab2195530e9 /Documentation/fault-injection
parentecaad81ca0dfaa5f6ab7a5a9bc16a10816e2bd27 (diff)
downloadlinux-9049f2f6e7bdfb5de0c63c2635bf3cdb70c4efb5.tar.bz2
fault-inject: parse as natural 1-based value for fail-nth write interface
The value written to fail-nth file is parsed as 0-based. Parsing as one-based is more natural to understand and it enables to cancel the previous setup by simply writing '0'. This change also converts task->fail_nth from signed to unsigned int. Link: http://lkml.kernel.org/r/1491490561-10485-3-git-send-email-akinobu.mita@gmail.com Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: Dmitry Vyukov <dvyukov@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation/fault-injection')
-rw-r--r--Documentation/fault-injection/fault-injection.txt7
1 files changed, 3 insertions, 4 deletions
diff --git a/Documentation/fault-injection/fault-injection.txt b/Documentation/fault-injection/fault-injection.txt
index 192d8cbcc5f9..a32190508751 100644
--- a/Documentation/fault-injection/fault-injection.txt
+++ b/Documentation/fault-injection/fault-injection.txt
@@ -138,8 +138,8 @@ o proc entries
- /proc/self/task/<current-tid>/fail-nth:
- Write to this file of integer N makes N-th call in the current task fail
- (N is 0-based). Read from this file returns a single char 'Y' or 'N'
+ Write to this file of integer N makes N-th call in the task fail.
+ Read from this file returns a single char 'Y' or 'N'
that says if the fault setup with a previous write to this file was
injected or not, and disables the fault if it wasn't yet injected.
Note that this file enables all types of faults (slab, futex, etc).
@@ -320,7 +320,7 @@ int main()
system("echo N > /sys/kernel/debug/failslab/ignore-gfp-wait");
sprintf(buf, "/proc/self/task/%ld/fail-nth", syscall(SYS_gettid));
fail_nth = open(buf, O_RDWR);
- for (i = 0;; i++) {
+ for (i = 1;; i++) {
sprintf(buf, "%d", i);
write(fail_nth, buf, strlen(buf));
res = socketpair(AF_LOCAL, SOCK_STREAM, 0, fds);
@@ -339,7 +339,6 @@ int main()
An example output:
-0-th fault Y: res=-1/23
1-th fault Y: res=-1/23
2-th fault Y: res=-1/23
3-th fault Y: res=-1/12