Windows: Record callback issued time
authorJeffrey Altman <jaltman@your-file-system.com>
Fri, 30 Mar 2012 19:13:55 +0000 (15:13 -0400)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Tue, 3 Apr 2012 03:17:40 +0000 (20:17 -0700)
Save the time at which a callback was issued.  This can be
used in a later patchset to determine if a callback was issued
after a negative access entry for a {fid,user} pair.

Change-Id: Iab54eb729fd5f2a2daf4855b7e7e75245dc28051
Reviewed-on: http://gerrit.openafs.org/6995
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>

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

index 9cdbbdf..1936698 100644 (file)
@@ -226,6 +226,7 @@ cm_callbackDiscardROVolumeByFID(cm_fid_t *fidp)
         cm_PutVolume(volp);
         if (volp->cbExpiresRO) {
             volp->cbExpiresRO = 0;
+            volp->cbIssuedRO = 0;
             if (volp->cbServerpRO) {
                 cm_PutServer(volp->cbServerpRO);
                 volp->cbServerpRO = NULL;
@@ -1730,6 +1731,7 @@ cm_EndCallbackGrantingCall(cm_scache_t *scp, cm_callbackRequest_t *cbrp,
                 cbrp->serverp = NULL;
             }
             scp->cbExpires = cbrp->startTime + cbp->ExpirationTime;
+            scp->cbIssued = time(NULL);
         }
 
         if (scp->flags & CM_SCACHEFLAG_PURERO) {
@@ -1738,6 +1740,7 @@ cm_EndCallbackGrantingCall(cm_scache_t *scp, cm_callbackRequest_t *cbrp,
                 if (volSyncp) {
                     lock_ObtainWrite(&cm_scacheLock);
                     volp->cbExpiresRO = scp->cbExpires;
+                    volp->cbIssuedRO = scp->cbIssued;
                     volp->creationDateRO = volSyncp->spare1;
                     if (volp->cbServerpRO != scp->cbServerp) {
                         if (volp->cbServerpRO)
@@ -2010,6 +2013,7 @@ void cm_CheckCBExpiration(void)
                 {
                     lock_ObtainWrite(&scp->rw);
                     scp->cbExpires = volp->cbExpiresRO;
+                    scp->cbIssued = volp->cbIssuedRO;
                     if (volp->cbServerpRO != scp->cbServerp) {
                         if (scp->cbServerp)
                             cm_PutServer(scp->cbServerp);
index 8d89507..b21a15f 100644 (file)
@@ -10,7 +10,7 @@
 #ifndef CM_MEMMAP_H
 #define CM_MEMMAP_H 1
 
-#define CM_CONFIG_DATA_VERSION  19
+#define CM_CONFIG_DATA_VERSION  20
 #define CM_CONFIG_DATA_MAGIC            ('A' | 'F'<<8 | 'S'<<16 | CM_CONFIG_DATA_VERSION<<24)
 
 typedef struct cm_config_data {
index d69e7e8..ab37205 100644 (file)
@@ -193,6 +193,7 @@ long cm_RecycleSCache(cm_scache_t *scp, afs_int32 flags)
         scp->cbServerp = NULL;
     }
     scp->cbExpires = 0;
+    scp->cbIssued = 0;
     scp->volumeCreationDate = 0;
 
     scp->fid.vnode = 0;
@@ -431,6 +432,7 @@ void cm_fakeSCacheInit(int newFile)
         cm_data.fakeSCache.magic = CM_SCACHE_MAGIC;
         cm_data.fakeSCache.cbServerp = (struct cm_server *)(-1);
         cm_data.fakeSCache.cbExpires = (time_t)-1;
+        cm_data.fakeSCache.cbExpires = time(NULL);
         /* can leave clientModTime at 0 */
         cm_data.fakeSCache.fileType = CM_SCACHETYPE_FILE;
         cm_data.fakeSCache.unixModeBits = 0777;
@@ -613,6 +615,7 @@ cm_ShutdownSCache(void)
             scp->cbServerp = NULL;
         }
         scp->cbExpires = 0;
+        scp->cbIssued = 0;
         _InterlockedAnd(&scp->flags, ~CM_SCACHEFLAG_CALLBACK);
         lock_ReleaseWrite(&scp->rw);
 
@@ -657,6 +660,7 @@ void cm_InitSCache(int newFile, long maxSCaches)
 #endif
                 scp->cbServerp = NULL;
                 scp->cbExpires = 0;
+                scp->cbIssued = 0;
                 scp->volumeCreationDate = 0;
                 scp->fileLocksH = NULL;
                 scp->fileLocksT = NULL;
@@ -1981,6 +1985,7 @@ void cm_DiscardSCache(cm_scache_t *scp)
        scp->cbServerp = NULL;
     }
     scp->cbExpires = 0;
+    scp->cbIssued = 0;
     scp->volumeCreationDate = 0;
     _InterlockedAnd(&scp->flags, ~(CM_SCACHEFLAG_CALLBACK | CM_SCACHEFLAG_LOCAL | CM_SCACHEFLAG_RDR_IN_USE));
     cm_dnlcPurgedp(scp);
index 6aca1a9..15b6d2d 100644 (file)
@@ -156,6 +156,7 @@ typedef struct cm_scache {
     /* callback info */
     struct cm_server *cbServerp;       /* server granting callback */
     time_t cbExpires;                  /* time callback expires */
+    time_t cbIssued;                    /* time callback was issued */
 
     /* access cache */
     long anyAccess;                    /* anonymous user's access */
index 43cefec..7416566 100644 (file)
@@ -76,6 +76,7 @@ cm_ShutdownVolume(void)
                 cm_VolumeStatusNotification(volp, volp->vol[volType].ID, volp->vol[volType].state, vl_alldown);
         }
         volp->cbExpiresRO = 0;
+        volp->cbIssuedRO = 0;
         volp->cbServerpRO = NULL;
         lock_FinalizeRWLock(&volp->rw);
     }
@@ -116,6 +117,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->cbIssuedRO = 0;
                 volp->cbServerpRO = NULL;
             }
         }
@@ -973,6 +975,7 @@ long cm_FindVolumeByName(struct cm_cell *cellp, char *volumeNamep,
             volp->vol[volType].flags = 0;
         }
         volp->cbExpiresRO = 0;
+        volp->cbIssuedRO = 0;
         volp->cbServerpRO = NULL;
         volp->creationDateRO = 0;
         cm_AddVolumeToNameHashTable(volp);
index 1646300..a308ca8 100644 (file)
@@ -50,6 +50,7 @@ typedef struct cm_volume {
     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 */
+    time_t cbIssuedRO;                  /* latest RO issue time; by cm_scacheLock */
     time_t creationDateRO;              /* latest volume creation date; 0 if unknown; by cm_scacheLock */
     time_t lastUpdateTime;              /* most recent volume location update cm_volumeLock */
 } cm_volume_t;