From 10dff9da9748b0eadd2d02dded3afd2321d15537 Mon Sep 17 00:00:00 2001 From: Rick Macklem Date: Wed, 22 Feb 2023 13:19:07 -0800 Subject: [PATCH] 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 --- sys/fs/nfsserver/nfs_nfsdport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c index 34b2f114bd7..9c7169d7daa 100644 --- a/sys/fs/nfsserver/nfs_nfsdport.c +++ b/sys/fs/nfsserver/nfs_nfsdport.c @@ -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);