Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/dkwedge release openlock mutex before closing parent...
details: https://anonhg.NetBSD.org/src/rev/0e87f6e4cf21
branches: trunk
changeset: 345449:0e87f6e4cf21
user: mlelstv <mlelstv%NetBSD.org@localhost>
date: Sun May 29 12:48:40 2016 +0000
description:
release openlock mutex before closing parent device.
diffstat:
sys/dev/dkwedge/dk.c | 21 +++++++++++----------
1 files changed, 11 insertions(+), 10 deletions(-)
diffs (60 lines):
diff -r 820195c4a310 -r 0e87f6e4cf21 sys/dev/dkwedge/dk.c
--- a/sys/dev/dkwedge/dk.c Sun May 29 09:16:11 2016 +0000
+++ b/sys/dev/dkwedge/dk.c Sun May 29 12:48:40 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dk.c,v 1.89 2016/04/27 02:19:12 christos Exp $ */
+/* $NetBSD: dk.c,v 1.90 2016/05/29 12:48:40 mlelstv Exp $ */
/*-
* Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.89 2016/04/27 02:19:12 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.90 2016/05/29 12:48:40 mlelstv Exp $");
#ifdef _KERNEL_OPT
#include "opt_dkwedge.h"
@@ -546,13 +546,13 @@
mutex_enter(&dk->dk_openlock);
if (dk->dk_openmask == 0)
; /* nothing to do */
- else if ((flags & DETACH_FORCE) == 0)
+ else if ((flags & DETACH_FORCE) == 0) {
rc = EBUSY;
- else {
+ mutex_exit(&dk->dk_openlock);
+ } else {
mutex_enter(&sc->sc_parent->dk_rawlock);
- rc = dklastclose(sc); /* releases dk_rawlock */
+ rc = dklastclose(sc); /* releases locks */
}
- mutex_exit(&dk->dk_openlock);
return rc;
}
@@ -1146,6 +1146,7 @@
}
mutex_exit(&sc->sc_parent->dk_rawlock);
+ mutex_exit(&sc->sc_dk.dk_openlock);
if (doclose) {
KASSERT(sc->sc_parent->dk_rawvp != NULL);
@@ -1185,11 +1186,11 @@
sc->sc_dk.dk_copenmask | sc->sc_dk.dk_bopenmask;
if (sc->sc_dk.dk_openmask == 0)
- error = dklastclose(sc); /* releases dk_rawlock */
- else
+ error = dklastclose(sc); /* releases locks */
+ else {
mutex_exit(&sc->sc_parent->dk_rawlock);
-
- mutex_exit(&sc->sc_dk.dk_openlock);
+ mutex_exit(&sc->sc_dk.dk_openlock);
+ }
return (error);
}
Home |
Main Index |
Thread Index |
Old Index