PERFORCE change 99875 for review

John Baldwin jhb at FreeBSD.org
Fri Jun 23 17:44:34 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=99875

Change 99875 by jhb at jhb_mutex on 2006/06/23 17:43:51

	Oops, something I missed when peeling Giant off of the linker:
	hold Giant around all module event handlers for now.

Affected files ...

.. //depot/projects/smpng/sys/kern/kern_module.c#20 edit

Differences ...

==== //depot/projects/smpng/sys/kern/kern_module.c#20 (text+ko) ====

@@ -99,10 +99,12 @@
 
 	if (arg2 & RB_NOSYNC)
 		return;
+	mtx_lock(&Giant);
 	MOD_SLOCK;
 	TAILQ_FOREACH(mod, &modules, link)
 		MOD_EVENT(mod, MOD_SHUTDOWN);
 	MOD_SUNLOCK;
+	mtx_unlock(&Giant);
 }
 
 void
@@ -112,6 +114,7 @@
 	int error;
 	module_t mod;
 
+	mtx_lock(&Giant);
 	MOD_SLOCK;
 	mod = module_lookupbyname(data->name);
 	if (mod == NULL)
@@ -128,6 +131,7 @@
 		    " %d\n", data->name, (void *)data->evhand, data->priv,
 		    error); 
 	}
+	mtx_unlock(&Giant);
 }
 
 int
@@ -232,12 +236,14 @@
 {
 	int error;
 
+	mtx_lock(&Giant);
 	error = MOD_EVENT(mod, MOD_QUIESCE);
 	if (error == EOPNOTSUPP || error == EINVAL)
 		error = 0;
-	if (flags == LINKER_UNLOAD_NORMAL && error != 0)
-		return (error);
-        return (MOD_EVENT(mod, MOD_UNLOAD));
+	if (error == 0 || flags == LINKER_UNLOAD_FORCE)
+		error = MOD_EVENT(mod, MOD_UNLOAD);
+	mtx_unlock(&Giant);
+	return (error);
 }
 
 int


More information about the p4-projects mailing list