smb-notify-callback-expire-20040817
authorJeffrey Altman <jaltman@mit.edu>
Tue, 17 Aug 2004 16:25:33 +0000 (16:25 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Tue, 17 Aug 2004 16:25:33 +0000 (16:25 +0000)
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

src/WINNT/afsd/cm_callback.c
src/WINNT/afsd/cm_server.c

index 8b0fc50..bded4b5 100644 (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 */
index 7b2b86b..ebe9eb2 100644 (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);
 }