Received: by 2002:ac0:c50a:0:0:0:0:0 with SMTP id y10csp1339350imi; Fri, 1 Jul 2022 07:48:37 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sbmLJoHktaeR/CSgoHKB38vItjDvv/udmVnpCULr4UvhUMprf2ySMPgesOk8baknR+wk6+ X-Received: by 2002:a17:907:a088:b0:726:db8d:281f with SMTP id hu8-20020a170907a08800b00726db8d281fmr14654695ejc.601.1656686917563; Fri, 01 Jul 2022 07:48:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656686917; cv=none; d=google.com; s=arc-20160816; b=tj7O+wEHN48NpfLYWV5z3ct/xjp/k899wU3WxdthsaY2u7mXYKGDPOJBElDjNUwyLH +nRnP3uCAzxSmXXig/wvIUP26BwAaIfIlYeMznNbRPl5MrhTX1GMHz2esyzWAhGHkxC3 DJRtv4nuSaqdp9ibsI/he5N80IxKy0FK0XfxyDBGxb654ajID5AFGhgAUrB3BsNBNNc5 UeUHHOvqn9C2fXByGGMcEt9JaS9KLtmTrmk6DfHxW19TFs6iwWh9KBc+2z9R9AFeRGIl 3mWIxjA0hW8nhbZ98IzRM70oRKX1EXdp3rq+BM3iaFRqU5JyySBJv/ybJwTR+ZLOTaV0 YnsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:message-id:date:cc:to:from:subject; bh=lAyH4S8/DYQ09dDT93m9dZRIlwMIuHNFN7kqti9c1Lo=; b=SRLDmA0u3xgBepFI3+FYT0zJWciK72PoCvhnlzpibtzmzQuP/2TXsfF4mBvGVwnKDp QK2jGBIOKXyPKwWgZ9UlH6FZ4VYLQ8gqBYPcbufJyuc9FXOa7qu8MqXfIgruM9rxSHX0 1we8X6Yx/H97NC/OJG5wR1PDLLVSK0K5yUQ1lgcrfFpN5NAn7YkJaNbFFiKl4QSoaZ28 zIcajoPSF9szuU59+AjQCa8+TLTjnzR8au6r5lNrj+O2QtSiR4Db87U0ozPSjLCmpXuc KS8KQk9wVvq3IAl+8gLR6L92x/EyFL9QcPHrqWHBOvgxeBEWYxlLIPCG4yOTDdAbF/af 2YLA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s20-20020a170906961400b007263462902bsi1980927ejx.858.2022.07.01.07.48.12; Fri, 01 Jul 2022 07:48:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233534AbiGAOj5 (ORCPT + 99 others); Fri, 1 Jul 2022 10:39:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233327AbiGAOjp (ORCPT ); Fri, 1 Jul 2022 10:39:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 389A545055 for ; Fri, 1 Jul 2022 07:37:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C6F06B83076 for ; Fri, 1 Jul 2022 14:37:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7760CC341C7; Fri, 1 Jul 2022 14:37:38 +0000 (UTC) Subject: [PATCH v1] SUNRPC: Add ability to inject signals via fault injection From: Chuck Lever To: linux-nfs@vger.kernel.org Cc: kolga@netapp.com Date: Fri, 01 Jul 2022 10:37:37 -0400 Message-ID: <165668625750.3724818.8474699462148567863.stgit@morisot.1015granger.net> User-Agent: StGit/1.5 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Signal injection can help exercise signal handling paths in the SUNRPC scheduler and in transport implementations. Signed-off-by: Chuck Lever --- Documentation/fault-injection/fault-injection.rst | 7 +++++++ net/sunrpc/debugfs.c | 3 +++ net/sunrpc/fail.h | 1 + net/sunrpc/sched.c | 10 ++++++++++ 4 files changed, 21 insertions(+) diff --git a/Documentation/fault-injection/fault-injection.rst b/Documentation/fault-injection/fault-injection.rst index 17779a2772e5..ff5c4db2198f 100644 --- a/Documentation/fault-injection/fault-injection.rst +++ b/Documentation/fault-injection/fault-injection.rst @@ -162,6 +162,13 @@ configuration of fault-injection capabilities. default is 'N', setting it to 'Y' will disable disconnect injection on the RPC client. +- /sys/kernel/debug/fail_sunrpc/ignore-client-signals: + + Format: { 'Y' | 'N' } + + default is 'N', setting it to 'Y' will disable signal + injection on the RPC client. + - /sys/kernel/debug/fail_sunrpc/ignore-server-disconnect: Format: { 'Y' | 'N' } diff --git a/net/sunrpc/debugfs.c b/net/sunrpc/debugfs.c index a176d5a0b0ee..8df634e63f30 100644 --- a/net/sunrpc/debugfs.c +++ b/net/sunrpc/debugfs.c @@ -260,6 +260,9 @@ static void fail_sunrpc_init(void) debugfs_create_bool("ignore-client-disconnect", S_IFREG | 0600, dir, &fail_sunrpc.ignore_client_disconnect); + debugfs_create_bool("ignore-client-signals", S_IFREG | 0600, dir, + &fail_sunrpc.ignore_client_signals); + debugfs_create_bool("ignore-server-disconnect", S_IFREG | 0600, dir, &fail_sunrpc.ignore_server_disconnect); diff --git a/net/sunrpc/fail.h b/net/sunrpc/fail.h index 4b4b500df428..359ed0b2f600 100644 --- a/net/sunrpc/fail.h +++ b/net/sunrpc/fail.h @@ -14,6 +14,7 @@ struct fail_sunrpc_attr { struct fault_attr attr; bool ignore_client_disconnect; + bool ignore_client_signals; bool ignore_server_disconnect; bool ignore_cache_wait; }; diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index 7f70c1e608b7..1b1de8906a91 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c @@ -26,6 +26,7 @@ #include #include "sunrpc.h" +#include "fail.h" #define CREATE_TRACE_POINTS #include @@ -959,6 +960,12 @@ static void __rpc_execute(struct rpc_task *task) if (task_is_async) goto out; +#if IS_ENABLED(CONFIG_FAIL_SUNRPC) + if (!fail_sunrpc.ignore_client_signals && + should_fail(&fail_sunrpc.attr, 1)) + goto signalled; +#endif + /* sync task: sleep here */ trace_rpc_task_sync_sleep(task, task->tk_action); status = out_of_line_wait_on_bit(&task->tk_runstate, @@ -971,6 +978,9 @@ static void __rpc_execute(struct rpc_task *task) * clean up after sleeping on some queue, we don't * break the loop here, but go around once more. */ +#if IS_ENABLED(CONFIG_FAIL_SUNRPC) +signalled: +#endif trace_rpc_task_signalled(task, task->tk_action); set_bit(RPC_TASK_SIGNALLED, &task->tk_runstate); task->tk_rpc_status = -ERESTARTSYS;