Blame SOURCES/bz1624203-Filesystem-1-monitor-symlink-support.patch

5c52dd
From 2aa8015bc4ff0bd61eca13eceb59aaa672335b76 Mon Sep 17 00:00:00 2001
5c52dd
From: Reid Wahl <nwahl@redhat.com>
5c52dd
Date: Thu, 30 Aug 2018 18:36:11 -0700
5c52dd
Subject: [PATCH] Filesystem: Support symlink as mountpoint directory
5c52dd
5c52dd
Filesystem monitor operation fails when the `directory` attribute is a
5c52dd
symlink.
5c52dd
5c52dd
The monitor operation calls the `list_mounts` function, which cats
5c52dd
`/proc/mounts` if it exists, else cats `/etc/mtab` if it exists, else
5c52dd
runs the `mount` command. It then greps for `" $MOUNTPOINT "` in the
5c52dd
output, where `$MOUNTPOINT` is the value of the `directory` attribute.
5c52dd
5c52dd
`/proc/mounts`, `/etc/mtab`, and the `mount` command resolve symlinks
5c52dd
to their canonical targets. So while the monitor operation greps for
5c52dd
the symlink path (surrounded by spaces) as defined in the directory
5c52dd
attribute, the symlink will not be present in the `list_mounts` output.
5c52dd
Only the symlink's target will be present.
5c52dd
5c52dd
This patch uses `readlink -f $MOUNTPOINT` to resolve the symlink to its
5c52dd
canonical name before using it as a grep pattern in the
5c52dd
`Filesystem_status` function.
5c52dd
---
5c52dd
 heartbeat/Filesystem | 2 +-
5c52dd
 1 file changed, 1 insertion(+), 1 deletion(-)
5c52dd
5c52dd
diff --git a/heartbeat/Filesystem b/heartbeat/Filesystem
5c52dd
index 7c73b0b97..fc4b8fcd5 100755
5c52dd
--- a/heartbeat/Filesystem
5c52dd
+++ b/heartbeat/Filesystem
5c52dd
@@ -580,7 +580,7 @@ Filesystem_stop()
5c52dd
 #
5c52dd
 Filesystem_status()
5c52dd
 {
5c52dd
-	if list_mounts | grep -q " $MOUNTPOINT " >/dev/null 2>&1; then
5c52dd
+	if list_mounts | grep -q " $(readlink -f $MOUNTPOINT) " >/dev/null 2>&1; then
5c52dd
 		rc=$OCF_SUCCESS
5c52dd
 		msg="$MOUNTPOINT is mounted (running)"
5c52dd
 	else