Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

NFSv4.1: pass transport for callback shutdown

When we are setting up the 4.1 callback server, we pass in
the appropriate rpc_xprt transport pointer with which to associate
the callback server structure. Similarly, pass in the rpc_xprt
pointer for when we are shutting down the callback. This will be
used to make sure that we free the server structure and then clear
the rpc_xprt's bc_server pointer in a safe manner.

Signed-off-by: Olga Kornievskaia <okorniev@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>

authored by

Olga Kornievskaia and committed by
Trond Myklebust
8936ff47 2e47c3cc

+10 -4
+1 -1
fs/nfs/callback.c
··· 258 258 /* 259 259 * Kill the callback thread if it's no longer being used. 260 260 */ 261 - void nfs_callback_down(int minorversion, struct net *net) 261 + void nfs_callback_down(int minorversion, struct net *net, struct rpc_xprt *xprt) 262 262 { 263 263 struct nfs_callback_data *cb_info = &nfs_callback_info[minorversion]; 264 264 struct svc_serv *serv;
+2 -1
fs/nfs/callback.h
··· 188 188 struct cb_process_state *cps); 189 189 #if IS_ENABLED(CONFIG_NFS_V4) 190 190 extern int nfs_callback_up(u32 minorversion, struct rpc_xprt *xprt); 191 - extern void nfs_callback_down(int minorversion, struct net *net); 191 + extern void nfs_callback_down(int minorversion, struct net *net, 192 + struct rpc_xprt *xprt); 192 193 #endif /* CONFIG_NFS_V4 */ 193 194 /* 194 195 * nfs41: Callbacks are expected to not cause substantial latency,
+7 -2
fs/nfs/nfs4client.c
··· 281 281 */ 282 282 static void nfs4_destroy_callback(struct nfs_client *clp) 283 283 { 284 - if (__test_and_clear_bit(NFS_CS_CALLBACK, &clp->cl_res_state)) 285 - nfs_callback_down(clp->cl_mvops->minor_version, clp->cl_net); 284 + if (__test_and_clear_bit(NFS_CS_CALLBACK, &clp->cl_res_state)) { 285 + struct rpc_xprt *xprt; 286 + 287 + xprt = rcu_dereference_raw(clp->cl_rpcclient->cl_xprt); 288 + nfs_callback_down(clp->cl_mvops->minor_version, clp->cl_net, 289 + xprt); 290 + } 286 291 } 287 292 288 293 static void nfs4_shutdown_client(struct nfs_client *clp)