prison_check_nfsd: Add check for enforce_statfs != 0

Since mountd(8) will not be able to do exports
when running in a vnet prison if enforce_statfs is
set to 0, add a check for this to prison_check_nfsd().

Reviewed by:	jamie, markj
MFC after:	2 months
Differential Revision:	https://reviews.freebsd.org/D38189
This commit is contained in:
Rick Macklem 2023-02-01 16:02:20 -08:00
parent 25c862ae50
commit 99187c3a44

View File

@ -3491,6 +3491,8 @@ prison_check(struct ucred *cred1, struct ucred *cred2)
* - The root directory (pr_root) of the prison must be
* a file system mount point, so the mountd can hang
* export information on it.
* - The prison's enforce_statfs cannot be 0, so that
* mountd(8) can do exports.
*/
bool
prison_check_nfsd(struct ucred *cred)
@ -3502,6 +3504,8 @@ prison_check_nfsd(struct ucred *cred)
return (false);
if ((cred->cr_prison->pr_root->v_vflag & VV_ROOT) == 0)
return (false);
if (cred->cr_prison->pr_enforce_statfs == 0)
return (false);
return (true);
}