Module Name: src Committed By: riastradh Date: Mon Aug 22 00:32:30 UTC 2022
Modified Files: src/sys/dev/dkwedge: dk.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.122 -r1.123 src/sys/dev/dkwedge/dk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/dkwedge/dk.c diff -u src/sys/dev/dkwedge/dk.c:1.122 src/sys/dev/dkwedge/dk.c:1.123 --- src/sys/dev/dkwedge/dk.c:1.122 Mon Aug 22 00:31:57 2022 +++ src/sys/dev/dkwedge/dk.c Mon Aug 22 00:32:30 2022 @@ -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, s 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