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

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