From 5b72b80187e08c9bdefa4c755aedd2561958113c Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Tue, 17 Aug 2004 16:26:04 +0000 Subject: [PATCH] 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 1ae8a71dfa8a5efea7d31ad985746b026b444f48) --- src/WINNT/afsd/cm_callback.c | 35 ++++++++++++++++++----------------- src/WINNT/afsd/cm_server.c | 4 ---- 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/src/WINNT/afsd/cm_callback.c b/src/WINNT/afsd/cm_callback.c index 8b0fc50290..bded4b5ac9 100644 --- a/src/WINNT/afsd/cm_callback.c +++ b/src/WINNT/afsd/cm_callback.c @@ -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; inextp) { - scp->refCount++; - lock_ReleaseWrite(&cm_scacheLock); - lock_ObtainMutex(&scp->mx); + now = osi_Time(); + lock_ObtainWrite(&cm_scacheLock); + for(i=0; inextp) { + 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 */ diff --git a/src/WINNT/afsd/cm_server.c b/src/WINNT/afsd/cm_server.c index 7b2b86b615..ebe9eb2b80 100644 --- a/src/WINNT/afsd/cm_server.c +++ b/src/WINNT/afsd/cm_server.c @@ -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); }