VirtualBox

Changeset 61844 in vbox


Ignore:
Timestamp:
Jun 23, 2016 10:50:04 AM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
108253
Message:

Storage/VMDK: Fix corrupting stream optimized VMDK images on first non readonly opening where the descriptor space is increased but the descriptor size in the image file is not updated

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Storage/VMDK.cpp

    r61757 r61844  
    30853085            &&  (!pExtent->uSectorRGD || (int64_t)pExtent->uSectorRGD - pExtent->uDescriptorSector >= 4))
    30863086        {
     3087            uint64_t cDescriptorSectorsOld = pExtent->cDescriptorSectors;
     3088
    30873089            pExtent->cDescriptorSectors = 4;
    3088             pExtent->fMetaDirty = true;
     3090            /*
     3091             * Update the on disk number now to make sure we don't introduce inconsistencies
     3092             * in case of stream optimized images from VMware where the descriptor is just
     3093             * one sector big (the binary header is not written to disk for complete
     3094             * stream optimized images in vmdkFlushImage()).
     3095             */
     3096            uint64_t u64DescSizeNew = RT_H2LE_U64(pExtent->cDescriptorSectors);
     3097            rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pFile->pStorage, RT_OFFSETOF(SparseExtentHeader, descriptorSize),
     3098                                        &u64DescSizeNew, sizeof(u64DescSizeNew));
     3099            if (RT_FAILURE(rc))
     3100            {
     3101                LogFlowFunc(("Increasing the descriptor size failed with %Rrc\n", rc));
     3102                /* Restore the old size and carry on. */
     3103                pExtent->cDescriptorSectors = cDescriptorSectorsOld;
     3104            }
    30893105        }
    30903106        /* Read the descriptor from the extent. */
Note: See TracChangeset for help on using the changeset viewer.

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