PATCH: mkinitrd: handle lv root specified as /dev/dm-X properly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

Some users (#471729) manage to end up with /dev/dm-X instead of /dev/Foo/Bar in their /etc/fstab (don't ask how I dunno). Given that this is not the first time AFAIK. I've written a patch to handle this properly (as long as the /dev/dm numbering does not change).

This patch does 3 things:
1) Properly handle slave links, so that our sysfs slave walking code
   actually walks the slaves properly
2) Check if a devicemapper device is an lv inside handledm
3) remove handlevordev, as this check is now done in handledm

I've tested this with various setups using mount by LABEL UUID /dev/mapper/XXX /dev/Foo/Bar and /dev/dm-x and all work properly.

Regards,

Hans

--- /sbin/mkinitrd	2009-01-19 17:19:58.000000000 +0100
+++ mkinitrd	2009-02-01 20:56:39.000000000 +0100
@@ -326,6 +326,9 @@
                     ;;
                 *)
                     slavestried="$slavestried $slavename"
+                    if [ -L $slave ]; then
+                        slave=$(readlink $slave)
+                    fi
                     qpushd $slave
                     findstoragedriverinsys
                     qpopd
@@ -578,12 +581,23 @@
                 fi
 
                 let ncryptodevs++
-                handlelvordev "/dev/$slavedev"
+                findstoragedriver "$slavedev"
                 ;;
         esac
     done << EOF
         $(dmsetup table -j $major -m $minor 2>/dev/null)
 EOF
+    local name=$(dmsetup info --noheadings -c -j $major -m $minor -o name)
+    local vg=$(lvshow "/dev/mapper/$name")
+    if [ -n "$vg" ]; then
+        vg=`echo $vg` # strip whitespace
+        case " $vg_list " in
+        *" $vg "*) ;;
+        *)  vg_list="$vg_list $vg"
+            [ -z "$nolvm" ] && find_base_dm_mods
+            ;;
+        esac
+    fi
 }
 
 handleiscsi() {
@@ -662,25 +676,6 @@
     dmmods_found="y"
 }
 
-handlelvordev() {
-    [ -n "$1" ] || return 0
-    local vg=$(lvshow $1)
-    if [ -n "$vg" ]; then
-        vg=`echo $vg` # strip whitespace
-        case " $vg_list " in
-        *" $vg "*) ;;
-        *)  vg_list="$vg_list $vg"
-            for device in $(vgdisplay $vg) ; do
-                findstoragedriver ${device##/dev/}
-            done
-            [ -z "$nolvm" ] && find_base_dm_mods
-            ;;
-        esac
-    else
-        findstoragedriver ${1##/dev/}
-    fi
-}
-
 handlenetdev() {
     local dev=$1
 
@@ -1086,9 +1085,9 @@
     fi
     if [ "$rootfs" != "nfs" ]; then
         if [ -n "$physdev" -a "$physdev" != "$rdev" ]; then
-            handlelvordev "$physdev"
+            findstoragedriver "$physdev"
         fi
-        handlelvordev $rdev
+        findstoragedriver ${rdev##/dev/}
     fi
 
     # find the first swap dev which would get used for swsusp
@@ -1105,9 +1104,9 @@
 	    vecho "Found swsusp device $suspdev for $swsuspdev"
         fi
         if [ -n "$suspdev" -a "$suspdev" != "$swsuspdev" ]; then
-            handlelvordev "$suspdev"
+            findstoragedriver "$suspdev"
         fi
-	handlelvordev "$swsuspdev"
+	findstoragedriver "${swsuspdev##/dev/}"
     fi
 fi
 
@@ -1158,7 +1157,7 @@
 	# FIXME: label support
 	
 	if [ "$loopfs" != "nfs" ]; then
-            handlelvordev $loopdev
+            findstoragedriver ${loopdev##/dev/}
         fi
 fi
 
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux