sunrpc: clean up "swapper" xprt handling
Subsystems (4)
v3 cover sunrpc: clean up "swapper" xprt handling
v3:
- make "enable" operations return -EINVAL when CONFIG_NFS_SWAP is disabled.
v2:
- don't take xprt lock unless we need to manipulate the memalloc flag
- add new xprt operations for swap enable/disable
This series is a (small) overhaul of the swap-over-NFS code. The main impetus is to fix the problem reported by Jerome Marchand. We currently hold the rcu_read_lock when calling xs_swapper and that's just plain wrong. The first patch in this series should fix that problem, and also clean up a bit of a layering violation.
The other focus of this set is to change how the swapper refcounting works. Right now, it's only tracked in the rpc_xprt, and there seem to be some gaps in its coverage -- places where we should taking or dropping references but aren't. This changes it so that the clnt tracks the number of swapfiles that it has, and the xprt tracks the number of "swappable" clients.
It also ensures that we only call sk_set_memalloc once per socket. I believe that's the correct thing to do as the main reason for the memalloc_socks counter is to track whether we have _any_ memalloc-enabled sockets.
There is still some work to be done here as I think there remains some potential for races between swapon/swapoff, and reconnect or migration events. That will take some careful thought that I haven't the time to spend on at the moment. I don't think this set will make those races any worse though.
Jeff Layton (5):
sunrpc: keep a count of swapfiles associated with the rpc_clnt
sunrpc: make xprt->swapper an atomic_t
sunrpc: if we're closing down a socket, clear memalloc on it first
sunrpc: lock xprt before trying to set memalloc on the sockets
sunrpc: turn swapper_enable/disable functions into rpc_xprt_ops
fs/nfs/file.c | 15 +------ include/linux/sunrpc/clnt.h | 1 + include/linux/sunrpc/sched.h | 16 ++++++++ include/linux/sunrpc/xprt.h | 17 +++++++- net/sunrpc/clnt.c | 67 +++++++++++++++++++++++++++----- net/sunrpc/xprtrdma/transport.c | 15 ++++++- net/sunrpc/xprtsock.c | 86 +++++++++++++++++++++++++++++++++-------- 7 files changed, 175 insertions(+), 42 deletions(-)
Signature · 7 lines
2.4.2 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH v3 1/5 sunrpc: keep a count of swapfiles associated with the rpc_clnt
Jerome reported seeing a warning pop when working with a swapfile on NFS. The nfs_swap_activate can end up calling sk_set_memalloc while holding the rcu_read_lock and that function can sleep.
To fix that, we need to take a reference to the xprt while holding the rcu_read_lock, set the socket up for swapping and then drop that reference. But, xprt_put is not exported and having NFS deal with the underlying xprt is a bit of layering violation anyway.
Fix this by adding a set of activate/deactivate functions that take a rpc_clnt pointer instead of an rpc_xprt, and have nfs_swap_activate and nfs_swap_deactivate call those.
Also, add a per-rpc_clnt atomic counter to keep track of the number of active swapfiles associated with it. When the counter does a 0->1 transition, we enable swapping on the xprt, when we do a 1->0 transition we disable swapping on it.
This also allows us to be a bit more selective with the RPC_TASK_SWAPPER flag. If non-swapper and swapper clnts are sharing a xprt, then we only need to flag the tasks from the swapper clnt with that flag.
--- fs/nfs/file.c | 15 ++-------- include/linux/sunrpc/clnt.h | 1 + include/linux/sunrpc/sched.h | 16 +++++++++++ net/sunrpc/clnt.c | 67 ++++++++++++++++++++++++++++++++++++++------ net/sunrpc/xprtsock.c | 3 +- 5 files changed, 78 insertions(+), 24 deletions(-)
fs/nfs/file.c +2 -13
@@ -555,31 +555,22 @@ static int nfs_launder_page(struct page *page)return nfs_wb_page (inode, page); } -#ifdef CONFIG_NFS_SWAP static int nfs_swap_activate (struct swap_info_struct *sis,struct file *file,sector_t *span) { -int ret;struct rpc_clnt *clnt =NFS_CLIENT (file->f_mapping->host); *span = sis->pages; -rcu_read_lock (); - ret =xs_swapper (rcu_dereference (clnt->cl_xprt),1 ); -rcu_read_unlock (); - -return ret; +return rpc_clnt_swap_activate (clnt); }static void nfs_swap_deactivate (struct file *file) {struct rpc_clnt *clnt =NFS_CLIENT (file->f_mapping->host); -rcu_read_lock (); -xs_swapper (rcu_dereference (clnt->cl_xprt),0 ); -rcu_read_unlock (); +rpc_clnt_swap_deactivate (clnt); } -#endif const struct address_space_operations nfs_file_aops = { .readpage = nfs_readpage,
@@ -596,10 +587,8 @@ const struct address_space_operations nfs_file_aops = { .launder_page = nfs_launder_page, .is_dirty_writeback = nfs_check_dirty_writeback, .error_remove_page = generic_error_remove_page, -#ifdef CONFIG_NFS_SWAP .swap_activate = nfs_swap_activate, .swap_deactivate = nfs_swap_deactivate, -#endif };/*
include/linux/sunrpc/clnt.h +1 -0
@@ -56,6 +56,7 @@ struct rpc_clnt {struct rpc_rtt * cl_rtt;/* RTO estimator data */ const struct rpc_timeout *cl_timeout;/* Timeout strategy */ +atomic_t cl_swapper;/* swapfile count */ int cl_nodelen;/* nodename length */ char cl_nodename[UNX_MAXNODENAME +1 ];struct rpc_pipe_dir_head cl_pipedir_objects;
include/linux/sunrpc/sched.h +16 -0
@@ -269,4 +269,20 @@ static inline void rpc_assign_waitqueue_name(struct rpc_wait_queue *q, }#endif +#if IS_ENABLED (CONFIG_SUNRPC_SWAP ) +int rpc_clnt_swap_activate (struct rpc_clnt *clnt); +void rpc_clnt_swap_deactivate (struct rpc_clnt *clnt); +#else +static inline int +rpc_clnt_swap_activate (struct rpc_clnt *clnt) +{ +return -EINVAL ; +} + +static inline void +rpc_clnt_swap_deactivate (struct rpc_clnt *clnt) +{ +} +#endif /* CONFIG_SUNRPC_SWAP */ +#endif /* _LINUX_SUNRPC_SCHED_H_ */
net/sunrpc/clnt.c +58 -9
76 lines not on this page · raw message
net/sunrpc/xprtsock.c +1 -2
@@ -1960,7 +1960,7 @@ static void xs_local_connect(struct rpc_xprt *xprt, struct rpc_task *task)msleep_interruptible (15000 ); } -#ifdef CONFIG_SUNRPC_SWAP +#if IS_ENABLED (CONFIG_SUNRPC_SWAP )static void xs_set_memalloc (struct rpc_xprt *xprt) { struct sock_xprt *transport = container_of(xprt, struct sock_xprt,
@@ -1992,7 +1992,6 @@ int xs_swapper(struct rpc_xprt *xprt, int enable) return err; } -EXPORT_SYMBOL_GPL (xs_swapper);#else static void xs_set_memalloc (struct rpc_xprt *xprt) {
Signature · 7 lines
2.4.2 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH v3 2/5 sunrpc: make xprt->swapper an atomic_t
In reply to Jeff LaytonSplit xs_swapper into enable/disable functions and eliminate the "enable" flag.
Currently, it's racy if you have multiple swapon/swapoff operations running in parallel over the same xprt. Also fix it so that we only set it to a memalloc socket on a 0->1 transition and only clear it on a 1->0 transition.
--- include/linux/sunrpc/xprt.h | 5 +++-- net/sunrpc/clnt.c | 4 ++-- net/sunrpc/xprtsock.c | 38 +++++++++++++++++++++++++------------- 3 files changed, 30 insertions(+), 17 deletions(-)
include/linux/sunrpc/xprt.h +3 -2
@@ -180,7 +180,7 @@ struct rpc_xprt {atomic_t num_reqs;/* total slots */ unsigned long state;/* transport state */ unsigned char resvport : 1; /* use a reserved port */ -unsigned int swapper;/* we're swapping over this +atomic_t swapper;/* we're swapping over this transport */ unsigned int bind_index;/* bind function index */
@@ -345,7 +345,8 @@ void xprt_release_rqst_cong(struct rpc_task *task);void xprt_disconnect_done (struct rpc_xprt *xprt);void xprt_force_disconnect (struct rpc_xprt *xprt);void xprt_conditional_disconnect (struct rpc_xprt *xprt,unsigned int cookie); -int xs_swapper (struct rpc_xprt *xprt,int enable); +int xs_swapper_enable (struct rpc_xprt *xprt); +void xs_swapper_disable (struct rpc_xprt *xprt);bool xprt_lock_connect (struct rpc_xprt *,struct rpc_task *,void *);void xprt_unlock_connect (struct rpc_xprt *,void *);
net/sunrpc/clnt.c +2 -2
@@ -2492,7 +2492,7 @@ retry: goto retry; } - ret =xs_swapper (xprt,1 ); + ret =xs_swapper_enable (xprt);xprt_put (xprt); }return ret;
@@ -2519,7 +2519,7 @@ retry: goto retry; } -xs_swapper (xprt,0 ); +xs_swapper_disable (xprt);xprt_put (xprt); } }
net/sunrpc/xprtsock.c +25 -13
@@ -1966,31 +1966,43 @@ static void xs_set_memalloc(struct rpc_xprt *xprt) struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); -if (xprt->swapper) +if (atomic_read (&xprt->swapper)) sk_set_memalloc(transport->inet); }/** -* xs_swapper - Tag this transport as being used for swap. +* xs_swapper_enable - Tag this transport as being used for swap. * @xprt: transport to tag -* @enable: enable/disable * +* Take a reference to this transport on behalf of the rpc_clnt, and +* optionally mark it for swapping if it wasn't already. */ -int xs_swapper (struct rpc_xprt *xprt,int enable) +int +xs_swapper_enable (struct rpc_xprt *xprt) { struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); -int err =0 ; -if (enable) { - xprt->swapper++; -xs_set_memalloc (xprt); - }else if (xprt->swapper) { - xprt->swapper--; -sk_clear_memalloc (transport->inet); - } +if (atomic_inc_return (&xprt->swapper) ==1 ) +sk_set_memalloc (transport->inet); +return 0 ; +} -return err; +/** +* xs_swapper_disable - Untag this transport as being used for swap. +* @xprt: transport to tag +* +* Drop a "swapper" reference to this xprt on behalf of the rpc_clnt. If the +* swapper refcount goes to 0, untag the socket as a memalloc socket. +*/ +void +xs_swapper_disable (struct rpc_xprt *xprt) +{ + struct sock_xprt *transport = container_of(xprt, struct sock_xprt, + xprt); + +if (atomic_dec_and_test (&xprt->swapper)) +sk_clear_memalloc (transport->inet); }#else static void xs_set_memalloc (struct rpc_xprt *xprt)
Signature · 1 line
2.4.2
PATCH v3 3/5 sunrpc: if we're closing down a socket, clear memalloc on it first
In reply to Jeff LaytonWe currently increment the memalloc_socks counter if we have a xprt that is associated with a swapfile. That socket can be replaced however during a reconnect event, and the memalloc_socks counter is never decremented if that occurs.
When tearing down a xprt socket, check to see if the xprt is set up for swapping and sk_clear_memalloc before releasing the socket if so.
--- net/sunrpc/xprtsock.c | 3 +++ 1 file changed, 3 insertions(+)
net/sunrpc/xprtsock.c +3 -0
@@ -827,6 +827,9 @@ static void xs_reset_transport(struct sock_xprt *transport)if (sk ==NULL )return ; +if (atomic_read (&transport->xprt.swapper)) +sk_clear_memalloc (sk); +write_lock_bh (&sk->sk_callback_lock); transport->inet =NULL ; transport->sock =NULL ;
Signature · 7 lines
2.4.2 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH v3 4/5 sunrpc: lock xprt before trying to set memalloc on the sockets
In reply to Jeff LaytonIt's possible that we could race with a call to xs_reset_transport, in which case the xprt->inet pointer could be zeroed out while we're accessing it. Lock the xprt before we try to set memalloc on it.
--- net/sunrpc/xprtsock.c | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-)
net/sunrpc/xprtsock.c +27 -8
@@ -1964,11 +1964,22 @@ static void xs_local_connect(struct rpc_xprt *xprt, struct rpc_task *task) }#if IS_ENABLED (CONFIG_SUNRPC_SWAP ) +/* +* Note that this should be called with XPRT_LOCKED held (or when we otherwise +* know that we have exclusive access to the socket), to guard against +* races with xs_reset_transport. +*/ static void xs_set_memalloc (struct rpc_xprt *xprt) { struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); +/* +* If there's no sock, then we have nothing to set. The +* reconnecting process will get it for us. +*/ +if (!transport->inet) +return ;if (atomic_read (&xprt->swapper))sk_set_memalloc (transport->inet); }
@@ -1983,11 +1994,15 @@ static void xs_set_memalloc(struct rpc_xprt *xprt)int xs_swapper_enable (struct rpc_xprt *xprt) { - struct sock_xprt *transport = container_of(xprt, struct sock_xprt, - xprt); + struct sock_xprt *xs = container_of(xprt, struct sock_xprt, xprt); -if (atomic_inc_return (&xprt->swapper) ==1 ) -sk_set_memalloc (transport->inet); +if (atomic_inc_return (&xprt->swapper) !=1 ) +return 0 ; +if (wait_on_bit_lock (&xprt->state,XPRT_LOCKED ,TASK_KILLABLE )) +return -ERESTARTSYS ; +if (xs->inet) +sk_set_memalloc (xs->inet); +xprt_release_xprt (xprt,NULL );return 0 ; }
@@ -2001,11 +2016,15 @@ xs_swapper_enable(struct rpc_xprt *xprt)void xs_swapper_disable (struct rpc_xprt *xprt) { - struct sock_xprt *transport = container_of(xprt, struct sock_xprt, - xprt); + struct sock_xprt *xs = container_of(xprt, struct sock_xprt, xprt); -if (atomic_dec_and_test (&xprt->swapper)) -sk_clear_memalloc (transport->inet); +if (!atomic_dec_and_test (&xprt->swapper)) +return ; +if (wait_on_bit_lock (&xprt->state,XPRT_LOCKED ,TASK_KILLABLE )) +return ; +if (xs->inet) +sk_clear_memalloc (xs->inet); +xprt_release_xprt (xprt,NULL ); }#else static void xs_set_memalloc (struct rpc_xprt *xprt)
Signature · 1 line
2.4.2
PATCH v3 5/5 sunrpc: turn swapper_enable/disable functions into rpc_xprt_ops
In reply to Jeff LaytonRDMA 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.
--- include/linux/sunrpc/xprt.h | 16 ++++++++++++++-- net/sunrpc/clnt.c | 4 ++-- net/sunrpc/xprtrdma/transport.c | 15 ++++++++++++++- net/sunrpc/xprtsock.c | 31 +++++++++++++++++++++++++------ 4 files changed, 55 insertions(+), 11 deletions(-)
include/linux/sunrpc/xprt.h +14 -2
@@ -133,6 +133,8 @@ struct rpc_xprt_ops {void (*close)(struct rpc_xprt *xprt);void (*destroy)(struct rpc_xprt *xprt);void (*print_stats)(struct rpc_xprt *xprt,struct seq_file *seq); +int (*enable_swap)(struct rpc_xprt *xprt); +void (*disable_swap)(struct rpc_xprt *xprt); };/*
@@ -327,6 +329,18 @@ static inline __be32 *xprt_skip_transport_header(struct rpc_xprt *xprt, __be32 *return p + xprt->tsh_size; } +static inline int +xprt_enable_swap (struct rpc_xprt *xprt) +{ +return xprt->ops->enable_swap (xprt); +} + +static inline void +xprt_disable_swap (struct rpc_xprt *xprt) +{ + xprt->ops->disable_swap (xprt); +} +/* * Transport switch helper functions */
@@ -345,8 +359,6 @@ void xprt_release_rqst_cong(struct rpc_task *task);void xprt_disconnect_done (struct rpc_xprt *xprt);void xprt_force_disconnect (struct rpc_xprt *xprt);void xprt_conditional_disconnect (struct rpc_xprt *xprt,unsigned int cookie); -int xs_swapper_enable (struct rpc_xprt *xprt); -void xs_swapper_disable (struct rpc_xprt *xprt);bool xprt_lock_connect (struct rpc_xprt *,struct rpc_task *,void *);void xprt_unlock_connect (struct rpc_xprt *,void *);
net/sunrpc/clnt.c +2 -2
@@ -2492,7 +2492,7 @@ retry: goto retry; } - ret =xs_swapper_enable (xprt); + ret =xprt_enable_swap (xprt);xprt_put (xprt); }return ret;
@@ -2519,7 +2519,7 @@ retry: goto retry; } -xs_swapper_disable (xprt); +xprt_disable_swap (xprt);xprt_put (xprt); } }
net/sunrpc/xprtrdma/transport.c +14 -1
@@ -682,6 +682,17 @@ static void xprt_rdma_print_stats(struct rpc_xprt *xprt, struct seq_file *seq) r_xprt->rx_stats.bad_reply_count); } +static int +xprt_rdma_enable_swap (struct rpc_xprt *xprt) +{ +return -EINVAL ; +} + +static void +xprt_rdma_disable_swap (struct rpc_xprt *xprt) +{ +} +/* * Plumbing for rpc transport switch and kernel module */
@@ -700,7 +711,9 @@ static struct rpc_xprt_ops xprt_rdma_procs = { .send_request = xprt_rdma_send_request, .close = xprt_rdma_close, .destroy = xprt_rdma_destroy, - .print_stats = xprt_rdma_print_stats + .print_stats = xprt_rdma_print_stats, + .enable_swap = xprt_rdma_enable_swap, + .disable_swap = xprt_rdma_disable_swap, };static struct xprt_class xprt_rdma = {
net/sunrpc/xprtsock.c +25 -6
@@ -1985,14 +1985,14 @@ static void xs_set_memalloc(struct rpc_xprt *xprt) }/** -* xs_swapper_enable - Tag this transport as being used for swap. +* xs_enable_swap - Tag this transport as being used for swap. * @xprt: transport to tag * * Take a reference to this transport on behalf of the rpc_clnt, and * optionally mark it for swapping if it wasn't already. */ -int -xs_swapper_enable (struct rpc_xprt *xprt) +static int +xs_enable_swap (struct rpc_xprt *xprt) { struct sock_xprt *xs = container_of(xprt, struct sock_xprt, xprt);
@@ -2007,14 +2007,14 @@ xs_swapper_enable(struct rpc_xprt *xprt) }/** -* xs_swapper_disable - Untag this transport as being used for swap. +* xs_disable_swap - Untag this transport as being used for swap. * @xprt: transport to tag * * Drop a "swapper" reference to this xprt on behalf of the rpc_clnt. If the * swapper refcount goes to 0, untag the socket as a memalloc socket. */ -void -xs_swapper_disable (struct rpc_xprt *xprt) +static void +xs_disable_swap (struct rpc_xprt *xprt) { struct sock_xprt *xs = container_of(xprt, struct sock_xprt, xprt);
@@ -2030,6 +2030,17 @@ xs_swapper_disable(struct rpc_xprt *xprt)static void xs_set_memalloc (struct rpc_xprt *xprt) { } + +static int +xs_enable_swap (struct rpc_xprt *xprt) +{ +return -EINVAL ; +} + +static void +xs_disable_swap (struct rpc_xprt *xprt) +{ +}#endif static void xs_udp_finish_connecting (struct rpc_xprt *xprt,struct socket *sock)
@@ -2496,6 +2507,8 @@ static struct rpc_xprt_ops xs_local_ops = { .close = xs_close, .destroy = xs_destroy, .print_stats = xs_local_print_stats, + .enable_swap = xs_enable_swap, + .disable_swap = xs_disable_swap, };static struct rpc_xprt_ops xs_udp_ops = {
@@ -2515,6 +2528,8 @@ static struct rpc_xprt_ops xs_udp_ops = { .close = xs_close, .destroy = xs_destroy, .print_stats = xs_udp_print_stats, + .enable_swap = xs_enable_swap, + .disable_swap = xs_disable_swap, };static struct rpc_xprt_ops xs_tcp_ops = {
@@ -2531,6 +2546,8 @@ static struct rpc_xprt_ops xs_tcp_ops = { .close = xs_tcp_shutdown, .destroy = xs_destroy, .print_stats = xs_tcp_print_stats, + .enable_swap = xs_enable_swap, + .disable_swap = xs_disable_swap, };/*
@@ -2548,6 +2565,8 @@ static struct rpc_xprt_ops bc_tcp_ops = { .close = bc_close, .destroy = bc_destroy, .print_stats = xs_tcp_print_stats, + .enable_swap = xs_enable_swap, + .disable_swap = xs_disable_swap, };static int xs_init_anyaddr (const int family,struct sockaddr *sap)
Signature · 7 lines
2.4.2 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH v3 5/5] sunrpc: turn swapper_enable/disable functions into rpc_xprt_ops
Quoted 8 lines · Jeff Layton
RDMA xprts don't have a
sock_xprt, but anrdma_xprt, so the xs_swapper_enable/disable functions will likely oops when fed an RDMA xprt. Turn these functions intorpc_xprt_opsso that that doesn't occur. For now the RDMA versions are no-ops that just return-EINVALon an attempt to swapon.Cc Chuck Lever <[email protected]>Signed-off-by Jeff Layton <[email protected]>
Thanks, Jeff, that works for me.
Quoted 200 lines
---
include/linux/sunrpc/xprt.h | 16 ++++++++++++++-- net/sunrpc/clnt.c | 4 ++-- net/sunrpc/xprtrdma/transport.c | 15 ++++++++++++++- net/sunrpc/xprtsock.c | 31 +++++++++++++++++++++++++------ 4 files changed, 55 insertions(+), 11 deletions(-)include/linux/sunrpc/xprt.h +14
-2@@ -133,6 +133,8 @@ struct rpc_xprt_ops {void (*close)(struct rpc_xprt *xprt);void (*destroy)(struct rpc_xprt *xprt);void (*print_stats)(struct rpc_xprt *xprt,struct seq_file *seq); +int (*enable_swap)(struct rpc_xprt *xprt); +void (*disable_swap)(struct rpc_xprt *xprt); };/* @@ -327,6 +329,18 @@ static inline __be32 *xprt_skip_transport_header(struct rpc_xprt *xprt, __be32 *return p + xprt->tsh_size; } +static inline int +xprt_enable_swap (struct rpc_xprt *xprt) +{ +return xprt->ops->enable_swap (xprt); +} + +static inline void +xprt_disable_swap (struct rpc_xprt *xprt) +{ + xprt->ops->disable_swap (xprt); +} +/* * Transport switch helper functions */ @@ -345,8 +359,6 @@ void xprt_release_rqst_cong(struct rpc_task *task);void xprt_disconnect_done (struct rpc_xprt *xprt);void xprt_force_disconnect (struct rpc_xprt *xprt);void xprt_conditional_disconnect (struct rpc_xprt *xprt,unsigned int cookie); -int xs_swapper_enable (struct rpc_xprt *xprt); -void xs_swapper_disable (struct rpc_xprt *xprt);bool xprt_lock_connect (struct rpc_xprt *,struct rpc_task *,void *);void xprt_unlock_connect (struct rpc_xprt *,void *);net/sunrpc/clnt.c +2
-2@@ -2492,7 +2492,7 @@ retry: goto retry; } - ret =xs_swapper_enable (xprt); + ret =xprt_enable_swap (xprt);xprt_put (xprt); }return ret;@@ -2519,7 +2519,7 @@ retry: goto retry; } -xs_swapper_disable (xprt); +xprt_disable_swap (xprt);xprt_put (xprt); } }net/sunrpc/xprtrdma/transport.c +14
-1@@ -682,6 +682,17 @@ static void xprt_rdma_print_stats(struct rpc_xprt *xprt, struct seq_file *seq) r_xprt->rx_stats.bad_reply_count); } +static int +xprt_rdma_enable_swap (struct rpc_xprt *xprt) +{ +return -EINVAL ; +} + +static void +xprt_rdma_disable_swap (struct rpc_xprt *xprt) +{ +} +/* * Plumbing for rpc transport switch and kernel module */ @@ -700,7 +711,9 @@ static struct rpc_xprt_ops xprt_rdma_procs = { .send_request = xprt_rdma_send_request, .close = xprt_rdma_close, .destroy = xprt_rdma_destroy, - .print_stats = xprt_rdma_print_stats + .print_stats = xprt_rdma_print_stats, + .enable_swap = xprt_rdma_enable_swap, + .disable_swap = xprt_rdma_disable_swap, };static struct xprt_class xprt_rdma = {net/sunrpc/xprtsock.c +25
-6@@ -1985,14 +1985,14 @@ static void xs_set_memalloc(struct rpc_xprt *xprt) }/** -* xs_swapper_enable - Tag this transport as being used for swap. +* xs_enable_swap - Tag this transport as being used for swap. * @xprt: transport to tag * * Take a reference to this transport on behalf of the rpc_clnt, and * optionally mark it for swapping if it wasn't already. */ -int -xs_swapper_enable (struct rpc_xprt *xprt) +static int +xs_enable_swap (struct rpc_xprt *xprt) { struct sock_xprt *xs = container_of(xprt, struct sock_xprt, xprt);@@ -2007,14 +2007,14 @@ xs_swapper_enable(struct rpc_xprt *xprt) }/** -* xs_swapper_disable - Untag this transport as being used for swap. +* xs_disable_swap - Untag this transport as being used for swap. * @xprt: transport to tag * * Drop a "swapper" reference to this xprt on behalf of the rpc_clnt. If the * swapper refcount goes to 0, untag the socket as a memalloc socket. */ -void -xs_swapper_disable (struct rpc_xprt *xprt) +static void +xs_disable_swap (struct rpc_xprt *xprt) { struct sock_xprt *xs = container_of(xprt, struct sock_xprt, xprt);@@ -2030,6 +2030,17 @@ xs_swapper_disable(struct rpc_xprt *xprt)static void xs_set_memalloc (struct rpc_xprt *xprt) { } + +static int +xs_enable_swap (struct rpc_xprt *xprt) +{ +return -EINVAL ; +} + +static void +xs_disable_swap (struct rpc_xprt *xprt) +{ +}#endif static void xs_udp_finish_connecting (struct rpc_xprt *xprt,struct socket *sock)@@ -2496,6 +2507,8 @@ static struct rpc_xprt_ops xs_local_ops = { .close = xs_close, .destroy = xs_destroy, .print_stats = xs_local_print_stats, + .enable_swap = xs_enable_swap, + .disable_swap = xs_disable_swap, };static struct rpc_xprt_ops xs_udp_ops = {@@ -2515,6 +2528,8 @@ static struct rpc_xprt_ops xs_udp_ops = { .close = xs_close, .destroy = xs_destroy, .print_stats = xs_udp_print_stats, + .enable_swap = xs_enable_swap, + .disable_swap = xs_disable_swap, };static struct rpc_xprt_ops xs_tcp_ops = {@@ -2531,6 +2546,8 @@ static struct rpc_xprt_ops xs_tcp_ops = { .close = xs_tcp_shutdown, .destroy = xs_destroy, .print_stats = xs_tcp_print_stats, + .enable_swap = xs_enable_swap, + .disable_swap = xs_disable_swap, };/* @@ -2548,6 +2565,8 @@ static struct rpc_xprt_ops bc_tcp_ops = { .close = bc_close, .destroy = bc_destroy, .print_stats = xs_tcp_print_stats, + .enable_swap = xs_enable_swap, + .disable_swap = xs_disable_swap, };static int xs_init_anyaddr (const int family,struct sockaddr *sap)Signature · 1 line
2.4.2
--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>