summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2022-08-22 00:19:22 +0000
committerriastradh <riastradh@NetBSD.org>2022-08-22 00:19:22 +0000
commitb9db97e63a8ad767e78e1ca5c29a6bbbd3b63ad2 (patch)
tree25b73488ce43ab8a63eecc2615ae2060fefcaaad /sys/dev
parent639e3bb52914d4db63014cd38eb63018cdddb9db (diff)
dk(4): Move lock release out of dklastclose into caller.
No longer necessary to have this unbalanced logic now that dk_close_parent correctly happens under the lock in order to serialize with dk_open_parent. No functional change intended.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/dkwedge/dk.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/sys/dev/dkwedge/dk.c b/sys/dev/dkwedge/dk.c
index 9379ebadf9e..c5a2410f5b9 100644
--- a/sys/dev/dkwedge/dk.c
+++ b/sys/dev/dkwedge/dk.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dk.c,v 1.113 2022/08/22 00:19:12 riastradh Exp $ */
+/* $NetBSD: dk.c,v 1.114 2022/08/22 00:19:22 riastradh 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.113 2022/08/22 00:19:12 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.114 2022/08/22 00:19:22 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_dkwedge.h"
@@ -589,7 +589,9 @@ dkwedge_cleanup_parent(struct dkwedge_softc *sc, int flags)
mutex_exit(&dk->dk_openlock);
} else {
mutex_enter(&sc->sc_parent->dk_rawlock);
- rc = dklastclose(sc); /* releases locks */
+ rc = dklastclose(sc);
+ mutex_exit(&sc->sc_parent->dk_rawlock);
+ mutex_exit(&sc->sc_dk.dk_openlock);
}
return rc;
@@ -1224,9 +1226,6 @@ dklastclose(struct dkwedge_softc *sc)
dk_close_parent(vp, mode);
}
- mutex_exit(&sc->sc_parent->dk_rawlock);
- mutex_exit(&sc->sc_dk.dk_openlock);
-
return error;
}
@@ -1259,7 +1258,9 @@ dkclose(dev_t dev, int flags, int fmt, struct lwp *l)
sc->sc_dk.dk_copenmask | sc->sc_dk.dk_bopenmask;
if (sc->sc_dk.dk_openmask == 0) {
- error = dklastclose(sc); /* releases locks */
+ error = dklastclose(sc);
+ mutex_exit(&sc->sc_parent->dk_rawlock);
+ mutex_exit(&sc->sc_dk.dk_openlock);
} else {
mutex_exit(&sc->sc_parent->dk_rawlock);
mutex_exit(&sc->sc_dk.dk_openlock);