bool grace_ended;
        time64_t boot_time;
 
-       /* internal mount of the "nfsd" pseudofilesystem: */
-       struct vfsmount *nfsd_mnt;
-
        struct dentry *nfsd_client_dir;
 
        /*
        wait_queue_head_t ntf_wq;
        atomic_t ntf_refcnt;
 
+       /* Allow umount to wait for nfsd state cleanup */
+       struct completion nfsd_shutdown_complete;
+
        /*
         * clientid and stateid data for construction of net unique COPY
         * stateids.
 
        struct nfsd_net *nn = net_generic(net, nfsd_net_id);
        int ret;
 
-       ret = get_nfsdfs(net);
-       if (ret)
-               return ret;
        ret = nfs4_state_create_net(net);
-       if (ret) {
-               mntput(nn->nfsd_mnt);
+       if (ret)
                return ret;
-       }
        locks_start_grace(net, &nn->nfsd4_manager);
        nfsd4_client_tracking_init(net);
        if (nn->track_reclaim_completes && nn->reclaim_str_hashtbl_size == 0)
 
        nfsd4_client_tracking_exit(net);
        nfs4_state_destroy_net(net);
-       mntput(nn->nfsd_mnt);
 }
 
 void
 
 {
        struct net *net = sb->s_fs_info;
 
+       nfsd_shutdown_threads(net);
+
        kill_litter_super(sb);
        put_net(net);
 }
 };
 MODULE_ALIAS_FS("nfsd");
 
-int get_nfsdfs(struct net *net)
-{
-       struct nfsd_net *nn = net_generic(net, nfsd_net_id);
-       struct vfsmount *mnt;
-
-       mnt =  vfs_kern_mount(&nfsd_fs_type, SB_KERNMOUNT, "nfsd", NULL);
-       if (IS_ERR(mnt))
-               return PTR_ERR(mnt);
-       nn->nfsd_mnt = mnt;
-       return 0;
-}
-
 #ifdef CONFIG_PROC_FS
 static int create_proc_exports_entry(void)
 {
 
 int            nfsd_set_nrthreads(int n, int *, struct net *);
 int            nfsd_pool_stats_open(struct inode *, struct file *);
 int            nfsd_pool_stats_release(struct inode *, struct file *);
+void           nfsd_shutdown_threads(struct net *net);
 
 void           nfsd_destroy(struct net *net);
 
 bool           i_am_nfsd(void);
 
-int get_nfsdfs(struct net *);
-
 struct nfsdfs_client {
        struct kref cl_ref;
        void (*cl_release)(struct kref *kref);
 
        .svo_module             = THIS_MODULE,
 };
 
+static void nfsd_complete_shutdown(struct net *net)
+{
+       struct nfsd_net *nn = net_generic(net, nfsd_net_id);
+
+       WARN_ON(!mutex_is_locked(&nfsd_mutex));
+
+       nn->nfsd_serv = NULL;
+       complete(&nn->nfsd_shutdown_complete);
+}
+
+void nfsd_shutdown_threads(struct net *net)
+{
+       struct nfsd_net *nn = net_generic(net, nfsd_net_id);
+       struct svc_serv *serv;
+
+       mutex_lock(&nfsd_mutex);
+       serv = nn->nfsd_serv;
+       if (serv == NULL) {
+               mutex_unlock(&nfsd_mutex);
+               return;
+       }
+
+       svc_get(serv);
+       /* Kill outstanding nfsd threads */
+       serv->sv_ops->svo_setup(serv, NULL, 0);
+       nfsd_destroy(net);
+       mutex_unlock(&nfsd_mutex);
+       /* Wait for shutdown of nfsd_serv to complete */
+       wait_for_completion(&nn->nfsd_shutdown_complete);
+}
+
 bool i_am_nfsd(void)
 {
        return kthread_func(current) == nfsd;
                                                &nfsd_thread_sv_ops);
        if (nn->nfsd_serv == NULL)
                return -ENOMEM;
+       init_completion(&nn->nfsd_shutdown_complete);
 
        nn->nfsd_serv->sv_maxconn = nn->max_connections;
        error = svc_bind(nn->nfsd_serv, net);
        if (error < 0) {
                svc_destroy(nn->nfsd_serv);
+               nfsd_complete_shutdown(net);
                return error;
        }
 
                svc_shutdown_net(nn->nfsd_serv, net);
        svc_destroy(nn->nfsd_serv);
        if (destroy)
-               nn->nfsd_serv = NULL;
+               nfsd_complete_shutdown(net);
 }
 
 int nfsd_set_nrthreads(int n, int *nthreads, struct net *net)