VirtualBox

Changeset 78380 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 4, 2019 1:56:48 PM (6 years ago)
Author:
vboxsync
Message:

winnt/vboxsf: Update FCB size info when opening a file too. bugref:9172

File:
1 edited

Legend:

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

    r78366 r78380  
    458458}
    459459
     460/**
     461 * Create/open a file, directory, ++.
     462 *
     463 * The RDBSS library will do a table lookup on the path passed in by the user
     464 * and therefore share FCBs for objects with the same path.
     465 *
     466 * The FCB needs to be locked exclusively upon successful return, however it
     467 * seems like it's not always locked when we get here (only older RDBSS library
     468 * versions?), so we have to check this before returning.
     469 *
     470 */
    460471NTSTATUS VBoxMRxCreate(IN OUT PRX_CONTEXT RxContext)
    461472{
     
    541552    RxContext->Create.ReturnedCreateInformation = CreateAction;
    542553
     554    /*
     555     * Make sure we've got the FCB locked exclusivly before updating it and returning.
     556     * (bird: not entirely sure if this is needed for the W10 RDBSS, but cannot hurt.)
     557     */
     558    if (!RxIsFcbAcquiredExclusive(capFcb))
     559        RxAcquireExclusiveFcbResourceInMRx(capFcb);
     560
     561
    543562    /* Initialize the FCB if this is the first open.
    544563       Note! The RxFinishFcbInitialization call expects node types as the 2nd parameter, but is for
     
    553572        Data.LastWriteTime.QuadPart  = RTTimeSpecGetNtTime(&Info.ModificationTime);
    554573        Data.ChangeTime.QuadPart     = RTTimeSpecGetNtTime(&Info.ChangeTime);
    555         Data.AllocationSize.QuadPart = Info.cbAllocated;
     574        Data.AllocationSize.QuadPart = Info.cbAllocated; /** @todo test sparse files.  CcSetFileSizes is documented to not want allocation size smaller than EOF offset. */
    556575        Data.EndOfFile.QuadPart      = Info.cbObject;
    557576        Data.FileAttributes          = VBoxToNTFileAttributes(Info.Attr.fMode);
     
    571590            RxFinishFcbInitialization(capFcb, (RX_FILE_TYPE)RDBSS_NTC_STORAGE_TYPE_FILE, &InitPacket);
    572591    }
    573     /*
    574      * See if the size has changed and update the FCB if it has.
    575      */
    576     else
    577     {
    578         /** @todo Need to check RDBSS stack for locking semantics before updating
    579          *        anything. */
    580     }
    581592
    582593    SrvOpen->BufferingFlags = 0;
     
    600611    pVBoxFobx->pSrvCall = RxContext->Create.pSrvCall;
    601612    pVBoxFobx->Info = Info;
     613
     614    /*
     615     * See if the size has changed and update the FCB if it has.
     616     */
     617    if (   capFcb->OpenCount > 0
     618        && capFcb->Header.FileSize.QuadPart != Info.cbObject)
     619    {
     620        PFILE_OBJECT pFileObj = RxContext->CurrentIrpSp->FileObject;
     621        Assert(pFileObj);
     622        if (pFileObj)
     623            vbsfNtUpdateFcbSize(pFileObj, capFcb, pVBoxFobx, Info.cbObject, capFcb->Header.FileSize.QuadPart, Info.cbAllocated);
     624    }
     625
     626    /*
     627     * Do logging.
     628     */
    602629    Log(("VBOXSF: MRxCreate: Info: BirthTime        %RI64\n", RTTimeSpecGetNano(&pVBoxFobx->Info.BirthTime)));
    603630    Log(("VBOXSF: MRxCreate: Info: ChangeTime       %RI64\n", RTTimeSpecGetNano(&pVBoxFobx->Info.ChangeTime)));
     
    609636        Log(("VBOXSF: MRxCreate: Info: cbObject         %#RX64\n", pVBoxFobx->Info.cbObject));
    610637        Log(("VBOXSF: MRxCreate: Info: cbAllocated      %#RX64\n", pVBoxFobx->Info.cbAllocated));
    611     }
    612 
    613     if (!RxIsFcbAcquiredExclusive(capFcb))
    614     {
    615         RxAcquireExclusiveFcbResourceInMRx(capFcb);
    616638    }
    617639
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