The existence of the pidfile must be checked outside of the loop to send
a signal to the daemon. Otherwise the daemon will remove the pidfile and
stop can return before the process is dead because it only checks
/proc/$pid if the pidfile exists.
http://tracker.ceph.com/issues/10389 Fixes: #10389
Signed-off-by: Loic Dachary <ldachary@redhat.com>
action=$5
[ -z "$action" ] && action="Stopping"
echo -n "$action Ceph $name on $host..."
- do_cmd "while [ 1 ]; do
- [ -e $pidfile ] || break
+ do_cmd "if [ -e $pidfile ] ; then
pid=\`cat $pidfile\`
while [ -e /proc/\$pid ] && grep -q $daemon /proc/\$pid/cmdline ; do
cmd=\"kill $signal \$pid\"
sleep 1
continue
done
- break
- done"
+ fi"
echo done
}