Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

SUNRPC: Add a /sys/kernel/debug/fail_sunrpc/ directory

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>

+42
+7
lib/Kconfig.debug
··· 1971 1971 and to test how the mmc host driver handles retries from 1972 1972 the block device. 1973 1973 1974 + config FAIL_SUNRPC 1975 + bool "Fault-injection capability for SunRPC" 1976 + depends on FAULT_INJECTION_DEBUG_FS && SUNRPC_DEBUG 1977 + help 1978 + Provide fault-injection capability for SunRPC and 1979 + its consumers. 1980 + 1974 1981 config FAULT_INJECTION_STACKTRACE_FILTER 1975 1982 bool "stacktrace filter for fault-injection capabilities" 1976 1983 depends on FAULT_INJECTION_DEBUG_FS && STACKTRACE_SUPPORT
+14
net/sunrpc/debugfs.c
··· 8 8 #include <linux/debugfs.h> 9 9 #include <linux/sunrpc/sched.h> 10 10 #include <linux/sunrpc/clnt.h> 11 + 11 12 #include "netns.h" 13 + #include "fail.h" 12 14 13 15 static struct dentry *topdir; 14 16 static struct dentry *rpc_clnt_dir; ··· 299 297 .release = fault_release, 300 298 }; 301 299 300 + #if IS_ENABLED(CONFIG_FAIL_SUNRPC) 301 + struct fail_sunrpc_attr fail_sunrpc = { 302 + .attr = FAULT_ATTR_INITIALIZER, 303 + }; 304 + EXPORT_SYMBOL_GPL(fail_sunrpc); 305 + #endif 306 + 302 307 void __exit 303 308 sunrpc_debugfs_exit(void) 304 309 { ··· 330 321 331 322 debugfs_create_file("disconnect", S_IFREG | 0400, rpc_fault_dir, NULL, 332 323 &fault_disconnect_fops); 324 + 325 + #if IS_ENABLED(CONFIG_FAIL_SUNRPC) 326 + fault_create_debugfs_attr("fail_sunrpc", NULL, 327 + &fail_sunrpc.attr); 328 + #endif 333 329 }
+21
net/sunrpc/fail.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* 3 + * Copyright (C) 2021, Oracle. All rights reserved. 4 + */ 5 + 6 + #ifndef _NET_SUNRPC_FAIL_H_ 7 + #define _NET_SUNRPC_FAIL_H_ 8 + 9 + #include <linux/fault-inject.h> 10 + 11 + #if IS_ENABLED(CONFIG_FAULT_INJECTION) 12 + 13 + struct fail_sunrpc_attr { 14 + struct fault_attr attr; 15 + }; 16 + 17 + extern struct fail_sunrpc_attr fail_sunrpc; 18 + 19 + #endif /* CONFIG_FAULT_INJECTION */ 20 + 21 + #endif /* _NET_SUNRPC_FAIL_H_ */