VirtualBox

Changeset 97626 in vbox


Ignore:
Timestamp:
Nov 21, 2022 1:34:53 PM (2 years ago)
Author:
vboxsync
Message:

Guest Control/Main: Fixed running out of context IDs when copying huge directory listings. Internally IGuestFile::i_closeFile() wasn't unregistering the file object from the guest session, only the public interface IGuestFile::close() did so. bugref:10286

Location:
trunk/src/VBox/Main
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/GuestFileImpl.h

    r96407 r97626  
    9393    /** @}  */
    9494
    95 private:
     95public:
    9696
    9797    /** @name Wrapped IGuestFile properties.
     
    135135    /** @}  */
    136136
     137private:
     138
    137139    /** This can safely be used without holding any locks.
    138140     * An AutoCaller suffices to prevent it being destroy while in use and
  • trunk/src/VBox/Main/include/GuestSessionImplTasks.h

    r97540 r97626  
    243243    /** @name File handling primitives.
    244244     * @{ */
     245    int fileClose(const ComObjPtr<GuestFile> &file);
    245246    int fileCopyFromGuestInner(const Utf8Str &strSrcFile, ComObjPtr<GuestFile> &srcFile,
    246247                               const Utf8Str &strDstFile, PRTFILE phDstFile,
  • trunk/src/VBox/Main/src-client/GuestFileImpl.cpp

    r97610 r97626  
    384384
    385385/**
    386  * Closes the file on the guest side.
     386 * Closes the file on the guest side and unregisters it.
    387387 *
    388388 * @returns VBox status code.
     
    424424                                    NULL /* FileStatus */, prcGuest);
    425425    unregisterWaitEvent(pEvent);
     426
     427    /* Unregister the file object from the guest session. */
     428    AssertPtr(mSession);
     429    int vrc2 = mSession->i_fileUnregister(this);
     430    if (RT_SUCCESS(vrc))
     431        vrc = vrc2;
    426432
    427433    LogFlowFuncLeaveRC(vrc);
     
    15351541    int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS;
    15361542    int vrc = i_closeFile(&vrcGuest);
    1537     /* On failure don't return here, instead do all the cleanup
    1538      * work first and then return an error. */
    1539 
    1540     AssertPtr(mSession);
    1541     int vrc2 = mSession->i_fileUnregister(this);
    1542     if (RT_SUCCESS(vrc))
    1543         vrc = vrc2;
    1544 
    15451543    if (RT_FAILURE(vrc))
    15461544    {
  • trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp

    r97592 r97626  
    494494
    495495/**
     496 * Closes a formerly opened guest file.
     497 *
     498 * @returns VBox status code.
     499 * @param   file                Guest file to close.
     500 *
     501 * @note    Set a progress error message on error.
     502 */
     503int GuestSessionTask::fileClose(const ComObjPtr<GuestFile> &file)
     504{
     505    int vrcGuest;
     506    int vrc = file->i_closeFile(&vrcGuest);
     507    if (RT_FAILURE(vrc))
     508    {
     509        Utf8Str strFilename;
     510        HRESULT const hrc = file->getFilename(strFilename);
     511        AssertComRCReturn(hrc, VERR_OBJECT_DESTROYED);
     512        setProgressErrorMsg(VBOX_E_IPRT_ERROR, Utf8StrFmt(tr("Error closing guest file \"%s\": %Rrc"),
     513                                                          strFilename.c_str(), vrc == VERR_GSTCTL_GUEST_ERROR ? vrcGuest : vrc));
     514        if (RT_SUCCESS(vrc))
     515            vrc = vrc == VERR_GSTCTL_GUEST_ERROR ? vrcGuest : vrc;
     516    }
     517
     518    return vrc;
     519}
     520
     521/**
    496522 * Copies a file from the guest to the host.
    497523 *
     
    613639    if (fSkip)
    614640    {
    615         int vrc2 = srcFile->i_closeFile(&vrcGuest);
    616         AssertRC(vrc2);
     641        int vrc2 = fileClose(srcFile);
     642        if (RT_SUCCESS(vrc))
     643            vrc = vrc2;
     644
    617645        return vrc;
    618646    }
     
    674702    }
    675703
    676     int vrc2 = srcFile->i_closeFile(&vrcGuest);
    677     AssertRC(vrc2);
     704    int vrc2 = fileClose(srcFile);
     705    if (RT_SUCCESS(vrc))
     706        vrc = vrc2;
    678707
    679708    LogFlowFuncLeaveRC(vrc);
     
    914943    if (fSkip)
    915944    {
    916         int vrc2 = dstFile->i_closeFile(&vrcGuest);
    917         AssertRC(vrc2);
     945        int vrc2 = fileClose(dstFile);
     946        if (RT_SUCCESS(vrc))
     947            vrc = vrc2;
     948
    918949        return vrc;
    919950    }
     
    942973    }
    943974
    944     int vrc2 = dstFile->i_closeFile(&vrcGuest);
    945     AssertRC(vrc2);
     975    int vrc2 = fileClose(dstFile);
     976    if (RT_SUCCESS(vrc))
     977        vrc = vrc2;
    946978
    947979    LogFlowFuncLeaveRC(vrc);
     
    25642596                vrc = fileCopyToGuestInner(strFileSrc, hVfsFile, strFileDst, dstFile, FileCopyFlag_None, 0 /*offCopy*/, cbSrcSize);
    25652597
    2566                 int vrc2 = dstFile->i_closeFile(&vrcGuest);
    2567                 AssertRC(vrc2);
     2598                int vrc2 = fileClose(dstFile);
     2599                if (RT_SUCCESS(vrc))
     2600                    vrc = vrc2;
    25682601            }
    25692602        }
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