]> git.baikalelectronics.ru Git - kernel.git/commitdiff
SUNRPC: Server-side disconnect injection
authorChuck Lever <chuck.lever@oracle.com>
Tue, 3 Aug 2021 19:55:58 +0000 (15:55 -0400)
committerChuck Lever <chuck.lever@oracle.com>
Fri, 20 Aug 2021 17:50:33 +0000 (13:50 -0400)
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. 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
net/sunrpc/fail.h
net/sunrpc/svc.c

index 04e453ad3508288de5af71b22e9333876bac909a..827bf3a2817888f022f6d0fe75bd74e7458f19f1 100644 (file)
@@ -259,6 +259,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-server-disconnect", S_IFREG | 0600, dir,
+                           &fail_sunrpc.ignore_server_disconnect);
 }
 #else
 static void fail_sunrpc_init(void)
index 62c1b9fd59e21eb454e87980f3a43300095f5188..69dc30cc44b84417ba52388d52c7d5c65502c01e 100644 (file)
@@ -14,6 +14,8 @@ struct fail_sunrpc_attr {
        struct fault_attr       attr;
 
        bool                    ignore_client_disconnect;
+
+       bool                    ignore_server_disconnect;
 };
 
 extern struct fail_sunrpc_attr fail_sunrpc;
index 5aa263326b6add9286af93c03aaeb990d7db5088..bfcbaf7b3822fbdcf5e5138938bcf44210ac5b0d 100644 (file)
@@ -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);
@@ -1524,6 +1526,12 @@ svc_process(struct svc_rqst *rqstp)
        struct svc_serv         *serv = rqstp->rq_server;
        u32                     dir;
 
+#if IS_ENABLED(CONFIG_FAIL_SUNRPC)
+       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