Windows: No network, no probe
authorJeffrey Altman <jaltman@your-file-system.com>
Thu, 4 Sep 2014 13:14:07 +0000 (09:14 -0400)
committerJeffrey Altman <jaltman@your-file-system.com>
Wed, 24 Sep 2014 22:16:44 +0000 (18:16 -0400)
Modify cm_PingServer and cm_CheckServersMulti to avoid probing servers
when there are no network interfaces with which to do so.  Just mark
the servers down.

Change-Id: I5ba6c9813a28ec44b09dccd8f8c5ffc7e0c0ce10
Reviewed-on: http://gerrit.openafs.org/11446
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

src/WINNT/afsd/cm_server.c

index 68fe24e..c3ada8a 100644 (file)
@@ -280,7 +280,10 @@ cm_PingServer(cm_server_t *tsp)
     afs_inet_ntoa_r(tsp->addr.sin_addr.S_un.S_addr, hoststr);
     lock_ReleaseMutex(&tsp->mx);
 
-    code = cm_ConnByServer(tsp, cm_rootUserp, FALSE, &connp);
+    if (cm_noIPAddr > 0)
+       code = cm_ConnByServer(tsp, cm_rootUserp, FALSE, &connp);
+    else
+       code = RX_CALL_DEAD;    /* No network */
     if (code == 0) {
        /* now call the appropriate ping call.  Drop the timeout if
        * the server is known to be down, so that we don't waste a
@@ -530,10 +533,18 @@ static void cm_CheckServersMulti(afs_uint32 flags, cm_cell_t *cellp)
             lock_ReleaseMutex(&tsp->mx);
 
             serversp[nconns] = tsp;
-            code = cm_ConnByServer(tsp, cm_rootUserp, FALSE, &conns[nconns]);
+           if (cm_noIPAddr > 0)
+               code = cm_ConnByServer(tsp, cm_rootUserp, FALSE, &conns[nconns]);
+           else
+               code = RX_CALL_DEAD;
             if (code) {
-                lock_ObtainRead(&cm_serverLock);
-                cm_PutServerNoLock(tsp);
+               if (code == RX_CALL_DEAD) {
+                   lock_ObtainMutex(&tsp->mx);
+                   cm_MarkServerDown(tsp, code, isDown);
+                   lock_ReleaseMutex(&tsp->mx);
+               }
+               lock_ObtainRead(&cm_serverLock);
+               cm_PutServerNoLock(tsp);
                 continue;
             }
             lock_ObtainRead(&cm_serverLock);
@@ -667,9 +678,17 @@ static void cm_CheckServersMulti(afs_uint32 flags, cm_cell_t *cellp)
             lock_ReleaseMutex(&tsp->mx);
 
             serversp[nconns] = tsp;
-            code = cm_ConnByServer(tsp, cm_rootUserp, FALSE, &conns[nconns]);
+           if (cm_noIPAddr > 0)
+               code = cm_ConnByServer(tsp, cm_rootUserp, FALSE, &conns[nconns]);
+           else
+               code = RX_CALL_DEAD;
             if (code) {
-                lock_ObtainRead(&cm_serverLock);
+               if (code == RX_CALL_DEAD) {
+                   lock_ObtainMutex(&tsp->mx);
+                   cm_MarkServerDown(tsp, code, isDown);
+                   lock_ReleaseMutex(&tsp->mx);
+               }
+               lock_ObtainRead(&cm_serverLock);
                 cm_PutServerNoLock(tsp);
                 continue;
             }