git: 3df3d88cc5e2 - main - vfs: move cn_nameptr assignment out of namei_getpath
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 17 Sep 2022 09:11:40 UTC
The branch main has been updated by mjg:
URL: https://cgit.FreeBSD.org/src/commit/?id=3df3d88cc5e291e106696c5a7734dc6640693a4a
commit 3df3d88cc5e291e106696c5a7734dc6640693a4a
Author: Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2022-09-17 00:59:32 +0000
Commit: Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2022-09-17 09:08:34 +0000
vfs: move cn_nameptr assignment out of namei_getpath
---
sys/kern/vfs_lookup.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c
index 4281cd434fcf..79c7fd8365fa 100644
--- a/sys/kern/vfs_lookup.c
+++ b/sys/kern/vfs_lookup.c
@@ -420,11 +420,7 @@ namei_getpath(struct nameidata *ndp)
&ndp->ni_pathlen);
}
- if (__predict_false(error != 0))
- return (error);
-
- cnp->cn_nameptr = cnp->cn_pnbuf;
- return (0);
+ return (error);
}
static int
@@ -622,6 +618,8 @@ namei(struct nameidata *ndp)
return (error);
}
+ cnp->cn_nameptr = cnp->cn_pnbuf;
+
#ifdef KTRACE
if (KTRPOINT(td, KTR_NAMEI)) {
ktrnamei(cnp->cn_pnbuf);
@@ -654,6 +652,7 @@ namei(struct nameidata *ndp)
namei_cleanup_cnp(cnp);
return (error);
}
+ cnp->cn_nameptr = cnp->cn_pnbuf;
/* FALLTHROUGH */
case CACHE_FPL_STATUS_ABORTED:
TAILQ_INIT(&ndp->ni_cap_tracker);