]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
DEVEL15-windows-merge-status-20070204
authorJeffrey Altman <jaltman@secure-endpoints.com>
Mon, 5 Feb 2007 11:08:32 +0000 (11:08 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Mon, 5 Feb 2007 11:08:32 +0000 (11:08 +0000)
For each StoreData operation the dataVersion on the object is incremented.
To prevent all of the cached buffers from being considered out of date,
if the dataVersion has been incremented by exactly one, then update the
dataVersion of the buffers that match the FID and the previous dataVersion

(cherry picked from commit 4e8bc6d5016f8e6d46a21331009c414d94e90d10)

src/WINNT/afsd/cm_dcache.c
src/WINNT/afsd/cm_scache.c
src/WINNT/afsd/cm_scache.h
src/WINNT/afsd/cm_vnodeops.c

index f1aa3dacae0c5474fe334e7ed05bf8ebd513bd55..f0ca4e270ec2f4a572c71543035c75e9bde19d99 100644 (file)
@@ -297,7 +297,7 @@ long cm_BufWrite(void *vscp, osi_hyper_t *offsetp, long length, long flags,
         if (LargeIntegerGreaterThanOrEqualTo(t, scp->length))
             scp->mask &= ~CM_SCACHEMASK_LENGTH;
 
-        cm_MergeStatus(scp, &outStatus, &volSync, userp, 0);
+        cm_MergeStatus(scp, &outStatus, &volSync, userp, CM_MERGEFLAG_STOREDATA);
     } else {
         if (code == CM_ERROR_SPACE)
             scp->flags |= CM_SCACHEFLAG_OUTOFSPACE;
@@ -420,7 +420,7 @@ long cm_StoreMini(cm_scache_t *scp, cm_user_t *userp, cm_req_t *reqp)
 
         if (LargeIntegerGreaterThanOrEqualTo(t, scp->length))
             scp->mask &= ~CM_SCACHEMASK_LENGTH;
-        cm_MergeStatus(scp, &outStatus, &volSync, userp, 0);
+        cm_MergeStatus(scp, &outStatus, &volSync, userp, CM_MERGEFLAG_STOREDATA);
     }
 
     return code;
index 67f2fed0326c182c302c454449d07e07c64f38a2..09a5c83e8256a3252f5839f687a3c3d5a9f4f947 100644 (file)
@@ -1368,6 +1368,7 @@ void cm_MergeStatus(cm_scache_t *scp, AFSFetchStatus *statusp, AFSVolSync *volp,
         if (!(scp->flags & CM_SCACHEFLAG_RO))
             return;
     }       
+
     scp->serverModTime = statusp->ServerModTime;
 
     if (!(scp->mask & CM_SCACHEMASK_CLIENTMODTIME)) {
@@ -1382,7 +1383,6 @@ void cm_MergeStatus(cm_scache_t *scp, AFSFetchStatus *statusp, AFSVolSync *volp,
     scp->serverLength.HighPart = statusp->Length_hi;
 
     scp->linkCount = statusp->LinkCount;
-    scp->dataVersion = statusp->DataVersion;
     scp->owner = statusp->Owner;
     scp->group = statusp->Group;
     scp->unixModeBits = statusp->UnixModeBits & 07777;
@@ -1413,6 +1413,23 @@ void cm_MergeStatus(cm_scache_t *scp, AFSFetchStatus *statusp, AFSVolSync *volp,
     if (userp != NULL) {
         cm_AddACLCache(scp, userp, statusp->CallerAccess);
     }
+
+    if ((flags & CM_MERGEFLAG_STOREDATA) &&
+       statusp->DataVersion - scp->dataVersion == 1) {
+       afs_uint32 i;
+       cm_buf_t *bp;
+
+       for (i = 0; i < cm_data.buf_hashSize; i++)
+       {
+           for(bp = cm_data.buf_hashTablepp[i]; bp; bp=bp->hashp) {
+               if (cm_FidCmp(&scp->fid, &bp->fid) == 0 && 
+                   bp->dataVersion == scp->dataVersion)
+                   bp->dataVersion = statusp->DataVersion;
+           }
+       }
+
+    }
+    scp->dataVersion = statusp->DataVersion;
 }
 
 /* note that our stat cache info is incorrect, so force us eventually
index e96a38bd3827805002272b816e86546d83c7e762..2592637ddc4b74b4f3e8eb791614ab9d7eb9bc6e 100644 (file)
@@ -292,6 +292,7 @@ typedef struct cm_scache {
                                                 * used to see if we're merging
                                                 * in old info.
                                                  */
+#define CM_MERGEFLAG_STOREDATA         2       /* Merge due to storedata op */
 
 /* hash define.  Must not include the cell, since the callback revocation code
  * doesn't necessarily know the cell in the case of a multihomed server
index a30cc5e595de06a0f6d412cde170ccef31b42f14..97619330b9c0fe61afd012e23adacffc5b1a1a87 100644 (file)
@@ -1405,13 +1405,13 @@ long cm_Unlink(cm_scache_t *dscp, char *namep, cm_user_t *userp, cm_req_t *reqp)
     cm_SyncOpDone(dscp, NULL, sflags);
     if (code == 0) 
         cm_MergeStatus(dscp, &newDirStatus, &volSync, userp, 0);
-       else if (code == CM_ERROR_NOSUCHFILE) {
-               /* windows would not have allowed the request to delete the file 
-                * if it did not believe the file existed.  therefore, we must 
-                * have an inconsistent view of the world.
-                */
-               dscp->cbServerp = NULL;
-       }
+    else if (code == CM_ERROR_NOSUCHFILE) {
+       /* windows would not have allowed the request to delete the file 
+        * if it did not believe the file existed.  therefore, we must 
+        * have an inconsistent view of the world.
+        */
+       dscp->cbServerp = NULL;
+    }
     lock_ReleaseMutex(&dscp->mx);
 
     return code;
@@ -2313,7 +2313,7 @@ long cm_SetAttr(cm_scache_t *scp, cm_attr_t *attrp, cm_user_t *userp,
     cm_SyncOpDone(scp, NULL, CM_SCACHESYNC_STORESTATUS);
     if (code == 0)
         cm_MergeStatus(scp, &afsOutStatus, &volSync, userp,
-                        CM_MERGEFLAG_FORCE);
+                        CM_MERGEFLAG_FORCE|CM_MERGEFLAG_STOREDATA);
        
     /* if we're changing the mode bits, discard the ACL cache, 
      * since we changed the mode bits.