From: Kirk McKusick Date: Tue, 22 Nov 1994 09:42:10 +0000 (-0800) Subject: return EBUSY if reference count on mount point is greater than 1 to X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/commitdiff_plain/7a191a213efffdb6838c010998b9e95667a1f39b return EBUSY if reference count on mount point is greater than 1 to avoid problems in lookup from programs referencing the hidden vnode SCCS-vsn: sys/kern/vfs_syscalls.c 8.25 --- diff --git a/usr/src/sys/kern/vfs_syscalls.c b/usr/src/sys/kern/vfs_syscalls.c index c59ce72831..4577355cf1 100644 --- a/usr/src/sys/kern/vfs_syscalls.c +++ b/usr/src/sys/kern/vfs_syscalls.c @@ -9,7 +9,7 @@ * * %sccs.include.redist.c% * - * @(#)vfs_syscalls.c 8.24 (Berkeley) %G% + * @(#)vfs_syscalls.c 8.25 (Berkeley) %G% */ #include @@ -145,6 +145,10 @@ mount(p, uap, retval) vput(vp); return (ENODEV); } + if (vp->v_usecount > 1 || vp->v_mountedhere != NULL) { + vput(vp); + return (EBUSY); + } /* * Allocate and initialize the file system. @@ -158,12 +162,6 @@ mount(p, uap, retval) vput(vp); return (error); } - if (vp->v_mountedhere != NULL) { - vfs_unlock(mp); - free((caddr_t)mp, M_MOUNT); - vput(vp); - return (EBUSY); - } vp->v_mountedhere = mp; mp->mnt_vnodecovered = vp; mp->mnt_stat.f_owner = p->p_ucred->cr_uid;