Subject: misc/35075: Not unconfiguring CCDs at shutdown can keep raid parity dirty.
To: None <misc-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <jdwhite@menelos.com>
List: netbsd-bugs
Date: 11/18/2006 19:55:01
>Number:         35075
>Category:       misc
>Synopsis:       Not unconfiguring CCDs at shutdown can keep raid parity dirty.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Nov 18 19:55:01 +0000 2006
>Originator:     Jason White
>Release:        NetBSD 3.0
>Organization:
Jason White <jdwhite@menelos.com>       Jabber: jdwhite(jabber.org)
http://jdwhite.menelos.com/                     jason.d.white(gmail.com)
PGP KeyID: 0x5290E477
>Environment:
	
	
System: NetBSD bender.menelos.com 3.0 NetBSD 3.0 (BENDER) #0: Thu Feb 2 17:13:01 CST 2006 jdwhite@smeghead:/usr/obj/i386/BENDER i386
Architecture: i386
Machine: i386
>Description:
CCD devices are created automatically at boot if /etc/ccd.conf exists as per 
/etc/defaults/rc.conf.  If a CCD component device resides on a raidframed 
device and is not manually unconfigured prior to shutdown, the raid parity 
status will always be dirty after the system boots.
>How-To-Repeat:
Configure a CCD with a component device that resides on a raidset with clean 
parity.  Leave it configured and reboot.  Parity is now dirty.
>Fix:
Alter /etc/rc.d/ccd to unconfigure CCD devices at shutdown.  Since the system 
default is to automatically configure CCDs at startup, should they not be 
automatically unconfigured at shutdown?  The following patch from 3.1 does 
this, resulting in clean raid parity across reboots.

--- ccd.old     2006-11-18 13:16:03.000000000 -0600
+++ ccd 2006-11-18 13:17:36.000000000 -0600
@@ -4,13 +4,14 @@
 #

 # PROVIDE: disks
+# KEYWORD: shutdown

 $_rc_subr_loaded . /etc/rc.subr

 name="ccd"
 rcvar=$name
 start_cmd="ccd_start"
-stop_cmd=":"
+stop_cmd="ccd_stop"

 ccd_start()
 {
@@ -20,5 +21,13 @@
        fi
 }

+ccd_stop()
+{
+       if [ -f /etc/ccd.conf ]; then
+               echo "Unconfiguring CCD devices."
+               ccdconfig -U
+       fi
+}
+
 load_rc_config $name
 run_rc_command "$1"

>Unformatted: