Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/dkwedge Revert "dk(4): Narrow scope of dk_rawlock on...



details:   https://anonhg.NetBSD.org/src/rev/774b35bf4602
branches:  trunk
changeset: 369578:774b35bf4602
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Aug 22 00:31:57 2022 +0000

description:
Revert "dk(4): Narrow scope of dk_rawlock on close to dklastclose."

dkfirstopen relies on reading from dk_openmask of _other_ wedges,
writes to dk_openmask must be serialized by dk_rawlock in addition to
dk_openlock.  (However, reads from dk_openlock only require one or
the other).

diffstat:

 sys/dev/dkwedge/dk.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (39 lines):

diff -r 24de6fb64c2e -r 774b35bf4602 sys/dev/dkwedge/dk.c
--- a/sys/dev/dkwedge/dk.c      Mon Aug 22 00:20:56 2022 +0000
+++ b/sys/dev/dkwedge/dk.c      Mon Aug 22 00:31:57 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dk.c,v 1.121 2022/08/22 00:20:36 riastradh Exp $       */
+/*     $NetBSD: dk.c,v 1.122 2022/08/22 00:31:57 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.121 2022/08/22 00:20:36 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.122 2022/08/22 00:31:57 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_dkwedge.h"
@@ -1253,6 +1253,7 @@
        KASSERT(sc->sc_dk.dk_openmask != 0);
 
        mutex_enter(&sc->sc_dk.dk_openlock);
+       mutex_enter(&sc->sc_parent->dk_rawlock);
 
        if (fmt == S_IFCHR)
                sc->sc_dk.dk_copenmask &= ~1;
@@ -1262,11 +1263,10 @@
            sc->sc_dk.dk_copenmask | sc->sc_dk.dk_bopenmask;
 
        if (sc->sc_dk.dk_openmask == 0) {
-               mutex_enter(&sc->sc_parent->dk_rawlock);
                dklastclose(sc);
-               mutex_exit(&sc->sc_parent->dk_rawlock);
        }
 
+       mutex_exit(&sc->sc_parent->dk_rawlock);
        mutex_exit(&sc->sc_dk.dk_openlock);
 
        return 0;



Home | Main Index | Thread Index | Old Index