Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Nov 2010 19:43:57 +0000 (UTC)
From:      Attilio Rao <attilio@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r215544 - head/sys/kern
Message-ID:  <201011191943.oAJJhv3i087205@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: attilio
Date: Fri Nov 19 19:43:56 2010
New Revision: 215544
URL: http://svn.freebsd.org/changeset/base/215544

Log:
  Scan the list in reverse order for the shutdown handlers of loaded modules.
  This way, when there is a dependency between two modules, the handler of the
  latter probed runs first.
  
  This is a similar approach as the modules are unloaded in the same
  linkerfile.
  
  Sponsored by:	Sandvine Incorporated
  Submitted by:	Nima Misaghian <nmisaghian at sandvine dot com>
  MFC after:	1 week

Modified:
  head/sys/kern/kern_module.c

Modified: head/sys/kern/kern_module.c
==============================================================================
--- head/sys/kern/kern_module.c	Fri Nov 19 18:59:35 2010	(r215543)
+++ head/sys/kern/kern_module.c	Fri Nov 19 19:43:56 2010	(r215544)
@@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$");
 
 static MALLOC_DEFINE(M_MODULE, "module", "module data structures");
 
-typedef TAILQ_HEAD(, module) modulelist_t;
+typedef TAILQ_HEAD(modulelst, module) modulelist_t;
 struct module {
 	TAILQ_ENTRY(module)	link;	/* chain together all modules */
 	TAILQ_ENTRY(module)	flink;	/* all modules in a file */
@@ -101,7 +101,7 @@ module_shutdown(void *arg1, int arg2)
 		return;
 	mtx_lock(&Giant);
 	MOD_SLOCK;
-	TAILQ_FOREACH(mod, &modules, link)
+	TAILQ_FOREACH_REVERSE(mod, &modules, modulelst, link)
 		MOD_EVENT(mod, MOD_SHUTDOWN);
 	MOD_SUNLOCK;
 	mtx_unlock(&Giant);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011191943.oAJJhv3i087205>