6452185 fmd can deadlock on exit if fmd-self-diagnosis is processing an ereport during module unload
authorcindi
Tue, 25 Jul 2006 14:29:01 -0700
changeset 2438 a39fcba7b390
parent 2437 63f0565fda5e
child 2439 40447ed85d31
6452185 fmd can deadlock on exit if fmd-self-diagnosis is processing an ereport during module unload
usr/src/cmd/fm/fmd/common/fmd.c
--- a/usr/src/cmd/fm/fmd/common/fmd.c	Tue Jul 25 13:52:56 2006 -0700
+++ b/usr/src/cmd/fm/fmd/common/fmd.c	Tue Jul 25 14:29:01 2006 -0700
@@ -514,11 +514,15 @@
 	 * hold the dispq lock as a writer while doing so since it uses d_self.
 	 */
 	if (dp->d_self != NULL) {
+		fmd_module_t *self;
+
 		(void) pthread_rwlock_wrlock(&dp->d_disp->dq_lock);
-		fmd_module_unload(dp->d_self);
-		fmd_module_rele(dp->d_self);
+		self = dp->d_self;
 		dp->d_self = NULL;
 		(void) pthread_rwlock_unlock(&dp->d_disp->dq_lock);
+
+		fmd_module_unload(self);
+		fmd_module_rele(self);
 	}
 
 	/*