From 31784ee1e37dc0337637493721c4c9b98547089b Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Mon, 25 Nov 2024 14:41:17 +0200 Subject: [PATCH] kern___realpathat(): style Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 3 days Differential revision: https://reviews.freebsd.org/D47739 --- sys/kern/vfs_cache.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index fa6b23fe3d6f..c4b4d59f3b40 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -3265,6 +3265,8 @@ kern___realpathat(struct thread *td, int fd, const char *path, char *buf, if (nd.ni_vp->v_type == VREG && nd.ni_dvp->v_type != VDIR && (nd.ni_vp->v_vflag & VV_ROOT) != 0) { + struct vnode *covered_vp; + /* * This happens if vp is a file mount. The call to * vn_fullpath_hardlink can panic if path resolution can't be @@ -3274,7 +3276,6 @@ kern___realpathat(struct thread *td, int fd, const char *path, char *buf, * this should have a unique global path since we disallow * mounting on linked files. */ - struct vnode *covered_vp; error = vn_lock(nd.ni_vp, LK_SHARED); if (error != 0) goto out; @@ -3284,8 +3285,9 @@ kern___realpathat(struct thread *td, int fd, const char *path, char *buf, error = vn_fullpath(covered_vp, &retbuf, &freebuf); vrele(covered_vp); } else { - error = vn_fullpath_hardlink(nd.ni_vp, nd.ni_dvp, nd.ni_cnd.cn_nameptr, - nd.ni_cnd.cn_namelen, &retbuf, &freebuf, &size); + error = vn_fullpath_hardlink(nd.ni_vp, nd.ni_dvp, + nd.ni_cnd.cn_nameptr, nd.ni_cnd.cn_namelen, &retbuf, + &freebuf, &size); } if (error == 0) { error = copyout(retbuf, buf, size);