diff options
author | Sebastien Marie <semarie@cvs.openbsd.org> | 2021-07-03 17:52:00 +0000 |
---|---|---|
committer | Sebastien Marie <semarie@cvs.openbsd.org> | 2021-07-03 17:52:00 +0000 |
commit | afb86a3e88efacbde029896750e2d2a4f353393c (patch) | |
tree | 244dab2ca6569b659d39043937f51c7925cee9c8 /sys/kern | |
parent | 0b29a75ee88ae2496c87a5d15ae6a5ad77c18f18 (diff) |
__realpath: removes LOCKLEAF from NDINIT.
The code doesn't doesn't need it: the returned vnode is released
immediately. The string path is built from the namei() call using
REALPATH, during directories traversal.
Without LOCKLEAF, calling vrele() only is enough if namei() found a
file, instead of calling VOP_UNLOCK() + vrele().
ok claudio@ mpi@
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/vfs_syscalls.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 840ea5453e1..d4f84e4f911 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_syscalls.c,v 1.349 2021/02/11 12:08:21 claudio Exp $ */ +/* $OpenBSD: vfs_syscalls.c,v 1.350 2021/07/03 17:51:59 semarie Exp $ */ /* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */ /* @@ -923,8 +923,8 @@ sys___realpath(struct proc *p, void *v, register_t *retval) if (*c != '/') break; } - NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | SAVENAME | REALPATH, - UIO_SYSSPACE, pathname, p); + NDINIT(&nd, LOOKUP, FOLLOW | SAVENAME | REALPATH, UIO_SYSSPACE, + pathname, p); nd.ni_cnd.cn_rpbuf = rpbuf; nd.ni_cnd.cn_rpi = strlen(rpbuf); @@ -934,11 +934,10 @@ sys___realpath(struct proc *p, void *v, register_t *retval) if ((error = namei(&nd)) != 0) goto end; - /* release lock and reference from namei */ - if (nd.ni_vp) { - VOP_UNLOCK(nd.ni_vp); + /* release reference from namei */ + if (nd.ni_vp) vrele(nd.ni_vp); - } + error = copyoutstr(nd.ni_cnd.cn_rpbuf, SCARG(uap, resolved), MAXPATHLEN, NULL); |