From: Rod Widdowson Date: Mon, 14 Apr 2014 20:50:36 +0000 (-0400) Subject: Windows: Pin write position prior to defer X-Git-Tag: openafs-stable-1_8_0pre1~726 X-Git-Url: http://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=a4bcc4b1dccf6ab2745be83288c380f5454a2db9 Windows: Pin write position prior to defer If we extend the file prior to defrring the write *and* the write is set up FILE_WRITE_TO_END_OF_FILE then we have to convert the FILE_WRITE_TO_END_OF_FILE to an absolute position since we have already moved the FCB->Header.FileSize. Change-Id: Ibe1a5d616490a3db152818cbd6bb24d5af251c5f Reviewed-on: http://gerrit.openafs.org/11069 Tested-by: BuildBot Reviewed-by: Rod Widdowson Reviewed-by: Jeffrey Altman --- diff --git a/src/WINNT/afsrdr/kernel/lib/AFSWrite.cpp b/src/WINNT/afsrdr/kernel/lib/AFSWrite.cpp index 3fcdbbd..eb3adaf 100644 --- a/src/WINNT/afsrdr/kernel/lib/AFSWrite.cpp +++ b/src/WINNT/afsrdr/kernel/lib/AFSWrite.cpp @@ -591,18 +591,23 @@ AFSCommonWrite( IN PDEVICE_OBJECT DeviceObject, bReleaseSectionObject = TRUE; if ( bWriteToEndOfFile) - { - if (pFcb->Header.ValidDataLength.QuadPart > pFcb->Header.FileSize.QuadPart) - { - liStartingByte = pFcb->Header.ValidDataLength; - } - else - { - liStartingByte = pFcb->Header.FileSize; - } - } + { - // + if (pFcb->Header.ValidDataLength.QuadPart > pFcb->Header.FileSize.QuadPart) + { + + liStartingByte = pFcb->Header.ValidDataLength; + } + else + { + + liStartingByte = pFcb->Header.FileSize; + } + + pIrpSp->Parameters.Write.ByteOffset = liStartingByte; + } + + // // We have the correct lock - even if we don't end up truncating // bLockOK = TRUE;