* [Cluster-devel] cluster/rgmanager/src/resources netfs.sh
@ 2006-09-14 13:54 mgrac
0 siblings, 0 replies; 6+ messages in thread
From: mgrac @ 2006-09-14 13:54 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: mgrac at sourceware.org 2006-09-14 13:54:43
Modified files:
rgmanager/src/resources: netfs.sh
Log message:
typing error
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/netfs.sh.diff?cvsroot=cluster&r1=1.6&r2=1.7
--- cluster/rgmanager/src/resources/netfs.sh 2006/06/02 17:37:10 1.6
+++ cluster/rgmanager/src/resources/netfs.sh 2006/09/14 13:54:43 1.7
@@ -194,7 +194,7 @@
verify_host()
{
if [ -z "$OCF_RESKEY_host" ]; then
- ocf_log err "No server hostname or IP addess specified."
+ ocf_log err "No server hostname or IP address specified."
return 1
fi
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Cluster-devel] cluster/rgmanager/src/resources netfs.sh
@ 2007-10-03 16:40 mgrac
0 siblings, 0 replies; 6+ messages in thread
From: mgrac @ 2007-10-03 16:40 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: mgrac at sourceware.org 2007-10-03 16:40:07
Modified files:
rgmanager/src/resources: netfs.sh
Log message:
Resolves: #250681 - mount samba share from netfs RA
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/netfs.sh.diff?cvsroot=cluster&r1=1.9&r2=1.10
--- cluster/rgmanager/src/resources/netfs.sh 2007/05/21 15:58:04 1.9
+++ cluster/rgmanager/src/resources/netfs.sh 2007/10/03 16:40:06 1.10
@@ -21,7 +21,7 @@
#
#
-# NFS file system mount/umount/etc. agent
+# NFS/CIFS file system mount/umount/etc. agent
#
LC_ALL=C
@@ -50,10 +50,10 @@
<version>1.0</version>
<longdesc lang="en">
- This defines an NFS mount for use by cluster services.
+ This defines an NFS/CIFS mount for use by cluster services.
</longdesc>
<shortdesc lang="en">
- Defines an NFS file system mount.
+ Defines an NFS/CIFS file system mount.
</shortdesc>
<parameters>
@@ -79,7 +79,7 @@
<parameter name="host" required="1">
<longdesc lang="en">
- NFS Server IP address or hostname
+ Server IP address or hostname
</longdesc>
<shortdesc lang="en">
IP or Host
@@ -89,7 +89,7 @@
<parameter name="export" required="1">
<longdesc lang="en">
- NFS Export directory name
+ NFS Export directory name or CIFS share
</longdesc>
<shortdesc lang="en">
Export
@@ -99,10 +99,10 @@
<parameter name="fstype" required="0">
<longdesc lang="en">
- NFS File System type (nfs or nfs4)
+ File System type (nfs, nfs4 or cifs)
</longdesc>
<shortdesc lang="en">
- NFS File System Type
+ File System Type
</shortdesc>
<content type="string"/>
</parameter>
@@ -215,7 +215,7 @@
[ -z "$OCF_RESKEY_fstype" ] && return 0
case $OCF_RESKEY_fstype in
- nfs|nfs4)
+ nfs|nfs4|cifs)
return 0
;;
*)
@@ -247,6 +247,9 @@
esac
case $OCF_RESKEY_fstype in
+ cifs)
+ continue
+ ;;
nfs|nfs4)
case $o in
#
@@ -374,7 +377,6 @@
return $FAIL
;;
esac
-
#
# Get the device
#
@@ -432,7 +434,16 @@
# Mount the NFS export
#
ocf_log debug "mount $fstype_option $mount_options $fullpath $mp"
- mount $fstype_option $mount_options $fullpath $mp
+
+ case $OCF_RESKEY_fstype in
+ nfs|nfs4)
+ mount -t $OCF_RESKEY_fstype $mount_options $host:$exp $mp
+ ;;
+ cifs)
+ mount -t $OCF_RESKEY_fstype $mount_options //$host/$exp $mp
+ ;;
+ esac
+
ret_val=$?
if [ $ret_val -ne 0 ]; then
ocf_log err "\
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Cluster-devel] cluster/rgmanager/src/resources netfs.sh
@ 2007-10-03 16:44 mgrac
0 siblings, 0 replies; 6+ messages in thread
From: mgrac @ 2007-10-03 16:44 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL5
Changes by: mgrac at sourceware.org 2007-10-03 16:44:15
Modified files:
rgmanager/src/resources: netfs.sh
Log message:
Resolves: #250681 - Allow mounting samba share from netfs RA
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/netfs.sh.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.7.2.1&r2=1.7.2.2
--- cluster/rgmanager/src/resources/netfs.sh 2007/05/21 15:57:29 1.7.2.1
+++ cluster/rgmanager/src/resources/netfs.sh 2007/10/03 16:44:15 1.7.2.2
@@ -21,7 +21,7 @@
#
#
-# NFS file system mount/umount/etc. agent
+# NFS/CIFS file system mount/umount/etc. agent
#
LC_ALL=C
@@ -50,10 +50,10 @@
<version>1.0</version>
<longdesc lang="en">
- This defines an NFS mount for use by cluster services.
+ This defines an NFS/CIFS mount for use by cluster services.
</longdesc>
<shortdesc lang="en">
- Defines an NFS file system mount.
+ Defines an NFS/CIFS file system mount.
</shortdesc>
<parameters>
@@ -79,7 +79,7 @@
<parameter name="host" required="1">
<longdesc lang="en">
- NFS Server IP address or hostname
+ Server IP address or hostname
</longdesc>
<shortdesc lang="en">
IP or Host
@@ -89,7 +89,7 @@
<parameter name="export" required="1">
<longdesc lang="en">
- NFS Export directory name
+ NFS Export directory name or CIFS share
</longdesc>
<shortdesc lang="en">
Export
@@ -99,10 +99,10 @@
<parameter name="fstype" required="0">
<longdesc lang="en">
- NFS File System type (nfs or nfs4)
+ File System type (nfs, nfs4 or cifs)
</longdesc>
<shortdesc lang="en">
- NFS File System Type
+ File System Type
</shortdesc>
<content type="string"/>
</parameter>
@@ -215,7 +215,7 @@
[ -z "$OCF_RESKEY_fstype" ] && return 0
case $OCF_RESKEY_fstype in
- nfs|nfs4)
+ nfs|nfs4|cifs)
return 0
;;
*)
@@ -247,6 +247,9 @@
esac
case $OCF_RESKEY_fstype in
+ cifs)
+ continue
+ ;;
nfs|nfs4)
case $o in
#
@@ -374,7 +377,6 @@
return $FAIL
;;
esac
-
#
# Get the device
#
@@ -432,7 +434,16 @@
# Mount the NFS export
#
ocf_log debug "mount $fstype_option $mount_options $fullpath $mp"
- mount $fstype_option $mount_options $fullpath $mp
+
+ case $OCF_RESKEY_fstype in
+ nfs|nfs4)
+ mount -t $OCF_RESKEY_fstype $mount_options $host:$exp $mp
+ ;;
+ cifs)
+ mount -t $OCF_RESKEY_fstype $mount_options //$host/$exp $mp
+ ;;
+ esac
+
ret_val=$?
if [ $ret_val -ne 0 ]; then
ocf_log err "\
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Cluster-devel] cluster/rgmanager/src/resources netfs.sh
@ 2007-10-03 17:01 lhh
0 siblings, 0 replies; 6+ messages in thread
From: lhh @ 2007-10-03 17:01 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL4
Changes by: lhh at sourceware.org 2007-10-03 17:01:39
Modified files:
rgmanager/src/resources: netfs.sh
Log message:
Merge netfs.sh from RHEL4 branch; adds cifs support to netfs.sh
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/netfs.sh.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.1.2.4&r2=1.1.2.5
--- cluster/rgmanager/src/resources/netfs.sh 2007/05/21 15:56:47 1.1.2.4
+++ cluster/rgmanager/src/resources/netfs.sh 2007/10/03 17:01:39 1.1.2.5
@@ -21,7 +21,7 @@
#
#
-# NFS file system mount/umount/etc. agent
+# NFS/CIFS file system mount/umount/etc. agent
#
LC_ALL=C
@@ -50,10 +50,10 @@
<version>1.0</version>
<longdesc lang="en">
- This defines an NFS mount for use by cluster services.
+ This defines an NFS/CIFS mount for use by cluster services.
</longdesc>
<shortdesc lang="en">
- Defines an NFS file system mount.
+ Defines an NFS/CIFS file system mount.
</shortdesc>
<parameters>
@@ -79,7 +79,7 @@
<parameter name="host" required="1">
<longdesc lang="en">
- NFS Server IP address or hostname
+ Server IP address or hostname
</longdesc>
<shortdesc lang="en">
IP or Host
@@ -89,7 +89,7 @@
<parameter name="export" required="1">
<longdesc lang="en">
- NFS Export directory name
+ NFS Export directory name or CIFS share
</longdesc>
<shortdesc lang="en">
Export
@@ -99,10 +99,10 @@
<parameter name="fstype" required="0">
<longdesc lang="en">
- NFS File System type (nfs or nfs4)
+ File System type (nfs, nfs4 or cifs)
</longdesc>
<shortdesc lang="en">
- NFS File System Type
+ File System Type
</shortdesc>
<content type="string"/>
</parameter>
@@ -194,7 +194,7 @@
verify_host()
{
if [ -z "$OCF_RESKEY_host" ]; then
- ocf_log err "No server hostname or IP addess specified."
+ ocf_log err "No server hostname or IP address specified."
return 1
fi
@@ -215,7 +215,7 @@
[ -z "$OCF_RESKEY_fstype" ] && return 0
case $OCF_RESKEY_fstype in
- nfs|nfs4)
+ nfs|nfs4|cifs)
return 0
;;
*)
@@ -247,6 +247,9 @@
esac
case $OCF_RESKEY_fstype in
+ cifs)
+ continue
+ ;;
nfs|nfs4)
case $o in
#
@@ -374,7 +377,6 @@
return $FAIL
;;
esac
-
#
# Get the device
#
@@ -432,7 +434,16 @@
# Mount the NFS export
#
ocf_log debug "mount $fstype_option $mount_options $fullpath $mp"
- mount $fstype_option $mount_options $fullpath $mp
+
+ case $OCF_RESKEY_fstype in
+ nfs|nfs4)
+ mount -t $OCF_RESKEY_fstype $mount_options $host:$exp $mp
+ ;;
+ cifs)
+ mount -t $OCF_RESKEY_fstype $mount_options //$host/$exp $mp
+ ;;
+ esac
+
ret_val=$?
if [ $ret_val -ne 0 ]; then
ocf_log err "\
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Cluster-devel] cluster/rgmanager/src/resources netfs.sh
@ 2007-11-14 18:49 lhh
0 siblings, 0 replies; 6+ messages in thread
From: lhh @ 2007-11-14 18:49 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL4
Changes by: lhh at sourceware.org 2007-11-14 18:49:51
Modified files:
rgmanager/src/resources: netfs.sh
Log message:
Apply patch from Marco Ceci to fix #358161
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/netfs.sh.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.1.2.5&r2=1.1.2.6
--- cluster/rgmanager/src/resources/netfs.sh 2007/10/03 17:01:39 1.1.2.5
+++ cluster/rgmanager/src/resources/netfs.sh 2007/11/14 18:49:51 1.1.2.6
@@ -348,6 +348,112 @@
return $NO
}
+#
+# killMountProcesses mount_point
+#
+# Using lsof or fuser try to unmount the mount by killing of the processes
+# that might be keeping it busy.
+#
+killMountProcesses()
+{
+ typeset -i ret=$SUCCESS
+ typeset have_lsof=""
+ typeset have_fuser=""
+ typeset try
+
+ if [ $# -ne 1 ]; then
+ ocf_log err \
+ "Usage: killMountProcesses mount_point"
+ return $FAIL
+ fi
+
+ typeset mp=$1
+
+ ocf_log notice "Forcefully unmounting $mp"
+
+ #
+ # Not all distributions have lsof. If not use fuser. If it
+ # does, try both.
+ #
+ file=$(which lsof 2>/dev/null)
+ if [ -f "$file" ]; then
+ have_lsof=$YES
+ fi
+
+ file=$(which fuser 2>/dev/null)
+ if [ -f "$file" ]; then
+ have_fuser=$YES
+ fi
+
+ if [ -z "$have_lsof" -a -z "$have_fuser" ]; then
+ ocf_log warn \
+ "Cannot forcefully unmount $mp; cannot find lsof or fuser commands"
+ return $FAIL
+ fi
+
+ for try in 1 2 3; do
+ if [ -n "$have_lsof" ]; then
+ #
+ # Use lsof to free up mount point
+ #
+ while read command pid user
+ do
+ if [ -z "$pid" ]; then
+ continue
+ fi
+
+ if [ $try -eq 1 ]; then
+ ocf_log warn \
+ "killing process $pid ($user $command $mp)"
+ elif [ $try -eq 3 ]; then
+ ocf_log crit \
+ "Could not clean up mountpoint $mp"
+ ret=$FAIL
+ fi
+
+ if [ $try -gt 1 ]; then
+ kill -9 $pid
+ else
+ kill -TERM $pid
+ fi
+ done < <(lsof -w -bn 2>/dev/null | \
+ grep -w -E "$mp(/.*|)\$" | \
+ awk '{print $1,$2,$3}' | \
+ sort -u -k 1,3)
+ elif [ -n "$have_fuser" ]; then
+ #
+ # Use fuser to free up mount point
+ #
+ while read command pid user
+ do
+ if [ -z "$pid" ]; then
+ continue
+ fi
+
+ if [ $try -eq 1 ]; then
+ ocf_log warn \
+ "killing process $pid ($user $command $mp)"
+ elif [ $try -eq 3 ]; then
+ ocf_log crit \
+ "Could not clean up mount point $mp"
+ ret=$FAIL
+ fi
+
+ if [ $try -gt 1 ]; then
+ kill -9 $pid
+ else
+ kill -TERM $pid
+ fi
+ done < <(fuser -vm $mp | \
+ grep -v PID | \
+ sed 's;^'$mp';;' | \
+ awk '{print $4,$2,$1}' | \
+ sort -u -k 1,3)
+ fi
+ done
+
+ return $ret
+}
#
# startNFSFilesystem
@@ -498,8 +604,8 @@
#
if [ -n "$mp" ]; then
case ${OCF_RESKEY_force_unmount} in
- $YES_STR) force_umount="-f" ;;
- 0) force_umount="-f" ;;
+ $YES_STR) force_umount="$YES" ;;
+ 1) force_umount="$YES" ;;
*) force_umount="" ;;
esac
fi
@@ -507,6 +613,7 @@
#
# Unmount
#
+ while [ ! "$done" ]; do
isMounted $fullpath $mp
case $? in
$NO)
@@ -519,27 +626,47 @@
;;
$YES)
sync; sync; sync
- ocf_log info "unmounting $fullpath ($mp)"
+ ocf_log info "unmounting $mp"
- umount $force_umount $mp
+ umount $mp
if [ $? -eq 0 ]; then
- return $SUCCESS
+ umount_failed=
+ done=$YES
+ continue
fi
umount_failed=yes
+ if [ "$force_umount" ]; then
+ killMountProcesses $mp
+ fi
+
+ if [ $try -ge $max_tries ]; then
+ done=$YES
+ else
+ sleep $sleep_time
+ let try=try+1
+ fi
;;
*)
return $FAIL
;;
esac
+ if [ $try -ge $max_tries ]; then
+ done=$YES
+ else
+ sleep $sleep_time
+ let try=try+1
+ fi
+ done # while
if [ -n "$umount_failed" ]; then
ocf_log err "'umount $fullpath' failed ($mp), error=$ret_val"
return $FAIL
- fi
+ else
return $SUCCESS
+ fi
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Cluster-devel] cluster/rgmanager/src/resources netfs.sh
@ 2007-12-04 22:02 lhh
0 siblings, 0 replies; 6+ messages in thread
From: lhh @ 2007-12-04 22:02 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: lhh at sourceware.org 2007-12-04 22:02:09
Modified files:
rgmanager/src/resources: netfs.sh
Log message:
Merge force-unmount from RHEL5 branch for netfs.sh script
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/netfs.sh.diff?cvsroot=cluster&r1=1.10&r2=1.11
--- cluster/rgmanager/src/resources/netfs.sh 2007/10/03 16:40:06 1.10
+++ cluster/rgmanager/src/resources/netfs.sh 2007/12/04 22:02:09 1.11
@@ -348,6 +348,112 @@
return $NO
}
+#
+# killMountProcesses mount_point
+#
+# Using lsof or fuser try to unmount the mount by killing of the processes
+# that might be keeping it busy.
+#
+killMountProcesses()
+{
+ typeset -i ret=$SUCCESS
+ typeset have_lsof=""
+ typeset have_fuser=""
+ typeset try
+
+ if [ $# -ne 1 ]; then
+ ocf_log err \
+ "Usage: killMountProcesses mount_point"
+ return $FAIL
+ fi
+
+ typeset mp=$1
+
+ ocf_log notice "Forcefully unmounting $mp"
+
+ #
+ # Not all distributions have lsof. If not use fuser. If it
+ # does, try both.
+ #
+ file=$(which lsof 2>/dev/null)
+ if [ -f "$file" ]; then
+ have_lsof=$YES
+ fi
+
+ file=$(which fuser 2>/dev/null)
+ if [ -f "$file" ]; then
+ have_fuser=$YES
+ fi
+
+ if [ -z "$have_lsof" -a -z "$have_fuser" ]; then
+ ocf_log warn \
+ "Cannot forcefully unmount $mp; cannot find lsof or fuser commands"
+ return $FAIL
+ fi
+
+ for try in 1 2 3; do
+ if [ -n "$have_lsof" ]; then
+ #
+ # Use lsof to free up mount point
+ #
+ while read command pid user
+ do
+ if [ -z "$pid" ]; then
+ continue
+ fi
+
+ if [ $try -eq 1 ]; then
+ ocf_log warn \
+ "killing process $pid ($user $command $mp)"
+ elif [ $try -eq 3 ]; then
+ ocf_log crit \
+ "Could not clean up mountpoint $mp"
+ ret=$FAIL
+ fi
+
+ if [ $try -gt 1 ]; then
+ kill -9 $pid
+ else
+ kill -TERM $pid
+ fi
+ done < <(lsof -w -bn 2>/dev/null | \
+ grep -w -E "$mp(/.*|)\$" | \
+ awk '{print $1,$2,$3}' | \
+ sort -u -k 1,3)
+ elif [ -n "$have_fuser" ]; then
+ #
+ # Use fuser to free up mount point
+ #
+ while read command pid user
+ do
+ if [ -z "$pid" ]; then
+ continue
+ fi
+
+ if [ $try -eq 1 ]; then
+ ocf_log warn \
+ "killing process $pid ($user $command $mp)"
+ elif [ $try -eq 3 ]; then
+ ocf_log crit \
+ "Could not clean up mount point $mp"
+ ret=$FAIL
+ fi
+
+ if [ $try -gt 1 ]; then
+ kill -9 $pid
+ else
+ kill -TERM $pid
+ fi
+ done < <(fuser -vm $mp | \
+ grep -v PID | \
+ sed 's;^'$mp';;' | \
+ awk '{print $4,$2,$1}' | \
+ sort -u -k 1,3)
+ fi
+ done
+
+ return $ret
+}
#
# startNFSFilesystem
@@ -498,8 +604,8 @@
#
if [ -n "$mp" ]; then
case ${OCF_RESKEY_force_unmount} in
- $YES_STR) force_umount="-f" ;;
- 0) force_umount="-f" ;;
+ $YES_STR) force_umount="$YES" ;;
+ 1) force_umount="$YES" ;;
*) force_umount="" ;;
esac
fi
@@ -507,6 +613,7 @@
#
# Unmount
#
+ while [ ! "$done" ]; do
isMounted $fullpath $mp
case $? in
$NO)
@@ -519,26 +626,46 @@
;;
$YES)
sync; sync; sync
- ocf_log info "unmounting $fullpath ($mp)"
+ ocf_log info "unmounting $mp"
- umount $force_umount $mp
+ umount $mp
if [ $? -eq 0 ]; then
- return $SUCCESS
+ umount_failed=
+ done=$YES
+ continue
fi
umount_failed=yes
+ if [ "$force_umount" ]; then
+ killMountProcesses $mp
+ fi
+
+ if [ $try -ge $max_tries ]; then
+ done=$YES
+ else
+ sleep $sleep_time
+ let try=try+1
+ fi
;;
*)
return $FAIL
;;
esac
+ if [ $try -ge $max_tries ]; then
+ done=$YES
+ else
+ sleep $sleep_time
+ let try=try+1
+ fi
+ done # while
if [ -n "$umount_failed" ]; then
ocf_log err "'umount $fullpath' failed ($mp), error=$ret_val"
return $FAIL
fi
+
return $SUCCESS
}
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-12-04 22:02 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-03 16:44 [Cluster-devel] cluster/rgmanager/src/resources netfs.sh mgrac
-- strict thread matches above, loose matches on Subject: below --
2007-12-04 22:02 lhh
2007-11-14 18:49 lhh
2007-10-03 17:01 lhh
2007-10-03 16:40 mgrac
2006-09-14 13:54 mgrac
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).