filesystem resource script patch

"Martin Bene" <[email protected]> Wed, 8 May 2002 10:27:05 +0200
Newsgroups gmane.linux.failsafe
Message-ID <[email protected]>
Hi Lars,

below is a patch for the filesystem resource scripts: for forced unmount, it uses the fuser tool with fixed /bin/fuser path. Location of fuser seems to be distrubution specific, I've also seen it at /sbin/fuser; the patch tries to pick the correct location.

********************************************************
Martin Bene,                 CTO
icomedias GmbH,              A-8020 Graz, Nikolaiplatz 4
t +43 (316) 721671-14,       f +43 (316) 721671-26
e [email protected], i http://www.icomedias.com
********************************************************
filesystem.patch (application/octet-stream, 1.1 KB)
diff -u -r1.7 filesystem_lib.sh
--- FailSafe/cluster_services/cmd/srm/scripts/filesystem/filesystem_lib.sh	2002/05/03 11:16:15	1.7
+++ FailSafe/cluster_services/cmd/srm/scripts/filesystem/filesystem_lib.sh	2002/05/08 08:07:33
@@ -110,11 +110,19 @@
          return 0;
      fi
 
-     if [ "$force_umount" = "yes" ]; then
-        if /bin/fuser -TERM -km $MountPoint >/dev/null 2>&1 ; then
+     if [ -x /bin/fuser ]; then
+	FUSER=/bin/fuser
+     elif [ -x /sbin/fuser ]; then
+	FUSER=/sbin/fuser
+     elif [ "$force_umount" = "yes" ]; then
+	$HA_LOG "fuser command not found, ignoring force_umount option"
+     fi
+
+     if [ "$force_umount" = "yes" ] && [ -n $FUSER ]; then
+        if $FUSER -TERM -km $MountPoint >/dev/null 2>&1 ; then
   	    $HA_LOG "Processes accessing $MountPoint were sent -TERM"
        	    sleep 3
-	    if /bin/fuser -KILL -km $MountPoint >/dev/null 2>&1 ; then
+	    if $FUSER -KILL -km $MountPoint >/dev/null 2>&1 ; then
 		$HA_LOG "Processes were -KILLed"
 		# Give the kernel a second to complete the
 		# kills, so the umount will succeed