Windows: Invalidate all volumes at library init

The afsredirlib.sys library driver is unloaded when the afsd_service
stops and is reloaded when the afsd_service restarts.  During the
shutdown window any objects known to the kernel are preserved by
afsredir.sys.  When the afsd_service restarts, there are no valid
callbacks on any objects so the afsredirlib.sys must invalidate all
status info to permit the service to request a callback from the
file server on next use.

Change-Id: I3e8fa9513f435ff5cd1a8cfb8daa766aa30dd8c1
Reviewed-on: http://gerrit.openafs.org/6617
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
This commit is contained in:
Jeffrey Altman 2012-01-24 17:09:01 -05:00 committed by Jeffrey Altman
parent e44163a547
commit 3d10edc2d4
2 changed files with 71 additions and 0 deletions

View File

@ -2566,6 +2566,67 @@ AFSInvalidateVolume( IN AFSVolumeCB *VolumeCB,
return ntStatus;
}
VOID
AFSInvalidateAllVolumes( VOID)
{
AFSVolumeCB *pVolumeCB = NULL;
AFSVolumeCB *pNextVolumeCB = NULL;
AFSDeviceExt *pRDRDeviceExt = NULL;
LONG lCount;
pRDRDeviceExt = (AFSDeviceExt *)AFSRDRDeviceObject->DeviceExtension;
AFSDbgLogMsg( AFS_SUBSYSTEM_LOCK_PROCESSING,
AFS_TRACE_LEVEL_VERBOSE,
"AFSInvalidateAllVolumes Acquiring RDR VolumeListLock lock %08lX SHARED %08lX\n",
&pRDRDeviceExt->Specific.RDR.VolumeListLock,
PsGetCurrentThread());
AFSAcquireShared( &pRDRDeviceExt->Specific.RDR.VolumeListLock,
TRUE);
pVolumeCB = pRDRDeviceExt->Specific.RDR.VolumeListHead;
if ( pVolumeCB)
{
AFSDbgLogMsg( AFS_SUBSYSTEM_LOCK_PROCESSING,
AFS_TRACE_LEVEL_VERBOSE,
"AFSInvalidateAllVolumes Acquiring VolumeRoot ObjectInfoTree lock %08lX SHARED %08lX\n",
pVolumeCB->ObjectInfoTree.TreeLock,
PsGetCurrentThread());
lCount = InterlockedIncrement( &pVolumeCB->VolumeReferenceCount);
}
while( pVolumeCB != NULL)
{
pNextVolumeCB = (AFSVolumeCB *)pVolumeCB->ListEntry.fLink;
if ( pNextVolumeCB)
{
lCount = InterlockedIncrement( &pNextVolumeCB->VolumeReferenceCount);
}
AFSReleaseResource( &pRDRDeviceExt->Specific.RDR.VolumeListLock);
// do I need to hold the volume lock here?
AFSInvalidateVolume( pVolumeCB, AFS_INVALIDATE_EXPIRED);
AFSAcquireShared( &pRDRDeviceExt->Specific.RDR.VolumeListLock,
TRUE);
lCount = InterlockedDecrement( &pVolumeCB->VolumeReferenceCount);
pVolumeCB = pNextVolumeCB;
}
AFSReleaseResource( &pRDRDeviceExt->Specific.RDR.VolumeListLock);
}
NTSTATUS
AFSVerifyEntry( IN GUID *AuthGroup,
IN AFSDirectoryCB *DirEntry)
@ -7441,6 +7502,13 @@ AFSInitializeLibrary( IN AFSLibraryInitCB *LibraryInit)
SetFlag( AFSGlobalRoot->Flags, AFS_VOLUME_ACTIVE_GLOBAL_ROOT);
//
// Invalidate all known volumes since contact with the service and therefore
// the file server was lost.
//
AFSInvalidateAllVolumes();
//
// Drop the locks acquired above
//

View File

@ -1154,6 +1154,9 @@ NTSTATUS
AFSInvalidateVolume( IN AFSVolumeCB *VolumeCB,
IN ULONG Reason);
VOID
AFSInvalidateAllVolumes( VOID);
NTSTATUS
AFSVerifyEntry( IN GUID *AuthGroup,
IN AFSDirectoryCB *DirectoryCB);