windows-callback-server-tracking-for-readonly-vols-20090626
authorJeffrey Altman <jaltman@secure-endpoints.com>
Fri, 26 Jun 2009 15:11:10 +0000 (15:11 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Fri, 26 Jun 2009 15:11:10 +0000 (15:11 +0000)
LICENSE MIT

Readonly volume callbacks apply to every cm_scache_t from the
same volume.  We were already tracking the cbExpires time in
the cm_volume_t.  We need to also track the cbServerp in the
cm_volume_t so that the cm_scache_t objects can be assigned
the correct server from which the callback was issued.

Add cbServerpRO field to the cm_volume_t.  Bump the memory
map version to force a rebuild of the cache data.

src/WINNT/afsd/cm_callback.c
src/WINNT/afsd/cm_memmap.h
src/WINNT/afsd/cm_volume.c
src/WINNT/afsd/cm_volume.h

index 7895e0a..63522b8 100644 (file)
@@ -1733,6 +1733,12 @@ void cm_EndCallbackGrantingCall(cm_scache_t *scp, cm_callbackRequest_t *cbrp,
             cm_volume_t * volp = cm_GetVolumeByFID(&scp->fid);
             if (volp) {
                 volp->cbExpiresRO = scp->cbExpires;
+                if (volp->cbServerpRO != scp->cbServerp) {
+                    if (volp->cbServerpRO)
+                        cm_PutServer(volp->cbServerpRO);
+                    cm_GetServer(scp->cbServerp);
+                    volp->cbServerpRO = scp->cbServerp;
+                }
                 cm_PutVolume(volp);
             }
         }
@@ -1931,6 +1937,12 @@ void cm_CheckCBExpiration(void)
                         scp->cbExpires > 0) 
                     {
                         scp->cbExpires = volp->cbExpiresRO;
+                        if (volp->cbServerpRO != scp->cbServerp) {
+                            if (scp->cbServerp)
+                               cm_PutServer(scp->cbServerp);
+                           cm_GetServer(volp->cbServerpRO);
+                           scp->cbServerp = volp->cbServerpRO;
+                        }
                     }        
                     cm_PutVolume(volp);
                 }
index 6588928..07881b3 100644 (file)
@@ -10,7 +10,7 @@
 #ifndef CM_MEMMAP_H
 #define CM_MEMMAP_H 1
 
-#define CM_CONFIG_DATA_VERSION  5
+#define CM_CONFIG_DATA_VERSION  6
 #define CM_CONFIG_DATA_MAGIC            ('A' | 'F'<<8 | 'S'<<16 | CM_CONFIG_DATA_VERSION<<24)
 
 typedef struct cm_config_data {
index e41d05a..cc6b802 100644 (file)
@@ -72,6 +72,7 @@ cm_ShutdownVolume(void)
                 cm_VolumeStatusNotification(volp, volp->vol[volType].ID, volp->vol[volType].state, vl_alldown);
         }
         volp->cbExpiresRO = 0;
+        volp->cbServerpRO = NULL;
         lock_FinalizeRWLock(&volp->rw);
     }
 
@@ -110,6 +111,7 @@ void cm_InitVolume(int newFile, long maxVols)
                         cm_VolumeStatusNotification(volp, volp->vol[volType].ID, vl_unknown, volp->vol[volType].state);
                 }
                 volp->cbExpiresRO = 0;
+                volp->cbServerpRO = NULL;
             }
         }
         osi_EndOnce(&once);
@@ -927,6 +929,7 @@ long cm_FindVolumeByName(struct cm_cell *cellp, char *volumeNamep,
             volp->vol[volType].flags = 0;
         }
         volp->cbExpiresRO = 0;
+        volp->cbServerpRO = NULL;
         cm_AddVolumeToNameHashTable(volp);
         lock_ReleaseWrite(&cm_volumeLock);
     }
index aae0c3e..704d216 100644 (file)
@@ -42,6 +42,7 @@ typedef struct cm_volume {
     osi_rwlock_t rw;
     afs_uint32 flags;                  /* by rw */
     afs_int32 refCount;                        /* by Interlocked operations */
+    struct cm_server *cbServerpRO;      /* server granting RO callback; by cm_scacheLock */
     time_t cbExpiresRO;                 /* latest RO expiration time; by cm_scacheLock */
 } cm_volume_t;