Skip to contentSkip to conversation

rgmanager: add nfsdrestart option as last resource to umount fs

PATCH New Fabio M. Di Nitto 1 participant 1 message May 16, 2012

lore
Share & tools
lore
#0 lore raw

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

From: "Fabio M. Di Nitto" <[email protected]>

Resolves: rhbz#822053

---
 rgmanager/src/resources/fs.sh.in |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)
rgmanager/src/resources/fs.sh.in +26 -0
index c43c177..404fe01 100644
@@ -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
 }
Signature · 1 line
1.7.7.6