SUNRPC: Remove svo_shutdown method
authorChuck Lever <chuck.lever@oracle.com>
Tue, 25 Jan 2022 18:49:29 +0000 (13:49 -0500)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 28 Feb 2022 15:26:39 +0000 (10:26 -0500)
Clean up. Neil observed that "any code that calls svc_shutdown_net()
knows what the shutdown function should be, and so can call it
directly."

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Reviewed-by: NeilBrown <neilb@suse.de>
fs/lockd/svc.c
fs/nfsd/nfssvc.c
include/linux/sunrpc/svc.h
net/sunrpc/svc.c

index 3a05af8736259d805fa371b8796ade51428cbf16..f5b688a844aa535ed05764fbac74f00aa74dc6b6 100644 (file)
@@ -249,6 +249,7 @@ out_err:
                printk(KERN_WARNING
                        "lockd_up: makesock failed, error=%d\n", err);
        svc_shutdown_net(serv, net);
+       svc_rpcb_cleanup(serv, net);
        return err;
 }
 
@@ -287,8 +288,7 @@ static void lockd_down_net(struct svc_serv *serv, struct net *net)
                        cancel_delayed_work_sync(&ln->grace_period_end);
                        locks_end_grace(&ln->lockd_manager);
                        svc_shutdown_net(serv, net);
-                       dprintk("%s: per-net data destroyed; net=%x\n",
-                               __func__, net->ns.inum);
+                       svc_rpcb_cleanup(serv, net);
                }
        } else {
                pr_err("%s: no users! net=%x\n",
@@ -351,7 +351,6 @@ static struct notifier_block lockd_inet6addr_notifier = {
 #endif
 
 static const struct svc_serv_ops lockd_sv_ops = {
-       .svo_shutdown           = svc_rpcb_cleanup,
        .svo_function           = lockd,
        .svo_module             = THIS_MODULE,
 };
index aeeac6de1f0ac4ab061c2fe0c722a9e44bb03c85..0c6b216e439ec57b294b7c6d185d701d9a500c9d 100644 (file)
@@ -613,7 +613,6 @@ static int nfsd_get_default_max_blksize(void)
 }
 
 static const struct svc_serv_ops nfsd_thread_sv_ops = {
-       .svo_shutdown           = nfsd_last_thread,
        .svo_function           = nfsd,
        .svo_module             = THIS_MODULE,
 };
@@ -724,6 +723,7 @@ void nfsd_put(struct net *net)
 
        if (kref_put(&nn->nfsd_serv->sv_refcnt, nfsd_noop)) {
                svc_shutdown_net(nn->nfsd_serv, net);
+               nfsd_last_thread(nn->nfsd_serv, net);
                svc_destroy(&nn->nfsd_serv->sv_refcnt);
                spin_lock(&nfsd_notifier_lock);
                nn->nfsd_serv = NULL;
index 6ef9c1cafd0b2c4831e262171159dc94955f2c0d..63794d772eb33bc86bcaccce72411719db2ef1bb 100644 (file)
@@ -55,9 +55,6 @@ struct svc_pool {
 struct svc_serv;
 
 struct svc_serv_ops {
-       /* Callback to use when last thread exits. */
-       void            (*svo_shutdown)(struct svc_serv *, struct net *);
-
        /* function for service threads to run */
        int             (*svo_function)(void *);
 
index 2aabec2b4beccd43d91fc2b6f98d401639c76321..74a75a22da9a53b23e301c903a54eee61a52f91e 100644 (file)
@@ -539,9 +539,6 @@ EXPORT_SYMBOL_GPL(svc_create_pooled);
 void svc_shutdown_net(struct svc_serv *serv, struct net *net)
 {
        svc_close_net(serv, net);
-
-       if (serv->sv_ops->svo_shutdown)
-               serv->sv_ops->svo_shutdown(serv, net);
 }
 EXPORT_SYMBOL_GPL(svc_shutdown_net);