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
This commit is contained in:
Jeffrey Altman 2004-08-17 16:25:33 +00:00 committed by Jeffrey Altman
parent 3dce18d248
commit 1ae8a71dfa
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 */ /* called periodically by cm_daemon to shut down use of expired callbacks */
void cm_CheckCBExpiration(void) void cm_CheckCBExpiration(void)
{ {
int i; int i;
cm_scache_t *scp; cm_scache_t *scp;
long now; long now;
osi_Log0(afsd_logp, "CheckCBExpiration"); osi_Log0(afsd_logp, "CheckCBExpiration");
now = osi_Time(); now = osi_Time();
lock_ObtainWrite(&cm_scacheLock); lock_ObtainWrite(&cm_scacheLock);
for(i=0; i<cm_hashTableSize; i++) { for(i=0; i<cm_hashTableSize; i++) {
for(scp = cm_hashTablep[i]; scp; scp=scp->nextp) { for(scp = cm_hashTablep[i]; scp; scp=scp->nextp) {
scp->refCount++; scp->refCount++;
lock_ReleaseWrite(&cm_scacheLock); lock_ReleaseWrite(&cm_scacheLock);
lock_ObtainMutex(&scp->mx); lock_ObtainMutex(&scp->mx);
if (scp->cbExpires > 0 && (scp->cbServerp == NULL || now > scp->cbExpires)) { if (scp->cbExpires > 0 && (scp->cbServerp == NULL || now > scp->cbExpires)) {
osi_Log1(afsd_logp, "Callback Expiration Discarding SCache scp %x", scp); osi_Log1(afsd_logp, "Callback Expiration Discarding SCache scp %x", scp);
cm_DiscardSCache(scp); cm_CallbackNotifyChange(scp);
} cm_DiscardSCache(scp);
lock_ReleaseMutex(&scp->mx); }
lock_ObtainWrite(&cm_scacheLock); lock_ReleaseMutex(&scp->mx);
osi_assert(scp->refCount-- > 0); lock_ObtainWrite(&cm_scacheLock);
} osi_assert(scp->refCount-- > 0);
} }
lock_ReleaseWrite(&cm_scacheLock); }
lock_ReleaseWrite(&cm_scacheLock);
} }
/* debug interface: not implemented */ /* debug interface: not implemented */

View File

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