Blame SOURCES/bz1901357-crypt-2-dont-sanity-check-during-probe.patch

030326
From 6a45c28cd074e14a7bc2e2531b15595b9985965c Mon Sep 17 00:00:00 2001
030326
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
030326
Date: Tue, 1 Dec 2020 10:11:52 +0100
030326
Subject: [PATCH] crypt: avoid failing for LVM exclusive by not running full
030326
 sanity check during probes
030326
030326
---
030326
 heartbeat/crypt | 13 +++++++++++--
030326
 1 file changed, 11 insertions(+), 2 deletions(-)
030326
030326
diff --git a/heartbeat/crypt b/heartbeat/crypt
030326
index 3ca28b92d..05bded7c5 100755
030326
--- a/heartbeat/crypt
030326
+++ b/heartbeat/crypt
030326
@@ -177,6 +177,13 @@ crypt_validate_all() {
030326
 			 esac
030326
 		esac
030326
 	fi
030326
+
030326
+	# return early for probes where device might not be available yet
030326
+	# e.g. LVM exclusive volumes
030326
+	if ocf_is_probe; then
030326
+		return $OCF_SUCCESS
030326
+	fi
030326
+
030326
 	if [ ! -b "$encrypted_dev" ] && [ ! -L "$encrypted_dev" ]; then
030326
 		ocf_exit_reason "Encrypted device $encrypted_dev not accessible"
030326
 		return $OCF_ERR_ARGS
030326
@@ -294,11 +301,13 @@ crypt_stop() {
030326
 crypt_monitor() {
030326
 	cryptsetup status $crypt_dev $disable_locks >/dev/null 2>&1
030326
 	if [ $? -eq 0 ]; then
030326
-		[ -L $crypt_dev_path ] && return $OCF_SUCCESS
030326
+		if [ -b "$encrypted_dev" ] || [ -L $crypt_dev_path ]; then
030326
+			return $OCF_SUCCESS
030326
+		fi
030326
 		return $OCF_ERR_GENERIC
030326
 	fi
030326
 
030326
-        [ "$__OCF_ACTION" = "monitor" ] && ! ocf_is_probe && ocf_exit_reason "Crypt resource not running"
030326
+	[ "$__OCF_ACTION" = "monitor" ] && ! ocf_is_probe && ocf_exit_reason "Crypt resource not running"
030326
 	return $OCF_NOT_RUNNING
030326
 }
030326