git: 10dff9da9748 - main - nfsd: Return ENXIO instead of EPERM when nfsd(8) already running

From: Rick Macklem <rmacklem_at_FreeBSD.org>
Date: Wed, 22 Feb 2023 21:19:57 UTC
The branch main has been updated by rmacklem:

URL: https://cgit.FreeBSD.org/src/commit/?id=10dff9da9748b0eadd2d02dded3afd2321d15537

commit 10dff9da9748b0eadd2d02dded3afd2321d15537
Author:     Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2023-02-22 21:19:07 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2023-02-22 21:19:07 +0000

    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 34b2f114bd7a..9c7169d7daac 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);