git: 9a237074d380 - main - nfs_nfsdsocket.c: Fix "nfsstats -d" for ERELOOKUP

From: Rick Macklem <rmacklem_at_FreeBSD.org>
Date: Thu, 08 Oct 2026 19:06:31 UTC
The branch main has been updated by rmacklem:

URL: https://cgit.FreeBSD.org/src/commit/?id=9a237074d380233e93a17ddee6b155cc2f90ee96

commit 9a237074d380233e93a17ddee6b155cc2f90ee96
Author:     Bren <BlueSkiesApplePies+FreeBUG@pm.me>
AuthorDate: 2026-10-08 19:03:51 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2026-10-08 19:03:51 +0000

    nfs_nfsdsocket.c: Fix "nfsstats -d" for ERELOOKUP
    
    When ERELOOKLUP is returned by a file operation
    (always vop_lookup?) the operation is retried without
    doing nfsrv_statsend().
    
    This patch fixes this problem,
    
    The only effect of the bug was bogus "nfsstat -d"
    output.
    
    PR:     298534
    Reviewed by:    rmacklem
    MFC after:      1 week
---
 sys/fs/nfsserver/nfs_nfsdsocket.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sys/fs/nfsserver/nfs_nfsdsocket.c b/sys/fs/nfsserver/nfs_nfsdsocket.c
index 70aa20d4aa04..7061ab86afa0 100644
--- a/sys/fs/nfsserver/nfs_nfsdsocket.c
+++ b/sys/fs/nfsserver/nfs_nfsdsocket.c
@@ -652,6 +652,8 @@ tryagain:
 		vn_finished_write(mp);
 
 		if (error == 0 && nd->nd_repstat == ERELOOKUP) {
+			nfsrvd_statend(nfsv3to4op[nd->nd_procnum], /*bytes*/ 0,
+			    /*now*/ NULL, /*then*/ &start_time);
 			/*
 			 * Roll back to the beginning of the RPC request
 			 * arguments.
@@ -1353,6 +1355,11 @@ tryagain:
 		}
 
 		if (nd->nd_repstat == ERELOOKUP) {
+			if (statsinprog != 0) {
+				nfsrvd_statend(op, /*bytes*/ 0, /*now*/ NULL,
+				    /*then*/ &start_time);
+				statsinprog = 0;
+			}
 			/*
 			 * Roll back to the beginning of the operation
 			 * arguments.