cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] [PATCH] rgmanager: add nfsdrestart option as last resource to umount fs
@ 2012-05-16 13:36 Fabio M. Di Nitto
  0 siblings, 0 replies; 2+ messages in thread
From: Fabio M. Di Nitto @ 2012-05-16 13:36 UTC (permalink / raw)
  To: cluster-devel.redhat.com

From: "Fabio M. Di Nitto" <fdinitto@redhat.com>

Resolves: rhbz#822053

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
---
 rgmanager/src/resources/fs.sh.in |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/rgmanager/src/resources/fs.sh.in b/rgmanager/src/resources/fs.sh.in
index c43c177..404fe01 100644
--- a/rgmanager/src/resources/fs.sh.in
+++ b/rgmanager/src/resources/fs.sh.in
@@ -135,6 +135,18 @@ do_metadata()
 	    <content type="boolean"/>
 	</parameter>
 
+	<parameter name="nfsrestart" inherit="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.
+	    </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
@@ -446,6 +458,20 @@ do_force_unmount() {
 		export 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
+			rpc.nfsd 0
+			rpc.nfsd $nfsdthreads
+			service nfslock start
+		else
+			ocf_log err "Unable to determin nfsd information. nfsd restart aborted"
+		fi
+	fi
+
 	# Proceed with fuser -kvm...
 	return 1
 }
-- 
1.7.7.6



^ permalink raw reply related	[flat|nested] 2+ messages in thread
* [Cluster-devel] [PATCH] rgmanager: add nfsdrestart option as last resource to umount fs
@ 2012-05-16 13:37 Fabio M. Di Nitto
  0 siblings, 0 replies; 2+ messages in thread
From: Fabio M. Di Nitto @ 2012-05-16 13:37 UTC (permalink / raw)
  To: cluster-devel.redhat.com

From: "Fabio M. Di Nitto" <fdinitto@redhat.com>

Resolves: rhbz#822066

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
---
 rgmanager/src/resources/fs.sh |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/rgmanager/src/resources/fs.sh b/rgmanager/src/resources/fs.sh
index 49912c2..f67f80e 100755
--- a/rgmanager/src/resources/fs.sh
+++ b/rgmanager/src/resources/fs.sh
@@ -202,6 +202,18 @@ meta_data()
 	    <content type="boolean"/>
 	</parameter>
 
+	<parameter name="nfsrestart" inherit="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.
+	    </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 +1017,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 +1121,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
-- 
1.7.7.6



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-05-16 13:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-16 13:36 [Cluster-devel] [PATCH] rgmanager: add nfsdrestart option as last resource to umount fs Fabio M. Di Nitto
  -- strict thread matches above, loose matches on Subject: below --
2012-05-16 13:37 Fabio M. Di Nitto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).