]> 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>
Tue, 29 Jul 2014 09:52:04 +0000 (11:52 +0200)
modules.d/90lvm/module-setup.sh

index 877631bb02e65c5c70e44e1b0e1d0f306ea8da17..f0c9b964d7ec55ac4c8fbb939f62e301cf77cdc6 100755 (executable)
@@ -97,9 +97,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
 }