Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Assert ownership of alldevs_mtx, as required for co...



details:   https://anonhg.NetBSD.org/src/rev/4a67a8c40ac1
branches:  trunk
changeset: 822428:4a67a8c40ac1
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Mar 20 01:05:03 2017 +0000

description:
Assert ownership of alldevs_mtx, as required for config_makeroom.

The one caller in config_unit_alloc guarantees ownership, via
config_alldevs_enter and preserved by config_makeroom.

diffstat:

 sys/kern/subr_autoconf.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (34 lines):

diff -r a799da8fcf93 -r 4a67a8c40ac1 sys/kern/subr_autoconf.c
--- a/sys/kern/subr_autoconf.c  Mon Mar 20 00:30:03 2017 +0000
+++ b/sys/kern/subr_autoconf.c  Mon Mar 20 01:05:03 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_autoconf.c,v 1.248 2017/03/20 00:30:03 riastradh Exp $ */
+/* $NetBSD: subr_autoconf.c,v 1.249 2017/03/20 01:05:03 riastradh Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.248 2017/03/20 00:30:03 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.249 2017/03/20 01:05:03 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1166,6 +1166,7 @@
        int ondevs, nndevs;
        device_t *osp, *nsp;
 
+       KASSERT(mutex_owned(&alldevs_mtx));
        alldevs_nwrite++;
 
        for (nndevs = MAX(4, cd->cd_ndevs); nndevs <= n; nndevs += nndevs)
@@ -1209,6 +1210,7 @@
                        mutex_enter(&alldevs_mtx);
                }
        }
+       KASSERT(mutex_owned(&alldevs_mtx));
        alldevs_nwrite--;
 }
 



Home | Main Index | Thread Index | Old Index