STABLE14-smb-notify-callback-expire-20040817

When the callback expires on an scache item, if there is an smb client
listening for updates send it is a notification of change.  This will
force the smb client to refresh its listener which will in turn cause
a new callback to be registered.

Also, remove debugging statements from GetServer/PutServer


(cherry picked from commit 1ae8a71dfa)
This commit is contained in:
Jeffrey Altman 2004-08-17 16:26:04 +00:00 committed by Jeffrey Altman
parent 9006fe486d
commit 5b72b80187
2 changed files with 18 additions and 21 deletions

View File

@ -894,29 +894,30 @@ long cm_GetCallback(cm_scache_t *scp, struct cm_user *userp,
/* called periodically by cm_daemon to shut down use of expired callbacks */
void cm_CheckCBExpiration(void)
{
int i;
cm_scache_t *scp;
long now;
int i;
cm_scache_t *scp;
long now;
osi_Log0(afsd_logp, "CheckCBExpiration");
now = osi_Time();
lock_ObtainWrite(&cm_scacheLock);
for(i=0; i<cm_hashTableSize; i++) {
for(scp = cm_hashTablep[i]; scp; scp=scp->nextp) {
scp->refCount++;
lock_ReleaseWrite(&cm_scacheLock);
lock_ObtainMutex(&scp->mx);
now = osi_Time();
lock_ObtainWrite(&cm_scacheLock);
for(i=0; i<cm_hashTableSize; i++) {
for(scp = cm_hashTablep[i]; scp; scp=scp->nextp) {
scp->refCount++;
lock_ReleaseWrite(&cm_scacheLock);
lock_ObtainMutex(&scp->mx);
if (scp->cbExpires > 0 && (scp->cbServerp == NULL || now > scp->cbExpires)) {
osi_Log1(afsd_logp, "Callback Expiration Discarding SCache scp %x", scp);
cm_DiscardSCache(scp);
}
lock_ReleaseMutex(&scp->mx);
lock_ObtainWrite(&cm_scacheLock);
osi_assert(scp->refCount-- > 0);
}
cm_CallbackNotifyChange(scp);
cm_DiscardSCache(scp);
}
lock_ReleaseMutex(&scp->mx);
lock_ObtainWrite(&cm_scacheLock);
osi_assert(scp->refCount-- > 0);
}
lock_ReleaseWrite(&cm_scacheLock);
}
lock_ReleaseWrite(&cm_scacheLock);
}
/* debug interface: not implemented */

View File

@ -139,27 +139,23 @@ void cm_GetServer(cm_server_t *serverp)
{
lock_ObtainWrite(&cm_serverLock);
serverp->refCount++;
afsi_log("cm_GetServer serverp=%x count=%d", serverp, serverp->refCount);
lock_ReleaseWrite(&cm_serverLock);
}
void cm_GetServerNoLock(cm_server_t *serverp)
{
serverp->refCount++;
afsi_log("cm_GetServerNoLock serverp=%x count=%d", serverp, serverp->refCount);
}
void cm_PutServer(cm_server_t *serverp)
{
lock_ObtainWrite(&cm_serverLock);
afsi_log("cm_PutServer serverp=%x count=%d", serverp, serverp->refCount-1);
osi_assert(serverp->refCount-- > 0);
lock_ReleaseWrite(&cm_serverLock);
}
void cm_PutServerNoLock(cm_server_t *serverp)
{
afsi_log("cm_PutServerNoLock serverp=%x count=%d", serverp, serverp->refCount-1);
osi_assert(serverp->refCount-- > 0);
}