From 860812931f3adf07c85ac2a56deb149b9c0d33bb Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Sat, 21 Jul 2012 12:17:46 -0400 Subject: [PATCH] Windows: AFSTearDownFcbExtents loop conditional If there are extents in the list with a non-zero ActiveCount, those extents will be skipped and the list 'le' will never become empty. Add an additional condition to ensure that the loop is only executed once for each extent in the list. Change-Id: I48adf7c49282181d0a34135ac50f7fa1a165c735 Reviewed-on: http://gerrit.openafs.org/7810 Tested-by: BuildBot Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- .../afsrdr/kernel/lib/AFSExtentsSupport.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/WINNT/afsrdr/kernel/lib/AFSExtentsSupport.cpp b/src/WINNT/afsrdr/kernel/lib/AFSExtentsSupport.cpp index 16621dafd..3e5b68e85 100644 --- a/src/WINNT/afsrdr/kernel/lib/AFSExtentsSupport.cpp +++ b/src/WINNT/afsrdr/kernel/lib/AFSExtentsSupport.cpp @@ -150,8 +150,8 @@ AFSTearDownFcbExtents( IN AFSFcb *Fcb, AFSNonPagedFcb *pNPFcb = Fcb->NPFcb; LIST_ENTRY *le, *leNext; AFSExtent *pEntry; - LONG lExtentCount = 0; - ULONG ulReleaseCount = 0, ulProcessCount = 0; + LONG lExtentCount = 0, lProcessCount = 0; + ULONG ulReleaseCount = 0; size_t sz; AFSReleaseExtentsCB *pRelease = NULL; BOOLEAN locked = FALSE; @@ -217,16 +217,18 @@ AFSTearDownFcbExtents( IN AFSFcb *Fcb, for( le = Fcb->Specific.File.ExtentsLists[AFS_EXTENTS_LIST].Flink, lExtentCount = 0; lExtentCount < Fcb->Specific.File.ExtentCount; - lExtentCount += ulProcessCount) + lExtentCount += lProcessCount) { RtlZeroMemory( pRelease, sizeof( AFSReleaseExtentsCB ) + (AFS_MAXIMUM_EXTENT_RELEASE_COUNT * sizeof ( AFSFileExtentCB ))); - for( ulProcessCount = 0, ulReleaseCount = 0; - !IsListEmpty( le) && ulReleaseCount < AFS_MAXIMUM_EXTENT_RELEASE_COUNT; - ulProcessCount++, le = leNext) + for( lProcessCount = 0, ulReleaseCount = 0; + !IsListEmpty( le) && + ulReleaseCount < AFS_MAXIMUM_EXTENT_RELEASE_COUNT && + lExtentCount + lProcessCount < Fcb->Specific.File.ExtentCount; + lProcessCount++, le = leNext) { leNext = le->Flink; @@ -310,7 +312,7 @@ AFSTearDownFcbExtents( IN AFSFcb *Fcb, // request would be a corruption. // - sz = sizeof( AFSReleaseExtentsCB ) + (ulProcessCount * sizeof ( AFSFileExtentCB )); + sz = sizeof( AFSReleaseExtentsCB ) + (lProcessCount * sizeof ( AFSFileExtentCB )); ntStatus = AFSProcessRequest( AFS_REQUEST_TYPE_RELEASE_FILE_EXTENTS, AFS_REQUEST_FLAG_SYNCHRONOUS, -- 2.39.5