Skip to content

Commit 8936ff4

Browse files
Olga KornievskaiaTrond Myklebust
authored andcommitted
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>
1 parent 2e47c3c commit 8936ff4

3 files changed

Lines changed: 10 additions & 4 deletions

File tree

fs/nfs/callback.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ int nfs_callback_up(u32 minorversion, struct rpc_xprt *xprt)
258258
/*
259259
* Kill the callback thread if it's no longer being used.
260260
*/
261-
void nfs_callback_down(int minorversion, struct net *net)
261+
void nfs_callback_down(int minorversion, struct net *net, struct rpc_xprt *xprt)
262262
{
263263
struct nfs_callback_data *cb_info = &nfs_callback_info[minorversion];
264264
struct svc_serv *serv;

fs/nfs/callback.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,8 @@ extern __be32 nfs4_callback_recall(void *argp, void *resp,
188188
struct cb_process_state *cps);
189189
#if IS_ENABLED(CONFIG_NFS_V4)
190190
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);
192193
#endif /* CONFIG_NFS_V4 */
193194
/*
194195
* nfs41: Callbacks are expected to not cause substantial latency,

fs/nfs/nfs4client.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,13 @@ struct nfs_client *nfs4_alloc_client(const struct nfs_client_initdata *cl_init)
281281
*/
282282
static void nfs4_destroy_callback(struct nfs_client *clp)
283283
{
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+
}
286291
}
287292

288293
static void nfs4_shutdown_client(struct nfs_client *clp)

0 commit comments

Comments
 (0)