File 0029-Medium-Raid1-Ignore-transient-devices-after-stopping.patch of Package resource-agents.8843

From 3b432453fcfda69e6fdfea6935e3bdfee281639a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michal=20Koutn=C3=BD?= <mkoutny@suse.com>
Date: Tue, 30 Jan 2018 12:01:53 +0100
Subject: [PATCH 29/29] Medium: Raid1: Ignore transient devices after stopping
 a device (bsc#1077416)

There may be a transient invalid device after we stop the MD due to
other programs processing uevent, the original device is stopped though
(`mdadm --stop` only returns when MD is stopped).

The idea suggested by Neil Brown <nfbrown@suse.com>.
---
 heartbeat/Raid1 | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/heartbeat/Raid1 b/heartbeat/Raid1
index f7cb1eaf..a3c99402 100755
--- a/heartbeat/Raid1
+++ b/heartbeat/Raid1
@@ -384,8 +384,16 @@ raid1_monitor_one() {
 		2)	ocf_exit_reason "$mddev has failed."
 			return $OCF_ERR_GENERIC
 			;;
-		4)	ocf_exit_reason "mdadm failed on $mddev."
-			return $OCF_ERR_GENERIC
+		4)
+			if [ "$__OCF_ACTION" = "stop" ] ; then
+				# There may be a transient invalid device after
+				# we stop MD due to uevent processing, the
+				# original device is stopped though.
+				return $OCF_NOT_RUNNING
+			else
+				ocf_exit_reason "mdadm failed on $mddev."
+				return $OCF_ERR_GENERIC
+			fi
 			;;
 		*)	ocf_exit_reason "mdadm returned an unknown result ($rc)."
 			return $OCF_ERR_GENERIC
-- 
2.16.2

openSUSE Build Service is sponsored by