|
|
c608c9 |
From d0ecd287511e49891245c68cd323e8f232aa033b Mon Sep 17 00:00:00 2001
|
|
|
c608c9 |
From: David Vossel <dvossel@redhat.com>
|
|
|
c608c9 |
Date: Wed, 6 Aug 2014 14:05:18 -0400
|
|
|
c608c9 |
Subject: [PATCH] High: Filesystem: when loading kernel modules wait for
|
|
|
c608c9 |
filesystem to initialize
|
|
|
c608c9 |
|
|
|
c608c9 |
When the Filesystem agent is managing a filesystem type that
|
|
|
c608c9 |
is not present in /proc/filesystems, the agent attempts to
|
|
|
c608c9 |
load the kernel module for that filesystem.
|
|
|
c608c9 |
|
|
|
c608c9 |
This patch improves on that logic by
|
|
|
c608c9 |
1. verifying that modprobe worked
|
|
|
c608c9 |
2. give the module a brief period of time to initialize.
|
|
|
c608c9 |
|
|
|
c608c9 |
Item 2 is important because there is a brief period
|
|
|
c608c9 |
of time between when modprobe returns loading the gfs2
|
|
|
c608c9 |
module, and when gfs2 will show up in the /proc/filesystems
|
|
|
c608c9 |
list. Without retrying the search of the /proc/filesystems
|
|
|
c608c9 |
file, a gfs2 filesystem may fail to start correctly because
|
|
|
c608c9 |
it will look like the filesystem isn't supported.
|
|
|
c608c9 |
---
|
|
|
c608c9 |
heartbeat/Filesystem | 71 +++++++++++++++++++++++++++++++++++++++-------------
|
|
|
c608c9 |
1 file changed, 53 insertions(+), 18 deletions(-)
|
|
|
c608c9 |
|
|
|
c608c9 |
diff --git a/heartbeat/Filesystem b/heartbeat/Filesystem
|
|
|
c608c9 |
index 9209818..9892b39 100755
|
|
|
c608c9 |
--- a/heartbeat/Filesystem
|
|
|
c608c9 |
+++ b/heartbeat/Filesystem
|
|
|
c608c9 |
@@ -450,6 +450,58 @@ is_fsck_needed() {
|
|
|
c608c9 |
esac
|
|
|
c608c9 |
}
|
|
|
c608c9 |
|
|
|
c608c9 |
+fstype_supported()
|
|
|
c608c9 |
+{
|
|
|
c608c9 |
+ local support="$FSTYPE"
|
|
|
c608c9 |
+ local rc
|
|
|
c608c9 |
+
|
|
|
c608c9 |
+ if [ "X${HOSTOS}" != "XOpenBSD" ];then
|
|
|
c608c9 |
+ # skip checking /proc/filesystems for obsd
|
|
|
c608c9 |
+ return $OCF_SUCCESS
|
|
|
c608c9 |
+ fi
|
|
|
c608c9 |
+
|
|
|
c608c9 |
+ if [ -z "$FSTYPE" -o "$FSTYPE" = none ]; then
|
|
|
c608c9 |
+ : No FSTYPE specified, rely on the system has the right file-system support already
|
|
|
c608c9 |
+ return $OCF_SUCCESS
|
|
|
c608c9 |
+ fi
|
|
|
c608c9 |
+
|
|
|
c608c9 |
+ # support fuse-filesystems (e.g. GlusterFS)
|
|
|
c608c9 |
+ case $FSTYPE in
|
|
|
c608c9 |
+ glusterfs) support="fuse";;
|
|
|
c608c9 |
+ esac
|
|
|
c608c9 |
+
|
|
|
c608c9 |
+ grep -w "$support"'$' /proc/filesystems >/dev/null
|
|
|
c608c9 |
+ if [ $? -eq 0 ]; then
|
|
|
c608c9 |
+ # found the fs type
|
|
|
c608c9 |
+ return $OCF_SUCCESS
|
|
|
c608c9 |
+ fi
|
|
|
c608c9 |
+
|
|
|
c608c9 |
+ # if here, we should attempt to load the module and then
|
|
|
c608c9 |
+ # check the if the filesystem support exists again.
|
|
|
c608c9 |
+ $MODPROBE $support >/dev/null
|
|
|
c608c9 |
+ if [ $? -ne 0 ]; then
|
|
|
c608c9 |
+ ocf_log err "Couldn't find filesystem $FSTYPE in /proc/filesystems and failed to load kernal module"
|
|
|
c608c9 |
+ return $OCF_ERR_INSTALLED
|
|
|
c608c9 |
+ fi
|
|
|
c608c9 |
+
|
|
|
c608c9 |
+ # It is possible for the module to load and not be complete initialized
|
|
|
c608c9 |
+ # before we check /proc/filesystems again. Give this a few trys before
|
|
|
c608c9 |
+ # giving up entirely.
|
|
|
c608c9 |
+ for try in $(seq 5); do
|
|
|
c608c9 |
+ grep -w "$support"'$' /proc/filesystems >/dev/null
|
|
|
c608c9 |
+ if [ $? -eq 0 ] ; then
|
|
|
c608c9 |
+ # yes. found the filesystem after doing the modprobe
|
|
|
c608c9 |
+ return $OCF_SUCCESS
|
|
|
c608c9 |
+ fi
|
|
|
c608c9 |
+ ocf_log debug "Unable to find support for $FSTYPE in /proc/filesystems after modprobe, trying again"
|
|
|
c608c9 |
+ sleep 1
|
|
|
c608c9 |
+ done
|
|
|
c608c9 |
+
|
|
|
c608c9 |
+ ocf_log err "Couldn't find filesystem $FSTYPE in /proc/filesystems"
|
|
|
c608c9 |
+ return $OCF_ERR_INSTALLED
|
|
|
c608c9 |
+}
|
|
|
c608c9 |
+
|
|
|
c608c9 |
+
|
|
|
c608c9 |
#
|
|
|
c608c9 |
# START: Start up the filesystem
|
|
|
c608c9 |
#
|
|
|
c608c9 |
@@ -472,24 +524,7 @@ Filesystem_start()
|
|
|
c608c9 |
return $OCF_SUCCESS
|
|
|
c608c9 |
fi
|
|
|
c608c9 |
|
|
|
c608c9 |
- if [ "X${HOSTOS}" != "XOpenBSD" ];then
|
|
|
c608c9 |
- if [ -z "$FSTYPE" -o "$FSTYPE" = none ]; then
|
|
|
c608c9 |
- : No FSTYPE specified, rely on the system has the right file-system support already
|
|
|
c608c9 |
- else
|
|
|
c608c9 |
- local support="$FSTYPE"
|
|
|
c608c9 |
- # support fuse-filesystems (e.g. GlusterFS)
|
|
|
c608c9 |
- case $FSTYPE in
|
|
|
c608c9 |
- glusterfs) support="fuse";;
|
|
|
c608c9 |
- esac
|
|
|
c608c9 |
- grep -w "$support"'$' /proc/filesystems >/dev/null ||
|
|
|
c608c9 |
- $MODPROBE $support >/dev/null
|
|
|
c608c9 |
- grep -w "$support"'$' /proc/filesystems >/dev/null
|
|
|
c608c9 |
- if [ $? -ne 0 ] ; then
|
|
|
c608c9 |
- ocf_log err "Couldn't find filesystem $FSTYPE in /proc/filesystems"
|
|
|
c608c9 |
- return $OCF_ERR_INSTALLED
|
|
|
c608c9 |
- fi
|
|
|
c608c9 |
- fi
|
|
|
c608c9 |
- fi
|
|
|
c608c9 |
+ fstype_supported || exit $OCF_ERR_INSTALLED
|
|
|
c608c9 |
|
|
|
c608c9 |
# Check the filesystem & auto repair.
|
|
|
c608c9 |
# NOTE: Some filesystem types don't need this step... Please modify
|
|
|
c608c9 |
--
|
|
|
c608c9 |
1.8.4.2
|
|
|
c608c9 |
|