]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
lvm: fixed lvm thin check
authorHarald Hoyer <harald@redhat.com>
Fri, 13 Dec 2013 10:05:39 +0000 (11:05 +0100)
committerHarald Hoyer <harald@redhat.com>
Fri, 13 Dec 2013 10:13:40 +0000 (11:13 +0100)
modules.d/90lvm/module-setup.sh

index 1206310bae86d477a7817f82ad317a6d825c34a0..a64e5d6629e051fa8cbfbf0d5a12a8545762d49b 100755 (executable)
@@ -99,9 +99,16 @@ install() {
 
     if [[ $hostonly ]] && type -P lvs &>/dev/null; then
         for dev in "${!host_fs_types[@]}"; do
-            if [[ "$(lvs --noheadings -o segtype "$dev" 2>/dev/null)" == *thin* ]] ; then
+            [ -e /sys/block/${dev#/dev/}/dm/name ] || continue
+            dev=$(</sys/block/${dev#/dev/}/dm/name)
+            eval $(dmsetup splitname --nameprefixes --noheadings --rows "$dev" 2>/dev/null)
+            [[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || continue
+            if [[ "$(lvs --noheadings -o segtype ${DM_VG_NAME} 2>/dev/null)" == *thin* ]] ; then
                 inst_multiple -o thin_dump thin_restore thin_check thin_repair
+                break
             fi
         done
+    else
+        inst_multiple -o thin_dump thin_restore thin_check thin_repair
     fi
 }