]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
SUNRPC: Make freeing of struct xprt rcu-safe
authorTrond Myklebust <trond.myklebust@primarydata.com>
Sat, 14 Feb 2015 22:48:49 +0000 (17:48 -0500)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Mon, 1 Feb 2016 02:37:23 +0000 (21:37 -0500)
Have it call kfree_rcu() to ensure that we can use it on rcu-protected
lists.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
include/linux/sunrpc/xprt.h
net/sunrpc/xprt.c

index 1bdb59a2efe8e48badd0e53ab429428fa6f04383..83218129ff285bb05f251844f698f2f7ebe60800 100644 (file)
@@ -257,6 +257,7 @@ struct rpc_xprt {
        struct dentry           *debugfs;               /* debugfs directory */
        atomic_t                inject_disconnect;
 #endif
+       struct rcu_head         rcu;
 };
 
 #if defined(CONFIG_SUNRPC_BACKCHANNEL)
index d8fd84c0cbbaa70d514314a3e8bf8b7df6aeae9d..605858699f6c9201f530400cf014af4a5231aa0e 100644 (file)
@@ -48,6 +48,7 @@
 #include <linux/sunrpc/clnt.h>
 #include <linux/sunrpc/metrics.h>
 #include <linux/sunrpc/bc_xprt.h>
+#include <linux/rcupdate.h>
 
 #include <trace/events/sunrpc.h>
 
@@ -1166,7 +1167,7 @@ void xprt_free(struct rpc_xprt *xprt)
 {
        put_net(xprt->xprt_net);
        xprt_free_all_slots(xprt);
-       kfree(xprt);
+       kfree_rcu(xprt, rcu);
 }
 EXPORT_SYMBOL_GPL(xprt_free);