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

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