git: 5fd0916cdbfd - main - nfsd: Add a KASSERT in nfsvno_open

From: Rick Macklem <rmacklem_at_FreeBSD.org>
Date: Sat, 11 Feb 2023 15:15:12 UTC
The branch main has been updated by rmacklem:

URL: https://cgit.FreeBSD.org/src/commit/?id=5fd0916cdbfdbaad620f3d5e7ff80e3436c640ea

commit 5fd0916cdbfdbaad620f3d5e7ff80e3436c640ea
Author:     Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2023-02-11 15:14:08 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2023-02-11 15:14:08 +0000

    nfsd: Add a KASSERT in nfsvno_open
    
    Commit ded5f2954e1a defined done_namei to indicate that
    nd_repstat was set after a successful nfsvno_namei(),
    so that a cleanup needs to be done in nfsvno_open().
    This only happens when nfsvno_namei() is done with CREATE.
    
    This patch adds a KASSERT() to check for that.
    
    PR:     268971
---
 sys/fs/nfsserver/nfs_nfsdport.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c
index daa57222fe22..9cd7f9320bd5 100644
--- a/sys/fs/nfsserver/nfs_nfsdport.c
+++ b/sys/fs/nfsserver/nfs_nfsdport.c
@@ -1926,6 +1926,8 @@ nfsvno_open(struct nfsrv_descript *nd, struct nameidata *ndp,
 			}
 		}
 	} else if (done_namei) {
+		KASSERT(create == NFSV4OPEN_CREATE,
+		    ("nfsvno_open: not create"));
 		/*
 		 * done_namei is set when nfsvno_namei() has completed
 		 * successfully, but a subsequent error was set in