Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Fix vnode locking for opendisk(), must lock for VOP...



details:   https://anonhg.NetBSD.org/src/rev/1dd070ad87a1
branches:  trunk
changeset: 449054:1dd070ad87a1
user:      hannken <hannken%NetBSD.org@localhost>
date:      Wed Feb 20 10:02:51 2019 +0000

description:
Fix vnode locking for opendisk(), must lock for VOP_OPEN().

diffstat:

 sys/kern/subr_disk_open.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r eaebd4a2f0cd -r 1dd070ad87a1 sys/kern/subr_disk_open.c
--- a/sys/kern/subr_disk_open.c Wed Feb 20 09:59:39 2019 +0000
+++ b/sys/kern/subr_disk_open.c Wed Feb 20 10:02:51 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_disk_open.c,v 1.13 2015/12/08 20:36:15 christos Exp $     */
+/*     $NetBSD: subr_disk_open.c,v 1.14 2019/02/20 10:02:51 hannken Exp $      */
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_disk_open.c,v 1.13 2015/12/08 20:36:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_disk_open.c,v 1.14 2019/02/20 10:02:51 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -65,6 +65,7 @@
        if (bdevvp(dev, &tmpvn))
                panic("%s: can't alloc vnode for %s", __func__,
                    device_xname(dv));
+       vn_lock(tmpvn, LK_EXCLUSIVE | LK_RETRY);
        error = VOP_OPEN(tmpvn, FREAD | FSILENT, NOCRED);
        if (error) {
                /*



Home | Main Index | Thread Index | Old Index