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

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