Windows: SetVolumeState is not an invalidation
authorJeffrey Altman <jaltman@your-file-system.com>
Thu, 6 Dec 2012 13:16:01 +0000 (08:16 -0500)
committerJeffrey Altman <jaltman@your-file-system.com>
Fri, 7 Dec 2012 14:48:04 +0000 (06:48 -0800)
Volume state notifications (online, offline, unknown) from the
afsd_service.exe to the afs redirector are not invalidation
events.  The verify flag should not be set, the extents should
not be purged, etc.  Just set or clear the AFS_VOLUME_FLAGS_OFFLINE.

Change-Id: I046468e614c836981db228aa142d2c8bdb03a9ad
Reviewed-on: http://gerrit.openafs.org/8651
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/afsrdr/kernel/lib/AFSGeneric.cpp

index f524fa1..e4fb8a5 100644 (file)
@@ -3276,96 +3276,6 @@ AFSSetVolumeState( IN AFSVolumeStatusCB *VolumeStatus)
 
                 InterlockedOr( (LONG *)&(pVolumeCB->Flags), AFS_VOLUME_FLAGS_OFFLINE);
             }
-
-            AFSAcquireShared( pVolumeCB->ObjectInfoTree.TreeLock,
-                              TRUE);
-
-            pCurrentObject = pVolumeCB->ObjectInfoListHead;;
-
-            while( pCurrentObject != NULL)
-            {
-
-                if( VolumeStatus->Online)
-                {
-
-                    ClearFlag( pCurrentObject->Flags, AFS_OBJECT_FLAGS_OBJECT_INVALID);
-
-                    SetFlag( pCurrentObject->Flags, AFS_OBJECT_FLAGS_VERIFY);
-
-                    pCurrentObject->DataVersion.QuadPart = (ULONGLONG)-1;
-                }
-                else
-                {
-
-                    SetFlag( pCurrentObject->Flags, AFS_OBJECT_FLAGS_OBJECT_INVALID);
-                }
-
-                pFcb = pCurrentObject->Fcb;
-
-                if( pFcb != NULL &&
-                    !(VolumeStatus->Online) &&
-                    pFcb->Header.NodeTypeCode == AFS_FILE_FCB)
-                {
-
-                    AFSDbgLogMsg( AFS_SUBSYSTEM_EXTENT_PROCESSING,
-                                  AFS_TRACE_LEVEL_ERROR,
-                                  "AFSSetVolumeState Marking volume offline and canceling extents Volume Cell %08lX Volume %08lX\n",
-                                  VolumeStatus->FileID.Cell,
-                                  VolumeStatus->FileID.Volume);
-
-                    //
-                    // Clear out the extents
-                    //
-
-                    AFSDbgLogMsg( AFS_SUBSYSTEM_LOCK_PROCESSING,
-                                  AFS_TRACE_LEVEL_VERBOSE,
-                                  "AFSSetVolumeState Acquiring Fcb extents lock %08lX EXCL %08lX\n",
-                                  &pFcb->NPFcb->Specific.File.ExtentsResource,
-                                  PsGetCurrentThread());
-
-                    AFSAcquireExcl( &pFcb->NPFcb->Specific.File.ExtentsResource,
-                                    TRUE);
-
-                    pFcb->NPFcb->Specific.File.ExtentsRequestStatus = STATUS_CANCELLED;
-
-                    KeSetEvent( &pFcb->NPFcb->Specific.File.ExtentsRequestComplete,
-                                0,
-                                FALSE);
-
-                    AFSDbgLogMsg( AFS_SUBSYSTEM_LOCK_PROCESSING,
-                                  AFS_TRACE_LEVEL_VERBOSE,
-                                  "AFSSetVolumeState Releasing Fcb extents lock %08lX EXCL %08lX\n",
-                                  &pFcb->NPFcb->Specific.File.ExtentsResource,
-                                  PsGetCurrentThread());
-
-                    AFSReleaseResource( &pFcb->NPFcb->Specific.File.ExtentsResource);
-
-                    //
-                    // And get rid of them (note this involves waiting
-                    // for any writes or reads to the cache to complete)
-                    //
-
-                    AFSTearDownFcbExtents( pFcb,
-                                           NULL);
-                }
-
-                pCurrentObject = (AFSObjectInfoCB *)pCurrentObject->ListEntry.fLink;
-            }
-
-            AFSReleaseResource( pVolumeCB->ObjectInfoTree.TreeLock);
-
-            lCount = InterlockedDecrement( &pVolumeCB->VolumeReferenceCount);
-
-            AFSDbgLogMsg( AFS_SUBSYSTEM_VOLUME_REF_COUNTING,
-                          AFS_TRACE_LEVEL_VERBOSE,
-                          "AFSSetVolumeState Decrement count on volume %08lX Cnt %d\n",
-                          pVolumeCB,
-                          lCount);
-        }
-        else
-        {
-
-            AFSReleaseResource( &pDevExt->Specific.RDR.VolumeTreeLock);
         }
     }