Subject: raidframe parity: daily and before securelevel
To: None <tech-userlevel@netbsd.org>
From: rudolf <rudolf@eq.cz>
List: tech-userlevel
Date: 05/15/2007 23:10:50
This is a multi-part message in MIME format.
--------------040306030403040506070401
Content-Type: text/plain; charset=ISO-8859-2; format=flowed
Content-Transfer-Encoding: 7bit

Hi,

I think that /etc/rc.d/raidframeparity should be ordered before 
/etc/rc.d/securelevel - otherwise it is possible to get EPERM if the 
securelevel is raised in /etc/rc.conf and the parity might then be left 
dirty.

It might be useful to test if the parity is clean from /etc/daily along 
with failed raidframe components too.

What do you think? See the attached patches (made against recent netbsd-4).

Best regards,

r.

--------------040306030403040506070401
Content-Type: text/plain;
 name="daily.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="daily.diff"

--- etc/daily.orig	2007-05-15 22:43:07.000000000 +0200
+++ etc/daily	2007-05-15 22:55:09.000000000 +0200
@@ -77,6 +77,7 @@
 
 TMP=daily.$$
 TMP2=daily2.$$
+TMP3=daily3.$$
 
 if checkyesno find_core; then
 	# Turn "foo !bar bax" into "-fstype foo -o ! -fstype bar -o -fstype bax"
@@ -176,13 +177,18 @@
 			echo "$dev:" >> $TMP2
 			cat $TMP >> $TMP2
 		fi
+		`raidctl -p $dev > /dev/null` || echo $dev >> $TMP3
 		rm -f $TMP
 	done
 	if [ -s $TMP2 ]; then
 		echo "failed RAIDframe component(s):"
 			cat $TMP2
 	fi
-	rm -f $TMP2
+	if [ -s $TMP3 ]; then
+		echo "RAIDframe device(s) with dirty parity:"
+			cat $TMP3
+	fi
+	rm -f $TMP2 $TMP3
 fi
 
 if checkyesno check_mailq; then

--------------040306030403040506070401
Content-Type: text/plain;
 name="raidframeparity.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="raidframeparity.diff"

--- etc/rc.d/raidframeparity.orig	2007-05-15 20:11:31.000000000 +0200
+++ etc/rc.d/raidframeparity	2007-05-15 20:13:01.000000000 +0200
@@ -4,6 +4,7 @@
 #
 
 # REQUIRE: quota
+# BEFORE:  securelevel
 
 $_rc_subr_loaded . /etc/rc.subr
 

--------------040306030403040506070401--