cluster: RHEL59 - rgmanager: add nfsdrestart option as last resource to umount fs/clustefs

Fabio M. Di Nitto fabbione at fedoraproject.org
Thu May 24 06:40:19 UTC 2012


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=e512a9ce367da0bb251559452023ce11f4506f27
Commit:        e512a9ce367da0bb251559452023ce11f4506f27
Parent:        1d1ba64f39fe8a16deef298aa1e36cf6333daa30
Author:        Fabio M. Di Nitto <fdinitto at redhat.com>
AuthorDate:    Thu May 24 08:39:24 2012 +0200
Committer:     Fabio M. Di Nitto <fdinitto at redhat.com>
CommitterDate: Thu May 24 08:39:24 2012 +0200

rgmanager: add nfsdrestart option as last resource to umount fs/clustefs

Resolves: rhbz#822066

Signed-off-by: Fabio M. Di Nitto <fdinitto at redhat.com>
Acked-by: Lon Hohberger <lhh at redhat.com>
---
 rgmanager/src/resources/clusterfs.sh |   30 ++++++++++++++++++++++++++++++
 rgmanager/src/resources/fs.sh        |   29 +++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+), 0 deletions(-)

diff --git a/rgmanager/src/resources/clusterfs.sh b/rgmanager/src/resources/clusterfs.sh
index 6a837b1..89b30a2 100755
--- a/rgmanager/src/resources/clusterfs.sh
+++ b/rgmanager/src/resources/clusterfs.sh
@@ -168,6 +168,20 @@ meta_data()
 	    <content type="boolean"/>
 	</parameter>
 
+	<parameter name="nfsrestart">
+	    <longdesc lang="en">
+		If set and unmounting the file system fails, the node will
+		try to restart nfs daemon and nfs lockd to drop all filesystem
+		references. Use this option as last resource.
+		This option requires force_unmount to be set and it is not
+		compatible with nfsserver resource.
+	    </longdesc>
+	    <shortdesc lang="en">
+		Enable NFS daemon and lockd workaround
+	    </shortdesc>
+	    <content type="boolean"/>
+	</parameter>
+
     </parameters>
 
     <actions>
@@ -667,6 +681,7 @@ stopFilesystem() {
 	typeset -i max_tries=3		# how many times to try umount
 	typeset -i sleep_time=2		# time between each umount failure
 	typeset -i refs=0
+	typeset nfsdthreads
 	typeset done=""
 	typeset umount_failed=""
 	typeset force_umount=""
@@ -786,6 +801,21 @@ stop: Could not match $OCF_RESKEY_device with a real device"
 			if [ "$force_umount" ]; then
 				if [ $try -eq 1 ]; then
 					fuser -TERM -kvm "$mp"
+
+					if [ "$OCF_RESKEY_nfsrestart" = "yes" ] || \
+					   [ "$OCF_RESKEY_nfsrestart" = "1" ]; then
+						if [ -f /proc/fs/nfsd/threads ]; then
+							ocf_log warning "Restarting nfsd/nfslock"
+							nfsdthreads="$(cat /proc/fs/nfsd/threads)"
+							service nfslock stop
+							echo 0 > /proc/fs/nfsd/threads
+							echo $nfsdthreads > /proc/fs/nfsd/threads
+							service nfslock start
+						else
+							ocf_log err "Unable to determin nfsd information. nfsd restart aborted"
+						fi
+					fi
+
 				else
 					fuser -kvm "$mp"
 				fi
diff --git a/rgmanager/src/resources/fs.sh b/rgmanager/src/resources/fs.sh
index 49912c2..5724352 100755
--- a/rgmanager/src/resources/fs.sh
+++ b/rgmanager/src/resources/fs.sh
@@ -202,6 +202,20 @@ meta_data()
 	    <content type="boolean"/>
 	</parameter>
 
+	<parameter name="nfsrestart">
+	    <longdesc lang="en">
+		If set and unmounting the file system fails, the node will
+		try to restart nfs daemon and nfs lockd to drop all filesystem
+		references. Use this option as last resource.
+		This option requires force_unmount to be set and it is not
+		compatible with nfsserver resource.
+	    </longdesc>
+	    <shortdesc lang="en">
+		Enable NFS daemon and lockd workaround
+	    </shortdesc>
+	    <content type="boolean"/>
+	</parameter>
+
 	<parameter name="fsid">
 	    <longdesc lang="en">
 	    	File system ID for NFS exports.  This can be overridden
@@ -1005,6 +1019,7 @@ stopFilesystem() {
 	typeset -i max_tries=3		# how many times to try umount
 	typeset -i sleep_time=5		# time between each umount failure
 	typeset -i nfslock_reclaim=0
+	typeset nfsdthreads
 	typeset done=""
 	typeset umount_failed=""
 	typeset force_umount=""
@@ -1108,6 +1123,20 @@ stop: Could not match $OCF_RESKEY_device with a real device"
 				    notify_list_store $mp/.clumanager/statd
 				    nfslock_reclaim=1
 				  fi
+
+				  if [ "$OCF_RESKEY_nfsrestart" = "yes" ] || \
+				     [ "$OCF_RESKEY_nfsrestart" = "1" ]; then
+					if [ -f /proc/fs/nfsd/threads ]; then
+						ocf_log warning "Restarting nfsd/nfslock"
+						nfsdthreads="$(cat /proc/fs/nfsd/threads)"
+						service nfslock stop
+						echo 0 > /proc/fs/nfsd/threads
+						echo $nfsdthreads > /proc/fs/nfsd/threads
+						service nfslock start
+					else
+						ocf_log err "Unable to determin nfsd information. nfsd restart aborted"
+					fi
+				  fi
 				else
 				  fuser -kvm "$mp"
 				fi


More information about the cluster-commits mailing list