File Import-ID_FS_XXX-variables-bnc909358.patch of Package lvm2.openSUSE_Leap_42.1_Update

From 41c91bba5f696c6b6571218fcbf8bef8b41aa9d9 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Wed, 25 Mar 2015 09:44:03 +0100
Subject: [PATCH] 13-dm-disk.rules: Import ID_FS_XXX variables from udev
         database
References: bnc#909358

If the disk is unavailable we need to import the existing ID_FS_XXX
variables from the database, otherwise the filesystem UUID won't
be set and the by-uuid symlink will disappear, leading to
intermittent boot failures.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---

Index: LVM2.2.02.120/udev/13-dm-disk.rules.in
===================================================================
--- LVM2.2.02.120.orig/udev/13-dm-disk.rules.in
+++ LVM2.2.02.120/udev/13-dm-disk.rules.in
@@ -17,15 +17,22 @@ ENV{DM_UDEV_DISABLE_DISK_RULES_FLAG}=="1
 SYMLINK+="disk/by-id/dm-name-$env{DM_NAME}", OPTIONS+="string_escape=replace"
 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_SUSPENDED}=="1", GOTO="dm_blkid_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"
+# For a suspended or otherwise unavailable device we
+# need to import the variables from the database, otherwise
+# a service interruption might occur
+ENV{ID_FS_TYPE}!="?*", IMPORT{db}="ID_FS_TYPE"
+ENV{ID_FS_USAGE}!="?*", IMPORT{db}="ID_FS_USAGE"
+ENV{ID_FS_UUID}!="?*", IMPORT{db}="ID_FS_UUID"
+ENV{ID_FS_UUID_ENC}!="?*", IMPORT{db}="ID_FS_UUID_ENC"
+ENV{ID_FS_VERSION}!="?*", IMPORT{db}="ID_FS_VERSION"
 ENV{DM_UDEV_LOW_PRIORITY_FLAG}=="1", OPTIONS+="link_priority=-100"
-OPTIONS+="watch"
 ENV{DM_TARGET_TYPES}=="*snapshot-origin*", OPTIONS+="link_priority=-90"
 ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
 ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"