diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -3265,6 +3265,8 @@ 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 @@ * 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 @@ 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);