virtualbox5: enable storage device flushing

The patches disable VBOX_IGNORE_FLUSH and a sanity check in the VMDK
backend. This enables passing an explicit flush request by the guest
down to the VFS.

Fixes #3743.
This commit is contained in:
Josef Söntgen 2020-02-18 18:14:55 +01:00 committed by Norman Feske
parent 3e8824908d
commit 7c1a4522d6
4 changed files with 41 additions and 3 deletions

View File

@ -1 +1 @@
e9340716743511dca9579b5c611862501ecd15e0
e60d9717f4833b0cba86ddb3b461925d974c5fa1

View File

@ -0,0 +1,11 @@
--- a/src/app/virtualbox/src/VBox/Devices/Storage/DrvVD.cpp
+++ b/src/app/virtualbox/src/VBox/Devices/Storage/DrvVD.cpp
@@ -86,7 +86,7 @@
* must be replaced with the correct LUN number of the disk that should
* ignore flush requests. The value of the key is a boolean. The default
* is to ignore flushes, i.e. true. */
-#define VBOX_IGNORE_FLUSH
+//#define VBOX_IGNORE_FLUSH
/*********************************************************************************************************************************

View File

@ -36,3 +36,4 @@ rem_mem.patch
vga.patch
register.patch
changeset82265.patch
drvvd.patch

View File

@ -4,7 +4,33 @@ diff --git a/src/app/virtualbox/src/VBox/Storage/VMDK.cpp b/src/app/virtualbox/s
index f749ee4..0c5d49e 100644
--- a/src/app/virtualbox/src/VBox/Storage/VMDK.cpp
+++ b/src/app/virtualbox/src/VBox/Storage/VMDK.cpp
@@ -5771,7 +5771,6 @@ static int vmdkRead(void *pBackendData, uint64_t uOffset, size_t cbToRead,
@@ -4378,6 +4378,7 @@
PVMDKEXTENT pExtent;
int rc = VINF_SUCCESS;
+#if 0
/* Update descriptor if changed. */
if (pImage->Descriptor.fDirty)
{
@@ -4385,6 +4386,7 @@
if (RT_FAILURE(rc))
goto out;
}
+#endif
for (unsigned i = 0; i < pImage->cExtents; i++)
{
@@ -4440,8 +4442,7 @@
case VMDKETYPE_FLAT:
/** @todo implement proper path absolute check. */
if ( pExtent->pFile != NULL
- && !(pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)
- && !(pExtent->pszBasename[0] == RTPATH_SLASH))
+ && !(pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY))
rc = vdIfIoIntFileFlush(pImage->pIfIo, pExtent->pFile->pStorage, pIoCtx,
NULL, NULL);
break;
@@ -5796,7 +5797,6 @@
}
pExtent->uGrainSectorAbs = uSectorExtentAbs;
pExtent->uGrain = uSectorExtentRel / pExtent->cSectorsPerGrain;
@ -12,7 +38,7 @@ index f749ee4..0c5d49e 100644
}
vdIfIoIntIoCtxCopyTo(pImage->pIfIo, pIoCtx,
(uint8_t *)pExtent->pvGrain
@@ -5920,7 +5919,6 @@ static int vmdkWrite(void *pBackendData, uint64_t uOffset, size_t cbToWrite,
@@ -5945,7 +5945,6 @@
* which is somewhere between expensive and impossible. */
rc = VERR_VD_VMDK_INVALID_STATE;
pExtent->uGrainSectorAbs = 0;