diff options
-rw-r--r-- | include/linux/sunrpc/xprt.h | 3 | ||||
-rw-r--r-- | net/sunrpc/xprt.c | 4 | ||||
-rw-r--r-- | net/sunrpc/xprtrdma/transport.c | 2 | ||||
-rw-r--r-- | net/sunrpc/xprtsock.c | 2 |
4 files changed, 7 insertions, 4 deletions
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h index c4f931597d0e..89d10d279a20 100644 --- a/include/linux/sunrpc/xprt.h +++ b/include/linux/sunrpc/xprt.h | |||
@@ -224,6 +224,7 @@ struct rpc_xprt { | |||
224 | bklog_u; /* backlog queue utilization */ | 224 | bklog_u; /* backlog queue utilization */ |
225 | } stat; | 225 | } stat; |
226 | 226 | ||
227 | struct net *xprt_net; | ||
227 | const char *address_strings[RPC_DISPLAY_MAX]; | 228 | const char *address_strings[RPC_DISPLAY_MAX]; |
228 | }; | 229 | }; |
229 | 230 | ||
@@ -281,7 +282,7 @@ void xprt_release_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task); | |||
281 | void xprt_release(struct rpc_task *task); | 282 | void xprt_release(struct rpc_task *task); |
282 | struct rpc_xprt * xprt_get(struct rpc_xprt *xprt); | 283 | struct rpc_xprt * xprt_get(struct rpc_xprt *xprt); |
283 | void xprt_put(struct rpc_xprt *xprt); | 284 | void xprt_put(struct rpc_xprt *xprt); |
284 | struct rpc_xprt * xprt_alloc(int size, int max_req); | 285 | struct rpc_xprt * xprt_alloc(struct net *net, int size, int max_req); |
285 | void xprt_free(struct rpc_xprt *); | 286 | void xprt_free(struct rpc_xprt *); |
286 | 287 | ||
287 | static inline __be32 *xprt_skip_transport_header(struct rpc_xprt *xprt, __be32 *p) | 288 | static inline __be32 *xprt_skip_transport_header(struct rpc_xprt *xprt, __be32 *p) |
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 0637340e5342..953206d8c6c2 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c | |||
@@ -962,7 +962,7 @@ static void xprt_free_slot(struct rpc_xprt *xprt, struct rpc_rqst *req) | |||
962 | spin_unlock(&xprt->reserve_lock); | 962 | spin_unlock(&xprt->reserve_lock); |
963 | } | 963 | } |
964 | 964 | ||
965 | struct rpc_xprt *xprt_alloc(int size, int max_req) | 965 | struct rpc_xprt *xprt_alloc(struct net *net, int size, int max_req) |
966 | { | 966 | { |
967 | struct rpc_xprt *xprt; | 967 | struct rpc_xprt *xprt; |
968 | 968 | ||
@@ -975,6 +975,7 @@ struct rpc_xprt *xprt_alloc(int size, int max_req) | |||
975 | if (xprt->slot == NULL) | 975 | if (xprt->slot == NULL) |
976 | goto out_free; | 976 | goto out_free; |
977 | 977 | ||
978 | xprt->xprt_net = get_net(net); | ||
978 | return xprt; | 979 | return xprt; |
979 | 980 | ||
980 | out_free: | 981 | out_free: |
@@ -986,6 +987,7 @@ EXPORT_SYMBOL_GPL(xprt_alloc); | |||
986 | 987 | ||
987 | void xprt_free(struct rpc_xprt *xprt) | 988 | void xprt_free(struct rpc_xprt *xprt) |
988 | { | 989 | { |
990 | put_net(xprt->xprt_net); | ||
989 | kfree(xprt->slot); | 991 | kfree(xprt->slot); |
990 | kfree(xprt); | 992 | kfree(xprt); |
991 | } | 993 | } |
diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c index 0f7a1b9d05ad..2da32b40bfcf 100644 --- a/net/sunrpc/xprtrdma/transport.c +++ b/net/sunrpc/xprtrdma/transport.c | |||
@@ -283,7 +283,7 @@ xprt_setup_rdma(struct xprt_create *args) | |||
283 | return ERR_PTR(-EBADF); | 283 | return ERR_PTR(-EBADF); |
284 | } | 284 | } |
285 | 285 | ||
286 | xprt = xprt_alloc(sizeof(struct rpcrdma_xprt), | 286 | xprt = xprt_alloc(args->net, sizeof(struct rpcrdma_xprt), |
287 | xprt_rdma_slot_table_entries); | 287 | xprt_rdma_slot_table_entries); |
288 | if (xprt == NULL) { | 288 | if (xprt == NULL) { |
289 | dprintk("RPC: %s: couldn't allocate rpcrdma_xprt\n", | 289 | dprintk("RPC: %s: couldn't allocate rpcrdma_xprt\n", |
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index b1e36ec6fd80..4ef3a6a9445c 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -2272,7 +2272,7 @@ static struct rpc_xprt *xs_setup_xprt(struct xprt_create *args, | |||
2272 | return ERR_PTR(-EBADF); | 2272 | return ERR_PTR(-EBADF); |
2273 | } | 2273 | } |
2274 | 2274 | ||
2275 | xprt = xprt_alloc(sizeof(*new), slot_table_size); | 2275 | xprt = xprt_alloc(args->net, sizeof(*new), slot_table_size); |
2276 | if (xprt == NULL) { | 2276 | if (xprt == NULL) { |
2277 | dprintk("RPC: xs_setup_xprt: couldn't allocate " | 2277 | dprintk("RPC: xs_setup_xprt: couldn't allocate " |
2278 | "rpc_xprt\n"); | 2278 | "rpc_xprt\n"); |