Blame 0045-Do-not-call-lvm-for-non-LVM-device-mapper-devices.patch

Harald Hoyer b94732
From 3244bf59816096377edee6f8937f16838dc1a709 Mon Sep 17 00:00:00 2001
Harald Hoyer b94732
From: Hannes Reinecke <hare@suse.de>
Harald Hoyer b94732
Date: Thu, 11 Dec 2014 15:46:06 +0100
Harald Hoyer b94732
Subject: [PATCH] Do not call 'lvm' for non-LVM device-mapper devices
Harald Hoyer b94732
Harald Hoyer b94732
If a device-mapper device is not created by LVM it's pointless
Harald Hoyer b94732
to call any 'lvm' programs got extract details; they'll be
Harald Hoyer b94732
failing anyway. So check the UUID before calling 'lvm'.
Harald Hoyer b94732
This speeds up initrd creation and avoids I/O errors on
Harald Hoyer b94732
multipath devices.
Harald Hoyer b94732
Harald Hoyer b94732
Signed-off-by: Hannes Reinecke <hare@suse.de>
Harald Hoyer b94732
Signed-off-by: Thomas Renninger <trenn@suse.de>
Harald Hoyer b94732
---
Harald Hoyer b94732
 dracut-functions.sh | 4 +++-
Harald Hoyer b94732
 1 file changed, 3 insertions(+), 1 deletion(-)
Harald Hoyer b94732
Harald Hoyer b94732
diff --git a/dracut-functions.sh b/dracut-functions.sh
Harald Hoyer b94732
index 17a71f0..edd8ea9 100755
Harald Hoyer b94732
--- a/dracut-functions.sh
Harald Hoyer b94732
+++ b/dracut-functions.sh
Harald Hoyer b94732
@@ -698,10 +698,12 @@ for_each_host_dev_and_slaves()
Harald Hoyer b94732
 # but you cannot create the logical volume without the volume group.
Harald Hoyer b94732
 # And the volume group might be bigger than the devices the LV needs.
Harald Hoyer b94732
 check_vol_slaves() {
Harald Hoyer b94732
-    local _lv _vg _pv
Harald Hoyer b94732
+    local _lv _vg _pv _dm
Harald Hoyer b94732
     for i in /dev/mapper/*; do
Harald Hoyer b94732
         [[ $i == /dev/mapper/control ]] && continue
Harald Hoyer b94732
         _lv=$(get_maj_min $i)
Harald Hoyer b94732
+        _dm=/sys/dev/block/$_lv/dm
Harald Hoyer b94732
+        [[ -f $_dm/uuid  && $(<$_dm/uuid) =~ LVM-* ]] || continue
Harald Hoyer b94732
         if [[ $_lv = $2 ]]; then
Harald Hoyer b94732
             _vg=$(lvm lvs --noheadings -o vg_name $i 2>/dev/null)
Harald Hoyer b94732
             # strip space