From: Mitko Haralanov Date: Fri, 10 Jan 2014 16:41:28 +0000 (-0500) Subject: truescale.cmds: Wait for /dev/ipath* devices before changing permissions X-Git-Tag: compat-rdma-2014-01-30~6^2~6 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=26fa31af17d0128463547a7f7d73ddfb79d8ce2d;p=~emulex%2Ftmp%2Fcompat-rdma%2F.git truescale.cmds: Wait for /dev/ipath* devices before changing permissions Wait for up to 30 seconds for the /dev/ipath* devices to appear before attempting to change their permissions. This helps with system which boot a bit slower on which the device permissions could be left in the wrong state. Signed-off-by: Mitko Haralanov --- diff --git a/ofed_scripts/truescale.cmds b/ofed_scripts/truescale.cmds index 0f445fe..d96147e 100644 --- a/ofed_scripts/truescale.cmds +++ b/ofed_scripts/truescale.cmds @@ -306,9 +306,17 @@ start) mount -t ipathfs none /ipathfs # make sure /dev/ipath files get created with correct permissions - if [ ! -c /dev/ipath ]; then sleep 2; fi - if [ ! -c /dev/ipath ]; then sleep 3; fi - chmod 666 /dev/ipath /dev/ipath[0-9]* >/dev/null 2>&1 + typeset -i timeout=30 count=0 + while [ $((count++)) -lt $timeout ]; do + if [ -c /dev/ipath ]; then + chmod 666 /dev/ipath /dev/ipath[0-9]* >/dev/null 2>&1 + break + fi + sleep 1 + done + if [ $count -ge $timeout ]; then + warn_and_log Failed to modify permissions on /dev/ipath\* files + fi set_irq_affinity ;;