diff options
author | Trond Myklebust <trond.myklebust@primarydata.com> | 2015-02-14 17:48:49 -0500 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2016-01-31 21:37:23 -0500 |
commit | fda1bfef9e465b28260d27cd9e538dd601c4cdc1 (patch) | |
tree | 125a5a8dbc027a9149d5ad4208bd27fe68a8009f | |
parent | 30c5116b113689c87a711a0963753adadd702c04 (diff) |
SUNRPC: Make freeing of struct xprt rcu-safe
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>
-rw-r--r-- | include/linux/sunrpc/xprt.h | 1 | ||||
-rw-r--r-- | net/sunrpc/xprt.c | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h index 1bdb59a2efe8..83218129ff28 100644 --- a/include/linux/sunrpc/xprt.h +++ b/include/linux/sunrpc/xprt.h | |||
@@ -257,6 +257,7 @@ struct rpc_xprt { | |||
257 | struct dentry *debugfs; /* debugfs directory */ | 257 | struct dentry *debugfs; /* debugfs directory */ |
258 | atomic_t inject_disconnect; | 258 | atomic_t inject_disconnect; |
259 | #endif | 259 | #endif |
260 | struct rcu_head rcu; | ||
260 | }; | 261 | }; |
261 | 262 | ||
262 | #if defined(CONFIG_SUNRPC_BACKCHANNEL) | 263 | #if defined(CONFIG_SUNRPC_BACKCHANNEL) |
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index d8fd84c0cbba..605858699f6c 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c | |||
@@ -48,6 +48,7 @@ | |||
48 | #include <linux/sunrpc/clnt.h> | 48 | #include <linux/sunrpc/clnt.h> |
49 | #include <linux/sunrpc/metrics.h> | 49 | #include <linux/sunrpc/metrics.h> |
50 | #include <linux/sunrpc/bc_xprt.h> | 50 | #include <linux/sunrpc/bc_xprt.h> |
51 | #include <linux/rcupdate.h> | ||
51 | 52 | ||
52 | #include <trace/events/sunrpc.h> | 53 | #include <trace/events/sunrpc.h> |
53 | 54 | ||
@@ -1166,7 +1167,7 @@ void xprt_free(struct rpc_xprt *xprt) | |||
1166 | { | 1167 | { |
1167 | put_net(xprt->xprt_net); | 1168 | put_net(xprt->xprt_net); |
1168 | xprt_free_all_slots(xprt); | 1169 | xprt_free_all_slots(xprt); |
1169 | kfree(xprt); | 1170 | kfree_rcu(xprt, rcu); |
1170 | } | 1171 | } |
1171 | EXPORT_SYMBOL_GPL(xprt_free); | 1172 | EXPORT_SYMBOL_GPL(xprt_free); |
1172 | 1173 | ||