From 8a36ef759c422205d282e2f5543e8a76b00eb847 Mon Sep 17 00:00:00 2001 From: Ryan Mitchell <rmitchel@redhat.com> Date: Thu, 7 Apr 2011 09:55:36 -0400 Subject: [PATCH] rgmanager: Fix quotaoff handling This is a simple port from the RHEL4 branch performed by Ryan Mitchell. Resolves: rhbz#637678 Signed-off-by: Lon Hohberger <lhh@redhat.com> --- rgmanager/src/resources/fs.sh | 49 ++++++++++++++++++++++++++++++----------- 1 files changed, 36 insertions(+), 13 deletions(-) diff --git a/rgmanager/src/resources/fs.sh b/rgmanager/src/resources/fs.sh index ce3e983..49912c2 100755 --- a/rgmanager/src/resources/fs.sh +++ b/rgmanager/src/resources/fs.sh @@ -699,19 +699,11 @@ isAlive() # Decide which quota options are enabled and return a string # which we can pass to quotaon # -enable_fs_quotas() +quota_opts() { - declare -i need_check=0 - declare -i rv declare quotaopts="" - declare mopt declare opts=$1 - declare mp=$2 - - if [ -z "`which quotaon`" ]; then - ocf_log err "quotaon not found in $PATH" - return $OCF_ERR_GENERIC - fi + declare mopt for mopt in `echo $opts | sed -e s/,/\ /g`; do case $mopt in @@ -730,6 +722,33 @@ enable_fs_quotas() esac done + echo $quotaopts + return 0 +} + + + +# +# Enable quotas on the mount point if the user requested them +# +enable_fs_quotas() +{ + declare -i need_check=0 + declare -i rv + declare quotaopts="" + declare mopt + declare opts=$1 + declare mp=$2 + + if [ -z "`which quotaon`" ]; then + ocf_log err "quotaon not found in $PATH" + return $OCF_ERR_GENERIC + fi + + quotaopts=$(quota_opts $opts) + + ocf_log info "quotaopts = $quotaopts" + [ -z "$quotaopts" ] && return 0 # Ok, create quota files if they don't exist @@ -991,6 +1010,7 @@ stopFilesystem() { typeset force_umount="" typeset self_fence="" typeset fstype="" + typeset quotaopts="" # @@ -1057,10 +1077,13 @@ stop: Could not match $OCF_RESKEY_device with a real device" ;; $YES) sync; sync; sync - ocf_log info "unmounting $mp" - + quotaopts=$(quota_opts $OCF_RESKEY_options) + if [ -n "$quotaopts" ]; then + ocf_log debug "Turning off quotas for $mp" + quotaoff -$quotaopts $mp &> /dev/null + fi - quotaoff -gu $mp &> /dev/null + ocf_log info "unmounting $mp" umount $mp if [ $? -eq 0 ]; then umount_failed= -- 1.7.3.4