From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935506AbdDFO5c (ORCPT ); Thu, 6 Apr 2017 10:57:32 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:35055 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935449AbdDFO4m (ORCPT ); Thu, 6 Apr 2017 10:56:42 -0400 From: Akinobu Mita To: akpm@linux-foundation.org, linux-kernel@vger.kernel.org Cc: Akinobu Mita , Dmitry Vyukov Subject: [PATCH -mm 5/5] fault-inject: add /proc//fail-nth Date: Thu, 6 Apr 2017 23:56:01 +0900 Message-Id: <1491490561-10485-6-git-send-email-akinobu.mita@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1491490561-10485-1-git-send-email-akinobu.mita@gmail.com> References: <1491490561-10485-1-git-send-email-akinobu.mita@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org fail-nth interface is only created in /proc/self/task//. This change also adds it in /proc//. This makes shell based tool a bit simpler. $ bash -c "builtin echo 100 > /proc/self/fail-nth && exec ls /" Cc: Dmitry Vyukov Signed-off-by: Akinobu Mita --- 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//fail-nth: +- /proc//fail-nth: +- /proc/self/task//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