Skip to content

Commit 3997249

Browse files
Mike SnitzerAnna Schumaker
authored andcommitted
nfsd: update percpu_ref to manage references on nfsd_net
Holding a reference on nfsd_net is what is required, it was never actually about ensuring nn->nfsd_serv available. Move waiting for outstanding percpu references from nfsd_destroy_serv() to nfsd_shutdown_net(). By moving it later it will be possible to invalidate localio clients during nfsd_file_cache_shutdown_net() via __nfsd_file_cache_purge(). Signed-off-by: Mike Snitzer <[email protected]> Reviewed-by: Jeff Layton <[email protected]> Acked-by: Chuck Lever <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
1 parent 86e0041 commit 3997249

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

fs/nfsd/nfssvc.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,10 @@ static void nfsd_shutdown_net(struct net *net)
436436

437437
if (!nn->nfsd_net_up)
438438
return;
439+
440+
percpu_ref_kill_and_confirm(&nn->nfsd_serv_ref, nfsd_serv_done);
441+
wait_for_completion(&nn->nfsd_serv_confirm_done);
442+
439443
nfsd_export_flush(net);
440444
nfs4_state_shutdown_net(net);
441445
nfsd_reply_cache_shutdown(nn);
@@ -444,7 +448,10 @@ static void nfsd_shutdown_net(struct net *net)
444448
lockd_down(net);
445449
nn->lockd_up = false;
446450
}
451+
452+
wait_for_completion(&nn->nfsd_serv_free_done);
447453
percpu_ref_exit(&nn->nfsd_serv_ref);
454+
448455
nn->nfsd_net_up = false;
449456
nfsd_shutdown_generic();
450457
}
@@ -526,11 +533,6 @@ void nfsd_destroy_serv(struct net *net)
526533

527534
lockdep_assert_held(&nfsd_mutex);
528535

529-
percpu_ref_kill_and_confirm(&nn->nfsd_serv_ref, nfsd_serv_done);
530-
wait_for_completion(&nn->nfsd_serv_confirm_done);
531-
wait_for_completion(&nn->nfsd_serv_free_done);
532-
/* percpu_ref_exit is called in nfsd_shutdown_net */
533-
534536
spin_lock(&nfsd_notifier_lock);
535537
nn->nfsd_serv = NULL;
536538
spin_unlock(&nfsd_notifier_lock);

0 commit comments

Comments
 (0)