From: Loic Dachary Date: Fri, 19 Dec 2014 14:54:33 +0000 (+0100) Subject: init-ceph: stop returns before daemons are dead X-Git-Tag: v0.92~56^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=487c22a8a4b3ba099f9c19125c720e99e7c8d0db;p=ceph.git init-ceph: stop returns before daemons are dead 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 --- diff --git a/src/init-ceph.in b/src/init-ceph.in index 4bfbf2878ad0..cb340f961dee 100644 --- a/src/init-ceph.in +++ b/src/init-ceph.in @@ -88,8 +88,7 @@ stop_daemon() { 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\" @@ -98,8 +97,7 @@ stop_daemon() { sleep 1 continue done - break - done" + fi" echo done }