git: 44e9c9f8f391 - main - nfsvno_rename(): do not use -1 as special error indicator

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Wed, 09 Jul 2025 17:38:16 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=44e9c9f8f3916200292e8191f3534dc7946c5c37

commit 44e9c9f8f3916200292e8191f3534dc7946c5c37
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2025-07-08 19:52:44 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-07-09 17:38:11 +0000

    nfsvno_rename(): do not use -1 as special error indicator
    
    it clashes with ERESTART.  Use EJUSTRETURN for the case, as it is often
    done in other places in the kernel.
    
    Reviewed by:    markj, rmacklem
    Tested by:      pho
    Sponsored by:   The FreeBSD Foundation
    Differential revision:  https://reviews.freebsd.org/D51211
---
 sys/fs/nfsserver/nfs_nfsdport.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c
index a81f1492ef95..95dc44438acc 100644
--- a/sys/fs/nfsserver/nfs_nfsdport.c
+++ b/sys/fs/nfsserver/nfs_nfsdport.c
@@ -1652,10 +1652,11 @@ nfsvno_rename(struct nameidata *fromndp, struct nameidata *tondp,
 	}
 	if (fvp == tvp) {
 		/*
-		 * If source and destination are the same, there is nothing to
-		 * do. Set error to -1 to indicate this.
+		 * If source and destination are the same, there is
+		 * nothing to do. Set error to EJUSTRETURN to indicate
+		 * this.
 		 */
-		error = -1;
+		error = EJUSTRETURN;
 		goto out;
 	}
 	if (nd->nd_flag & ND_NFSV4) {
@@ -1710,7 +1711,7 @@ out:
 			vput(tvp);
 		vrele(fromndp->ni_dvp);
 		vrele(fvp);
-		if (error == -1)
+		if (error == EJUSTRETURN)
 			error = 0;
 	}