NetBSD Problem Report #37802

From martin@duskware.de  Fri Jan 18 20:08:33 2008
Return-Path: <martin@duskware.de>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id A7AD163B90D
	for <gnats-bugs@gnats.netbsd.org>; Fri, 18 Jan 2008 20:08:33 +0000 (UTC)
Message-Id: <20080118191448.CCDCA63B8A2@narn.NetBSD.org>
Date: Fri, 18 Jan 2008 19:14:48 +0000 (UTC)
From: rudolf@eq.cz
Reply-To: rudolf@eq.cz
To: netbsd-bugs-owner@NetBSD.org
Subject: Report daily dirty RAIDframe parity, order /etc/rc.d/raidframeparity before /etc/rc.d/securelevel
X-Send-Pr-Version: www-1.0

>Number:         37802
>Category:       misc
>Synopsis:       Report daily dirty RAIDframe parity, order /etc/rc.d/raidframeparity before /etc/rc.d/securelevel
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 18 20:10:00 +0000 2008
>Originator:     rudolf
>Release:        netbsd-4
>Organization:
>Environment:
>Description:
Please see the following email and corresponding discussion:
http://mail-index.netbsd.org/tech-userlevel/2007/05/15/0000.html

The /etc/rc.d/raidframeparity script 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.

I also suggest to test if the parity is clean from /etc/daily along 
with failed raidframe components.
>How-To-Repeat:
Set securelevel to 2 on a computer with raidframe mirrored disks and go through the power outage. You'll find out you'll have to go to single user to repair it (problem with wrong order of rc.d scripts) and if you just check the daily scripts, you'll think the raid is ok (problem with the daily script).
>Fix:
--- 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

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.