From: Fabio M. Di NItto <fabbione@fabbione.net>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] rgmanager: Fix CIFS mount handling in netfs.sh
Date: Wed, 27 Oct 2010 06:41:18 +0200 [thread overview]
Message-ID: <4CC7AD6E.8050203@fabbione.net> (raw)
In-Reply-To: <1288124979-16682-1-git-send-email-lhh@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
prev parent reply other threads:[~2010-10-27 4:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4CC7AD6E.8050203@fabbione.net \
--to=fabbione@fabbione.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.