Don't release the lock on mount point vnode so early when doing update mount.

Otherwise, race condition occurs (e.g., between mountd(8) and next mount(8)
when multiple update mount command is invoked from shell script).
This commit is contained in:
enami 2002-05-11 00:45:06 +00:00
parent c1fc5d35dc
commit 3700fdfba4
1 changed files with 4 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: vfs_syscalls.c,v 1.173 2001/11/12 15:25:41 lukem Exp $ */ /* $NetBSD: vfs_syscalls.c,v 1.174 2002/05/11 00:45:06 enami Exp $ */
/* /*
* Copyright (c) 1989, 1993 * Copyright (c) 1989, 1993
@ -41,7 +41,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.173 2001/11/12 15:25:41 lukem Exp $"); __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.174 2002/05/11 00:45:06 enami Exp $");
#include "opt_compat_netbsd.h" #include "opt_compat_netbsd.h"
#include "opt_compat_43.h" #include "opt_compat_43.h"
@ -204,7 +204,6 @@ sys_mount(p, v, retval)
vput(vp); vput(vp);
return (EPERM); return (EPERM);
} }
VOP_UNLOCK(vp, 0);
goto update; goto update;
} else { } else {
if (securelevel >= 2) { if (securelevel >= 2) {
@ -310,7 +309,6 @@ update:
*/ */
error = VFS_MOUNT(mp, SCARG(uap, path), SCARG(uap, data), &nd, p); error = VFS_MOUNT(mp, SCARG(uap, path), SCARG(uap, data), &nd, p);
if (mp->mnt_flag & MNT_UPDATE) { if (mp->mnt_flag & MNT_UPDATE) {
vrele(vp);
if (mp->mnt_flag & MNT_WANTRDWR) if (mp->mnt_flag & MNT_WANTRDWR)
mp->mnt_flag &= ~MNT_RDONLY; mp->mnt_flag &= ~MNT_RDONLY;
mp->mnt_flag &=~ mp->mnt_flag &=~
@ -325,6 +323,8 @@ update:
vfs_deallocate_syncvnode(mp); vfs_deallocate_syncvnode(mp);
} }
vfs_unbusy(mp); vfs_unbusy(mp);
VOP_UNLOCK(vp, 0);
vrele(vp);
return (error); return (error);
} }
/* /*