90mdraid dracut-functions: fix md raid hostonly detection

check_block_and_slaves looks at slaves but not parents.
This commit is contained in:
Andy Lutomirski 2010-05-19 08:13:12 +02:00 committed by Harald Hoyer
parent 7e33fa5b52
commit a3afcf2a5a
2 changed files with 5 additions and 2 deletions

View File

@ -97,6 +97,9 @@ check_block_and_slaves() {
[[ -b /dev/block/$2 ]] || return 1 # Not a block device? So sorry.
"$1" $2 && return
check_vol_slaves "$@" && return 0
if [[ -f "/sys/dev/block/$2/../dev" ]]; then
check_block_and_slaves $1 $(cat "/sys/dev/block/$2/../dev") && return 0
fi
[[ -d /sys/dev/block/$2/slaves ]] || return 1
for x in /sys/dev/block/$2/slaves/*/dev; do
[[ -f $x ]] || continue

View File

@ -6,7 +6,7 @@ which mdadm >/dev/null 2>&1 || exit 1
. $dracutfunctions
[[ $debug ]] && set -x
is_mdraid() { get_fs_type /dev/block/$1 |egrep -q '(linux|isw)_raid'; }
is_mdraid() { [[ -d "/sys/dev/block/$1/md" ]]; }
[[ $1 = '-h' ]] && {
rootdev=$(find_root_block_device)
@ -16,7 +16,7 @@ is_mdraid() { get_fs_type /dev/block/$1 |egrep -q '(linux|isw)_raid'; }
check_block_and_slaves is_mdraid "$rootdev" || exit 1
else
# root is not on a block device, use the shotgun approach
blkid | grep -q linux_raid || exit 1
blkid | egrep -q '(linux|isw)_raid' || exit 1
fi
}