From nobody  Thu Jan 28 03:52:26 1999
Received: (from nobody@localhost)
          by hub.freebsd.org (8.8.8/8.8.8) id DAA03527;
          Thu, 28 Jan 1999 03:52:26 -0800 (PST)
          (envelope-from nobody)
Message-Id: <199901281152.DAA03527@hub.freebsd.org>
Date: Thu, 28 Jan 1999 03:52:26 -0800 (PST)
From: rock@cs.uni-sb.de
To: freebsd-gnats-submit@freebsd.org
Subject: error in queue handling of at_shutdown() in kern_shutdown.c
X-Send-Pr-Version: www-1.0

>Number:         9748
>Category:       kern
>Synopsis:       error in queue handling of at_shutdown() in kern_shutdown.c
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jan 28 04:00:01 PST 1999
>Closed-Date:    Sun Jun 02 04:47:20 PDT 2002
>Last-Modified:  Sun Jun 02 04:47:20 PDT 2002
>Originator:     Daniel Rock
>Release:        4.0-current
>Organization:
>Environment:
But is present in kern_shutdown.c since priorities were introduced
(rev 1.41)
>Description:
Inserting shutdown on priority basis doesn't fully work:
The 2nd function is always placed behind the 1st function in the
queue, regardless of the function priority
>How-To-Repeat:
at_shutdown_pri(func1, arg, QUEUE, SHUTDOWN_PRI_LAST);
at_shutdown_pri(func2, arg, QUEUE, SHUTDOWN_PRI_FIRST);
func1 is executed before func2 (if these are the first calls to
at_shutdown_pri for queue QUEUE)
>Fix:
Simple three line fix:
Index: kern_shutdown.c
===================================================================
RCS file: /data/cvs/src/sys/kern/kern_shutdown.c,v
retrieving revision 1.44
diff -c -r1.44 kern_shutdown.c
*** kern_shutdown.c	1998/12/28 23:03:00	1.44
--- kern_shutdown.c	1999/01/28 11:42:52
***************
*** 470,476 ****
  int
  at_shutdown_pri(bootlist_fn function, void *arg, int queue, int pri)
  {
! 	sle_p ep, ip;
  
  	if (queue < SHUTDOWN_PRE_SYNC
  	 || queue > SHUTDOWN_FINAL) {
--- 470,476 ----
  int
  at_shutdown_pri(bootlist_fn function, void *arg, int queue, int pri)
  {
! 	sle_p op, ep, ip;
  
  	if (queue < SHUTDOWN_PRE_SYNC
  	 || queue > SHUTDOWN_FINAL) {
***************
*** 492,498 ****
  	if (ip == NULL) {
  		LIST_INSERT_HEAD(&shutdown_lists[queue], ep, links);
  	} else {
! 		for (; LIST_NEXT(ip, links) != NULL; ip = LIST_NEXT(ip, links)) {
  			if (ep->priority < ip->priority) {
  				LIST_INSERT_BEFORE(ip, ep, links);
  				ep = NULL;
--- 492,498 ----
  	if (ip == NULL) {
  		LIST_INSERT_HEAD(&shutdown_lists[queue], ep, links);
  	} else {
! 		for (; ip != NULL; op = ip, ip = LIST_NEXT(ip, links)) {
  			if (ep->priority < ip->priority) {
  				LIST_INSERT_BEFORE(ip, ep, links);
  				ep = NULL;
***************
*** 500,506 ****
  			}
  		}
  		if (ep != NULL)
! 			LIST_INSERT_AFTER(ip, ep, links);
  	}
  	return (0);
  }
--- 500,506 ----
  			}
  		}
  		if (ep != NULL)
! 			LIST_INSERT_AFTER(op, ep, links);
  	}
  	return (0);
  }

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: iedowse 
State-Changed-When: Sat Jan 19 14:55:18 PST 2002 
State-Changed-Why:  

Does this problem still exist? 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=9748 
State-Changed-From-To: feedback->closed 
State-Changed-By: iedowse 
State-Changed-When: Sun Jun 2 04:47:00 PDT 2002 
State-Changed-Why:  

Feedback timeout. 

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