summaryrefslogtreecommitdiffstats
path: root/lvm-fixed-lvm-thin-check.patch
blob: c7f8f7a5ff7eee35d4fc4005a93b8761633eb8c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
From 920384c4128691941f9bd8819eae2b4f334aa7b1 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Fri, 13 Dec 2013 11:05:39 +0100
Subject: [PATCH] lvm: fixed lvm thin check

---
 modules.d/90lvm/module-setup.sh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/modules.d/90lvm/module-setup.sh b/modules.d/90lvm/module-setup.sh
index 1206310..c62dc90 100755
--- a/modules.d/90lvm/module-setup.sh
+++ b/modules.d/90lvm/module-setup.sh
@@ -99,8 +99,13 @@ 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
     fi
-- 
1.8.4.2