Skip to content

Medium: Filesystem: faster stop procedure when large number of proces… #1042

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion heartbeat/Filesystem
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ get_pids()
signal_processes() {
local dir=$1
local sig=$2
local pids pid
local pids pid pidcnt
# fuser returns a non-zero return code if none of the
# specified files is accessed or in case of a fatal
# error.
Expand All @@ -492,6 +492,12 @@ signal_processes() {
ocf_log info "No processes on $dir were signalled. force_unmount is set to '$FORCE_UNMOUNT'"
return
fi
pidcnt=$(echo "$pids" | wc -w)
if [ $pidcnt -gt 10 ]; then
ocf_log info "$pidcnt processes found, signaling en masse"
echo "$pids" | xargs kill -s $sig
return
fi
for pid in $pids; do
ocf_log info "sending signal $sig to: `ps -f $pid | tail -1`"
kill -s $sig $pid
Expand Down