Blame SOURCES/bz1744140-Filesystem-1-avoid-corrupt-mount-list.patch

b4b3ce
From b67278bc92cfb0b9947ff5fff65f46f420a42c2c Mon Sep 17 00:00:00 2001
b4b3ce
From: Kazutomo Nakahira <kazutomo_nakahira@newson.co.jp>
b4b3ce
Date: Fri, 10 May 2019 14:30:51 +0900
b4b3ce
Subject: [PATCH] Low: Filesystem: Fix missing mount point due to corrupted
b4b3ce
 mount list
b4b3ce
b4b3ce
---
b4b3ce
 heartbeat/Filesystem | 20 +++++++++++++++-----
b4b3ce
 1 file changed, 15 insertions(+), 5 deletions(-)
b4b3ce
b4b3ce
diff --git a/heartbeat/Filesystem b/heartbeat/Filesystem
b4b3ce
index 2a43d1daa..c38ae12d4 100755
b4b3ce
--- a/heartbeat/Filesystem
b4b3ce
+++ b/heartbeat/Filesystem
b4b3ce
@@ -255,16 +255,26 @@ is_bind_mount() {
b4b3ce
 }
b4b3ce
 list_mounts() {
b4b3ce
 	local inpf=""
b4b3ce
+	local mount_list=""
b4b3ce
+	local check_list="x"
b4b3ce
+
b4b3ce
 	if [ -e "/proc/mounts" ] && ! is_bind_mount; then
b4b3ce
 		inpf=/proc/mounts
b4b3ce
 	elif [ -f "/etc/mtab" -a -r "/etc/mtab" ]; then
b4b3ce
 		inpf=/etc/mtab
b4b3ce
 	fi
b4b3ce
-	if [ "$inpf" ]; then
b4b3ce
-		cut -d' ' -f1,2,3 < $inpf
b4b3ce
-	else
b4b3ce
-		$MOUNT | cut -d' ' -f1,3,5
b4b3ce
-	fi
b4b3ce
+
b4b3ce
+	# Make sure that the mount list has not been changed while reading.
b4b3ce
+	while [ "$mount_list" != "$check_list" ]; do
b4b3ce
+		check_list=$mount_list
b4b3ce
+		if [ "$inpf" ]; then
b4b3ce
+			mount_list=$(cut -d' ' -f1,2,3 < $inpf)
b4b3ce
+		else
b4b3ce
+			mount_list=$($MOUNT | cut -d' ' -f1,3,5)
b4b3ce
+		fi
b4b3ce
+	done
b4b3ce
+
b4b3ce
+	echo "$mount_list"
b4b3ce
 }
b4b3ce
 
b4b3ce
 determine_blockdevice() {