]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: osd-pool-create must not loop forever on kill
authorLoic Dachary <loic@dachary.org>
Wed, 25 Dec 2013 20:36:13 +0000 (21:36 +0100)
committerLoic Dachary <loic@dachary.org>
Thu, 26 Dec 2013 09:01:19 +0000 (10:01 +0100)
Looping forever on kill does not serve any useful purpose.
Reduce the verbosity of the exit trap to help diagnose error
conditions.

Signed-off-by: Loic Dachary <loic@dachary.org>
src/test/mon/osd-pool-create.sh

index 9f58f00bd818d6f53be2047d085909937bb3ee73..35cfd409ced348d330430c2d1210c2529dc2f9e2 100755 (executable)
@@ -19,7 +19,7 @@ PS4='$LINENO: '
 
 DIR=osd-pool-create
 rm -fr $DIR
-trap "kill_mon || true ; rm -fr $DIR" EXIT
+trap "set +x ; kill_mon || true ; rm -fr $DIR" EXIT
 mkdir $DIR
 export CEPH_ARGS="--conf /dev/null --auth-supported=none --mon-host=127.0.0.1" 
 
@@ -40,7 +40,14 @@ function run_mon() {
 }
 
 function kill_mon() {
-    while [ -f $DIR/pidfile ] && kill $(cat $DIR/pidfile) ; do sleep 1 ; done
+    for try in 0 1 1 1 2 3 ; do
+        if [ ! -e $DIR/pidfile ] ||
+            ! kill $(cat $DIR/pidfile) ; then
+            break
+        fi
+        sleep $try
+    done
+
     rm -fr $DIR/store.db
 }