|
|
734564 |
From 69d607dc7568168e874f99d5a8b6bdb66b579d8b Mon Sep 17 00:00:00 2001
|
|
|
734564 |
From: "yusk.iida" <yusk.iida@gmail.com>
|
|
|
734564 |
Date: Tue, 7 May 2019 19:37:26 +0900
|
|
|
734564 |
Subject: [PATCH] Low: Filesystem: Fix a problem umount is not executed in the
|
|
|
734564 |
event of a disk failure
|
|
|
734564 |
|
|
|
734564 |
---
|
|
|
734564 |
heartbeat/Filesystem | 11 ++++++++---
|
|
|
734564 |
1 file changed, 8 insertions(+), 3 deletions(-)
|
|
|
734564 |
|
|
|
734564 |
diff --git a/heartbeat/Filesystem b/heartbeat/Filesystem
|
|
|
734564 |
index 2a43d1daa..bd974f8f3 100755
|
|
|
734564 |
--- a/heartbeat/Filesystem
|
|
|
734564 |
+++ b/heartbeat/Filesystem
|
|
|
734564 |
@@ -278,7 +278,7 @@ determine_blockdevice() {
|
|
|
734564 |
nfs4|nfs|smbfs|cifs|glusterfs|ceph|tmpfs|overlay|overlayfs|rozofs|zfs|cvfs|none)
|
|
|
734564 |
: ;;
|
|
|
734564 |
*)
|
|
|
734564 |
- DEVICE=`list_mounts | grep " $(readlink -f "$MOUNTPOINT" ) " | cut -d' ' -f1`
|
|
|
734564 |
+ DEVICE=`list_mounts | grep " $CANONICALIZED_MOUNTPOINT " | cut -d' ' -f1`
|
|
|
734564 |
if [ -b "$DEVICE" ]; then
|
|
|
734564 |
blockdevice=yes
|
|
|
734564 |
fi
|
|
|
734564 |
@@ -396,7 +396,7 @@ fstype_supported()
|
|
|
734564 |
Filesystem_start()
|
|
|
734564 |
{
|
|
|
734564 |
# Check if there are any mounts mounted under the mountpoint
|
|
|
734564 |
- if list_mounts | grep -q -E " $(readlink -f "$MOUNTPOINT" )/\w+" >/dev/null 2>&1; then
|
|
|
734564 |
+ if list_mounts | grep -q -E " $CANONICALIZED_MOUNTPOINT/\w+" >/dev/null 2>&1; then
|
|
|
734564 |
ocf_log err "There is one or more mounts mounted under $MOUNTPOINT."
|
|
|
734564 |
return $OCF_ERR_CONFIGURED
|
|
|
734564 |
fi
|
|
|
734564 |
@@ -580,7 +580,7 @@ Filesystem_stop()
|
|
|
734564 |
#
|
|
|
734564 |
Filesystem_status()
|
|
|
734564 |
{
|
|
|
734564 |
- if list_mounts | grep -q " $(readlink -f "$MOUNTPOINT" ) " >/dev/null 2>&1; then
|
|
|
734564 |
+ if list_mounts | grep -q " $CANONICALIZED_MOUNTPOINT " >/dev/null 2>&1; then
|
|
|
734564 |
rc=$OCF_SUCCESS
|
|
|
734564 |
msg="$MOUNTPOINT is mounted (running)"
|
|
|
734564 |
else
|
|
|
734564 |
@@ -804,6 +804,11 @@ if [ -z "$OCF_RESKEY_directory" ]; then
|
|
|
734564 |
else
|
|
|
734564 |
MOUNTPOINT=$(echo $OCF_RESKEY_directory | sed 's/\/*$//')
|
|
|
734564 |
: ${MOUNTPOINT:=/}
|
|
|
734564 |
+ CANONICALIZED_MOUNTPOINT=$(readlink -f "$MOUNTPOINT")
|
|
|
734564 |
+ if [ $? -ne 0 ]; then
|
|
|
734564 |
+ ocf_exit_reason "Could not canonicalize $MOUNTPOINT because readlink failed"
|
|
|
734564 |
+ exit $OCF_ERR_GENERIC
|
|
|
734564 |
+ fi
|
|
|
734564 |
# At this stage, $MOUNTPOINT does not contain trailing "/" unless it is "/"
|
|
|
734564 |
# TODO: / mounted via Filesystem sounds dangerous. On stop, we'll
|
|
|
734564 |
# kill the whole system. Is that a good idea?
|