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