Windows: Add CM_MERGEFLAG_CACHE_BYPASS
authorJeffrey Altman <jaltman@your-file-system.com>
Fri, 25 Jan 2013 00:42:41 +0000 (19:42 -0500)
committerJeffrey Altman <jaltman@your-file-system.com>
Sat, 2 Feb 2013 17:11:18 +0000 (09:11 -0800)
If a store operation is performed direct to the file server
bypassing the AFSCache, call cm_MergeStatus() with
CM_MERGEFLAG_CACHE_BYPASS to ensure that the valid version
numbers for the cm_scache_t object are incremented appropriately.
After a cache bypass occurs, only buffers with the current
data version number are valid since the cached data will be
incomplete.

Change-Id: I9438f8c9759407de69ab894df4f6fe91027a4b94
Reviewed-on: http://gerrit.openafs.org/8964
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

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

index 1c07b12..7f41d2f 100644 (file)
@@ -1932,8 +1932,10 @@ long cm_MergeStatus(cm_scache_t *dscp,
     if (((flags & (CM_MERGEFLAG_STOREDATA|CM_MERGEFLAG_DIROP)) && (dv_diff(dataVersion, scp->dataVersion) > activeRPCs)) ||
          (!(flags & (CM_MERGEFLAG_STOREDATA|CM_MERGEFLAG_DIROP)) && (scp->dataVersion != dataVersion)) ||
          scp->bufDataVersionLow == CM_SCACHE_VERSION_BAD ||
-         scp->fileType == CM_SCACHETYPE_DIRECTORY)
+         scp->fileType == CM_SCACHETYPE_DIRECTORY ||
+         flags & CM_MERGEFLAG_CACHE_BYPASS) {
         scp->bufDataVersionLow = dataVersion;
+    }
 
     if (RDR_Initialized) {
         /*
index fd7c7da..2345ba0 100644 (file)
@@ -345,6 +345,7 @@ typedef struct cm_scache {
 #define CM_MERGEFLAG_DIROP              4       /* Merge due to directory op */
 #define CM_MERGEFLAG_FETCHDATA          8       /* Merge due to fetchdata op */
 #define CM_MERGEFLAG_BULKSTAT        0x10       /* Merge due to bulkstat op */
+#define CM_MERGEFLAG_CACHE_BYPASS    0x20       /* Data not stored into cache */
 
 /* 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