windows-volume-status-tracking-20070612
[openafs.git] / src / WINNT / afsd / cm_daemon.c
index 0ab8bd5..7dc6fbc 100644 (file)
 
 /* in seconds */
 long cm_daemonCheckDownInterval  = 180;
-long cm_daemonCheckUpInterval    = 600;
+long cm_daemonCheckUpInterval    = 240;
 long cm_daemonCheckVolInterval   = 3600;
 long cm_daemonCheckCBInterval    = 60;
 long cm_daemonCheckLockInterval  = 60;
 long cm_daemonTokenCheckInterval = 180;
+long cm_daemonCheckBusyVolInterval = 600;
 
 osi_rwlock_t cm_daemonLock;
 
@@ -273,6 +274,12 @@ cm_DaemonCheckInit(void)
     if (code == ERROR_SUCCESS)
        cm_daemonTokenCheckInterval = dummy;
     
+    dummyLen = sizeof(DWORD);
+    code = RegQueryValueEx(parmKey, "BusyVolumeCheckInterval", NULL, NULL,
+                           (BYTE *) &dummy, &dummyLen);
+    if (code == ERROR_SUCCESS)
+       cm_daemonCheckBusyVolInterval = dummy;
+    
     RegCloseKey(parmKey);
 }
 
@@ -286,6 +293,7 @@ void cm_Daemon(long parm)
     time_t lastDownServerCheck;
     time_t lastUpServerCheck;
     time_t lastTokenCacheCheck;
+    time_t lastBusyVolCheck;
     char thostName[200];
     unsigned long code;
     struct hostent *thp;
@@ -325,6 +333,7 @@ void cm_Daemon(long parm)
     lastDownServerCheck = now - cm_daemonCheckDownInterval/2 + (rand() % cm_daemonCheckDownInterval);
     lastUpServerCheck = now - cm_daemonCheckUpInterval/2 + (rand() % cm_daemonCheckUpInterval);
     lastTokenCacheCheck = now - cm_daemonTokenCheckInterval/2 + (rand() % cm_daemonTokenCheckInterval);
+    lastBusyVolCheck = now - cm_daemonCheckBusyVolInterval/2 * (rand() % cm_daemonCheckBusyVolInterval);
 
     while (daemon_ShutdownFlag == 0) {
        /* check to see if the listener threads halted due to network 
@@ -378,6 +387,12 @@ void cm_Daemon(long parm)
            now = osi_Time();
         }
 
+        if (now > lastBusyVolCheck + cm_daemonCheckBusyVolInterval) {
+            lastVolCheck = now;
+            cm_CheckOfflineVolumes();
+           now = osi_Time();
+        }
+
         if (now > lastCBExpirationCheck + cm_daemonCheckCBInterval) {
             lastCBExpirationCheck = now;
             cm_CheckCBExpiration();