git: 6b715687bd44 - main - vfs: make sure truncate always calls NDFREE_*

From: Mateusz Guzik <mjg_at_FreeBSD.org>
Date: Fri, 20 May 2022 17:25:57 UTC
The branch main has been updated by mjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=6b715687bd441f2815ec93dad7efd156fb3b591d

commit 6b715687bd441f2815ec93dad7efd156fb3b591d
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2022-05-16 01:16:17 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2022-05-20 17:25:51 +0000

    vfs: make sure truncate always calls NDFREE_*
    
    While here convert it to NDFREE_NOTHING.
---
 sys/kern/vfs_syscalls.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index ccc14bdc0382..86ef3fc7a095 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -3472,13 +3472,13 @@ retry:
 	if ((error = namei(&nd)) != 0)
 		return (error);
 	vp = nd.ni_vp;
+	NDFREE_NOTHING(&nd);
 	rl_cookie = vn_rangelock_wlock(vp, 0, OFF_MAX);
 	if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) {
 		vn_rangelock_unlock(vp, rl_cookie);
 		vrele(vp);
 		return (error);
 	}
-	NDFREE_PNBUF(&nd);
 	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 	if (vp->v_type == VDIR)
 		error = EISDIR;