Subject: Re: kern/36673: dubious code in sysmon_envsys
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
List: netbsd-bugs
Date: 07/21/2007 17:55:02
The following reply was made to PR kern/36673; it has been noted by GNATS.

From: yamt@mwd.biglobe.ne.jp (YAMAMOTO Takashi)
To: juan@xtrarom.org
Cc: gnats-bugs@NetBSD.org
Subject: Re: kern/36673: dubious code in sysmon_envsys
Date: Sun, 22 Jul 2007 02:53:02 +0900 (JST)

 > >  what i want to know is if it's safe to drop the lock here,
 > >  rather than a reason why you want to drop it...
 > 
 > Do you think is it safe? well, I don't know.
 
 i don't know.
 
 > Do you have any idea
 > how to change it to be safe?
 
 if i were you, i'd do it like the following.
 
 	/* setup new data without any lock held
 	 (create and fill a dictionary, etc) */
 
 	mutex_enter(global_mutex);
 
 	/* attach the above data into the global structure,
 	  so that it's visible from other threads.
 	  (sme_register_sensorname, prop_array_add) */
 
 	mutex_exit(global_mutex);
 
 YAMAMOTO Takashi