diff options
| author | riastradh <riastradh@NetBSD.org> | 2022-08-22 00:32:30 +0000 |
|---|---|---|
| committer | riastradh <riastradh@NetBSD.org> | 2022-08-22 00:32:30 +0000 |
| commit | f12342b7f87dbf5d4ecfe854d418ecc63f28a526 (patch) | |
| tree | 4325d87125d61740697a897b140174b198865152 /sys/dev | |
| parent | 3362568525e0009b4fffdf062a1089e7aae83160 (diff) | |
dk(4): Assert about dk_openmask under the lock.
This serves two purposes:
1. Pacifies data race sanitizers.
2. Ensures that we don't spuriously trip over the assertion if
dkclose happens concurrently with dkopen due to a revoke call.
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/dkwedge/dk.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/dev/dkwedge/dk.c b/sys/dev/dkwedge/dk.c index bbb3539fe3c..1884ce1b2ff 100644 --- a/sys/dev/dkwedge/dk.c +++ b/sys/dev/dkwedge/dk.c @@ -1,4 +1,4 @@ -/* $NetBSD: dk.c,v 1.122 2022/08/22 00:31:57 riastradh Exp $ */ +/* $NetBSD: dk.c,v 1.123 2022/08/22 00:32:30 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.122 2022/08/22 00:31:57 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.123 2022/08/22 00:32:30 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_dkwedge.h" @@ -1250,11 +1250,11 @@ dkclose(dev_t dev, int flags, int fmt, struct lwp *l) if (sc->sc_state != DKW_STATE_RUNNING) return ENXIO; - KASSERT(sc->sc_dk.dk_openmask != 0); - mutex_enter(&sc->sc_dk.dk_openlock); mutex_enter(&sc->sc_parent->dk_rawlock); + KASSERT(sc->sc_dk.dk_openmask != 0); + if (fmt == S_IFCHR) sc->sc_dk.dk_copenmask &= ~1; else |
