git: b837f100e1c8 - main - nfs: set vnet(9) context in mountnfs()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 01 Feb 2025 09:02:14 UTC
The branch main has been updated by glebius:
URL: https://cgit.FreeBSD.org/src/commit/?id=b837f100e1c854d1f805b615f0bce5ede85f8552
commit b837f100e1c854d1f805b615f0bce5ede85f8552
Author: Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2025-02-01 01:02:29 +0000
Commit: Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2025-02-01 09:00:26 +0000
nfs: set vnet(9) context in mountnfs()
This seems to be the right place to set it once and for all, without
setting it deep in kgssapi/rpctls/etc leaf functions.
Reviewed by: rmacklem
Differential Revision: https://reviews.freebsd.org/D48558
---
sys/fs/nfsclient/nfs_clvfsops.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/sys/fs/nfsclient/nfs_clvfsops.c b/sys/fs/nfsclient/nfs_clvfsops.c
index 1cbe8e70867f..6bc67b342cbe 100644
--- a/sys/fs/nfsclient/nfs_clvfsops.c
+++ b/sys/fs/nfsclient/nfs_clvfsops.c
@@ -1524,12 +1524,14 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam,
#endif
NFSCL_DEBUG(3, "in mnt\n");
+ CURVNET_SET(CRED_TO_VNET(cred));
clp = NULL;
if (mp->mnt_flag & MNT_UPDATE) {
nmp = VFSTONFS(mp);
printf("%s: MNT_UPDATE is no longer handled here\n", __func__);
free(nam, M_SONAME);
free(tlscertname, M_NEWNFSMNT);
+ CURVNET_RESTORE();
return (0);
} else {
/* NFS-over-TLS requires that rpctls be functioning. */
@@ -1544,6 +1546,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam,
if (error != 0) {
free(nam, M_SONAME);
free(tlscertname, M_NEWNFSMNT);
+ CURVNET_RESTORE();
return (error);
}
}
@@ -1816,6 +1819,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam,
*/
NFSVOPUNLOCK(*vpp);
vfs_cache_root_set(mp, *vpp);
+ CURVNET_RESTORE();
return (0);
}
error = EIO;
@@ -1844,6 +1848,7 @@ bad:
free(nmp->nm_tlscertname, M_NEWNFSMNT);
free(nmp, M_NEWNFSMNT);
free(nam, M_SONAME);
+ CURVNET_RESTORE();
return (error);
}