Source-Changes-HG archive

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

[src/trunk]: src/sys/dev use dk_openlock when accessing openmask.



details:   https://anonhg.NetBSD.org/src/rev/d72128cc5d33
branches:  trunk
changeset: 339652:d72128cc5d33
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sun Aug 02 11:40:41 2015 +0000

description:
use dk_openlock when accessing openmask.

diffstat:

 sys/dev/vnd.c |  11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diffs (53 lines):

diff -r e0647be1d057 -r d72128cc5d33 sys/dev/vnd.c
--- a/sys/dev/vnd.c     Sun Aug 02 11:28:01 2015 +0000
+++ b/sys/dev/vnd.c     Sun Aug 02 11:40:41 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vnd.c,v 1.246 2015/07/28 13:12:47 prlw1 Exp $  */
+/*     $NetBSD: vnd.c,v 1.247 2015/08/02 11:40:41 mlelstv Exp $        */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.246 2015/07/28 13:12:47 prlw1 Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.247 2015/08/02 11:40:41 mlelstv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vnd.h"
@@ -343,6 +343,8 @@
        if ((error = vndlock(sc)) != 0)
                return error;
 
+       mutex_enter(&sc->sc_dkdev.dk_openlock);
+
        if ((sc->sc_flags & VNF_CLEARING) != 0) {
                error = ENXIO;
                goto done;
@@ -403,6 +405,7 @@
            sc->sc_dkdev.dk_copenmask | sc->sc_dkdev.dk_bopenmask;
 
  done:
+       mutex_exit(&sc->sc_dkdev.dk_openlock);
        vndunlock(sc);
        return error;
 }
@@ -425,6 +428,8 @@
        if ((error = vndlock(sc)) != 0)
                return error;
 
+       mutex_enter(&sc->sc_dkdev.dk_openlock);
+
        part = DISKPART(dev);
 
        /* ...that much closer to allowing unconfiguration... */
@@ -446,6 +451,8 @@
                        sc->sc_flags &= ~VNF_VLABEL;
        }
 
+       mutex_exit(&sc->sc_dkdev.dk_openlock);
+
        vndunlock(sc);
 
        if ((sc->sc_flags & VNF_INITED) == 0) {



Home | Main Index | Thread Index | Old Index