git: b4098b4fd6d6 - stable/13 - nfscommon: Use IS_DEFAULT_VNET() in the vnet initialization

From: Rick Macklem <rmacklem_at_FreeBSD.org>
Date: Thu, 18 May 2023 23:10:27 UTC
The branch stable/13 has been updated by rmacklem:

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

commit b4098b4fd6d63d88abba265b06bf4aa39174b7be
Author:     Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2023-02-21 03:43:37 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2023-05-18 23:09:39 +0000

    nfscommon: Use IS_DEFAULT_VNET() in the vnet initialization
    
    Another oopsie.  The vnet initialization function in
    nfs_commonport.c for initializing prison0 by testing
    curthread->td_ucred->cr_prison == &prison0. This is bogus
    and always true.  Replace it with IS_DEFAULT_VNET(curvnet).
    
    (cherry picked from commit ef4e8f0cf91f7009745d5a7a90d3bdd2d9e25780)
---
 sys/fs/nfs/nfs_commonport.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/fs/nfs/nfs_commonport.c b/sys/fs/nfs/nfs_commonport.c
index d72565cd3e9c..e78edff964f9 100644
--- a/sys/fs/nfs/nfs_commonport.c
+++ b/sys/fs/nfs/nfs_commonport.c
@@ -878,7 +878,7 @@ static void
 nfs_vnetinit(const void *unused __unused)
 {
 
-	if (curthread->td_ucred->cr_prison == &prison0)
+	if (IS_DEFAULT_VNET(curvnet))
 		NFSD_VNET(nfsstatsv1_p) = &nfsstatsv1;
 	else
 		NFSD_VNET(nfsstatsv1_p) = malloc(sizeof(struct nfsstatsv1),