Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Jan 1999 05:35:46 -0800 (PST)
From:      rock@cs.uni-sb.de
To:        freebsd-gnats-submit@FreeBSD.ORG
Subject:   kern/9664: unclean file system after halt -p
Message-ID:  <199901241335.FAA03274@hub.freebsd.org>

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

>Number:         9664
>Category:       kern
>Synopsis:       unclean file system after halt -p
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jan 24 05:40:00 PST 1999
>Closed-Date:
>Last-Modified:
>Originator:     Daniel Rock
>Release:        4.0-current
>Organization:
>Environment:
>Description:
On at least one machine the power is cut too fast in the shutdown
routine. The superblock (and maybe others) aren't flushed to disk,
forcing a fsck on next reboot.
>How-To-Repeat:
Depends on hardware configuration. My configuration:
Maxtor DiamondMax (90432D2) IDE drive
Asus SP98 mainboard.
>Fix:
Add a sysctl variable where you can specify a shutdown delay before
cutting the power:

Index: sys/kern/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/24 13:18:24
***************
*** 88,93 ****
--- 88,95 ----
  	&debugger_on_panic, 0, "");
  #endif
  
+ SYSCTL_NODE(_kern, OID_AUTO, shutdown, CTLFLAG_RW, 0, "Shutdown environment");
+ 
  #ifdef	HW_WDOG
  /*
   * If there is a hardware watchdog, point this at the function needed to
Index: sys/i386/apm/apm.c
===================================================================
RCS file: /data/cvs/src/sys/i386/apm/apm.c,v
retrieving revision 1.77
diff -c -r1.77 apm.c
*** apm.c	1998/12/10 23:36:14	1.77
--- apm.c	1999/01/24 13:10:49
***************
*** 38,43 ****
--- 38,44 ----
  #include <vm/vm_param.h>
  #include <vm/pmap.h>
  #include <sys/syslog.h>
+ #include <sys/sysctl.h>
  #include <i386/apm/apm_setup.h>
  
  #ifdef VM86
***************
*** 69,74 ****
--- 70,80 ----
  static struct apm_softc apm_softc;
  static struct apmhook	*hook[NAPM_HOOK];		/* XXX */
  
+ /* delay (in ms) to turn power of after shutdown */
+ static int poweroff_delay = 0;
+ SYSCTL_INT(_kern_shutdown, OID_AUTO, poweroff_delay, CTLFLAG_RW,
+ 	&poweroff_delay, 0, "");
+ 
  #define is_enabled(foo) ((foo) ? "enabled" : "disabled")
  
  /* Map version number to integer (keeps ordering of version numbers) */
***************
*** 254,259 ****
--- 260,267 ----
  	/* Not halting powering off, or not active */
  	if (!(howto & RB_POWEROFF) || !apm_softc.active)
  		return;
+ 	if(poweroff_delay > 0)
+ 		DELAY(poweroff_delay * 1000);
  	eax = (APM_BIOS << 8) | APM_SETPWSTATE;
  	ebx = PMDV_ALLDEV;
  	ecx = PMST_OFF;

>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?199901241335.FAA03274>