# HG changeset patch
# User Florian Haas <[email protected]>
# Date 1285602290 -7200
# Node ID 215ccda0732bbadc55fb4a898dc420bd32f47039
# Parent ff7e2dcd7a24536b793a3348e9985be6905ee12d
Medium: exportfs: add unlock_on_stop parameter
When the resource stops, it's a good idea to relinquish all locks
which the NFS server holds on the exported file system. On Linux,
the NFS server can be forced to do this by echoing the affected path
into the /proc/nfs/nfsd/unlock_filesystem virtual file.
Leave this parameter disabled by default for the following reasons:
- POLS. Don't introduce a new default since people are already
using this RA.
- The relevant virtual file may not be present on legacy kernels.
- The resource may be running on an OS other than Linux.
diff -r ff7e2dcd7a24 -r 215ccda0732b heartbeat/exportfs
--- a/heartbeat/exportfs Wed Oct 06 17:29:35 2010 +0200
+++ b/heartbeat/exportfs Mon Sep 27 17:44:50 2010 +0200
@@ -8,9 +8,17 @@
#
# License: GNU General Public License v2 (GPLv2) and later
+#######################################################################
+# Initialization:
: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/resource.d/heartbeat}
. ${OCF_FUNCTIONS_DIR}/.ocf-shellfuncs
+# Defaults
+OCF_RESKEY_unlock_on_stop_default=0
+
+: ${OCF_RESKEY_unlock_on_stop=${OCF_RESKEY_unlock_on_stop_default}}
+#######################################################################
+
exportfs_meta_data() {
cat <<END
<?xml version="1.0"?>
@@ -68,7 +76,7 @@
integer, a UUID, or the special string "root" which is functionally
identical to numeric fsid of 0.
0 (root) identifies the export as the root of an NFSv4
-pseudofilesystem -- avoid this setting unless you understand its
+pseudofilesystem -- avoid this setting unless you understand its
special status.
This value will override any fsid provided via the options parameter.
</longdesc>
@@ -78,6 +86,19 @@
<content type="string" />
</parameter>
+<parameter name="unlock_on_stop">
+<longdesc lang="en">
+Relinquish NFS locks associated with this filesystem when the resource
+stops. Enabling this parameter is highly recommended unless the path exported
+by this ${__SCRIPT_NAME} resource is also exported by a different resource.
+</longdesc>
+<shortdesc lang="en">
+Unlock filesystem on stop?
+</shortdesc>
+<content type="boolean" default="${OCF_RESKEY_unlock_on_stop_default}" />
+</parameter>
+
+
</parameters>
<actions>
@@ -187,6 +208,17 @@
rm $PIDF
fi
+ if ocf_is_true ${OCF_RESKEY_unlock_on_stop}; then
+ local unlockfile
+ unlockfile=/proc/fs/nfsd/unlock_filesystem
+ if [ -w ${unlockfile} ]; then
+ echo "${OCF_RESKEY_directory}" > ${unlockfile}
+ ocf_log info "Unlocked NFS export
${OCF_RESKEY_directory}"
+ else
+ ocf_log warn "Unable to unlock NFS export
${OCF_RESKEY_directory}, ${unlockfile} not found or not writable"
+ fi
+ fi
+
backup_rmtab
clean_rmtab
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/