|
|
9cf66a |
From af39017b9333dcbadee2a15f3829667f2b18fb45 Mon Sep 17 00:00:00 2001
|
|
|
9cf66a |
From: Roger Zhou <zzhou@suse.com>
|
|
|
9cf66a |
Date: Fri, 20 Dec 2019 23:28:45 +0800
|
|
|
9cf66a |
Subject: [PATCH 1/2] Filesystem: respect udevd need time to create UUID
|
|
|
9cf66a |
symlinks
|
|
|
9cf66a |
|
|
|
9cf66a |
To refresh the filesystem UUID, there is a race condition. partprobe
|
|
|
9cf66a |
might return before the UUID symlink get created. Particularly, when the
|
|
|
9cf66a |
system has many devices, the udev daemon could need visible time to
|
|
|
9cf66a |
process the udev event queue. Hence, wait udev for a moment.
|
|
|
9cf66a |
|
|
|
9cf66a |
Signed-off-by: Roger Zhou <zzhou@suse.com>
|
|
|
9cf66a |
---
|
|
|
9cf66a |
heartbeat/Filesystem | 4 ++++
|
|
|
9cf66a |
1 file changed, 4 insertions(+)
|
|
|
9cf66a |
|
|
|
9cf66a |
diff --git a/heartbeat/Filesystem b/heartbeat/Filesystem
|
|
|
9cf66a |
index 543986441..c21ad5761 100755
|
|
|
9cf66a |
--- a/heartbeat/Filesystem
|
|
|
9cf66a |
+++ b/heartbeat/Filesystem
|
|
|
9cf66a |
@@ -460,6 +460,10 @@ Filesystem_start()
|
|
|
9cf66a |
# is not visible yet. Then try partprobe to
|
|
|
9cf66a |
# refresh /dev/disk/by-uuid/* up to date.
|
|
|
9cf66a |
have_binary partprobe && partprobe >/dev/null 2>&1
|
|
|
9cf66a |
+ local timeout
|
|
|
9cf66a |
+ timeout=${OCF_RESKEY_CRM_meta_timeout:="60000"}
|
|
|
9cf66a |
+ timeout=$((timeout/1000))
|
|
|
9cf66a |
+ have_binary udevadm && udevadm settle -t $timeout --exit-if-exists=$DEVICE
|
|
|
9cf66a |
fi
|
|
|
9cf66a |
|
|
|
9cf66a |
if [ "$DEVICE" != "/dev/null" -a ! -b "$DEVICE" ] ; then
|
|
|
9cf66a |
|
|
|
9cf66a |
From a9fb8077c8201b287ee0486b2a34db4b7d4d8f5d Mon Sep 17 00:00:00 2001
|
|
|
9cf66a |
From: Roger Zhou <zzhou@suse.com>
|
|
|
9cf66a |
Date: Wed, 25 Dec 2019 15:45:03 +0800
|
|
|
9cf66a |
Subject: [PATCH 2/2] Filesystem: add trigger_udev_rules_if_need() for -U, -L,
|
|
|
9cf66a |
or /dev/xxx device
|
|
|
9cf66a |
|
|
|
9cf66a |
DEVICE parameter of this RA accepts "-U <uuid>" and "-L <label>" in
|
|
|
9cf66a |
addition to "/dev/xxx". Let's add a new function
|
|
|
9cf66a |
trigger_udev_rules_if_needed() to accommodate them all.
|
|
|
9cf66a |
|
|
|
9cf66a |
It is useful in the case a fresh filesystem is just created from another
|
|
|
9cf66a |
node on the shared storage, and is not visible yet.
|
|
|
9cf66a |
|
|
|
9cf66a |
Signed-off-by: Roger Zhou <zzhou@suse.com>
|
|
|
9cf66a |
---
|
|
|
9cf66a |
heartbeat/Filesystem | 55 ++++++++++++++++++++++++++++++++++----------
|
|
|
9cf66a |
1 file changed, 43 insertions(+), 12 deletions(-)
|
|
|
9cf66a |
|
|
|
9cf66a |
diff --git a/heartbeat/Filesystem b/heartbeat/Filesystem
|
|
|
9cf66a |
index c21ad5761..c716bd0a6 100755
|
|
|
9cf66a |
--- a/heartbeat/Filesystem
|
|
|
9cf66a |
+++ b/heartbeat/Filesystem
|
|
|
9cf66a |
@@ -430,6 +430,47 @@ fstype_supported()
|
|
|
9cf66a |
}
|
|
|
9cf66a |
|
|
|
9cf66a |
|
|
|
9cf66a |
+#
|
|
|
9cf66a |
+# In the case a fresh filesystem is just created from another
|
|
|
9cf66a |
+# node on the shared storage, and is not visible yet. Then try
|
|
|
9cf66a |
+# partprobe to refresh /dev/disk/by-{label,uuid}/* up to date.
|
|
|
9cf66a |
+#
|
|
|
9cf66a |
+# DEVICE can be /dev/xxx, -U, -L
|
|
|
9cf66a |
+#
|
|
|
9cf66a |
+trigger_udev_rules_if_needed()
|
|
|
9cf66a |
+{
|
|
|
9cf66a |
+ local refresh_flag="no"
|
|
|
9cf66a |
+ local tmp
|
|
|
9cf66a |
+ local timeout
|
|
|
9cf66a |
+
|
|
|
9cf66a |
+ if [ $blockdevice = "yes" ]; then
|
|
|
9cf66a |
+ tmp="$DEVICE"
|
|
|
9cf66a |
+ if [ "$DEVICE" != "/dev/null" -a ! -b "$DEVICE" ] ; then
|
|
|
9cf66a |
+ refresh_flag="yes"
|
|
|
9cf66a |
+ fi
|
|
|
9cf66a |
+ else
|
|
|
9cf66a |
+ tmp="`echo $DEVICE|awk '{$1=""; print substr($0,2)}'`"
|
|
|
9cf66a |
+ case "$DEVICE" in
|
|
|
9cf66a |
+ -U*|--uuid*)
|
|
|
9cf66a |
+ tmp="/dev/disk/by-uuid/$tmp"
|
|
|
9cf66a |
+ ;;
|
|
|
9cf66a |
+ -L*|--label*)
|
|
|
9cf66a |
+ tmp="/dev/disk/by-label/$tmp"
|
|
|
9cf66a |
+ ;;
|
|
|
9cf66a |
+ esac
|
|
|
9cf66a |
+ [ ! -b "$tmp" ] && refresh_flag="yes"
|
|
|
9cf66a |
+ fi
|
|
|
9cf66a |
+
|
|
|
9cf66a |
+ [ "$refresh_flag" = "no" ] && return
|
|
|
9cf66a |
+
|
|
|
9cf66a |
+ have_binary partprobe && partprobe >/dev/null 2>&1
|
|
|
9cf66a |
+ timeout=${OCF_RESKEY_CRM_meta_timeout:="60000"}
|
|
|
9cf66a |
+ timeout=$((timeout/1000))
|
|
|
9cf66a |
+ have_binary udevadm && udevadm settle -t $timeout --exit-if-exists=$tmp
|
|
|
9cf66a |
+
|
|
|
9cf66a |
+ return $?
|
|
|
9cf66a |
+}
|
|
|
9cf66a |
+
|
|
|
9cf66a |
#
|
|
|
9cf66a |
# START: Start up the filesystem
|
|
|
9cf66a |
#
|
|
|
9cf66a |
@@ -453,19 +494,9 @@ Filesystem_start()
|
|
|
9cf66a |
# NOTE: Some filesystem types don't need this step... Please modify
|
|
|
9cf66a |
# accordingly
|
|
|
9cf66a |
|
|
|
9cf66a |
- if [ $blockdevice = "yes" ]; then
|
|
|
9cf66a |
- if [ "$DEVICE" != "/dev/null" -a ! -b "$DEVICE" ] ; then
|
|
|
9cf66a |
- # In the case a fresh filesystem is just created
|
|
|
9cf66a |
- # from another node on the shared storage, and
|
|
|
9cf66a |
- # is not visible yet. Then try partprobe to
|
|
|
9cf66a |
- # refresh /dev/disk/by-uuid/* up to date.
|
|
|
9cf66a |
- have_binary partprobe && partprobe >/dev/null 2>&1
|
|
|
9cf66a |
- local timeout
|
|
|
9cf66a |
- timeout=${OCF_RESKEY_CRM_meta_timeout:="60000"}
|
|
|
9cf66a |
- timeout=$((timeout/1000))
|
|
|
9cf66a |
- have_binary udevadm && udevadm settle -t $timeout --exit-if-exists=$DEVICE
|
|
|
9cf66a |
- fi
|
|
|
9cf66a |
+ trigger_udev_rules_if_needed
|
|
|
9cf66a |
|
|
|
9cf66a |
+ if [ $blockdevice = "yes" ]; then
|
|
|
9cf66a |
if [ "$DEVICE" != "/dev/null" -a ! -b "$DEVICE" ] ; then
|
|
|
9cf66a |
ocf_exit_reason "Couldn't find device [$DEVICE]. Expected /dev/??? to exist"
|
|
|
9cf66a |
exit $OCF_ERR_INSTALLED
|