linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Akinobu Mita <akinobu.mita@gmail.com>
To: akpm@linux-foundation.org, linux-kernel@vger.kernel.org
Cc: Akinobu Mita <akinobu.mita@gmail.com>,
	Dmitry Vyukov <dvyukov@google.com>
Subject: [PATCH -mm 5/5] fault-inject: add /proc/<pid>/fail-nth
Date: Thu,  6 Apr 2017 23:56:01 +0900	[thread overview]
Message-ID: <1491490561-10485-6-git-send-email-akinobu.mita@gmail.com> (raw)
In-Reply-To: <1491490561-10485-1-git-send-email-akinobu.mita@gmail.com>

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 /"

Cc: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
 Documentation/fault-injection/fault-injection.txt | 3 ++-
 fs/proc/base.c                                    | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/fault-injection/fault-injection.txt b/Documentation/fault-injection/fault-injection.txt
index 370ddcb..918972b 100644
--- a/Documentation/fault-injection/fault-injection.txt
+++ b/Documentation/fault-injection/fault-injection.txt
@@ -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
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 14e7b73..ea1039d 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2964,6 +2964,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),
-- 
2.7.4

      parent reply	other threads:[~2017-04-06 14:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-06 14:55 [PATCH -mm 0/5] fault-inject: improve fail-nth interface Akinobu Mita
2017-04-06 14:55 ` [PATCH -mm 1/5] fault-inject: automatically detect the number base for fail-nth write interface Akinobu Mita
2017-04-06 14:55 ` [PATCH -mm 2/5] fault-inject: parse as natural 1-based value " Akinobu Mita
2017-04-06 14:55 ` [PATCH -mm 3/5] fault-inject: make fail-nth read/write interface symmetric Akinobu Mita
2017-04-07 20:37   ` Dmitry Vyukov
2017-07-12 20:49     ` Andrew Morton
2017-07-13 16:17       ` Akinobu Mita
2017-04-06 14:56 ` [PATCH -mm 4/5] fault-inject: simplify access check for fail-nth Akinobu Mita
2017-04-07 20:23   ` Dmitry Vyukov
2017-04-07 20:45   ` Dmitry Vyukov
2017-04-08  8:25     ` Akinobu Mita
2017-04-08 17:35       ` Dmitry Vyukov
2017-04-06 14:56 ` Akinobu Mita [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1491490561-10485-6-git-send-email-akinobu.mita@gmail.com \
    --to=akinobu.mita@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=dvyukov@google.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).