From nobody@FreeBSD.org  Thu Jun 11 20:49:09 2009
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 65D221065673
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 11 Jun 2009 20:49:09 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 536B58FC12
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 11 Jun 2009 20:49:09 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n5BKn9Sw093034
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 11 Jun 2009 20:49:09 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id n5BKn9qa093033;
	Thu, 11 Jun 2009 20:49:09 GMT
	(envelope-from nobody)
Message-Id: <200906112049.n5BKn9qa093033@www.freebsd.org>
Date: Thu, 11 Jun 2009 20:49:09 GMT
From: Nima Misaghian <nmisaghian@sandvine.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: During a shutdown, kernel modules should be unloaded in reverse order in which they where loaded
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         135485
>Category:       kern
>Synopsis:       [modules] [patch] During a shutdown, kernel modules should be unloaded in reverse order in which they where loaded
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jun 11 20:50:01 UTC 2009
>Closed-Date:    Tue Nov 13 20:46:17 UTC 2012
>Last-Modified:  Tue Nov 13 20:46:17 UTC 2012
>Originator:     Nima Misaghian
>Release:        6.1
>Organization:
Sandvine
>Environment:
>Description:
During a shutdown, kernel modules should be unloaded in reverse order in which they where loaded. Otherwise, modules that other modules depend on are unloaded first, which could cause problems. 

>How-To-Repeat:

>Fix:
src/sys/kern/kern_module.c


< typedef TAILQ_HEAD(modulelist, module) modulelist_t;
> typedef TAILQ_HEAD(, module) modulelist_t;


static void
module_shutdown(void *arg1, int arg2)
{
	module_t mod;

	if (arg2 & RB_NOSYNC)
		return;
	MOD_SLOCK;
<	TAILQ_FOREACH_REVERSE(mod, &modules, modulelist, link)
>       TAILQ_FOREACH(mod, &modules, link)
		MOD_EVENT(mod, MOD_SHUTDOWN);
	MOD_SUNLOCK;
}


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->eadler 
Responsible-Changed-By: eadler 
Responsible-Changed-When: Tue Jun 19 06:54:09 UTC 2012 
Responsible-Changed-Why:  
I'll take it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=135485 
State-Changed-From-To: open->feedback 
State-Changed-By: eadler 
State-Changed-When: Sun Jul 15 20:04:24 UTC 2012 
State-Changed-Why:  
could you explain a bit more about the problem you are seeing? Is it 
with modules auto-detected? modules in loader.conf? This patch doesn't 
seem correct on first thought. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=135485 
Responsible-Changed-From-To: eadler->freebsd-bugs 
Responsible-Changed-By: eadler 
Responsible-Changed-When: Tue Sep 11 01:43:53 UTC 2012 
Responsible-Changed-Why:  
I won't be looking at this PR for a while and I need to clear some out 
of my queue 

http://www.freebsd.org/cgi/query-pr.cgi?pr=135485 
State-Changed-From-To: feedback->closed 
State-Changed-By: eadler 
State-Changed-When: Tue Nov 13 20:46:16 UTC 2012 
State-Changed-Why:  
Feedback timeout. Please email me and I will reopen if needed. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=135485 
>Unformatted:
