On 02/11/16 03:02, Greg Quinlan wrote:
Hi HPS,
Note: Does not happen on FreeBSD 10.1-Stable!


Yes, that's because WITNESS is off in 10.x by default.

Does the attached patch solve your problem?

--HPS

Index: sys/kern/kern_module.c
===================================================================
--- sys/kern/kern_module.c	(revision 295464)
+++ sys/kern/kern_module.c	(working copy)
@@ -214,16 +214,24 @@
 module_lookupbyname(const char *name)
 {
 	module_t mod;
+	int xlocked;
 	int err;
 
-	MOD_LOCK_ASSERT;
-
+	/*
+	 * If the context is not properly locked, apply the proper
+	 * locks here:
+	 */
+	xlocked = sx_xlocked(&modules_sx);
+	if (!xlocked)
+		MOD_SLOCK;
 	TAILQ_FOREACH(mod, &modules, link) {
 		err = strcmp(mod->name, name);
 		if (err == 0)
-			return (mod);
+			break;
 	}
-	return (NULL);
+	if (!xlocked)
+		MOD_SUNLOCK;
+	return (mod);
 }
 
 module_t
_______________________________________________
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Reply via email to