]> git.openfabrics.org - ~emulex/compat-rdma_3.12.git/commitdiff
truescale.cmds: Wait for /dev/ipath* devices before changing permissions
authorMitko Haralanov <mitko@qlogic.com>
Fri, 10 Jan 2014 16:41:28 +0000 (11:41 -0500)
committerMike Marciniszyn <mike.marciniszyn@intel.com>
Fri, 10 Jan 2014 16:41:28 +0000 (11:41 -0500)
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 <mitko@qlogic.com>
ofed_scripts/truescale.cmds

index 0f445fe75c1e57650c028d7c8ea6304acaf195d6..d96147efb3836493923c99f59190e5206dee318b 100644 (file)
@@ -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
        ;;