Blame SOURCES/bz2049319-Filesystem-add-support-for-Amazon-EFS.patch

98dd5d
From cab190c737fdf58268aa5c009f6089b754862b22 Mon Sep 17 00:00:00 2001
98dd5d
From: Reid Wahl <nrwahl@protonmail.com>
98dd5d
Date: Tue, 1 Feb 2022 16:32:50 -0800
98dd5d
Subject: [PATCH 1/3] Filesystem: Fix OpenBSD check in fstype_supported()
98dd5d
98dd5d
fstype_supported() is supposed to skip the /proc/filesystems check if
98dd5d
the OS is OpenBSD. Instead, it skips the check if the OS is **not**
98dd5d
OpenBSD. That means the function has been a no-op for all other distros.
98dd5d
98dd5d
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
98dd5d
---
98dd5d
 heartbeat/Filesystem | 2 +-
98dd5d
 1 file changed, 1 insertion(+), 1 deletion(-)
98dd5d
98dd5d
diff --git a/heartbeat/Filesystem b/heartbeat/Filesystem
98dd5d
index 010c1dcfc..8b4792152 100755
98dd5d
--- a/heartbeat/Filesystem
98dd5d
+++ b/heartbeat/Filesystem
98dd5d
@@ -440,7 +440,7 @@ fstype_supported()
98dd5d
 	local support="$FSTYPE"
98dd5d
 	local rc
98dd5d
 
98dd5d
-	if [ "X${HOSTOS}" != "XOpenBSD" ];then
98dd5d
+	if [ "X${HOSTOS}" = "XOpenBSD" ];then
98dd5d
 		# skip checking /proc/filesystems for obsd
98dd5d
 		return $OCF_SUCCESS
98dd5d
 	fi
98dd5d
98dd5d
From 5d38b87daa9cfffa89a193df131d6ebd87cd05aa Mon Sep 17 00:00:00 2001
98dd5d
From: Reid Wahl <nrwahl@protonmail.com>
98dd5d
Date: Tue, 1 Feb 2022 18:26:32 -0800
98dd5d
Subject: [PATCH 2/3] Filesystem: Improve fstype_supported logs for fuse
98dd5d
98dd5d
Make it more clear when we have to use a different name to check for
98dd5d
support of a particular filesystem. Currently only used for fuse-type
98dd5d
filesystems.
98dd5d
98dd5d
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
98dd5d
---
98dd5d
 heartbeat/Filesystem | 13 ++++++++++---
98dd5d
 1 file changed, 10 insertions(+), 3 deletions(-)
98dd5d
98dd5d
diff --git a/heartbeat/Filesystem b/heartbeat/Filesystem
98dd5d
index 8b4792152..4d84846c1 100755
98dd5d
--- a/heartbeat/Filesystem
98dd5d
+++ b/heartbeat/Filesystem
98dd5d
@@ -455,6 +455,10 @@ fstype_supported()
98dd5d
 		fuse.*|glusterfs|rozofs) support="fuse";;
98dd5d
 	esac
98dd5d
 
98dd5d
+	if [ "$support" != "$FSTYPE" ]; then
98dd5d
+		ocf_log info "Checking support for $FSTYPE as \"$support\""
98dd5d
+	fi
98dd5d
+
98dd5d
 	grep -w "$support"'$' /proc/filesystems >/dev/null
98dd5d
 	if [ $? -eq 0 ]; then
98dd5d
 		# found the fs type
98dd5d
@@ -465,7 +469,7 @@ fstype_supported()
98dd5d
 	# check the if the filesystem support exists again.
98dd5d
 	$MODPROBE $support >/dev/null
98dd5d
 	if [ $? -ne 0 ]; then
98dd5d
-		ocf_exit_reason "Couldn't find filesystem $FSTYPE in /proc/filesystems and failed to load kernel module"
98dd5d
+		ocf_exit_reason "Couldn't find filesystem $support in /proc/filesystems and failed to load kernel module"
98dd5d
 		return $OCF_ERR_INSTALLED
98dd5d
 	fi
98dd5d
 
98dd5d
@@ -478,11 +482,11 @@ fstype_supported()
98dd5d
 			# yes. found the filesystem after doing the modprobe
98dd5d
 			return $OCF_SUCCESS
98dd5d
 		fi
98dd5d
-		ocf_log debug "Unable to find support for $FSTYPE in /proc/filesystems after modprobe, trying again"
98dd5d
+		ocf_log debug "Unable to find support for $support in /proc/filesystems after modprobe, trying again"
98dd5d
 		sleep 1
98dd5d
 	done
98dd5d
 
98dd5d
-	ocf_exit_reason "Couldn't find filesystem $FSTYPE in /proc/filesystems"
98dd5d
+	ocf_exit_reason "Couldn't find filesystem $support in /proc/filesystems"
98dd5d
 	return $OCF_ERR_INSTALLED
98dd5d
 }
98dd5d
 
98dd5d
@@ -837,6 +841,9 @@ Filesystem_monitor()
98dd5d
 #	VALIDATE_ALL: Are the instance parameters valid?
98dd5d
 #	FIXME!!  The only part that's useful is the return code.
98dd5d
 #	This code always returns $OCF_SUCCESS (!)
98dd5d
+#	FIXME!! Needs some tuning to match fstype_supported() (e.g., for
98dd5d
+#	fuse). Can we just call fstype_supported() with a flag like
98dd5d
+#	"no_modprobe" instead?
98dd5d
 #
98dd5d
 Filesystem_validate_all()
98dd5d
 {
98dd5d
98dd5d
From e2174244067b02d798e0f12437f0f499c80f91fe Mon Sep 17 00:00:00 2001
98dd5d
From: Reid Wahl <nrwahl@protonmail.com>
98dd5d
Date: Tue, 1 Feb 2022 18:55:47 -0800
98dd5d
Subject: [PATCH 3/3] Filesystem: Add support for Amazon EFS mount helper
98dd5d
98dd5d
mount.efs, the mount helper for Amazon Elastic File System (EFS)
98dd5d
provided by amazon-efs-utils [1], is a wrapper for mount.nfs4. It offers
98dd5d
a number of AWS-specific mount options and some security improvements
98dd5d
like encryption of data in transit.
98dd5d
98dd5d
This commit adds support by treating an fstype=efs like fstype=nfs4 for
98dd5d
the most part.
98dd5d
98dd5d
Resolves: RHBZ#2049319
98dd5d
98dd5d
[1] https://docs.aws.amazon.com/efs/latest/ug/efs-mount-helper.html
98dd5d
98dd5d
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
98dd5d
---
98dd5d
 heartbeat/Filesystem | 14 ++++++++------
98dd5d
 1 file changed, 8 insertions(+), 6 deletions(-)
98dd5d
98dd5d
diff --git a/heartbeat/Filesystem b/heartbeat/Filesystem
98dd5d
index 4d84846c1..1a90d6a42 100755
98dd5d
--- a/heartbeat/Filesystem
98dd5d
+++ b/heartbeat/Filesystem
98dd5d
@@ -341,7 +341,7 @@ determine_blockdevice() {
98dd5d
 	# Get the current real device name, if possible.
98dd5d
 	# (specified devname could be -L or -U...)
98dd5d
 	case "$FSTYPE" in
98dd5d
-	nfs4|nfs|smbfs|cifs|glusterfs|ceph|tmpfs|overlay|overlayfs|rozofs|zfs|cvfs|none|lustre)
98dd5d
+	nfs4|nfs|efs|smbfs|cifs|glusterfs|ceph|tmpfs|overlay|overlayfs|rozofs|zfs|cvfs|none|lustre)
98dd5d
 		: ;;
98dd5d
 	*)
98dd5d
 		match_string="${TAB}${CANONICALIZED_MOUNTPOINT}${TAB}"
98dd5d
@@ -423,7 +423,7 @@ is_fsck_needed() {
98dd5d
 		no)    false;;
98dd5d
 		""|auto)
98dd5d
 		case "$FSTYPE" in
98dd5d
-			ext4|ext4dev|ext3|reiserfs|reiser4|nss|xfs|jfs|vfat|fat|nfs4|nfs|cifs|smbfs|ocfs2|gfs2|none|lustre|glusterfs|ceph|tmpfs|overlay|overlayfs|rozofs|zfs|cvfs)
98dd5d
+			ext4|ext4dev|ext3|reiserfs|reiser4|nss|xfs|jfs|vfat|fat|nfs4|nfs|efs|cifs|smbfs|ocfs2|gfs2|none|lustre|glusterfs|ceph|tmpfs|overlay|overlayfs|rozofs|zfs|cvfs)
98dd5d
 			false;;
98dd5d
 			*)
98dd5d
 			true;;
98dd5d
@@ -450,9 +450,11 @@ fstype_supported()
98dd5d
 		return $OCF_SUCCESS
98dd5d
 	fi
98dd5d
 
98dd5d
-	# support fuse-filesystems (e.g. GlusterFS)
98dd5d
+	# support fuse-filesystems (e.g. GlusterFS) and Amazon Elastic File
98dd5d
+	# System (EFS)
98dd5d
 	case "$FSTYPE" in
98dd5d
 		fuse.*|glusterfs|rozofs) support="fuse";;
98dd5d
+		efs) support="nfs4";;
98dd5d
 	esac
98dd5d
 
98dd5d
 	if [ "$support" != "$FSTYPE" ]; then
98dd5d
@@ -701,7 +703,7 @@ Filesystem_stop()
98dd5d
 
98dd5d
 		# For networked filesystems, there's merit in trying -f:
98dd5d
 		case "$FSTYPE" in
98dd5d
-		nfs4|nfs|cifs|smbfs) umount_force="-f" ;;
98dd5d
+		nfs4|nfs|efs|cifs|smbfs) umount_force="-f" ;;
98dd5d
 		esac
98dd5d
 
98dd5d
 		# Umount all sub-filesystems mounted under $MOUNTPOINT/ too.
98dd5d
@@ -892,7 +894,7 @@ set_blockdevice_var() {
98dd5d
 
98dd5d
 	# these are definitely not block devices
98dd5d
 	case "$FSTYPE" in
98dd5d
-	nfs4|nfs|smbfs|cifs|none|glusterfs|ceph|tmpfs|overlay|overlayfs|rozofs|zfs|cvfs|lustre) return;;
98dd5d
+	nfs4|nfs|efs|smbfs|cifs|none|glusterfs|ceph|tmpfs|overlay|overlayfs|rozofs|zfs|cvfs|lustre) return;;
98dd5d
 	esac
98dd5d
 
98dd5d
 	if $(is_option "loop"); then
98dd5d
@@ -1013,7 +1015,7 @@ is_option "ro" &&
98dd5d
 	CLUSTERSAFE=2
98dd5d
 
98dd5d
 case "$FSTYPE" in
98dd5d
-nfs4|nfs|smbfs|cifs|none|gfs2|glusterfs|ceph|ocfs2|overlay|overlayfs|tmpfs|cvfs|lustre)
98dd5d
+nfs4|nfs|efs|smbfs|cifs|none|gfs2|glusterfs|ceph|ocfs2|overlay|overlayfs|tmpfs|cvfs|lustre)
98dd5d
 	CLUSTERSAFE=1 # this is kind of safe too
98dd5d
 	;;
98dd5d
 # add here CLUSTERSAFE=0 for all filesystems which are not