From f716962ab41847af4450d0a361f5de9195b32ed0 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Thu, 19 Nov 2009 18:53:56 -0500 Subject: [PATCH] Windows: disable readonly volume versioning due to file server bug Change I17e3980184ec68e38c5186e1c9637ac6e38451fe corrects a file server bug that results in invalid volume sync data being sent to clients during bulk status rpcs. Unless this is fixed in the file servers it is not safe to use the volume versioning functionality. This patchset disables the functionality by default and permits it to be turned on via a registry value. If the client is deployed in an environment in which all of the file servers have been fixed, then it will be safe to turn this feature on. LICENSE MIT Change-Id: I0db38ffc9cdeb90db20b92adca9a42a06fed2e2f Reviewed-on: http://gerrit.openafs.org/859 Reviewed-by: Derrick Brashear Reviewed-by: Rod Widdowson Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- src/WINNT/afsd/afsd.h | 1 + src/WINNT/afsd/afsd_init.c | 9 +++++++++ src/WINNT/afsd/cm_callback.c | 3 ++- src/WINNT/afsd/cm_scache.c | 4 +++- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/WINNT/afsd/afsd.h b/src/WINNT/afsd/afsd.h index 2176154fce..17835aea49 100644 --- a/src/WINNT/afsd/afsd.h +++ b/src/WINNT/afsd/afsd.h @@ -111,6 +111,7 @@ extern int cm_fakeGettingCallback; // 1 if currently updating the fake root.af extern int cm_dnsEnabled; extern int cm_freelanceEnabled; +extern int cm_readonlyVolumeVersioning; extern long rx_mtu; diff --git a/src/WINNT/afsd/afsd_init.c b/src/WINNT/afsd/afsd_init.c index faf7422684..e6813ed63b 100644 --- a/src/WINNT/afsd/afsd_init.c +++ b/src/WINNT/afsd/afsd_init.c @@ -68,6 +68,7 @@ DWORD cm_mountRootLen; clientchar_t cm_mountRootC[1024]; DWORD cm_mountRootCLen; +int cm_readonlyVolumeVersioning = 0; int cm_logChunkSize; int cm_chunkSize; @@ -1238,6 +1239,14 @@ afsd_InitCM(char **reasonP) } afsi_log("CM PerFileAccessCheck is %d", cm_accessPerFileCheck); + dummyLen = sizeof(DWORD); + code = RegQueryValueEx(parmKey, "ReadOnlyVolumeVersioning", NULL, NULL, + (BYTE *) &dwValue, &dummyLen); + if (code == ERROR_SUCCESS) { + cm_readonlyVolumeVersioning = (unsigned short) dwValue; + } + afsi_log("CM ReadOnlyVolumeVersioning is %u", cm_readonlyVolumeVersioning); + RegCloseKey (parmKey); cacheBlocks = ((afs_uint64)cacheSize * 1024) / blockSize; diff --git a/src/WINNT/afsd/cm_callback.c b/src/WINNT/afsd/cm_callback.c index 0b94d40f1d..f8f587cf46 100644 --- a/src/WINNT/afsd/cm_callback.c +++ b/src/WINNT/afsd/cm_callback.c @@ -1576,7 +1576,8 @@ int cm_HaveCallback(cm_scache_t *scp) return 0; } #endif - if (scp->flags & CM_SCACHEFLAG_PURERO) { + if (cm_readonlyVolumeVersioning && + (scp->flags & CM_SCACHEFLAG_PURERO)) { cm_volume_t *volp = cm_GetVolumeByFID(&scp->fid); if (volp) { int haveCB = 0; diff --git a/src/WINNT/afsd/cm_scache.c b/src/WINNT/afsd/cm_scache.c index bee91c4904..9c1dd73ce3 100644 --- a/src/WINNT/afsd/cm_scache.c +++ b/src/WINNT/afsd/cm_scache.c @@ -1635,7 +1635,8 @@ void cm_MergeStatus(cm_scache_t *dscp, goto done; } - scp->volumeCreationDate = volsyncp->spare1; /* volume creation date */ + if (cm_readonlyVolumeVersioning) + scp->volumeCreationDate = volsyncp->spare1; /* volume creation date */ scp->serverModTime = statusp->ServerModTime; @@ -1805,6 +1806,7 @@ void cm_DiscardSCache(cm_scache_t *scp) scp->cbServerp = NULL; } scp->cbExpires = 0; + scp->volumeCreationDate = 0; scp->flags &= ~(CM_SCACHEFLAG_CALLBACK | CM_SCACHEFLAG_LOCAL); cm_dnlcPurgedp(scp); cm_dnlcPurgevp(scp);