# HG changeset patch # User Florian Haas <florian.h...@linbit.com> # Date 1285602290 -7200 # Node ID e2953ed0d65b38eb8535f1b9e5d394b5e38a4f84 # Parent 98769f180501a1b99865c2fa6f9f63a63a3837fa 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 98769f180501 -r e2953ed0d65b heartbeat/exportfs --- a/heartbeat/exportfs Fri Aug 20 15:23:24 2010 -0400 +++ 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,16 @@ 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} + 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: Linux-HA-Dev@lists.linux-ha.org http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev Home Page: http://linux-ha.org/