From 82313816f8f3ea81e3fd7a739743657c1b6fea0d Mon Sep 17 00:00:00 2001 From: xtraeme Date: Sat, 21 Jul 2007 17:18:00 +0000 Subject: [PATCH] Use the mutex that belongs to the specific task and do not mix them blindly. - sme_list_mtx to access to the linked lists sme_list/sme_names_list. - sme_mtx to access to the data in the sysmon envsys device. --- sys/dev/sysmon/sysmon_envsys.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sys/dev/sysmon/sysmon_envsys.c b/sys/dev/sysmon/sysmon_envsys.c index f8fad365adae..24768357f551 100644 --- a/sys/dev/sysmon/sysmon_envsys.c +++ b/sys/dev/sysmon/sysmon_envsys.c @@ -1,4 +1,4 @@ -/* $NetBSD: sysmon_envsys.c,v 1.38 2007/07/21 16:16:59 xtraeme Exp $ */ +/* $NetBSD: sysmon_envsys.c,v 1.39 2007/07/21 17:18:00 xtraeme Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -75,7 +75,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.38 2007/07/21 16:16:59 xtraeme Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.39 2007/07/21 17:18:00 xtraeme Exp $"); #include #include @@ -233,20 +233,23 @@ sysmonioctl_envsys(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l) * new data if it's different than we have currently * in the dictionary. */ - mutex_enter(&sme_mtx); + mutex_enter(&sme_list_mtx); LIST_FOREACH(sme, &sysmon_envsys_list, sme_list) { if (sme == NULL) continue; + mutex_enter(&sme_mtx); error = sme_update_dictionary(sme); if (error) { DPRINTF(("%s: sme_update_dictionary, " "error=%d\n", __func__, error)); + mutex_exit(&sme_list_mtx); mutex_exit(&sme_mtx); return error; } + mutex_exit(&sme_mtx); } - mutex_exit(&sme_mtx); + mutex_exit(&sme_list_mtx); /* * Copy global dictionary to userland. */