* [Cluster-devel] [PATCH] rgmanager: Fix CIFS mount handling in netfs.sh
@ 2010-10-26 20:29 Lon Hohberger
2010-10-26 20:32 ` Lon Hohberger
2010-10-27 4:41 ` Fabio M. Di NItto
0 siblings, 2 replies; 3+ messages in thread
From: Lon Hohberger @ 2010-10-26 20:29 UTC (permalink / raw)
To: cluster-devel.redhat.com
Portions based on a patch by Eduardo Alvarenga.
Resolves: rhbz#640676
Signed-off-by: Lon Hohberger <lhh@redhat.com>
---
rgmanager/src/resources/netfs.sh | 135 +++++++++++++++++++++-----------------
1 files changed, 76 insertions(+), 59 deletions(-)
diff --git a/rgmanager/src/resources/netfs.sh b/rgmanager/src/resources/netfs.sh
index 2cc6863..1a669d3 100755
--- a/rgmanager/src/resources/netfs.sh
+++ b/rgmanager/src/resources/netfs.sh
@@ -196,7 +196,7 @@ verify_mountpoint()
[ -d "$OCF_RESKEY_mountpoint" ] && return 0
ocf_log err "$OCF_RESKEY_mountpoint is not a directory"
-
+
return 1
}
@@ -392,7 +392,14 @@ startNFSFilesystem() {
host=${OCF_RESKEY_host}
exp=${OCF_RESKEY_export}
- fullpath=$host:$exp
+ case $OCF_RESKEY_fstype in
+ cifs)
+ fullpath="//$host/$exp"
+ ;;
+ *)
+ fullpath=$host:$exp
+ ;;
+ esac
#
# Ensure we've got a valid directory
@@ -445,12 +452,12 @@ startFilesystem: Creating mount point $mp for $fullpath"
ocf_log debug "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
- ;;
+ cifs)
+ mount -t $OCF_RESKEY_fstype $mount_options //$host/$exp $mp
+ ;;
+ *) # nfs/nfs4
+ mount -t $OCF_RESKEY_fstype $mount_options $host:$exp $mp
+ ;;
esac
ret_val=$?
@@ -459,7 +466,7 @@ startFilesystem: Creating mount point $mp for $fullpath"
'mount $fstype_option $mount_options $fullpath $mp' failed, error=$ret_val"
return $FAIL
fi
-
+
return $SUCCESS
}
@@ -497,11 +504,19 @@ stopNFSFilesystem() {
return $FAIL
;;
esac
-
+
#
# Get the host/path
#
- fullpath="${OCF_RESKEY_host}:${OCF_RESKEY_export}"
+ case $OCF_RESKEY_fstype in
+ cifs)
+ fullpath="//${OCF_RESKEY_host}/${OCF_RESKEY_export}"
+ ;;
+ *) # nfs / nfs4
+ fullpath="${OCF_RESKEY_host}:${OCF_RESKEY_export}"
+ ;;
+ esac
+
#
# Get the force unmount setting if there is a mount point.
@@ -517,61 +532,54 @@ stopNFSFilesystem() {
#
# Unmount
#
- while [ ! "$done" ]; do
- isMounted $fullpath $mp
- case $? in
- $NO)
- ocf_log debug "$fullpath is not mounted"
- umount_failed=
- done=$YES
- ;;
- $FAIL)
- return $FAIL
- ;;
- $YES)
- case ${OCF_RESKEY_no_unmount} in
- $YES_STR) no_umount="$YES" ;;
- 1) no_umount="$YES" ;;
- *) no_umount="" ;;
- esac
-
- if [ "$no_umount" ]; then
- ocf_log info "skipping unmount operation of $mp"
- return $SUCCESS
- fi
+ while [ ! "$done" ]; do
+ isMounted $fullpath $mp
+ case $? in
+ $NO)
+ ocf_log debug "$fullpath is not mounted"
+ umount_failed=
+ done=$YES
+ ;;
+ $FAIL)
+ return $FAIL
+ ;;
+ $YES)
+ case ${OCF_RESKEY_no_unmount} in
+ $YES_STR) no_umount="$YES" ;;
+ 1) no_umount="$YES" ;;
+ *) no_umount="" ;;
+ esac
- sync; sync; sync
- ocf_log info "unmounting $mp"
+ if [ "$no_umount" ]; then
+ ocf_log info "skipping unmount operation of $mp"
+ return $SUCCESS
+ fi
+
+ sync; sync; sync
+ ocf_log info "unmounting $mp"
umount $mp
- if [ $? -eq 0 ]; then
+ if [ $? -eq 0 ]; then
umount_failed=
done=$YES
continue
- fi
+ fi
- umount_failed=yes
+ umount_failed=yes
- if [ "$force_umount" ]; then
- if [ $try -eq 1 ]; then
- fuser -TERM -kvm "$mp"
- else
- fuser -kvm "$mp"
+ if [ "$force_umount" ]; then
+ if [ $try -eq 1 ]; then
+ fuser -TERM -kvm "$mp"
+ else
+ fuser -kvm "$mp"
+ fi
fi
- fi
-
- if [ $try -ge $max_tries ]; then
- done=$YES
- else
- sleep $sleep_time
- let try=try+1
- fi
- ;;
- *)
- return $FAIL
- ;;
- esac
+ ;;
+ *)
+ return $FAIL
+ ;;
+ esac
if [ $try -ge $max_tries ]; then
done=$YES
@@ -580,9 +588,9 @@ stopNFSFilesystem() {
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
@@ -618,9 +626,18 @@ stop)
exit $?
;;
status|monitor)
- isMounted ${OCF_RESKEY_host}:${OCF_RESKEY_export} \
+ case $OCF_RESKEY_fstype in
+ cifs)
+ isMounted //${OCF_RESKEY_host}/${OCF_RESKEY_export} \
${OCF_RESKEY_mountpoint}
- exit $?
+ exit $?
+ ;;
+ *) # nfs/nfs4
+ isMounted ${OCF_RESKEY_host}:${OCF_RESKEY_export} \
+ ${OCF_RESKEY_mountpoint}
+ exit $?
+ ;;
+ esac
;;
restart)
stopNFSFilesystem
--
1.7.2.3
^ permalink raw reply related [flat|nested] 3+ messages in thread* [Cluster-devel] [PATCH] rgmanager: Fix CIFS mount handling in netfs.sh
2010-10-26 20:29 [Cluster-devel] [PATCH] rgmanager: Fix CIFS mount handling in netfs.sh Lon Hohberger
@ 2010-10-26 20:32 ` Lon Hohberger
2010-10-27 4:41 ` Fabio M. Di NItto
1 sibling, 0 replies; 3+ messages in thread
From: Lon Hohberger @ 2010-10-26 20:32 UTC (permalink / raw)
To: cluster-devel.redhat.com
NOTES:
* This patch is only for the RHEL56 branch; it will not work on any
other branches, and is not needed on STABLE3 or STABLE31 of the cluster
git repository nor in the resource-agents git repository.
* Spaces in export names or mount points do not work; it is unlikely
this will be fixed.
-- Lon
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Cluster-devel] [PATCH] rgmanager: Fix CIFS mount handling in netfs.sh
2010-10-26 20:29 [Cluster-devel] [PATCH] rgmanager: Fix CIFS mount handling in netfs.sh Lon Hohberger
2010-10-26 20:32 ` Lon Hohberger
@ 2010-10-27 4:41 ` Fabio M. Di NItto
1 sibling, 0 replies; 3+ messages in thread
From: Fabio M. Di NItto @ 2010-10-27 4:41 UTC (permalink / raw)
To: cluster-devel.redhat.com
Patch looks sane to me (untested)
ACK
Fabio
On 10/26/2010 10:29 PM, Lon Hohberger wrote:
> Portions based on a patch by Eduardo Alvarenga.
>
> Resolves: rhbz#640676
>
> Signed-off-by: Lon Hohberger <lhh@redhat.com>
> ---
> rgmanager/src/resources/netfs.sh | 135 +++++++++++++++++++++-----------------
> 1 files changed, 76 insertions(+), 59 deletions(-)
>
> diff --git a/rgmanager/src/resources/netfs.sh b/rgmanager/src/resources/netfs.sh
> index 2cc6863..1a669d3 100755
> --- a/rgmanager/src/resources/netfs.sh
> +++ b/rgmanager/src/resources/netfs.sh
> @@ -196,7 +196,7 @@ verify_mountpoint()
> [ -d "$OCF_RESKEY_mountpoint" ] && return 0
>
> ocf_log err "$OCF_RESKEY_mountpoint is not a directory"
> -
> +
> return 1
> }
>
> @@ -392,7 +392,14 @@ startNFSFilesystem() {
> host=${OCF_RESKEY_host}
> exp=${OCF_RESKEY_export}
>
> - fullpath=$host:$exp
> + case $OCF_RESKEY_fstype in
> + cifs)
> + fullpath="//$host/$exp"
> + ;;
> + *)
> + fullpath=$host:$exp
> + ;;
> + esac
>
> #
> # Ensure we've got a valid directory
> @@ -445,12 +452,12 @@ startFilesystem: Creating mount point $mp for $fullpath"
> ocf_log debug "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
> - ;;
> + cifs)
> + mount -t $OCF_RESKEY_fstype $mount_options //$host/$exp $mp
> + ;;
> + *) # nfs/nfs4
> + mount -t $OCF_RESKEY_fstype $mount_options $host:$exp $mp
> + ;;
> esac
>
> ret_val=$?
> @@ -459,7 +466,7 @@ startFilesystem: Creating mount point $mp for $fullpath"
> 'mount $fstype_option $mount_options $fullpath $mp' failed, error=$ret_val"
> return $FAIL
> fi
> -
> +
> return $SUCCESS
> }
>
> @@ -497,11 +504,19 @@ stopNFSFilesystem() {
> return $FAIL
> ;;
> esac
> -
> +
> #
> # Get the host/path
> #
> - fullpath="${OCF_RESKEY_host}:${OCF_RESKEY_export}"
> + case $OCF_RESKEY_fstype in
> + cifs)
> + fullpath="//${OCF_RESKEY_host}/${OCF_RESKEY_export}"
> + ;;
> + *) # nfs / nfs4
> + fullpath="${OCF_RESKEY_host}:${OCF_RESKEY_export}"
> + ;;
> + esac
> +
>
> #
> # Get the force unmount setting if there is a mount point.
> @@ -517,61 +532,54 @@ stopNFSFilesystem() {
> #
> # Unmount
> #
> - while [ ! "$done" ]; do
> - isMounted $fullpath $mp
> - case $? in
> - $NO)
> - ocf_log debug "$fullpath is not mounted"
> - umount_failed=
> - done=$YES
> - ;;
> - $FAIL)
> - return $FAIL
> - ;;
> - $YES)
> - case ${OCF_RESKEY_no_unmount} in
> - $YES_STR) no_umount="$YES" ;;
> - 1) no_umount="$YES" ;;
> - *) no_umount="" ;;
> - esac
> -
> - if [ "$no_umount" ]; then
> - ocf_log info "skipping unmount operation of $mp"
> - return $SUCCESS
> - fi
> + while [ ! "$done" ]; do
> + isMounted $fullpath $mp
> + case $? in
> + $NO)
> + ocf_log debug "$fullpath is not mounted"
> + umount_failed=
> + done=$YES
> + ;;
> + $FAIL)
> + return $FAIL
> + ;;
> + $YES)
> + case ${OCF_RESKEY_no_unmount} in
> + $YES_STR) no_umount="$YES" ;;
> + 1) no_umount="$YES" ;;
> + *) no_umount="" ;;
> + esac
>
> - sync; sync; sync
> - ocf_log info "unmounting $mp"
> + if [ "$no_umount" ]; then
> + ocf_log info "skipping unmount operation of $mp"
> + return $SUCCESS
> + fi
> +
> + sync; sync; sync
> + ocf_log info "unmounting $mp"
>
> umount $mp
> - if [ $? -eq 0 ]; then
> + if [ $? -eq 0 ]; then
> umount_failed=
> done=$YES
> continue
> - fi
> + fi
>
> - umount_failed=yes
> + umount_failed=yes
>
> - if [ "$force_umount" ]; then
> - if [ $try -eq 1 ]; then
> - fuser -TERM -kvm "$mp"
> - else
> - fuser -kvm "$mp"
> + if [ "$force_umount" ]; then
> + if [ $try -eq 1 ]; then
> + fuser -TERM -kvm "$mp"
> + else
> + fuser -kvm "$mp"
> + fi
> fi
> - fi
> -
>
> - if [ $try -ge $max_tries ]; then
> - done=$YES
> - else
> - sleep $sleep_time
> - let try=try+1
> - fi
> - ;;
> - *)
> - return $FAIL
> - ;;
> - esac
> + ;;
> + *)
> + return $FAIL
> + ;;
> + esac
>
> if [ $try -ge $max_tries ]; then
> done=$YES
> @@ -580,9 +588,9 @@ stopNFSFilesystem() {
> 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
>
> @@ -618,9 +626,18 @@ stop)
> exit $?
> ;;
> status|monitor)
> - isMounted ${OCF_RESKEY_host}:${OCF_RESKEY_export} \
> + case $OCF_RESKEY_fstype in
> + cifs)
> + isMounted //${OCF_RESKEY_host}/${OCF_RESKEY_export} \
> ${OCF_RESKEY_mountpoint}
> - exit $?
> + exit $?
> + ;;
> + *) # nfs/nfs4
> + isMounted ${OCF_RESKEY_host}:${OCF_RESKEY_export} \
> + ${OCF_RESKEY_mountpoint}
> + exit $?
> + ;;
> + esac
> ;;
> restart)
> stopNFSFilesystem
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-10-27 4:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-26 20:29 [Cluster-devel] [PATCH] rgmanager: Fix CIFS mount handling in netfs.sh Lon Hohberger
2010-10-26 20:32 ` Lon Hohberger
2010-10-27 4:41 ` Fabio M. Di NItto
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.