From 970848073ebdf6cf9c5382a71f2d08e60642b6ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Fri, 8 Jan 2010 11:15:27 +0000 Subject: [PATCH] - updated device_cio_free script (#533494) --- device_cio_free | 18 +++++++++++------- s390utils.spec | 5 ++++- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/device_cio_free b/device_cio_free index 6cee0a3..a17662b 100644 --- a/device_cio_free +++ b/device_cio_free @@ -22,10 +22,12 @@ BLACKLIST=/proc/cio_ignore VERBOSE= PATH=/bin:/usr/bin:/sbin:/usr/sbin ALL_DEVICES= +WAITING_TIMEOUT=60 # maximum time to wait for all devices to appear +WAITING_TOTAL=0 # actual time spent waiting for devices usage() { - echo "$0 [-h|--help] [-V|--verbose]" + echo "Usage: $CMD [-h|--help] [-V|--verbose]" exit 1 } @@ -53,22 +55,24 @@ free_device() # wait until a device appears on the ccw bus wait_on_device() { - local DEVICE_CCW DEVICE_ONLINE DEV + local DEVICE_ONLINE DEV [ -z "$1" ] && return DEV=$1 - DEVICE_CCW=/sys/bus/ccw/devices/$DEV - DEVICE_ONLINE=$DEVICE_CCW/online - -# [ -f $DEVICE_CCW ] || sleep 1 -# [ -f $DEVICE_CCW ] || return + DEVICE_ONLINE=/sys/bus/ccw/devices/$DEV/online [ $VERBOSE ] && echo "Waiting on device $DEV" [ -f "$DEVICE_ONLINE" ] && return for t in 1 2 3 4 5 do + if [ $WAITING_TOTAL -ge $WAITING_TIMEOUT ]; then + [ $VERBOSE ] && echo "Waiting timeout of $WAITING_TIMEOUT seconds reached" + break + fi + WAITING_TOTAL=$(($WAITING_TOTAL + $t)) + [ $VERBOSE ] && echo "Waiting additional $t second(s) and $WAITING_TOTAL second(s) in total" sleep $t [ -f "$DEVICE_ONLINE" ] && return done diff --git a/s390utils.spec b/s390utils.spec index d97c363..dc43247 100644 --- a/s390utils.spec +++ b/s390utils.spec @@ -8,7 +8,7 @@ Name: s390utils Summary: Utilities and daemons for IBM System/z Group: System Environment/Base Version: 1.8.2 -Release: 7%{?dist} +Release: 8%{?dist} Epoch: 2 License: GPLv2 and GPLv2+ and CPL Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -826,6 +826,9 @@ User-space development files for the s390/s390x architecture. %changelog +* Fri Jan 8 2010 Dan Horák 2:1.8.2-8 +- updated device_cio_free script (#533494) + * Fri Jan 8 2010 Dan Horák 2:1.8.2-7 - updated device_cio_free script (#533494)