From 240c3f5a22149302602cf07edde83a4ae888ec81 Mon Sep 17 00:00:00 2001 From: Joe Talbott Date: Mon, 21 Jun 2010 21:14:28 -0400 Subject: [PATCH] kern_linker - Rearrange locking a bit for module loading. This was needed to get automatic firmware module loading to work properly. --- sys/kern/kern_linker.c | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c index 4c2ccc0..21f19e5 100644 --- a/sys/kern/kern_linker.c +++ b/sys/kern/kern_linker.c @@ -1091,8 +1091,10 @@ linker_reference_module(const char *modname, struct mod_depend *verinfo, return (0); } - error = linker_load_module(NULL, modname, NULL, verinfo, result); lockmgr(&lock, LK_RELEASE); + get_mplock(); + error = linker_load_module(NULL, modname, NULL, verinfo, result); + rel_mplock(); return (error); } @@ -1116,8 +1118,10 @@ linker_release_module(const char *modname, struct mod_depend *verinfo, } else KASSERT(modname == NULL && verinfo == NULL, ("linker_release_module: both file and name")); - error = linker_file_unload(lf); lockmgr(&lock, LK_RELEASE); + get_mplock(); + error = linker_file_unload(lf); + rel_mplock(); return (error); } @@ -1463,11 +1467,15 @@ linker_load_module(const char *kldname, const char *modname, if (modlist_lookup2(modname, verinfo) != NULL) return (EEXIST); if (kldname != NULL) + { pathname = linker_strdup(kldname); + } else if (rootvnode == NULL) pathname = NULL; else + { pathname = linker_search_path(modname); + } #if 0 /* * Need to find a KLD with required module -- 1.7.7.2