]> git.baikalelectronics.ru Git - kernel.git/commitdiff
fault-inject: add /proc/<pid>/fail-nth
authorAkinobu Mita <akinobu.mita@gmail.com>
Fri, 14 Jul 2017 21:50:00 +0000 (14:50 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 14 Jul 2017 22:05:13 +0000 (15:05 -0700)
fail-nth interface is only created in /proc/self/task/<current-tid>/.
This change also adds it in /proc/<pid>/.

This makes shell based tool a bit simpler.

$ bash -c "builtin echo 100 > /proc/self/fail-nth && exec ls /"

Link: http://lkml.kernel.org/r/1491490561-10485-6-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>
Documentation/fault-injection/fault-injection.txt
fs/proc/base.c

index 370ddcbc2b44173d9ddbafc48635b9ab4fa41df7..918972babcd8f2fb877babb7447d4e9476341af3 100644 (file)
@@ -136,7 +136,8 @@ use the boot option:
 
 o proc entries
 
-- /proc/self/task/<current-tid>/fail-nth:
+- /proc/<pid>/fail-nth:
+- /proc/self/task/<tid>/fail-nth:
 
        Write to this file of integer N makes N-th call in the task fail.
        Read from this file returns a integer value. A value of '0' indicates
index 872a3f28bfe41b7dd6cf847047187a9d28ba63be..719c2e943ea1028f22cd2e400b7b6f9289ca6791 100644 (file)
@@ -2962,6 +2962,7 @@ static const struct pid_entry tgid_base_stuff[] = {
 #endif
 #ifdef CONFIG_FAULT_INJECTION
        REG("make-it-fail", S_IRUGO|S_IWUSR, proc_fault_inject_operations),
+       REG("fail-nth", 0644, proc_fail_nth_operations),
 #endif
 #ifdef CONFIG_ELF_CORE
        REG("coredump_filter", S_IRUGO|S_IWUSR, proc_coredump_filter_operations),