[Ocfs2-tools-devel] [PATCH 5/6] o2cb.init: Load dlmfs for user stacks when supported
Joel Becker
joel.becker at oracle.com
Wed Feb 10 01:34:25 PST 2010
If dlmfs supports user stacks, load and mount it at startup.
This is gated by the 'stackglue' capability. ocfs2_dlmfs reports this
as a module parameter named 'capabilities'. If ocfs2_dlmfs is built-in
or loaded, this will appear at
/sys/module/ocfs2_dlmfs/parameter/capabilities. If it is not loaded, we
can find it via modinfo.
Signed-off-by: Joel Becker <joel.becker at oracle.com>
---
vendor/common/o2cb.init.sh | 33 +++++++++++++++++++++++++++++++++
1 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/vendor/common/o2cb.init.sh b/vendor/common/o2cb.init.sh
index e0307bf..5cb606f 100644
--- a/vendor/common/o2cb.init.sh
+++ b/vendor/common/o2cb.init.sh
@@ -31,6 +31,7 @@ CLUSTERCONF=/etc/ocfs2/cluster.conf
OCFS2_SYS_DIR="/sys/fs/ocfs2"
LOADED_PLUGINS_FILE="${OCFS2_SYS_DIR}/loaded_cluster_plugins"
CLUSTER_STACK_FILE="${OCFS2_SYS_DIR}/cluster_stack"
+DLMFS_CAPABILITIES_FILE='/sys/module/ocfs2_dlmfs/parameters/capabilities'
if [ -f /etc/sysconfig/o2cb ]
then
@@ -900,6 +901,27 @@ load_stack_o2cb()
}
#
+# dlmfs_user_capable()
+# Check if dlmfs supports user stacks.
+#
+# 0 is yes, 1 is no.
+#
+dlmfs_user_capable()
+{
+ if [ -e "$DLMFS_CAPABILITIES_FILE" ]
+ then
+ CAP_LINE="$(awk '/\ystackglue\y/{print}' "$DLMFS_CAPABILITIES_FILE" 2>/dev/null)"
+ else
+ CAP_LINE="$(modinfo ocfs2_dlmfs 2>/dev/null |
+ awk '/parm:[ \t]*capabilities:.*\ystackglue\y/{
+ print
+ }')"
+ fi
+
+ test x"$CAP_LINE" != x
+}
+
+#
# load_stack_user()
# Load the userspace stack plugin.
#
@@ -937,6 +959,14 @@ load_stack_user()
[ "$?" != 0 ] && if_fail 1 "Unable to load module \"$PLUGIN_MODULE\""
if_fail 0
fi
+
+ if dlmfs_user_capable
+ then
+ mount_filesystem "ocfs2_dlmfs" "/dlm"
+ if_fail $?
+ fi
+
+ return 0
}
#
@@ -1012,6 +1042,9 @@ unload_stack_user()
exit 1
fi
+ unmount_filesystem "ocfs2_dlmfs" "/dlm"
+ if_fail $?
+
unload_stack_plugins
}
--
1.6.6.1
More information about the Ocfs2-tools-devel
mailing list