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

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