freebsd-dev/sys/fs/nfsserver
Rick Macklem 88175af8b7 vfs_export: Add mnt_exjail to control exports done in prisons
If there are multiple instances of mountd(8) (in different
prisons), there will be confusion if they manipulate the
exports of the same file system.  This patch adds mnt_exjail
to "struct mount" so that the credentials (and, therefore,
the prison) that did the exports for that file system can
be recorded.  If another prison has already exported the
file system, vfs_export() will fail with an error.
If mnt_exjail == NULL, the file system has not been exported.
mnt_exjail is checked by the NFS server, so that exports done
from within a different prison will not be used.

The patch also implements vfs_exjail_destroy(), which is
called from prison_cleanup() to release all the mnt_exjail
credential references, so that the prison can be removed.
Mainly to avoid doing a scan of the mountlist for the case
where there were no exports done from within the prison,
a count of how many file systems have been exported from
within the prison is kept in pr_exportcnt.

Reviewed by:	markj
Discussed with:	jamie
Differential Revision:	https://reviews.freebsd.org/D38371
MFC after:	3 months
2023-02-21 13:00:42 -08:00
..
nfs_fha_new.c nfsd: Enable the NFSD_VNET vnet front end macros 2023-02-18 14:59:36 -08:00
nfs_fha_new.h nfsd: Get rid of useless "pool" field in nfs_fha_new.c 2023-02-17 07:34:40 -08:00
nfs_nfsdcache.c nfsd: Add VNET_SYSUNINIT() macros for vnet cleanup 2023-02-20 13:11:22 -08:00
nfs_nfsdkrpc.c nfsd: Fix initialization broken by 7344856e3a6d 2023-02-12 09:16:56 -08:00
nfs_nfsdport.c vfs_export: Add mnt_exjail to control exports done in prisons 2023-02-21 13:00:42 -08:00
nfs_nfsdserv.c nfsd: Fix handling of the error case for nfsvno_open 2023-02-08 13:08:51 -08:00
nfs_nfsdsocket.c nfsd: Wrap nfsstatsv1_p in the NFSD_VNET() macro 2023-02-15 17:39:07 -08:00
nfs_nfsdstate.c nfsd: Wrap nfsstatsv1_p in the NFSD_VNET() macro 2023-02-15 17:39:07 -08:00
nfs_nfsdsubs.c nfsd: Prepare the NFS server code to run in a vnet prison 2023-02-11 15:51:19 -08:00