r352 - in mdadm/trunk/debian: . initramfs
madduck at users.alioth.debian.org
madduck at users.alioth.debian.org
Tue Jul 10 08:01:14 UTC 2007
Author: madduck
Date: 2007-07-10 08:01:14 +0000 (Tue, 10 Jul 2007)
New Revision: 352
Modified:
mdadm/trunk/debian/changelog
mdadm/trunk/debian/initramfs/hook
Log:
* Does some sanity checking for proper format of level= arguments in
mdadm.conf and bails if an error is found. Since the RAID levels are used
verbatim as module names, a discrepancy might lead to an unusable system.
Instead, we thus use the emergency fallback. Thanks to Andrew
Sackville-West for spotting this and helping me with the fix.
Modified: mdadm/trunk/debian/changelog
===================================================================
--- mdadm/trunk/debian/changelog 2007-06-07 08:06:42 UTC (rev 351)
+++ mdadm/trunk/debian/changelog 2007-07-10 08:01:14 UTC (rev 352)
@@ -7,8 +7,13 @@
a replacement disk into an existing array with minimal effort; will remain
in examples/ until I had a chance to really test and understand it. Thanks
to Arno van Amersfoort (closes: #427880).
+ * Does some sanity checking for proper format of level= arguments in
+ mdadm.conf and bails if an error is found. Since the RAID levels are used
+ verbatim as module names, a discrepancy might lead to an unusable system.
+ Instead, we thus use the emergency fallback. Thanks to Andrew
+ Sackville-West for spotting this and helping me with the fix.
- -- martin f. krafft <madduck at debian.org> Wed, 30 May 2007 14:45:57 +0200
+ -- martin f. krafft <madduck at debian.org> Tue, 10 Jul 2007 09:59:45 +0200
mdadm (2.6.2-1) unstable; urgency=low
Modified: mdadm/trunk/debian/initramfs/hook
===================================================================
--- mdadm/trunk/debian/initramfs/hook 2007-06-07 08:06:42 UTC (rev 351)
+++ mdadm/trunk/debian/initramfs/hook 2007-07-10 08:01:14 UTC (rev 352)
@@ -53,16 +53,16 @@
}
if [ -e /usr/share/initramfs-tools/hooks/md ]; then
- warn "initramfs md hook still present, stepping out of its way." >&2
- warn "Please see /usr/share/doc/mdadm/README.initramfs-transition ." >&2
+ warn "initramfs md hook still present, stepping out of its way."
+ warn "Please see /usr/share/doc/mdadm/README.initramfs-transition ."
exit 0
fi
if [ -e /etc/initramfs-tools/hooks/md ]; then
- warn "I found /etc/initramfs-tools/hooks/md, which may conflict" >&2
- warn "with this version of mdadm. Please see /usr/share/doc/mdadm/README.mdrun" >&2
- warn "and /usr/share/initramfs-tools/hooks/mdadm for reference and update" >&2
- warn "(or remove) the file." >&2
+ warn "I found /etc/initramfs-tools/hooks/md, which may conflict"
+ warn "with this version of mdadm. Please see /usr/share/doc/mdadm/README.mdrun"
+ warn "and /usr/share/initramfs-tools/hooks/mdadm for reference and update"
+ warn "(or remove) the file."
exit 0
fi
@@ -117,11 +117,11 @@
if /usr/share/mdadm/mkconf generate $CONFIG; then
# all is well
install_config $CONFIG $DESTMDADMCONF
- info "auto-generated the mdadm.conf configuration file." >&2
+ info "auto-generated the mdadm.conf configuration file."
else
# we failed to auto-generate, so let the emergency procedure take over
- warn "failed to auto-generate the mdadm.conf file." >&2
- warn "please read /usr/share/doc/mdadm/README.upgrading-2.5.3.gz ." >&2
+ warn "failed to auto-generate the mdadm.conf file."
+ warn "please read /usr/share/doc/mdadm/README.upgrading-2.5.3.gz ."
fi
else
@@ -131,21 +131,21 @@
# the file comes from an old installation and hence is not guaranteed to
# work. We thus better create one and start all arrays to be sure.
- warn "unchecked configuration file: $CONFIG" >&2
- warn "please read /usr/share/doc/mdadm/README.upgrading-2.5.3.gz ." >&2
+ warn "unchecked configuration file: $CONFIG"
+ warn "please read /usr/share/doc/mdadm/README.upgrading-2.5.3.gz ."
use_temp=1
elif ! grep -q '^ARRAY' $CONFIG; then
# the file defines no ARRAYs. We better create a temporary file to be
# sure.
- warn "$CONFIG defines no arrays." >&2
+ warn "$CONFIG defines no arrays."
use_temp=1
else
# this is the ideal case
install_config $CONFIG $DESTMDADMCONF
- info "using configuration file: $CONFIG" >&2
+ info "using configuration file: $CONFIG"
fi
if [ $use_temp -eq 1 ]; then
@@ -153,15 +153,15 @@
tmpfile="${DESTMDADMCONF}.tmp"
if /usr/share/mdadm/mkconf > $tmpfile; then
# all is well, we now have a temporary configuration file
- info "auto-generated temporary mdadm.conf configuration file." >&2
+ info "auto-generated temporary mdadm.conf configuration file."
install_config $tmpfile $DESTMDADMCONF
else
# stuff's really broke, as we failed to generate a temporary file.
# let's hope the unchecked file works, provided it contains at least one
# ARRAY statement...
- warn "failed to auto-generate temporary mdadm.conf file." >&2
+ warn "failed to auto-generate temporary mdadm.conf file."
if grep -q '^ARRAY' $CONFIG; then
- warn "using the unchecked file and hoping for the best..." >&2
+ warn "using the unchecked file and hoping for the best..."
install_config $CONFIG $DESTMDADMCONF
fi
fi
@@ -173,12 +173,12 @@
# if at this point, $DESTMDADMCONF does not exist or it does not contain any
# ARRAY statements, we must let the initramfs handle stuff.
if [ ! -f $DESTMDADMCONF ]; then
- warn "no configuration file available." >&2
- warn "falling back to emergency procedure in initramfs." >&2
+ warn "no configuration file available."
+ warn "falling back to emergency procedure in initramfs."
exit 0
elif ! grep -q '^ARRAY' $DESTMDADMCONF; then
- warn "no arrays defined in configuration file." >&2
- warn "falling back to emergency procedure in initramfs." >&2
+ warn "no arrays defined in configuration file."
+ warn "falling back to emergency procedure in initramfs."
exit 0
else
# obtain dev:level pairs from config file, honouring multiline entries
@@ -191,7 +191,14 @@
for atom in $line; do
case "$atom" in
(/dev*) dev=$atom;;
- (level=*) level=${atom#level=};;
+ (level=raid*|level=linear|level=multipath) level=${atom#level=};;
+ (level=*)
+ err "invalid level specified in ARRAY statement in $CONFIG:"
+ err " $line"
+ err "levels should be either raid*, linear, or multipath."
+ warn "falling back to emergency procedure in initramfs."
+ exit 1
+ ;;
(*) :;;
esac
done
@@ -203,7 +210,7 @@
echo -n "$($MDADM --detail $dev | sed -rne 's,[[:space:]]+Raid Level : ,,p')"
fi
echo -n ' '
- done < $DESTMDADMCONF)"
+ done < $DESTMDADMCONF)" || exit $?
fi
uniquify()
@@ -234,9 +241,9 @@
*) :;;
esac
- warn "I am supposed to start $i from the initial ramdisk," >&2
- warn "yet I cannot find the array in the configuration file." >&2
- warn "I am thus reverting to starting all arrays." >&2
+ warn "I am supposed to start $i from the initial ramdisk,"
+ warn "yet I cannot find the array in the configuration file."
+ warn "I am thus reverting to starting all arrays."
INITRDSTART=all
break
done
@@ -259,21 +266,21 @@
echo "MD_MODULES='${modules% }'" >> $DESTCONFIG
if [ "$INITRDSTART" = all ]; then
- info "will start all available MD arrays from the initial ramdisk." >&2
+ info "will start all available MD arrays from the initial ramdisk."
else
for i in $devs; do
- info "will start MD array $i from the initial ramdisk." >&2
+ info "will start MD array $i from the initial ramdisk."
done
fi
else
echo "MD_DEVS=none" >> $DESTCONFIG
echo "MD_MODULES=''" >> $DESTCONFIG
- info "no MD arrays will be started from the initial ramdisk." >&2
+ info "no MD arrays will be started from the initial ramdisk."
fi
# only output this on Debian systems
[ -s /etc/default/mdadm ] && \
- info 'use `dpkg-reconfigure --priority=low mdadm` to change this.' >&2
+ info 'use `dpkg-reconfigure --priority=low mdadm` to change this.'
exit 0
More information about the pkg-mdadm-commits
mailing list