windows-registry-OfflineReadOnlyIsValid-20071019

Add registry value "OfflineReadOnlyIsValid" option.  When set to non-zero
value, an offline or down read only volume will be treated as if it has
a valid callback even if it doesn't.
This commit is contained in:
Jeffrey Altman 2007-10-20 04:58:40 +00:00
parent 6122c757e1
commit 20cfc16e3d
5 changed files with 39 additions and 2 deletions

View File

@ -41,6 +41,7 @@ extern afs_int32 cryptall;
extern int cm_enableServerLocks;
extern int cm_deleteReadOnly;
extern afs_int32 cm_BPlusTrees;
extern afs_int32 cm_OfflineROIsValid;
extern const char **smb_ExecutableExtensions;
osi_log_t *afsd_logp;
@ -1106,6 +1107,14 @@ int afsd_InitCM(char **reasonP)
if (!smb_ExecutableExtensions)
afsi_log("No PrefetchExecutableExtensions");
dummyLen = sizeof(DWORD);
code = RegQueryValueEx(parmKey, "OfflineReadOnlyIsValid", NULL, NULL,
(BYTE *) &dwValue, &dummyLen);
if (code == ERROR_SUCCESS) {
cm_OfflineROIsValid = (unsigned short) dwValue;
}
afsi_log("CM OfflineReadOnlyIsValid is %u", cm_deleteReadOnly);
RegCloseKey (parmKey);
cacheBlocks = ((afs_uint64)cacheSize * 1024) / blockSize;

View File

@ -30,6 +30,8 @@
/* read/write lock for all global storage in this module */
osi_rwlock_t cm_callbackLock;
afs_int32 cm_OfflineROIsValid = 0;
#ifdef AFS_FREELANCE_CLIENT
extern osi_mutex_t cm_Freelance_Lock;
#endif
@ -1483,10 +1485,20 @@ int cm_HaveCallback(cm_scache_t *scp)
}
#endif
if (scp->cbServerp != NULL)
if (scp->cbServerp != NULL) {
return 1;
else
} else if (cm_OfflineROIsValid) {
switch (cm_GetVolumeStatus(scp->volp, scp->fid.volume)) {
case vl_offline:
case vl_alldown:
case vl_unknown:
return 1;
default:
return 0;
}
} else {
return 0;
}
}
/* need to detect a broken callback that races with our obtaining a callback.

View File

@ -72,4 +72,5 @@ extern void cm_GiveUpAllCallbacks(cm_server_t *tsp, afs_int32 markDown);
extern void cm_GiveUpAllCallbacksAllServers(afs_int32 markDown);
extern afs_int32 cm_OfflineROIsValid;
#endif /* _CM_CALLBACK_H_ENV__ */

View File

@ -1480,3 +1480,17 @@ void cm_VolumeStatusNotification(cm_volume_t * volp, afs_uint32 volID, enum vols
cm_VolStatus_Change_Notification(volp->cellp->cellID, volID, new);
}
enum volstatus cm_GetVolumeStatus(cm_volume_t *volp, afs_uint32 volID)
{
if (volp->rw.ID == volID) {
return volp->rw.state;
} else if (volp->ro.ID == volID) {
return volp->ro.state;
} else if (volp->bk.ID == volID) {
return volp->bk.state;
} else {
return vl_unknown;
}
}

View File

@ -118,4 +118,5 @@ extern void cm_UpdateVolumeStatus(cm_volume_t *volp, afs_uint32 volID);
extern void cm_VolumeStatusNotification(cm_volume_t * volp, afs_uint32 volID, enum volstatus old, enum volstatus new);
extern enum volstatus cm_GetVolumeStatus(cm_volume_t *volp, afs_uint32 volID);
#endif /* __CM_VOLUME_H_ENV__ */