nfsd: Return ENXIO instead of EPERM when nfsd(8) already running

The nfsd(8) daemon generates an error message that does not
indicate that the nfsd daemon is already running when the nfssvc(2)
syscall fails for the NFSSVC_STABLERESTART.  Also, the check for
running nfsd(8) in a vnet prison will return EPERM when it fails.

This patch replaces EPERM with ENXIO so that the nfsd(8) daemon
can generate more reasonable failure messages.  The nfsd(8) daemon
will be patched in a future commit.

MFC after:	3 months
This commit is contained in:
Rick Macklem 2023-02-22 13:19:07 -08:00
parent 30c91a3cee
commit 10dff9da97

View File

@ -4007,7 +4007,7 @@ nfssvc_srvcall(struct thread *p, struct nfssvc_args *uap, struct ucred *cred)
if (!error && (NFSFPFLAG(fp) & (FREAD | FWRITE)) != (FREAD | FWRITE))
error = EBADF;
if (!error && NFSD_VNET(nfsrv_numnfsd) != 0)
error = EPERM;
error = ENXIO;
if (!error) {
NFSD_VNET(nfsrv_stablefirst).nsf_fp = fp;
nfsrv_setupstable(p);