Gitweb: http://git.fedorahosted.org/git/resource-agents.git?p=resource-agents.git;a…
Commit: 53c9f50ebe210a63c74f11184d3023992ed88f31
Parent: e642cd87a7cc5455b398b017a33455decd77bbbb
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Tue Apr 20 18:52:05 2010 -0400
Committer: Fabio M. Di Nitto <fdinitto(a)redhat.com>
CommitterDate: Tue Jul 6 05:39:49 2010 +0200
rgmanager: Minor cleanups for file system agents
- don't double-check if the mount point exists; once
is enough
- report an error if creation of the mount point fails
Resolves: rhbz#581533
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/src/resources/clusterfs.sh | 22 +++++++---------------
rgmanager/src/resources/fs.sh.in | 20 ++++++--------------
rgmanager/src/resources/netfs.sh | 8 +++++++-
3 files changed, 20 insertions(+), 30 deletions(-)
diff --git a/rgmanager/src/resources/clusterfs.sh b/rgmanager/src/resources/clusterfs.sh
index bb0acfd..f90f865 100644
--- a/rgmanager/src/resources/clusterfs.sh
+++ b/rgmanager/src/resources/clusterfs.sh
@@ -534,7 +534,13 @@ startFilesystem: Mount point $mp exists but is not a directory"
else
ocf_log info "\
startFilesystem: Creating mount point $mp for device $dev"
- mkdir -p $mp
+ mkdir -p "$mp"
+ ret_val=$?
+ if [ $ret_val -ne 0 ]; then
+ ocf_log err "\
+startFilesystem: Unable to create $mp. Error code: $ret_val"
+ return $OCF_ERR_GENERIC
+ fi
fi
#
@@ -593,20 +599,6 @@ Cannot mount $dev on $mp, the device or mount point is already in use!"
esac
#
- # Make sure the mount point exists.
- #
- if [ ! -d $mp ]; then
- rm -f $mp # rm in case its a plain file
- mkdir -p $mp # create the mount point
- ret_val=$?
- if [ $ret_val -ne 0 ]; then
- ocf_log err \
- "'mkdir -p $mp' failed, error=$ret_val"
- return $FAIL
- fi
- fi
-
- #
# Get the mount options, if they exist.
#
mount_options=""
diff --git a/rgmanager/src/resources/fs.sh.in b/rgmanager/src/resources/fs.sh.in
index 5a6348b..ffa721f 100644
--- a/rgmanager/src/resources/fs.sh.in
+++ b/rgmanager/src/resources/fs.sh.in
@@ -816,6 +816,12 @@ startFilesystem: Mount point $mp exists but is not a directory"
ocf_log err "\
startFilesystem: Creating mount point $mp for device $dev"
mkdir -p "$mp"
+ ret_val=$?
+ if [ $ret_val -ne 0 ]; then
+ ocf_log err "\
+startFilesystem: Unable to create $mp. Error code: $ret_val"
+ return $OCF_ERR_GENERIC
+ fi
fi
#
@@ -874,20 +880,6 @@ Cannot mount $dev on $mp, the device or mount point is already in use!"
esac
#
- # Make sure the mount point exists.
- #
- if [ ! -d $mp ]; then
- rm -f $mp # rm in case its a plain file
- mkdir -p $mp # create the mount point
- ret_val=$?
- if [ $ret_val -ne 0 ]; then
- ocf_log err \
- "'mkdir -p $mp' failed, error=$ret_val"
- return $FAIL
- fi
- fi
-
- #
# Get the mount options, if they exist.
#
mount_options=""
diff --git a/rgmanager/src/resources/netfs.sh b/rgmanager/src/resources/netfs.sh
index b85027a..bb749f7 100644
--- a/rgmanager/src/resources/netfs.sh
+++ b/rgmanager/src/resources/netfs.sh
@@ -386,7 +386,13 @@ startFilesystem: Mount point $mp exists but is not a directory"
else
ocf_log info "\
startFilesystem: Creating mount point $mp for $fullpath"
- mkdir -p $mp
+ mkdir -p "$mp"
+ ret_val=$?
+ if [ $ret_val -ne 0 ]; then
+ ocf_log err "\
+startFilesystem: Unable to create $mp. Error code: $ret_val"
+ return $OCF_ERR_GENERIC
+ fi
fi
#
Gitweb: http://git.fedorahosted.org/git/resource-agents.git?p=resource-agents.git;a…
Commit: e642cd87a7cc5455b398b017a33455decd77bbbb
Parent: bf1e803698e490caeb7d9b2db66021e577d89f45
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Mon Apr 19 16:51:42 2010 -0400
Committer: Fabio M. Di Nitto <fdinitto(a)redhat.com>
CommitterDate: Tue Jul 6 05:39:33 2010 +0200
rgmanager: Allow spaces in fs.sh mount points
Resolves: rhbz#582573
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/src/resources/fs.sh.in | 32 ++++++++++++++++----------------
1 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/rgmanager/src/resources/fs.sh.in b/rgmanager/src/resources/fs.sh.in
index adc66e3..5a6348b 100644
--- a/rgmanager/src/resources/fs.sh.in
+++ b/rgmanager/src/resources/fs.sh.in
@@ -747,12 +747,12 @@ enable_fs_quotas()
if [ $need_check -eq 1 ]; then
ocf_log info "Checking quota info in $mp"
- quotacheck -$quotaopts $mp
+ quotacheck -$quotaopts "$mp"
fi
ocf_log info "Enabling Quotas on $mp"
- ocf_log debug "quotaon -$quotaopts $mp"
- quotaon -$quotaopts $mp
+ ocf_log debug "quotaon -$quotaopts \"$mp\""
+ quotaon -$quotaopts "$mp"
rv=$?
if [ $rv -ne 0 ]; then
# Just a warning
@@ -815,7 +815,7 @@ startFilesystem: Mount point $mp exists but is not a directory"
else
ocf_log err "\
startFilesystem: Creating mount point $mp for device $dev"
- mkdir -p $mp
+ mkdir -p "$mp"
fi
#
@@ -835,7 +835,7 @@ startFilesystem: Creating mount point $mp for device $dev"
#
# See if the device is already mounted.
#
- isMounted $dev $mp
+ isMounted $dev "$mp"
case $? in
$YES) # already mounted
ocf_log debug "$dev already mounted"
@@ -855,7 +855,7 @@ startFilesystem: Creating mount point $mp for device $dev"
# function checks to see if either the device or mount point are in
# use somewhere else on the system.
#
- mountInUse $dev $mp
+ mountInUse $dev "$mp"
case $? in
$YES) # uh oh, someone is using the device or mount point
ocf_log err "\
@@ -954,7 +954,7 @@ Unknown file system type '$fstype' for device $dev. Assuming fsck is required."
#
ocf_log info "mounting $dev on $mp"
ocf_log debug "mount $fstype_option $mount_options $dev $mp"
- mount $fstype_option $mount_options $dev $mp
+ mount $fstype_option $mount_options $dev "$mp"
ret_val=$?
if [ $ret_val -ne 0 ]; then
ocf_log err "\
@@ -968,12 +968,12 @@ Unknown file system type '$fstype' for device $dev. Assuming fsck is required."
if [ $NFS_TRICKS -eq 0 ]; then
if [ "$OCF_RESKEY_nfslock" = "yes" ] || \
[ "$OCF_RESKEY_nfslock" = "1" ]; then
- mkdir -p $mp/.clumanager/statd
- notify_list_merge $mp/.clumanager/statd
+ mkdir -p "$mp"/.clumanager/statd
+ notify_list_merge "$mp"/.clumanager/statd
fi
fi
- enable_fs_quotas $opts $mp
+ enable_fs_quotas $opts "$mp"
return $SUCCESS
}
@@ -1050,7 +1050,7 @@ stop: Could not match $OCF_RESKEY_device with a real device"
# Unmount the device.
#
while [ ! "$done" ]; do
- isMounted $dev $mp
+ isMounted $dev "$mp"
case $? in
$NO)
ocf_log info "$dev is not mounted"
@@ -1065,12 +1065,12 @@ stop: Could not match $OCF_RESKEY_device with a real device"
quotaopts=$(quota_opts $OCF_RESKEY_options)
if [ -n "$quotaopts" ]; then
ocf_log debug "Turning off quotas for $mp"
- quotaoff -$quotaopts $mp &> /dev/null
+ quotaoff -$quotaopts "$mp" &> /dev/null
fi
ocf_log info "unmounting $mp"
- umount $mp
+ umount "$mp"
if [ $? -eq 0 ]; then
umount_failed=
done=$YES
@@ -1088,10 +1088,10 @@ stop: Could not match $OCF_RESKEY_device with a real device"
ocf_log warning \
"Dropping node-wide NFS locks"
pkill -KILL -x lockd
- mkdir -p $mp/.clumanager/statd
+ mkdir -p "$mp"/.clumanager/statd
# Copy out the notify list; our
# IPs are already torn down
- notify_list_store $mp/.clumanager/statd
+ notify_list_store "$mp"/.clumanager/statd
nfslock_reclaim=1
fi
else
@@ -1115,7 +1115,7 @@ stop: Could not match $OCF_RESKEY_device with a real device"
if [ $nfslock_reclaim -eq 1 ]; then
# If we have this flag set, do a full reclaim broadcast
- notify_list_broadcast $mp/.clumanager/statd
+ notify_list_broadcast "$mp"/.clumanager/statd
fi
if [ -n "$umount_failed" ]; then
Gitweb: http://git.fedorahosted.org/git/resource-agents.git?p=resource-agents.git;a…
Commit: bf1e803698e490caeb7d9b2db66021e577d89f45
Parent: e152ed4b6d86f4fb558c1cebe2cd51097b8b2543
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Wed Apr 14 17:29:54 2010 -0400
Committer: Fabio M. Di Nitto <fdinitto(a)redhat.com>
CommitterDate: Tue Jul 6 05:39:09 2010 +0200
rgmanager: Kill processes correctly w/ force_unmount
The killMountProcesses function was written about 10 years ago.
It was designed to work with lsof or fuser, and to log messages
for each process killed. This is not a bad idea. The problem
is that parsing the output of either is and error-prone,
particularly when mountpoints are similar to other directories
on the system.
A far less error-prone method to cleaning up a mount point is to
use 'fuser -kvm' on it. Not only is this less error-prone, it's
a good bit faster at doing its job than iterating through output
in a shell script.
This patch makes force_unmount very reliable at killing the correct
processes, but we lose the logging functionality. It is a fair
trade-off because there have been several bugs in the
killMountProcesses function over the years which have caused several
problems.
Resolves: bz555901 bz582754
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/src/resources/clusterfs.sh | 113 ++----------------------------
rgmanager/src/resources/fs.sh.in | 121 ++------------------------------
rgmanager/src/resources/netfs.sh | 128 ++++------------------------------
3 files changed, 23 insertions(+), 339 deletions(-)
diff --git a/rgmanager/src/resources/clusterfs.sh b/rgmanager/src/resources/clusterfs.sh
index 0ccc93d..bb0acfd 100644
--- a/rgmanager/src/resources/clusterfs.sh
+++ b/rgmanager/src/resources/clusterfs.sh
@@ -484,113 +484,6 @@ isAlive()
#
-# killMountProcesses device 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 -b 2>/dev/null | \
- grep -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 2>&1 | \
- grep -v PID | \
- sed 's;^'$mp:';;' | \
- awk '{print $4,$2,$1}' | \
- sort -u -k 1,3)
- fi
- done
-
- return $ret
-}
-
-#
# startFilesystem
#
startFilesystem() {
@@ -871,7 +764,11 @@ stop: Could not match $OCF_RESKEY_device with a real device"
umount_failed=yes
if [ "$force_umount" ]; then
- killMountProcesses $mp
+ if [ $try -eq 1 ]; then
+ fuser -TERM -kvm "$mp"
+ else
+ fuser -kvm "$mp"
+ fi
fi
if [ $try -ge $max_tries ]; then
diff --git a/rgmanager/src/resources/fs.sh.in b/rgmanager/src/resources/fs.sh.in
index 1454295..adc66e3 100644
--- a/rgmanager/src/resources/fs.sh.in
+++ b/rgmanager/src/resources/fs.sh.in
@@ -680,114 +680,6 @@ isAlive()
#
-# 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 -bn 2>/dev/null | \
- grep -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 2>&1 | \
- grep -v PID | \
- sed 's;^'$mp:';;' | \
- awk '{print $4,$2,$1}' | \
- sort -u -k 1,3)
- fi
- done
-
- return $ret
-}
-
-
-#
# Decide which quota options are enabled and return a string
# which we can pass to quotaon
#
@@ -1188,8 +1080,9 @@ stop: Could not match $OCF_RESKEY_device with a real device"
umount_failed=yes
if [ "$force_umount" ]; then
- killMountProcesses $mp
if [ $try -eq 1 ]; then
+ fuser -TERM -kvm "$mp"
+
if [ "$OCF_RESKEY_nfslock" = "yes" ] || \
[ "$OCF_RESKEY_nfslock" = "1" ]; then
ocf_log warning \
@@ -1201,15 +1094,11 @@ stop: Could not match $OCF_RESKEY_device with a real device"
notify_list_store $mp/.clumanager/statd
nfslock_reclaim=1
fi
+ else
+ fuser -kvm "$mp"
fi
fi
- if [ $try -ge $max_tries ]; then
- done=$YES
- else
- sleep $sleep_time
- let try=try+1
- fi
;;
*)
return $FAIL
@@ -1218,7 +1107,7 @@ stop: Could not match $OCF_RESKEY_device with a real device"
if [ $try -ge $max_tries ]; then
done=$YES
- elif [ "$done" -ne "$YES" ]; then
+ elif [ "$done" != "$YES" ]; then
sleep $sleep_time
let try=try+1
fi
diff --git a/rgmanager/src/resources/netfs.sh b/rgmanager/src/resources/netfs.sh
index 24b89ec..b85027a 100644
--- a/rgmanager/src/resources/netfs.sh
+++ b/rgmanager/src/resources/netfs.sh
@@ -339,113 +339,6 @@ isMounted () {
}
#
-# 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 2>&1 | \
- grep -v PID | \
- sed 's;^'$mp:';;' | \
- awk '{print $4,$2,$1}' | \
- sort -u -k 1,3)
- fi
- done
-
- return $ret
-}
-
-#
# startNFSFilesystem
#
startNFSFilesystem() {
@@ -639,15 +532,20 @@ stopNFSFilesystem() {
umount_failed=yes
- if [ "$force_umount" ]; then
- killMountProcesses $mp
- fi
+ if [ "$force_umount" ]; then
+ if [ $try -eq 1 ]; then
+ fuser -TERM -kvm "$mp"
+ else
+ fuser -kvm "$mp"
+ fi
+ fi
- if [ $try -ge $max_tries ]; then
- done=$YES
- else
- sleep $sleep_time
- let try=try+1
+
+ if [ $try -ge $max_tries ]; then
+ done=$YES
+ else
+ sleep $sleep_time
+ let try=try+1
fi
;;
*)
Gitweb: http://git.fedorahosted.org/git/resource-agents.git?p=resource-agents.git;a…
Commit: 0c2fba3fc8c100a3aaf32e383a8954ae87916e06
Parent: 3e0c47b36f6f8e7cf3e590490213e907055669c3
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Mon Mar 1 16:17:17 2010 -0500
Committer: Fabio M. Di Nitto <fdinitto(a)redhat.com>
CommitterDate: Tue Jul 6 05:38:30 2010 +0200
resource-agents: Clear vm.sh default
The default behavior of vm.sh is to use_virsh whenever
possible. The problem with specifying a default in the
RA metadata is that it causes rgmanager to provide a
value to the RA when it is called. In this case, rgmanager
was providing "1" as the default, meaning that the logic
which carefully determines whether to use 'xm' or 'virsh'
is disabled.
This is not seen when testing the resource agent by
hand; it is only seen when called in the context of
rgmanager or rg_test.
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/src/resources/vm.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/rgmanager/src/resources/vm.sh b/rgmanager/src/resources/vm.sh
index 3ec8b87..09f3f6e 100644
--- a/rgmanager/src/resources/vm.sh
+++ b/rgmanager/src/resources/vm.sh
@@ -128,7 +128,7 @@ meta_data()
virtual machines instead of xm. This is required when
using non-Xen virtual machines (e.g. qemu / KVM).
</shortdesc>
- <content type="integer" default="1"/>
+ <content type="integer" default=""/>
</parameter>
<parameter name="xmlfile">
Gitweb: http://git.fedorahosted.org/git/resource-agents.git?p=resource-agents.git;a…
Commit: 3e0c47b36f6f8e7cf3e590490213e907055669c3
Parent: f3a2fe8271161bad2975d355635e14dc3eb17755
Author: Shane Bradley <sbradley(a)redhat.com>
AuthorDate: Mon Feb 15 16:16:55 2010 -0500
Committer: Fabio M. Di Nitto <fdinitto(a)redhat.com>
CommitterDate: Tue Jul 6 05:38:08 2010 +0200
resource-agents: Kill correct PIDs during force_unmount
When stopping a service that contains a filesystem resource that is
managed by fs.sh, on a stop operation it can kill a process that is
not located on that mount point.
There was a couple of scenarios that would kill a process that was
not on that mount point when it was stopped:
These processes should not have been killed:
$ less /tmp/media/demo1/tmp.txt
$ less /tmp/test\ /media/demo1/tmp.txt
These processes was and should have been killed:
$ less /media/demo1/tmp.txt
Resolves: rhbz#555901
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/src/resources/fs.sh.in | 27 ++++++++++++++-------------
1 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/rgmanager/src/resources/fs.sh.in b/rgmanager/src/resources/fs.sh.in
index 1454295..b037796 100644
--- a/rgmanager/src/resources/fs.sh.in
+++ b/rgmanager/src/resources/fs.sh.in
@@ -691,6 +691,7 @@ killMountProcesses()
typeset have_lsof=""
typeset have_fuser=""
typeset try
+ typeset command pid user line
if [ $# -ne 1 ]; then
ocf_log err \
@@ -727,30 +728,30 @@ killMountProcesses()
#
# Use lsof to free up mount point
#
- while read command pid user
+ while read line
do
- if [ -z "$pid" ]; then
+ path=$(echo $line | awk '{for (i=9;i<NF+1;i++) {printf "%s ",$i};}')
+ #if [ -z $(echo $path | grep -E "$mp(/| |$)") ]
+ if [ -z $(echo $path | grep -E "^$mp/.*") ]; then
continue
fi
-
+ command=$(echo $line | awk '{print $1}')
+ pid=$(echo $line | awk '{print $2}')
+ user=$(echo $line | awk '{print $3}')
if [ $try -eq 1 ]; then
- ocf_log warn \
- "killing process $pid ($user $command $mp)"
+ 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
+ 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 -bn 2>/dev/null | \
- grep -E " $mp(/| |$)" | \
- awk '{print $1,$2,$3}' | \
- sort -u -k 1,3)
+ done< <(lsof -bn 2>/dev/null | \
+ grep -E " $mp(/| |$)" | \
+ sort -u -k 1,3)
elif [ -n "$have_fuser" ]; then
#
# Use fuser to free up mount point
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=f9…
Commit: f917674f6d7d75547105e036524157d32ac9929d
Parent: 2d62c9fb0363b137d6d48ac6f8adc6104c81a666
Author: Christine Caulfield <ccaulfie(a)redhat.com>
AuthorDate: Mon Jul 5 15:03:36 2010 +0100
Committer: Christine Caulfield <ccaulfie(a)redhat.com>
CommitterDate: Mon Jul 5 15:03:36 2010 +0100
cman: Mention cman_tool version -S in man page
rhbz#609978
Signed-off-by: Christine Caulfield <ccaulfie(a)redhat.com>
---
cman/man/cman_tool.8 | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/cman/man/cman_tool.8 b/cman/man/cman_tool.8
index d45e9e9..2ee2524 100644
--- a/cman/man/cman_tool.8
+++ b/cman/man/cman_tool.8
@@ -153,6 +153,13 @@ cman_tool version -r.
.TP
.I -D<option>
see "JOIN" options
+.TP
+.I -S
+By default cman_tool version will try to distribute the new cluster.conf file using
+ricci. If you have distributed the file yourself and/or do not have ricci
+installed then the -S option will skip this step.
+NOTE: it is still important that all nodes in the cluster have the same version of
+the file. Make sure that this is the case before using this option.
.SH "WAIT" OPTIONS
.TP
.I -q