From 17e271787c154835e3dd566162e4571841c5b49f Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Sat, 29 Oct 2005 21:15:07 +0000 Subject: [PATCH] STABLE14-windows-daemon-timers-20051028 the daemon up server check was set for 1 hour and not ten minutes. turned all interval constants into variables so that they can be set via registry entries at a future time. (cherry picked from commit 288886618b347cdd2d4bfaa06a2df18b1a24229e) --- src/WINNT/afsd/NTMakefile | 1 + src/WINNT/afsd/cm_daemon.c | 27 ++++++++++++++++----------- src/WINNT/afsd/cm_daemon.h | 7 ++++++- src/WINNT/afsd/cm_ioctl.c | 4 ++-- 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/WINNT/afsd/NTMakefile b/src/WINNT/afsd/NTMakefile index 85bbf1a6a8..ba44fc5e3b 100644 --- a/src/WINNT/afsd/NTMakefile +++ b/src/WINNT/afsd/NTMakefile @@ -132,6 +132,7 @@ FSOBJS=$(OUT)\fs.obj $(OUT)\fs_utils.obj CMDBGOBJS=$(OUT)\cmdebug.obj $(CMDBGOBJS): $(AFSROOT)\src\venus\cmdebug.c + $(C2OBJ) -DAFS_PTHREAD_ENV /Fo$@ $** SLOBJS=$(OUT)\symlink.obj $(OUT)\fs_utils.obj diff --git a/src/WINNT/afsd/cm_daemon.c b/src/WINNT/afsd/cm_daemon.c index b0d94da8cf..8089847eaa 100644 --- a/src/WINNT/afsd/cm_daemon.c +++ b/src/WINNT/afsd/cm_daemon.c @@ -27,7 +27,12 @@ #include "afsd.h" #include "afsicf.h" -long cm_daemonCheckInterval = 30; +/* in seconds */ +long cm_daemonCheckDownInterval = 180; +long cm_daemonCheckUpInterval = 600; +long cm_daemonCheckVolInterval = 3600; +long cm_daemonCheckCBInterval = 60; +long cm_daemonCheckLockInterval = 60; long cm_daemonTokenCheckInterval = 180; osi_rwlock_t cm_daemonLock; @@ -204,11 +209,11 @@ void cm_Daemon(long parm) srand(ntohl(code)); now = osi_Time(); - lastVolCheck = now - 1800 + (rand() % 3600); - lastCBExpirationCheck = now - 60 + (rand() % 60); - lastLockCheck = now - 60 + (rand() % 60); - lastDownServerCheck = now - cm_daemonCheckInterval/2 + (rand() % cm_daemonCheckInterval); - lastUpServerCheck = now - 1800 + (rand() % 3600); + lastVolCheck = now - cm_daemonCheckVolInterval/2 + (rand() % cm_daemonCheckVolInterval); + lastCBExpirationCheck = now - cm_daemonCheckCBInterval/2 + (rand() % cm_daemonCheckCBInterval); + lastLockCheck = now - cm_daemonCheckLockInterval/2 + (rand() % cm_daemonCheckLockInterval); + lastDownServerCheck = now - cm_daemonCheckDownInterval/2 + (rand() % cm_daemonCheckDownInterval); + lastUpServerCheck = now - cm_daemonCheckUpInterval/2 + (rand() % cm_daemonCheckUpInterval); lastTokenCacheCheck = now - cm_daemonTokenCheckInterval/2 + (rand() % cm_daemonTokenCheckInterval); while (daemon_ShutdownFlag == 0) { @@ -241,7 +246,7 @@ void cm_Daemon(long parm) now = osi_Time(); /* check down servers */ - if (now > lastDownServerCheck + cm_daemonCheckInterval) { + if (now > lastDownServerCheck + cm_daemonCheckDownInterval) { lastDownServerCheck = now; osi_Log0(afsd_logp, "cm_Daemon CheckDownServers"); cm_CheckServers(CM_FLAG_CHECKDOWNSERVERS, NULL); @@ -249,26 +254,26 @@ void cm_Daemon(long parm) } /* check up servers */ - if (now > lastUpServerCheck + 3600) { + if (now > lastUpServerCheck + cm_daemonCheckUpInterval) { lastUpServerCheck = now; osi_Log0(afsd_logp, "cm_Daemon CheckUpServers"); cm_CheckServers(CM_FLAG_CHECKUPSERVERS, NULL); now = osi_Time(); } - if (now > lastVolCheck + 3600) { + if (now > lastVolCheck + cm_daemonCheckVolInterval) { lastVolCheck = now; cm_CheckVolumes(); now = osi_Time(); } - if (now > lastCBExpirationCheck + 60) { + if (now > lastCBExpirationCheck + cm_daemonCheckCBInterval) { lastCBExpirationCheck = now; cm_CheckCBExpiration(); now = osi_Time(); } - if (now > lastLockCheck + 60) { + if (now > lastLockCheck + cm_daemonCheckLockInterval) { lastLockCheck = now; cm_CheckLocks(); now = osi_Time(); diff --git a/src/WINNT/afsd/cm_daemon.h b/src/WINNT/afsd/cm_daemon.h index 7345cd9a5c..a5c25a65bc 100644 --- a/src/WINNT/afsd/cm_daemon.h +++ b/src/WINNT/afsd/cm_daemon.h @@ -11,7 +11,12 @@ #define __CM_DAEMON_H_ENV_ 1 /* externs */ -extern long cm_daemonCheckInterval; +extern long cm_daemonCheckDownInterval; +extern long cm_daemonCheckUpInterval; +extern long cm_daemonCheckVolInterval; +extern long cm_daemonCheckCBInterval; +extern long cm_daemonCheckLockInterval; +extern long cm_daemonTokenCheckInterval; extern osi_rwlock_t cm_daemonLock; diff --git a/src/WINNT/afsd/cm_ioctl.c b/src/WINNT/afsd/cm_ioctl.c index eb7d5b9367..6190774ee6 100644 --- a/src/WINNT/afsd/cm_ioctl.c +++ b/src/WINNT/afsd/cm_ioctl.c @@ -983,12 +983,12 @@ long cm_IoctlCheckServers(struct smb_ioctl *ioctlp, struct cm_user *userp) memcpy(&csi, tp, sizeof(csi)); if (csi.tinterval >= 0) { cp = ioctlp->outDatap; - memcpy(cp, (char *)&cm_daemonCheckInterval, sizeof(long)); + memcpy(cp, (char *)&cm_daemonCheckDownInterval, sizeof(long)); ioctlp->outDatap += sizeof(long); if (csi.tinterval > 0) { if (!smb_SUser(userp)) return CM_ERROR_NOACCESS; - cm_daemonCheckInterval = csi.tinterval; + cm_daemonCheckDownInterval = csi.tinterval; } return 0; }