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

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