diff -r c30940f6d922 -r e880629062dd userlibandfileserver/fileserver/sfile/sf_file_cache.cpp --- a/userlibandfileserver/fileserver/sfile/sf_file_cache.cpp Tue May 04 09:44:26 2010 +0100 +++ b/userlibandfileserver/fileserver/sfile/sf_file_cache.cpp Wed May 05 05:11:16 2010 +0100 @@ -1503,6 +1503,11 @@ // Need to reset currentOperation.iReadWriteArgs.iTotalLength here to make sure // TFsFileWrite::PostInitialise() doesn't think there's no data left to process aMsgRequest.ReStart(); + + //Need to preserve the current state otherwise if we are over the ram threshold + //the request can end up in a livelock trying to repeatedly flush. + currentOperation->iState = EStWriteThrough; + if (r == CFsRequest::EReqActionBusy || r != CFsRequest::EReqActionComplete) return r; } @@ -1594,17 +1599,13 @@ void CFileCache::PropagateFlushErrorToAllFileShares() { - FileShares->Lock(); - TInt count = FileShares->Count(); - while(count--) + ASSERT(IsDriveThread()); + TDblQueIter fileShareIter(iFileCB->FileShareList()); + CFileShare* pFileShare; + while ((pFileShare = fileShareIter++) != NULL) { - CFileShare* share = (CFileShare*)(*FileShares)[count]; - if (&share->File() == iFileCB) - { - share->iFlushError = iFlushError; - } + pFileShare->iFlushError = iFlushError; } - FileShares->Unlock(); } /**