File udev-Check-for-DM_NR_VALID_PATHS.patch of Package lvm2.openSUSE_Leap_42.1_Update

From b8354ac161b5ab8a4f5842201d7ee69f5089c6dc Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 12 Jun 2014 17:07:31 +0200
Subject: [PATCH] udev: Check for DM_NR_VALID_PATHS

When the device becomes inaccessible we must not run any program
requiring disk access, as this will stall and cause udev to
eventually timeout this event.

So check for DM_NR_VALID_PATHS before calling these programs.

References: bnc#875233

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 udev/10-dm.rules.in           | 1 -
 udev/13-dm-disk.rules.in      | 2 ++
 udev/69-dm-lvm-metad.rules.in | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

Index: LVM2.2.02.111/udev/10-dm.rules.in
===================================================================
--- LVM2.2.02.111.orig/udev/10-dm.rules.in
+++ LVM2.2.02.111/udev/10-dm.rules.in
@@ -126,7 +126,6 @@ ENV{DM_UDEV_DISABLE_DM_RULES_FLAG}!="1",
 
 # We have to ignore further rule application for inappropriate events
 # and devices. But still send the notification if cookie exists.
-ENV{DM_UUID}=="mpath-?*", ENV{DM_ACTION}=="PATH_FAILED", GOTO="dm_disable"
 
 # Avoid processing and scanning a DM device in the other (foreign)
 # rules if it is in suspended state. However, we still keep 'disk'
Index: LVM2.2.02.111/udev/13-dm-disk.rules.in
===================================================================
--- LVM2.2.02.111.orig/udev/13-dm-disk.rules.in
+++ LVM2.2.02.111/udev/13-dm-disk.rules.in
@@ -18,10 +18,12 @@ SYMLINK+="disk/by-id/dm-name-$env{DM_NAM
 ENV{DM_UUID}=="?*", SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}", OPTIONS+="string_escape=replace"
 
 ENV{DM_SUSPENDED}=="1", GOTO="dm_end"
+ENV{DM_NR_VALID_PATHS}=="0", GOTO="dm_blkid_end"
 ENV{DM_NOSCAN}=="1", GOTO="dm_watch"
 ENV{DM_TARGET_TYPES}=="|*error*", GOTO="dm_end"
 
 (BLKID_RULE)
+LABEL="dm_blkid_end"
 ENV{DM_UDEV_LOW_PRIORITY_FLAG}=="1", OPTIONS+="link_priority=-100"
 OPTIONS+="watch"
 ENV{DM_TARGET_TYPES}=="*snapshot-origin*", OPTIONS+="link_priority=-90"
Index: LVM2.2.02.111/udev/69-dm-lvm-metad.rules.in
===================================================================
--- LVM2.2.02.111.orig/udev/69-dm-lvm-metad.rules.in
+++ LVM2.2.02.111/udev/69-dm-lvm-metad.rules.in
@@ -47,6 +47,7 @@ ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="dis
 
 # DM device:
 KERNEL!="dm-[0-9]*", GOTO="next"
+KERNEL=="dm-[0-9]*", ENV{DM_NR_VALID_PATHS}=="0", GOTO="lvm_end"
 ENV{DM_UDEV_PRIMARY_SOURCE_FLAG}=="1", ENV{DM_ACTIVATION}=="1", GOTO="lvm_scan"
 GOTO="lvm_end"