Subject: kern/14770: raidframe startupscript doesn't handle autoconfigured devices correctly
To: None <>
From: None <>
List: netbsd-bugs
Date: 11/29/2001 16:16:03
>Number:         14770
>Category:       kern
>Synopsis:       raidframe startupscript doesn't handle autoconfigured devices correctly
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Nov 29 05:16:04 PST 2001
>Originator:     Wolfgang Stukenbrock (
>Release:        NetBSD release 1.5.2
Dr. Nagler & Comapny GmbH
System: NetBSD test-s4 1.5.2 NetBSD 1.5.2 (NSW-Firewall) #2: Thu Nov 29 15:07:53 CET 2001 wgstuken@test-s4:/export/netbsd-1.5.2/usr/src/sys/arch/i386/compile/NSW-Firewall i386

	The raidframe startup script in /etc/rc.d will only configure raid devices, but does noch check parity on autoconfigured raid devices.
        For autoconfigured raid-devices (e.g. the root device) there is no raidx.conf and this script just ignores suh devices.
        A second bug in this script is, that it only looks for raid0 to raid3.
        This can be done much better be examining the /dev/raid*d devices.
        seen on every boot ...
	change the raidframe startupscript in a way like the following:

# $NetBSD: raidframe,v 1.x 2000/05/16 16:54:33 oster Exp $

# PROVIDE: disks

. /etc/rc.subr


  ( for dev in `(cd /dev && echo raid*d) | sed -e 's/raid\([0-9]\)d/raid\1/g'`; do
      if raidctl -s $dev > /dev/null 2>&1; then
# raid device already configured - just check parity in background ...
        echo -n " $dev"
        if [ -f /etc/$dev.conf ]; then
# raid device not configured - check for config file ...
	  raidctl -c /etc/$dev.conf $dev
          echo -n " $dev"
  ) | read alldev;
  if [ -n "$alldev" ]; then
    ( for dev in $alldev; do raidctl -P $dev; done ) &

load_rc_config $name
run_rc_command "$1"