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