Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Don't release the lock on mount point vnode so earl...



details:   https://anonhg.NetBSD.org/src/rev/47aaef0acb55
branches:  trunk
changeset: 526800:47aaef0acb55
user:      enami <enami%NetBSD.org@localhost>
date:      Sat May 11 00:45:06 2002 +0000

description:
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).

diffstat:

 sys/kern/vfs_syscalls.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (43 lines):

diff -r 32852abf25d1 -r 47aaef0acb55 sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c   Sat May 11 00:36:02 2002 +0000
+++ b/sys/kern/vfs_syscalls.c   Sat May 11 00:45:06 2002 +0000
@@ -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
@@ -41,7 +41,7 @@
  */
 
 #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_43.h"
@@ -204,7 +204,6 @@
                        vput(vp);
                        return (EPERM);
                }                     
-               VOP_UNLOCK(vp, 0);
                goto update;
        } else {
                if (securelevel >= 2) {
@@ -310,7 +309,6 @@
         */
        error = VFS_MOUNT(mp, SCARG(uap, path), SCARG(uap, data), &nd, p);
        if (mp->mnt_flag & MNT_UPDATE) {
-               vrele(vp);
                if (mp->mnt_flag & MNT_WANTRDWR)
                        mp->mnt_flag &= ~MNT_RDONLY;
                mp->mnt_flag &=~
@@ -325,6 +323,8 @@
                                vfs_deallocate_syncvnode(mp);
                }
                vfs_unbusy(mp);
+               VOP_UNLOCK(vp, 0);
+               vrele(vp);
                return (error);
        }
        /*



Home | Main Index | Thread Index | Old Index