summaryrefslogtreecommitdiffstats
path: root/net/sunrpc/xprtsock.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@poochiereds.net>2015-06-03 16:14:29 -0400
committerTrond Myklebust <trond.myklebust@primarydata.com>2015-06-10 18:26:26 -0400
commitd67fa4d85a2143b46052b2e9ccc6749a4c97b2de (patch)
treea594a793ca2c827f383965e25d0a5d2d2a790287 /net/sunrpc/xprtsock.c
parentd6e971d8ecafee18ff9cc1ac646eb0817ab8b143 (diff)
sunrpc: turn swapper_enable/disable functions into rpc_xprt_ops
RDMA xprts don't have a sock_xprt, but an rdma_xprt, so the xs_swapper_enable/disable functions will likely oops when fed an RDMA xprt. Turn these functions into rpc_xprt_ops so that that doesn't occur. For now the RDMA versions are no-ops that just return -EINVAL on an attempt to swapon. Cc: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Jeff Layton <jeff.layton@primarydata.com> Reviewed-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'net/sunrpc/xprtsock.c')
-rw-r--r--net/sunrpc/xprtsock.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index e0efd8514886..bf20726d4ab5 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1980,14 +1980,14 @@ static void xs_set_memalloc(struct rpc_xprt *xprt)
1980} 1980}
1981 1981
1982/** 1982/**
1983 * xs_swapper_enable - Tag this transport as being used for swap. 1983 * xs_enable_swap - Tag this transport as being used for swap.
1984 * @xprt: transport to tag 1984 * @xprt: transport to tag
1985 * 1985 *
1986 * Take a reference to this transport on behalf of the rpc_clnt, and 1986 * Take a reference to this transport on behalf of the rpc_clnt, and
1987 * optionally mark it for swapping if it wasn't already. 1987 * optionally mark it for swapping if it wasn't already.
1988 */ 1988 */
1989int 1989static int
1990xs_swapper_enable(struct rpc_xprt *xprt) 1990xs_enable_swap(struct rpc_xprt *xprt)
1991{ 1991{
1992 struct sock_xprt *xs = container_of(xprt, struct sock_xprt, xprt); 1992 struct sock_xprt *xs = container_of(xprt, struct sock_xprt, xprt);
1993 1993
@@ -2002,14 +2002,14 @@ xs_swapper_enable(struct rpc_xprt *xprt)
2002} 2002}
2003 2003
2004/** 2004/**
2005 * xs_swapper_disable - Untag this transport as being used for swap. 2005 * xs_disable_swap - Untag this transport as being used for swap.
2006 * @xprt: transport to tag 2006 * @xprt: transport to tag
2007 * 2007 *
2008 * Drop a "swapper" reference to this xprt on behalf of the rpc_clnt. If the 2008 * Drop a "swapper" reference to this xprt on behalf of the rpc_clnt. If the
2009 * swapper refcount goes to 0, untag the socket as a memalloc socket. 2009 * swapper refcount goes to 0, untag the socket as a memalloc socket.
2010 */ 2010 */
2011void 2011static void
2012xs_swapper_disable(struct rpc_xprt *xprt) 2012xs_disable_swap(struct rpc_xprt *xprt)
2013{ 2013{
2014 struct sock_xprt *xs = container_of(xprt, struct sock_xprt, xprt); 2014 struct sock_xprt *xs = container_of(xprt, struct sock_xprt, xprt);
2015 2015
@@ -2025,6 +2025,17 @@ xs_swapper_disable(struct rpc_xprt *xprt)
2025static void xs_set_memalloc(struct rpc_xprt *xprt) 2025static void xs_set_memalloc(struct rpc_xprt *xprt)
2026{ 2026{
2027} 2027}
2028
2029static int
2030xs_enable_swap(struct rpc_xprt *xprt)
2031{
2032 return -EINVAL;
2033}
2034
2035static void
2036xs_disable_swap(struct rpc_xprt *xprt)
2037{
2038}
2028#endif 2039#endif
2029 2040
2030static void xs_udp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock) 2041static void xs_udp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock)
@@ -2488,6 +2499,8 @@ static struct rpc_xprt_ops xs_local_ops = {
2488 .close = xs_close, 2499 .close = xs_close,
2489 .destroy = xs_destroy, 2500 .destroy = xs_destroy,
2490 .print_stats = xs_local_print_stats, 2501 .print_stats = xs_local_print_stats,
2502 .enable_swap = xs_enable_swap,
2503 .disable_swap = xs_disable_swap,
2491}; 2504};
2492 2505
2493static struct rpc_xprt_ops xs_udp_ops = { 2506static struct rpc_xprt_ops xs_udp_ops = {
@@ -2507,6 +2520,8 @@ static struct rpc_xprt_ops xs_udp_ops = {
2507 .close = xs_close, 2520 .close = xs_close,
2508 .destroy = xs_destroy, 2521 .destroy = xs_destroy,
2509 .print_stats = xs_udp_print_stats, 2522 .print_stats = xs_udp_print_stats,
2523 .enable_swap = xs_enable_swap,
2524 .disable_swap = xs_disable_swap,
2510}; 2525};
2511 2526
2512static struct rpc_xprt_ops xs_tcp_ops = { 2527static struct rpc_xprt_ops xs_tcp_ops = {
@@ -2523,6 +2538,8 @@ static struct rpc_xprt_ops xs_tcp_ops = {
2523 .close = xs_tcp_shutdown, 2538 .close = xs_tcp_shutdown,
2524 .destroy = xs_destroy, 2539 .destroy = xs_destroy,
2525 .print_stats = xs_tcp_print_stats, 2540 .print_stats = xs_tcp_print_stats,
2541 .enable_swap = xs_enable_swap,
2542 .disable_swap = xs_disable_swap,
2526}; 2543};
2527 2544
2528/* 2545/*
@@ -2540,6 +2557,8 @@ static struct rpc_xprt_ops bc_tcp_ops = {
2540 .close = bc_close, 2557 .close = bc_close,
2541 .destroy = bc_destroy, 2558 .destroy = bc_destroy,
2542 .print_stats = xs_tcp_print_stats, 2559 .print_stats = xs_tcp_print_stats,
2560 .enable_swap = xs_enable_swap,
2561 .disable_swap = xs_disable_swap,
2543}; 2562};
2544 2563
2545static int xs_init_anyaddr(const int family, struct sockaddr *sap) 2564static int xs_init_anyaddr(const int family, struct sockaddr *sap)