git: 764664aaa5d5 - stable/13 - nfsd: Fix initialization broken by 7344856e3a6d

From: Rick Macklem <rmacklem_at_FreeBSD.org>
Date: Mon, 15 May 2023 23:47:20 UTC
The branch stable/13 has been updated by rmacklem:

URL: https://cgit.FreeBSD.org/src/commit/?id=764664aaa5d547b58db321c40162eced7fd4da7a

commit 764664aaa5d547b58db321c40162eced7fd4da7a
Author:     Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2023-02-12 17:16:56 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2023-05-15 23:46:29 +0000

    nfsd: Fix initialization broken by 7344856e3a6d
    
    Oops, although the vneting macros do not do anything yet,
    commit 7344856e3a6d did change where things are initialized
    and one of the initialization functions was not being called
    early enough.  This patch moves nfsrvd_init(0) to the
    function called via (VNET_)SYSINIT() to fix this.
    
    (cherry picked from commit fcfdb76e12fb3cdf584e6f06e56e7c48ec475cc6)
---
 sys/fs/nfsserver/nfs_nfsdkrpc.c | 1 -
 sys/fs/nfsserver/nfs_nfsdport.c | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/fs/nfsserver/nfs_nfsdkrpc.c b/sys/fs/nfsserver/nfs_nfsdkrpc.c
index 7b0f84c397bc..ca4d9f910562 100644
--- a/sys/fs/nfsserver/nfs_nfsdkrpc.c
+++ b/sys/fs/nfsserver/nfs_nfsdkrpc.c
@@ -531,7 +531,6 @@ nfsrvd_nfsd(struct thread *td, struct nfsd_nfsd_args *args)
 	 */
 	NFSD_LOCK();
 	if (NFSD_VNET(nfsrv_numnfsd) == 0) {
-		nfsrvd_init(0);
 		nfsdev_time = time_second;
 		p = td->td_proc;
 		PROC_LOCK(p);
diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c
index 6be29f563ec4..d62c6295ccfa 100644
--- a/sys/fs/nfsserver/nfs_nfsdport.c
+++ b/sys/fs/nfsserver/nfs_nfsdport.c
@@ -3544,6 +3544,7 @@ nfsd_mntinit(void)
 		return;
 	}
 	NFSD_VNET(nfsrv_mntinited) = true;
+	nfsrvd_init(0);
 	NFSD_UNLOCK();
 
 	if (curthread->td_ucred->cr_prison == &prison0)