From e2c3ec91cdd123b8afc6010f45ecd22ee6d8ecf7 Mon Sep 17 00:00:00 2001 From: Reid Wahl Date: Mon, 3 Sep 2018 00:30:01 -0700 Subject: [PATCH] Filesystem: Canonicalize mountpoint symlinks Commit 2aa8015 added support to `Filesystem_status()` for mountpoints that are symlinks. However, it missed two other places where `readlink` calls should have been added to canonicalize symlinks. --- heartbeat/Filesystem | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/heartbeat/Filesystem b/heartbeat/Filesystem index fc4b8fcd5..2a43d1daa 100755 --- a/heartbeat/Filesystem +++ b/heartbeat/Filesystem @@ -278,7 +278,7 @@ determine_blockdevice() { nfs4|nfs|smbfs|cifs|glusterfs|ceph|tmpfs|overlay|overlayfs|rozofs|zfs|cvfs|none) : ;; *) - DEVICE=`list_mounts | grep " $MOUNTPOINT " | cut -d' ' -f1` + DEVICE=`list_mounts | grep " $(readlink -f "$MOUNTPOINT" ) " | cut -d' ' -f1` if [ -b "$DEVICE" ]; then blockdevice=yes fi @@ -396,7 +396,7 @@ fstype_supported() Filesystem_start() { # Check if there are any mounts mounted under the mountpoint - if list_mounts | grep -q -E " $MOUNTPOINT/\w+" >/dev/null 2>&1; then + if list_mounts | grep -q -E " $(readlink -f "$MOUNTPOINT" )/\w+" >/dev/null 2>&1; then ocf_log err "There is one or more mounts mounted under $MOUNTPOINT." return $OCF_ERR_CONFIGURED fi @@ -580,7 +580,7 @@ Filesystem_stop() # Filesystem_status() { - if list_mounts | grep -q " $(readlink -f $MOUNTPOINT) " >/dev/null 2>&1; then + if list_mounts | grep -q " $(readlink -f "$MOUNTPOINT" ) " >/dev/null 2>&1; then rc=$OCF_SUCCESS msg="$MOUNTPOINT is mounted (running)" else