712866
From 793beab60c416e0edf7331fa2e6881b08f2bece0 Mon Sep 17 00:00:00 2001
712866
From: Harald Hoyer <harald@redhat.com>
712866
Date: Fri, 13 Dec 2013 11:05:39 +0100
712866
Subject: [PATCH] lvm: fixed lvm thin check
712866
712866
---
712866
 modules.d/90lvm/module-setup.sh | 9 ++++++++-
712866
 1 file changed, 8 insertions(+), 1 deletion(-)
712866
712866
diff --git a/modules.d/90lvm/module-setup.sh b/modules.d/90lvm/module-setup.sh
5c6c2a
index 877631bb..f0c9b964 100755
712866
--- a/modules.d/90lvm/module-setup.sh
712866
+++ b/modules.d/90lvm/module-setup.sh
712866
@@ -97,9 +97,16 @@ install() {
712866
 
712866
     if [[ $hostonly ]] && type -P lvs &>/dev/null; then
712866
         for dev in "${!host_fs_types[@]}"; do
712866
-            if [[ "$(lvs --noheadings -o segtype "$dev" 2>/dev/null)" == *thin* ]] ; then
712866
+            [ -e /sys/block/${dev#/dev/}/dm/name ] || continue
712866
+            dev=$(
712866
+            eval $(dmsetup splitname --nameprefixes --noheadings --rows "$dev" 2>/dev/null)
712866
+            [[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || continue
712866
+            if [[ "$(lvs --noheadings -o segtype ${DM_VG_NAME} 2>/dev/null)" == *thin* ]] ; then
712866
                 inst_multiple -o thin_dump thin_restore thin_check thin_repair
712866
+                break
712866
             fi
712866
         done
712866
+    else
712866
+        inst_multiple -o thin_dump thin_restore thin_check thin_repair
712866
     fi
712866
 }