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

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