[OpenAFS] AFS startup script and wireless laptops (OS-X)

Richard Brittain richard@northstar.dartmouth.edu
Thu, 8 Dec 2005 11:54:19 -0500 (EST)


Hi,
   I've just started using AFS on a Mac laptop with wireless network and 
noticed a problem with the startup script, which never occurred on 
machines with wired ethernet.   It seems that although the network 
initialization script has already been called before AFS gets started, the 
network startup is proceeding in background and 9 times out of 10, when 
wireless is in use, it hasn't finished setting up when the AFS rc script 
calls "CheckForNetwork".  As distributed, the script immediately exits if 
the network isn't up
  (if [ "${NETWORKUP}" = "-NO-" ]; then exit; fi)

I eventually figured out how to manually run the AFS startup script when 
it didn't load, but this isn't knowledge that most OS-X users will have -
"sudo SystemStarter start AFS"

I changed my startup script to loop for a while waiting for network 
initialization and not give up for a couple of minutes - this is probably 
overkill - "sleep 5" was actually enough every time I tested it on our 
campus network.

     echo "Starting OpenAFS"

     # Don't just exit if the network isn't up - give it some time.
     i=0
     delay=5
     maxdelay=120
     while [ "${NETWORKUP}" != "-YES-" ]; do
        i=$((i + delay))
        [ $i -gt $maxdelay ] && exit
        sleep $delay
        unset NETWORKUP
        CheckForNetwork
     done

Also, it would seem logical that the requirement metadata in the 
"StartupParameters.plist" file should include "Network" as a prerequisite, 
although in practice that makes no difference because of the asynchronous 
startup.

On a related note, I was happy to see that the OpenAFS 1.4 rc script now 
has start and stop functions.  The stop function works great as long as no 
open filehandles exist into AFS, but when AFS was busy, I got system hangs 
or else immediate system crashes when AFS tried to unload.  I don't know 
enough OS-X or afsd internals to speculate on how to improve this 
situation though.

  Richard
-- 
Richard Brittain,  Kiewit Computing Services, 6224 Baker/Berry Library
                    Dartmouth College, Hanover NH 03755
Email: richard.brittain@dartmouth.edu