* [PATCH v2 0/4] SunRPC fault injection
@ 2021-08-10 21:05 Chuck Lever
2021-08-10 21:06 ` [PATCH v2 1/4] SUNRPC: Add a /sys/kernel/debug/fail_sunrpc/ directory Chuck Lever
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Chuck Lever @ 2021-08-10 21:05 UTC (permalink / raw)
To: linux-nfs
The following series (re)implements SunRPC disconnect injection
using the kernel's generic fault injection infrastructure under
the debugfs. It's partially a clean-up and partially a fresh
implementation of server-side disconnect injection, while also
enabling the straightforward addition of further types of fault
injection in the future.
Changes since v1:
- Now builds properly with various combinations of CONFIG options
---
Chuck Lever (4):
SUNRPC: Add a /sys/kernel/debug/fail_sunrpc/ directory
SUNRPC: Server-side disconnect injection
SUNRPC: Move client-side disconnect injection
SUNRPC: Add documentation for the fail_sunrpc/ directory
.../fault-injection/fault-injection.rst | 18 +++++
include/linux/sunrpc/xprt.h | 18 -----
net/sunrpc/debugfs.c | 73 +++++--------------
net/sunrpc/fail.h | 24 ++++++
net/sunrpc/svc.c | 8 ++
net/sunrpc/xprt.c | 14 ++++
6 files changed, 84 insertions(+), 71 deletions(-)
create mode 100644 net/sunrpc/fail.h
--
Chuck Lever
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH v2 1/4] SUNRPC: Add a /sys/kernel/debug/fail_sunrpc/ directory 2021-08-10 21:05 [PATCH v2 0/4] SunRPC fault injection Chuck Lever @ 2021-08-10 21:06 ` Chuck Lever 2021-08-10 23:31 ` kernel test robot 2021-08-11 6:26 ` kernel test robot 2021-08-10 21:06 ` [PATCH v2 2/4] SUNRPC: Server-side disconnect injection Chuck Lever ` (2 subsequent siblings) 3 siblings, 2 replies; 9+ messages in thread From: Chuck Lever @ 2021-08-10 21:06 UTC (permalink / raw) To: linux-nfs This directory will contain a set of administrative controls for enabling error injection for kernel RPC consumers. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> --- net/sunrpc/debugfs.c | 23 +++++++++++++++++++++++ net/sunrpc/fail.h | 21 +++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 net/sunrpc/fail.h diff --git a/net/sunrpc/debugfs.c b/net/sunrpc/debugfs.c index 56029e3af6ff..dd9cf4cbda75 100644 --- a/net/sunrpc/debugfs.c +++ b/net/sunrpc/debugfs.c @@ -8,7 +8,9 @@ #include <linux/debugfs.h> #include <linux/sunrpc/sched.h> #include <linux/sunrpc/clnt.h> + #include "netns.h" +#include "fail.h" static struct dentry *topdir; static struct dentry *rpc_clnt_dir; @@ -297,6 +299,25 @@ static const struct file_operations fault_disconnect_fops = { .release = fault_release, }; + +#if IS_ENABLED(CONFIG_FAULT_INJECTION) +struct fail_sunrpc_attr fail_sunrpc = { + .attr = FAULT_ATTR_INITIALIZER, +}; + +#if IS_ENABLED(CONFIG_FAULT_INJECTION_DEBUG_FS) +static void fail_sunrpc_init(void) +{ + fault_create_debugfs_attr("fail_sunrpc", NULL, + &fail_sunrpc.attr); +} +#else +static inline void fail_sunrpc_init(void) +{ +} +#endif +#endif + void __exit sunrpc_debugfs_exit(void) { @@ -321,4 +342,6 @@ sunrpc_debugfs_init(void) debugfs_create_file("disconnect", S_IFREG | 0400, rpc_fault_dir, NULL, &fault_disconnect_fops); + + fail_sunrpc_init(); } diff --git a/net/sunrpc/fail.h b/net/sunrpc/fail.h new file mode 100644 index 000000000000..1d402b0d3453 --- /dev/null +++ b/net/sunrpc/fail.h @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2021, Oracle. All rights reserved. + */ + +#ifndef _NET_SUNRPC_FAIL_H_ +#define _NET_SUNRPC_FAIL_H_ + +#include <linux/fault-inject.h> + +#if IS_ENABLED(CONFIG_FAULT_INJECTION) + +struct fail_sunrpc_attr { + struct fault_attr attr; +}; + +extern struct fail_sunrpc_attr fail_sunrpc; + +#endif /* CONFIG_FAULT_INJECTION */ + +#endif /* _NET_SUNRPC_FAIL_H_ */ ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2 1/4] SUNRPC: Add a /sys/kernel/debug/fail_sunrpc/ directory 2021-08-10 21:06 ` [PATCH v2 1/4] SUNRPC: Add a /sys/kernel/debug/fail_sunrpc/ directory Chuck Lever @ 2021-08-10 23:31 ` kernel test robot 2021-08-11 6:26 ` kernel test robot 1 sibling, 0 replies; 9+ messages in thread From: kernel test robot @ 2021-08-10 23:31 UTC (permalink / raw) To: Chuck Lever, linux-nfs; +Cc: kbuild-all [-- Attachment #1: Type: text/plain, Size: 2418 bytes --] Hi Chuck, I love your patch! Yet something to improve: [auto build test ERROR on nfs/linux-next] [also build test ERROR on linus/master v5.14-rc5 next-20210810] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Chuck-Lever/SunRPC-fault-injection/20210811-050828 base: git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next config: xtensa-nommu_kc705_defconfig (attached as .config) compiler: xtensa-de212-linux-gcc (GCC) 10.3.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/0day-ci/linux/commit/fe621cd68ac79d864276194e88bf1384505db10b git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Chuck-Lever/SunRPC-fault-injection/20210811-050828 git checkout fe621cd68ac79d864276194e88bf1384505db10b # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross ARCH=xtensa If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): net/sunrpc/debugfs.c: In function 'sunrpc_debugfs_init': >> net/sunrpc/debugfs.c:346:2: error: implicit declaration of function 'fail_sunrpc_init' [-Werror=implicit-function-declaration] 346 | fail_sunrpc_init(); | ^~~~~~~~~~~~~~~~ cc1: some warnings being treated as errors vim +/fail_sunrpc_init +346 net/sunrpc/debugfs.c 329 330 void __init 331 sunrpc_debugfs_init(void) 332 { 333 struct dentry *rpc_fault_dir; 334 335 topdir = debugfs_create_dir("sunrpc", NULL); 336 337 rpc_clnt_dir = debugfs_create_dir("rpc_clnt", topdir); 338 339 rpc_xprt_dir = debugfs_create_dir("rpc_xprt", topdir); 340 341 rpc_fault_dir = debugfs_create_dir("inject_fault", topdir); 342 343 debugfs_create_file("disconnect", S_IFREG | 0400, rpc_fault_dir, NULL, 344 &fault_disconnect_fops); 345 > 346 fail_sunrpc_init(); --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org [-- Attachment #2: .config.gz --] [-- Type: application/gzip, Size: 12158 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 1/4] SUNRPC: Add a /sys/kernel/debug/fail_sunrpc/ directory 2021-08-10 21:06 ` [PATCH v2 1/4] SUNRPC: Add a /sys/kernel/debug/fail_sunrpc/ directory Chuck Lever 2021-08-10 23:31 ` kernel test robot @ 2021-08-11 6:26 ` kernel test robot 1 sibling, 0 replies; 9+ messages in thread From: kernel test robot @ 2021-08-11 6:26 UTC (permalink / raw) To: Chuck Lever, linux-nfs; +Cc: clang-built-linux, kbuild-all [-- Attachment #1: Type: text/plain, Size: 2382 bytes --] Hi Chuck, I love your patch! Yet something to improve: [auto build test ERROR on nfs/linux-next] [also build test ERROR on linus/master v5.14-rc5 next-20210810] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Chuck-Lever/SunRPC-fault-injection/20210811-050828 base: git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next config: x86_64-randconfig-a006-20210811 (attached as .config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d39ebdae674c8efc84ebe8dc32716ec353220530) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/0day-ci/linux/commit/fe621cd68ac79d864276194e88bf1384505db10b git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Chuck-Lever/SunRPC-fault-injection/20210811-050828 git checkout fe621cd68ac79d864276194e88bf1384505db10b # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): >> net/sunrpc/debugfs.c:346:2: error: implicit declaration of function 'fail_sunrpc_init' [-Werror,-Wimplicit-function-declaration] fail_sunrpc_init(); ^ 1 error generated. vim +/fail_sunrpc_init +346 net/sunrpc/debugfs.c 329 330 void __init 331 sunrpc_debugfs_init(void) 332 { 333 struct dentry *rpc_fault_dir; 334 335 topdir = debugfs_create_dir("sunrpc", NULL); 336 337 rpc_clnt_dir = debugfs_create_dir("rpc_clnt", topdir); 338 339 rpc_xprt_dir = debugfs_create_dir("rpc_xprt", topdir); 340 341 rpc_fault_dir = debugfs_create_dir("inject_fault", topdir); 342 343 debugfs_create_file("disconnect", S_IFREG | 0400, rpc_fault_dir, NULL, 344 &fault_disconnect_fops); 345 > 346 fail_sunrpc_init(); --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org [-- Attachment #2: .config.gz --] [-- Type: application/gzip, Size: 39081 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 2/4] SUNRPC: Server-side disconnect injection 2021-08-10 21:05 [PATCH v2 0/4] SunRPC fault injection Chuck Lever 2021-08-10 21:06 ` [PATCH v2 1/4] SUNRPC: Add a /sys/kernel/debug/fail_sunrpc/ directory Chuck Lever @ 2021-08-10 21:06 ` Chuck Lever 2021-08-11 10:39 ` kernel test robot 2021-08-10 21:06 ` [PATCH v2 3/4] SUNRPC: Move client-side " Chuck Lever 2021-08-10 21:06 ` [PATCH v2 4/4] SUNRPC: Add documentation for the fail_sunrpc/ directory Chuck Lever 3 siblings, 1 reply; 9+ messages in thread From: Chuck Lever @ 2021-08-10 21:06 UTC (permalink / raw) To: linux-nfs Disconnect injection stress-tests the ability for both client and server implementations to behave resiliently in the face of network instability. A file called /sys/kernel/debug/fail_sunrpc/ignore-server-disconnect enables administrators to turn off server-side disconnect injection while allowing other types of sunrpc errors to be injected. So far there are no others. The default setting is that server-side disconnect injection is enabled (ignore=false). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> --- net/sunrpc/debugfs.c | 9 +++++++-- net/sunrpc/fail.h | 2 ++ net/sunrpc/svc.c | 8 ++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/net/sunrpc/debugfs.c b/net/sunrpc/debugfs.c index dd9cf4cbda75..cdc6f0ded5ca 100644 --- a/net/sunrpc/debugfs.c +++ b/net/sunrpc/debugfs.c @@ -308,8 +308,13 @@ struct fail_sunrpc_attr fail_sunrpc = { #if IS_ENABLED(CONFIG_FAULT_INJECTION_DEBUG_FS) static void fail_sunrpc_init(void) { - fault_create_debugfs_attr("fail_sunrpc", NULL, - &fail_sunrpc.attr); + struct dentry *dir; + + dir = fault_create_debugfs_attr("fail_sunrpc", NULL, + &fail_sunrpc.attr); + + debugfs_create_bool("ignore-server-disconnect", S_IFREG | 0600, dir, + &fail_sunrpc.ignore_server_disconnect); } #else static inline void fail_sunrpc_init(void) diff --git a/net/sunrpc/fail.h b/net/sunrpc/fail.h index 1d402b0d3453..33ed557530ba 100644 --- a/net/sunrpc/fail.h +++ b/net/sunrpc/fail.h @@ -12,6 +12,8 @@ struct fail_sunrpc_attr { struct fault_attr attr; + + bool ignore_server_disconnect; }; extern struct fail_sunrpc_attr fail_sunrpc; diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index 35b549c147a2..c435f0061007 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c @@ -31,6 +31,8 @@ #include <trace/events/sunrpc.h> +#include "fail.h" + #define RPCDBG_FACILITY RPCDBG_SVCDSP static void svc_unregister(const struct svc_serv *serv, struct net *net); @@ -1507,6 +1509,12 @@ svc_process(struct svc_rqst *rqstp) struct svc_serv *serv = rqstp->rq_server; u32 dir; +#if IS_ENABLED(CONFIG_FAULT_INJECTION) + if (!fail_sunrpc.ignore_server_disconnect && + should_fail(&fail_sunrpc.attr, 1)) + svc_xprt_deferred_close(rqstp->rq_xprt); +#endif + /* * Setup response xdr_buf. * Initially it has just one page ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2 2/4] SUNRPC: Server-side disconnect injection 2021-08-10 21:06 ` [PATCH v2 2/4] SUNRPC: Server-side disconnect injection Chuck Lever @ 2021-08-11 10:39 ` kernel test robot 0 siblings, 0 replies; 9+ messages in thread From: kernel test robot @ 2021-08-11 10:39 UTC (permalink / raw) To: Chuck Lever, linux-nfs; +Cc: kbuild-all [-- Attachment #1: Type: text/plain, Size: 1743 bytes --] Hi Chuck, I love your patch! Yet something to improve: [auto build test ERROR on nfs/linux-next] [also build test ERROR on linus/master v5.14-rc5] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Chuck-Lever/SunRPC-fault-injection/20210811-050828 base: git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next config: parisc-randconfig-r014-20210811 (attached as .config) compiler: hppa-linux-gcc (GCC) 10.3.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/0day-ci/linux/commit/d79f2f148971c84a535defe82f0834489c4e8d62 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Chuck-Lever/SunRPC-fault-injection/20210811-050828 git checkout d79f2f148971c84a535defe82f0834489c4e8d62 # save the attached .config to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross O=build_dir ARCH=parisc SHELL=/bin/bash If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): hppa-linux-ld: net/sunrpc/svc.o: in function `svc_process': >> (.text+0x5370): undefined reference to `fail_sunrpc' >> hppa-linux-ld: (.text+0x5374): undefined reference to `fail_sunrpc' --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org [-- Attachment #2: .config.gz --] [-- Type: application/gzip, Size: 35579 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 3/4] SUNRPC: Move client-side disconnect injection 2021-08-10 21:05 [PATCH v2 0/4] SunRPC fault injection Chuck Lever 2021-08-10 21:06 ` [PATCH v2 1/4] SUNRPC: Add a /sys/kernel/debug/fail_sunrpc/ directory Chuck Lever 2021-08-10 21:06 ` [PATCH v2 2/4] SUNRPC: Server-side disconnect injection Chuck Lever @ 2021-08-10 21:06 ` Chuck Lever 2021-08-11 4:08 ` kernel test robot 2021-08-10 21:06 ` [PATCH v2 4/4] SUNRPC: Add documentation for the fail_sunrpc/ directory Chuck Lever 3 siblings, 1 reply; 9+ messages in thread From: Chuck Lever @ 2021-08-10 21:06 UTC (permalink / raw) To: linux-nfs Disconnect injection stress-tests the ability for both client and server implementations to behave resiliently in the face of network instability. Convert the existing client-side disconnect injection infrastructure to use the kernel's generic error injection facility. The generic facility has a richer set of injection criteria. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> --- include/linux/sunrpc/xprt.h | 18 ------------ net/sunrpc/debugfs.c | 65 +------------------------------------------ net/sunrpc/fail.h | 1 + net/sunrpc/xprt.c | 14 +++++++++ 4 files changed, 17 insertions(+), 81 deletions(-) diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h index c8c39f22d3b1..b15c1f07162d 100644 --- a/include/linux/sunrpc/xprt.h +++ b/include/linux/sunrpc/xprt.h @@ -288,7 +288,6 @@ struct rpc_xprt { const char *address_strings[RPC_DISPLAY_MAX]; #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) struct dentry *debugfs; /* debugfs directory */ - atomic_t inject_disconnect; #endif struct rcu_head rcu; const struct xprt_class *xprt_class; @@ -502,21 +501,4 @@ static inline int xprt_test_and_set_binding(struct rpc_xprt *xprt) return test_and_set_bit(XPRT_BINDING, &xprt->state); } -#if IS_ENABLED(CONFIG_SUNRPC_DEBUG) -extern unsigned int rpc_inject_disconnect; -static inline void xprt_inject_disconnect(struct rpc_xprt *xprt) -{ - if (!rpc_inject_disconnect) - return; - if (atomic_dec_return(&xprt->inject_disconnect)) - return; - atomic_set(&xprt->inject_disconnect, rpc_inject_disconnect); - xprt->ops->inject_disconnect(xprt); -} -#else -static inline void xprt_inject_disconnect(struct rpc_xprt *xprt) -{ -} -#endif - #endif /* _LINUX_SUNRPC_XPRT_H */ diff --git a/net/sunrpc/debugfs.c b/net/sunrpc/debugfs.c index cdc6f0ded5ca..ce479cc0c696 100644 --- a/net/sunrpc/debugfs.c +++ b/net/sunrpc/debugfs.c @@ -16,8 +16,6 @@ static struct dentry *topdir; static struct dentry *rpc_clnt_dir; static struct dentry *rpc_xprt_dir; -unsigned int rpc_inject_disconnect; - static int tasks_show(struct seq_file *f, void *v) { @@ -237,8 +235,6 @@ rpc_xprt_debugfs_register(struct rpc_xprt *xprt) /* make tasks file */ debugfs_create_file("info", S_IFREG | 0400, xprt->debugfs, xprt, &xprt_info_fops); - - atomic_set(&xprt->inject_disconnect, rpc_inject_disconnect); } void @@ -248,58 +244,6 @@ rpc_xprt_debugfs_unregister(struct rpc_xprt *xprt) xprt->debugfs = NULL; } -static int -fault_open(struct inode *inode, struct file *filp) -{ - filp->private_data = kmalloc(128, GFP_KERNEL); - if (!filp->private_data) - return -ENOMEM; - return 0; -} - -static int -fault_release(struct inode *inode, struct file *filp) -{ - kfree(filp->private_data); - return 0; -} - -static ssize_t -fault_disconnect_read(struct file *filp, char __user *user_buf, - size_t len, loff_t *offset) -{ - char *buffer = (char *)filp->private_data; - size_t size; - - size = sprintf(buffer, "%u\n", rpc_inject_disconnect); - return simple_read_from_buffer(user_buf, len, offset, buffer, size); -} - -static ssize_t -fault_disconnect_write(struct file *filp, const char __user *user_buf, - size_t len, loff_t *offset) -{ - char buffer[16]; - - if (len >= sizeof(buffer)) - len = sizeof(buffer) - 1; - if (copy_from_user(buffer, user_buf, len)) - return -EFAULT; - buffer[len] = '\0'; - if (kstrtouint(buffer, 10, &rpc_inject_disconnect)) - return -EINVAL; - return len; -} - -static const struct file_operations fault_disconnect_fops = { - .owner = THIS_MODULE, - .open = fault_open, - .read = fault_disconnect_read, - .write = fault_disconnect_write, - .release = fault_release, -}; - - #if IS_ENABLED(CONFIG_FAULT_INJECTION) struct fail_sunrpc_attr fail_sunrpc = { .attr = FAULT_ATTR_INITIALIZER, @@ -315,6 +259,8 @@ static void fail_sunrpc_init(void) debugfs_create_bool("ignore-server-disconnect", S_IFREG | 0600, dir, &fail_sunrpc.ignore_server_disconnect); + debugfs_create_bool("ignore-client-disconnect", S_IFREG | 0600, dir, + &fail_sunrpc.ignore_client_disconnect); } #else static inline void fail_sunrpc_init(void) @@ -335,18 +281,11 @@ sunrpc_debugfs_exit(void) void __init sunrpc_debugfs_init(void) { - struct dentry *rpc_fault_dir; - topdir = debugfs_create_dir("sunrpc", NULL); rpc_clnt_dir = debugfs_create_dir("rpc_clnt", topdir); rpc_xprt_dir = debugfs_create_dir("rpc_xprt", topdir); - rpc_fault_dir = debugfs_create_dir("inject_fault", topdir); - - debugfs_create_file("disconnect", S_IFREG | 0400, rpc_fault_dir, NULL, - &fault_disconnect_fops); - fail_sunrpc_init(); } diff --git a/net/sunrpc/fail.h b/net/sunrpc/fail.h index 33ed557530ba..1759395b75b3 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_server_disconnect; + bool ignore_client_disconnect; }; extern struct fail_sunrpc_attr fail_sunrpc; diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index fb6db09725c7..9d1a14ba44cb 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c @@ -56,6 +56,7 @@ #include "sunrpc.h" #include "sysfs.h" +#include "fail.h" /* * Local variables @@ -855,6 +856,19 @@ xprt_init_autodisconnect(struct timer_list *t) queue_work(xprtiod_workqueue, &xprt->task_cleanup); } +#if IS_ENABLED(CONFIG_FAULT_INJECTION) +static void xprt_inject_disconnect(struct rpc_xprt *xprt) +{ + if (!fail_sunrpc.ignore_client_disconnect && + should_fail(&fail_sunrpc.attr, 1)) + xprt->ops->inject_disconnect(xprt); +} +#else +static inline void xprt_inject_disconnect(struct rpc_xprt *xprt) +{ +} +#endif + bool xprt_lock_connect(struct rpc_xprt *xprt, struct rpc_task *task, void *cookie) ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2 3/4] SUNRPC: Move client-side disconnect injection 2021-08-10 21:06 ` [PATCH v2 3/4] SUNRPC: Move client-side " Chuck Lever @ 2021-08-11 4:08 ` kernel test robot 0 siblings, 0 replies; 9+ messages in thread From: kernel test robot @ 2021-08-11 4:08 UTC (permalink / raw) To: Chuck Lever, linux-nfs; +Cc: kbuild-all [-- Attachment #1: Type: text/plain, Size: 2230 bytes --] Hi Chuck, I love your patch! Yet something to improve: [auto build test ERROR on nfs/linux-next] [also build test ERROR on linus/master v5.14-rc5 next-20210810] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Chuck-Lever/SunRPC-fault-injection/20210811-050828 base: git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next config: openrisc-randconfig-r025-20210811 (attached as .config) compiler: or1k-linux-gcc (GCC) 10.3.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/0day-ci/linux/commit/f1aa75010640cf376cac8baca8d42fda71472772 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Chuck-Lever/SunRPC-fault-injection/20210811-050828 git checkout f1aa75010640cf376cac8baca8d42fda71472772 # save the attached .config to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross O=build_dir ARCH=openrisc SHELL=/bin/bash If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): or1k-linux-ld: net/sunrpc/xprt.o: in function `xprt_inject_disconnect': xprt.c:(.text+0x2dd4): undefined reference to `fail_sunrpc' >> or1k-linux-ld: xprt.c:(.text+0x2dd8): undefined reference to `fail_sunrpc' or1k-linux-ld: net/sunrpc/xprt.o: in function `xprt_end_transmit': xprt.c:(.text+0x7b20): undefined reference to `fail_sunrpc' or1k-linux-ld: xprt.c:(.text+0x7b28): undefined reference to `fail_sunrpc' or1k-linux-ld: net/sunrpc/svc.o: in function `svc_process': svc.c:(.text+0x4f64): undefined reference to `fail_sunrpc' or1k-linux-ld: net/sunrpc/svc.o:svc.c:(.text+0x4f80): more undefined references to `fail_sunrpc' follow --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org [-- Attachment #2: .config.gz --] [-- Type: application/gzip, Size: 33867 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 4/4] SUNRPC: Add documentation for the fail_sunrpc/ directory 2021-08-10 21:05 [PATCH v2 0/4] SunRPC fault injection Chuck Lever ` (2 preceding siblings ...) 2021-08-10 21:06 ` [PATCH v2 3/4] SUNRPC: Move client-side " Chuck Lever @ 2021-08-10 21:06 ` Chuck Lever 3 siblings, 0 replies; 9+ messages in thread From: Chuck Lever @ 2021-08-10 21:06 UTC (permalink / raw) To: linux-nfs Signed-off-by: Chuck Lever <chuck.lever@oracle.com> --- Documentation/fault-injection/fault-injection.rst | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Documentation/fault-injection/fault-injection.rst b/Documentation/fault-injection/fault-injection.rst index f47d05ed0d94..4a25c5eb6f07 100644 --- a/Documentation/fault-injection/fault-injection.rst +++ b/Documentation/fault-injection/fault-injection.rst @@ -24,6 +24,10 @@ Available fault injection capabilities injects futex deadlock and uaddr fault errors. +- fail_sunrpc + + injects kernel RPC client and server failures. + - fail_make_request injects disk IO errors on devices permitted by setting @@ -151,6 +155,20 @@ configuration of fault-injection capabilities. default is 'N', setting it to 'Y' will disable failure injections when dealing with private (address space) futexes. +- /sys/kernel/debug/fail_sunrpc/ignore-client-disconnect: + + Format: { 'Y' | 'N' } + + default is 'N', setting it to 'Y' will disable disconnect + injection on the RPC client. + +- /sys/kernel/debug/fail_sunrpc/ignore-server-disconnect: + + Format: { 'Y' | 'N' } + + default is 'N', setting it to 'Y' will disable disconnect + injection on the RPC server. + - /sys/kernel/debug/fail_function/inject: Format: { 'function-name' | '!function-name' | '' } ^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2021-08-11 10:40 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-08-10 21:05 [PATCH v2 0/4] SunRPC fault injection Chuck Lever 2021-08-10 21:06 ` [PATCH v2 1/4] SUNRPC: Add a /sys/kernel/debug/fail_sunrpc/ directory Chuck Lever 2021-08-10 23:31 ` kernel test robot 2021-08-11 6:26 ` kernel test robot 2021-08-10 21:06 ` [PATCH v2 2/4] SUNRPC: Server-side disconnect injection Chuck Lever 2021-08-11 10:39 ` kernel test robot 2021-08-10 21:06 ` [PATCH v2 3/4] SUNRPC: Move client-side " Chuck Lever 2021-08-11 4:08 ` kernel test robot 2021-08-10 21:06 ` [PATCH v2 4/4] SUNRPC: Add documentation for the fail_sunrpc/ directory Chuck Lever
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox