Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Jan 1999 03:52:26 -0800 (PST)
From:      rock@cs.uni-sb.de
To:        freebsd-gnats-submit@FreeBSD.ORG
Subject:   kern/9748: error in queue handling of at_shutdown() in kern_shutdown.c
Message-ID:  <199901281152.DAA03527@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jan 28 04:00:01 PST 1999
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



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