windows-volstate-update-post-network-change-20070614
authorJeffrey Altman <jaltman@secure-endpoints.com>
Thu, 14 Jun 2007 21:54:16 +0000 (21:54 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Thu, 14 Jun 2007 21:54:16 +0000 (21:54 +0000)
When the system's IP address list changes we invalidate the existing
RX connections and probe all of the servers.  A better algorithm is
to probe all vldb servers, invalidate the rx connections, and then
probe all file servers.

src/WINNT/afsd/cm_daemon.c
src/WINNT/afsd/cm_server.c
src/WINNT/afsd/cm_server.h

index 7dc6fbc..78a04f5 100644 (file)
@@ -54,10 +54,11 @@ void cm_IpAddrDaemon(long parm)
     while (daemon_ShutdownFlag == 0) {
        DWORD Result = NotifyAddrChange(NULL,NULL);
        if (Result == NO_ERROR && daemon_ShutdownFlag == 0) {
-           osi_Log0(afsd_logp, "cm_IpAddrDaemon CheckDownServers");
            Sleep(2500);
+           osi_Log0(afsd_logp, "cm_IpAddrDaemon CheckDownServers");
+            cm_CheckServers(CM_FLAG_CHECKVLDBSERVERS | CM_FLAG_CHECKUPSERVERS | CM_FLAG_CHECKDOWNSERVERS, NULL);
            cm_ForceNewConnectionsAllServers();
-            cm_CheckServers(CM_FLAG_CHECKUPSERVERS | CM_FLAG_CHECKDOWNSERVERS, NULL);
+            cm_CheckServers(CM_FLAG_CHECKFILESERVERS | CM_FLAG_CHECKUPSERVERS | CM_FLAG_CHECKDOWNSERVERS, NULL);
            smb_CheckVCs();
        }       
     }
index be93b1e..54a1a25 100644 (file)
@@ -197,6 +197,7 @@ void cm_CheckServers(long flags, cm_cell_t *cellp)
     cm_server_t *tsp;
     int doPing;
     int isDown;
+    int isFS;
 
     lock_ObtainWrite(&cm_serverLock);
     for (tsp = cm_allServersp; tsp; tsp = tsp->allNextp) {
@@ -208,6 +209,7 @@ void cm_CheckServers(long flags, cm_cell_t *cellp)
 
         doPing = 0;
         isDown = tsp->flags & CM_SERVERFLAG_DOWN;
+        isFS   = tsp->type == CM_SERVER_FILE;
 
         /* only do the ping if the cell matches the requested cell, or we're
          * matching all cells (cellp == NULL), and if we've requested to ping
@@ -215,7 +217,11 @@ void cm_CheckServers(long flags, cm_cell_t *cellp)
          */
         if ((cellp == NULL || cellp == tsp->cellp) &&
              ((isDown && (flags & CM_FLAG_CHECKDOWNSERVERS)) ||
-               (!isDown && (flags & CM_FLAG_CHECKUPSERVERS)))) {
+               (!isDown && (flags & CM_FLAG_CHECKUPSERVERS))) &&
+             ((!(flags & CM_FLAG_CHECKVLDBSERVERS) || 
+               !isFS && (flags & CM_FLAG_CHECKVLDBSERVERS)) &&
+              (!(flags & CM_FLAG_CHECKFILESERVERS) || 
+                 isFS && (flags & CM_FLAG_CHECKFILESERVERS)))) {
             doPing = 1;
         }      /* we're supposed to check this up/down server */
         lock_ReleaseMutex(&tsp->mx);
index de8aef4..5387247 100644 (file)
@@ -63,6 +63,8 @@ typedef struct cm_serverRef {
 /* flags for procedures */
 #define CM_FLAG_CHECKUPSERVERS         1       /* check working servers */
 #define CM_FLAG_CHECKDOWNSERVERS       2       /* check down servers */
+#define CM_FLAG_CHECKVLDBSERVERS        4       /* check only vldb servers */
+#define CM_FLAG_CHECKFILESERVERS        8       /* check only file servers */
 
 /* values for ipRank */
 #define CM_IPRANK_TOP  5000    /* on same machine */