aboutsummaryrefslogtreecommitdiffstats
path: root/rc.d/init.d/functions
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2009-03-04 17:51:48 -0500
committerBill Nottingham <notting@redhat.com>2009-03-04 17:51:48 -0500
commitbcb7572fe42c8efb712e5124f25935568c951103 (patch)
treea4508be65df0c7a31ee6ec2d1d754016aff0fbb8 /rc.d/init.d/functions
parent14c0e7d144b21255c23374286c2ab5b2a17cf195 (diff)
downloadinitscripts-bcb7572fe42c8efb712e5124f25935568c951103.tar
initscripts-bcb7572fe42c8efb712e5124f25935568c951103.tar.gz
initscripts-bcb7572fe42c8efb712e5124f25935568c951103.tar.bz2
initscripts-bcb7572fe42c8efb712e5124f25935568c951103.tar.xz
initscripts-bcb7572fe42c8efb712e5124f25935568c951103.zip
Fix various issues with dmraid handling (#485895, <hdegoede@redhat.com>)
I've been doing a lot of work on mkinitrd's dmraid support lately some of the lessons learned there also apply to the activation of (not used for /) dmraid arrays in rc.sysinit, this will esp. help the livecd proerly activating and using dmraid sets. The patch fixes the following issues: 1) rc.sysinit (and mkinitrd used to) calls dm_resolve_name() on the output of dmraid, this is not necessary as dm_resolve_name is only needed when the name is /dev/dm-#, it is actually harmful as dm_resolve_name sometimes fails when used like this, causing us to fail to activate dmraid sets 2) rc.sysinit does not remove the partitions from the raw disks used in a raidset the initrd used to use special nash functionality to tell the kernels to forget about the partitions of the raw disks it had scanned at boot. The issue here is, say we have a mirror of sda and sdb, and that mirror has 2 partitions. Then the kernel when scanning the raw disks will find sda1,sda2,sdb1,sdb2. But we do not want anything using those, they should use the devicemapper versions as those are mirrored! I've even seen mounting by LABEL / UUID do the wrong thing by using the raw partitions instead of the raidset partitions. I've recently done a patch to dmraid adding a --rm_partitions cmdline option which makes dmraid do the ioctl which makes the kernel forget about the partitions of the rawdisk (which in turn makes udev remove the device nodes). This way we no longer need the nash magic. Part of my rc.sysinit patch is adding --rm_partitions to the dmraid invocation 3) rc.sysinit uses dmraid -p, which tells dmraid to not setup device maps for the partitions of the raidset and then kalls kpartx to setup the device maps for the partitions. This can be simplified by removing the -p argument to dmraid 4) with all these changes in place there is no longer a reason to loop, a single dmraid invocation is enough. p.s. AFAIK with this patch the last user of dm_resolve_name is gone, so that function can be removed. Better check twice though.
Diffstat (limited to 'rc.d/init.d/functions')
-rw-r--r--rc.d/init.d/functions30
1 files changed, 0 insertions, 30 deletions
diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions
index bb580486..37ec2865 100644
--- a/rc.d/init.d/functions
+++ b/rc.d/init.d/functions
@@ -542,36 +542,6 @@ get_numeric_dev() {
) 2>/dev/null
}
-# find the working name for a running dm device with the same table as one
-# that dmraid would create
-resolve_dm_name() {
-(
- name="$1"
-
- line=$(/sbin/dmraid -ay -t --ignorelocking | \
- egrep -iv "no block devices found|No RAID disks" | \
- awk -F ':' "{ if (\$1 ~ /^$name$/) { print \$2; }}")
- for x in $line ; do
- if [[ "$x" =~ ^/dev/ ]] ; then
- majmin=$(get_numeric_dev dec $x)
- line=$(echo "$line" | sed -e "s,$x\( \|$\),$majmin\1,g")
- fi
- done
- line=$(echo "$line" | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' \
- -e 's/ core [12] [[:digit:]]\+ / core [12] [[:digit:]]\\+ /')
- # XXX PJFIX -- this method of handling extra parameters is really just
- # asking for failure -- the better way would be to make
- # dmsetup or dmraid be able to do resolve_dm_name for us.
- if [ "$(echo $line | awk '{ print $3 }')" == "mirror" ]; then
- line=$(echo "$line" | sed \
- -e 's/ 1 [[:alpha:]][[:alnum:]_]\+$/\\($\\|&$\\)/')
- fi
- /sbin/dmsetup table | \
- sed -n -e "s/.*\(no block devices found\|No devices found\).*//" \
- -e "s/\(^[^:]\+\): $line\( \+$\|$\)/\1/p"
-) 2>/dev/null
-}
-
# Check whether file $1 is a backup or rpm-generated file and should be ignored
is_ignored_file() {
case "$1" in