Author: jhb Date: Wed Jan 21 18:35:48 2009 New Revision: 187554 URL: http://svn.freebsd.org/changeset/base/187554
Log: MFC: Reorder modules during initialization to ensure that MOD_QUIESCE and MOD_UNLOAD events are posted to kernel modules in the reverse order of MOD_LOAD events. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/kern/kern_module.c Modified: stable/7/sys/kern/kern_module.c ============================================================================== --- stable/7/sys/kern/kern_module.c Wed Jan 21 18:32:43 2009 (r187553) +++ stable/7/sys/kern/kern_module.c Wed Jan 21 18:35:48 2009 (r187554) @@ -130,6 +130,21 @@ module_register_init(const void *arg) printf("module_register_init: MOD_LOAD (%s, %p, %p) error" " %d\n", data->name, (void *)data->evhand, data->priv, error); + } else { + MOD_XLOCK; + if (mod->file) { + /* + * Once a module is succesfully loaded, move + * it to the head of the module list for this + * linker file. This resorts the list so that + * when the kernel linker iterates over the + * modules to unload them, it will unload them + * in the reverse order they were loaded. + */ + TAILQ_REMOVE(&mod->file->modules, mod, flink); + TAILQ_INSERT_HEAD(&mod->file->modules, mod, flink); + } + MOD_XUNLOCK; } mtx_unlock(&Giant); } _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"