VirtualBox

Changeset 78548 in vbox


Ignore:
Timestamp:
May 16, 2019 1:53:39 PM (6 years ago)
Author:
vboxsync
Message:

winnt/vboxsf: Fixed none-working open+truncate testcase caused by an old misconception in the FileAllocationInformation wrt when the incoming sizes would be updated (before call, as it turns out). bugref:9172

Location:
trunk/src/VBox/Additions/WINNT/SharedFolders/driver
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/SharedFolders/driver/file.cpp

    r78544 r78548  
    438438        if (pVBoxFcbx->pFobxLastWriteTime != pVBoxFobx)
    439439            pVBoxFcbx->pFobxLastWriteTime = NULL;
     440
     441        /* Make sure our cached file size value is up to date: */
     442        if (ctx.cbData > 0)
     443        {
     444            RTFOFF offEndOfWrite = LowIoContext->ParamsFor.ReadWrite.ByteOffset + ctx.cbData;
     445            if (pVBoxFobx->Info.cbObject < offEndOfWrite)
     446                pVBoxFobx->Info.cbObject = offEndOfWrite;
     447
     448            if (pVBoxFobx->Info.cbAllocated < offEndOfWrite)
     449            {
     450                pVBoxFobx->Info.cbAllocated = offEndOfWrite;
     451                pVBoxFobx->nsUpToDate       = 0;
     452            }
     453        }
    440454    }
    441455    else
  • trunk/src/VBox/Additions/WINNT/SharedFolders/driver/info.cpp

    r78543 r78548  
    12091209                FileSizes.ValidDataLength.QuadPart = cbFileNew;
    12101210
     1211
    12111212                /* RDBSS leave the lock before calling CcSetFileSizes, so we do that too then.*/
    12121213                if (NT_SUCCESS(rcNtLock))
     
    12251226                    Log(("vbsfNtUpdateFcbSize: CcSetFileSizes -> %#x\n", rcNt));
    12261227#endif
    1227                 }
     1228                    return;
     1229                }
     1230                Log2(("vbsfNtUpdateFcbSize: Updated Size+VDL from %#RX64 to %#RX64; Alloc %#RX64\n",
     1231                      cbFileOld, cbFileNew, FileSizes.AllocationSize));
    12281232                return;
    12291233            }
    12301234            /** @todo should we flag this so we can try again later? */
    12311235        }
     1236
     1237        Log2(("vbsfNtUpdateFcbSize: Updated sizes: cb=%#RX64 VDL=%#RX64 Alloc=%#RX64 (old cb=#RX64)\n",
     1238              pFcb->Header.FileSize.QuadPart, pFcb->Header.ValidDataLength.QuadPart, pFcb->Header.AllocationSize.QuadPart, cbFileOld));
    12321239    }
    12331240    else
     
    12371244    if (NT_SUCCESS(rcNtLock))
    12381245    {
    1239         RxReleasePagingIoResource(NULL, pFcb);
     1246        RxReleasePagingIoResource(NULL, pFcb); /* requires {} */
    12401247    }
    12411248}
     
    21592166         *
    21602167         * https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/d4bc551b-7aaf-4b4f-ba0e-3a75e7c528f0#Appendix_A_83
     2168         *
     2169         * Note! The AllocationSize and FileSize could be set by RxSetAllocationInfo
     2170         *       before it calls us, so we must use our own copy of the file size here
     2171         *       when we try avoid calling the host!  (open+truncate test failure)
    21612172         */
    21622173        case FileAllocationInformation:
     
    21662177                 pInfo->AllocationSize.QuadPart, capFcb->Header.FileSize.QuadPart));
    21672178
    2168             if (pInfo->AllocationSize.QuadPart >= capFcb->Header.FileSize.QuadPart)
     2179            if (pInfo->AllocationSize.QuadPart >= pVBoxFobx->Info.cbObject)
    21692180                Status = STATUS_SUCCESS;
    21702181            else
  • trunk/src/VBox/Additions/WINNT/SharedFolders/driver/path.cpp

    r78543 r78548  
    561561    if (capFcb->OpenCount == 0)
    562562    {
     563        Log(("VBOXSF: MRxCreate: Initializing the FCB.\n"));
    563564        FCB_INIT_PACKET               InitPacket;
    564565        FILE_NETWORK_OPEN_INFORMATION Data;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette