Changeset 29154 in vbox
- Timestamp:
- May 6, 2010 1:29:30 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/PDMAsyncCompletionFileNormal.cpp
r29124 r29154 406 406 407 407 /** 408 * Checks if a given status code is fatal. 409 * Non fatal errors can be fixed by migrating the endpoint to a 410 * failsafe manager. 411 * 412 * @returns true If the error is fatal and migrating to a failsafe manager doesn't help 413 * false If the error can be fixed by a migration. (image on NFS disk for example) 414 * @param rcReq The status code to check. 415 */ 416 DECLINLINE(bool) pdmacFileAioMgrNormalRcIsFatal(int rcReq) 417 { 418 return rcReq == VERR_DEV_IO_ERROR 419 || rcReq == VERR_FILE_IO_ERROR 420 || rcReq == VERR_DISK_IO_ERROR 421 || rcReq == VERR_DISK_FULL 422 || rcReq == VERR_FILE_TOO_BIG; 423 } 424 425 /** 408 426 * Error handler which will create the failsafe managers and destroy the failed I/O manager. 409 427 * … … 1356 1374 RTMemPageFree(pTask->pvBounceBuffer, pTask->cbBounceBuffer); 1357 1375 1358 /* Queue the request on the pending list. */ 1359 pTask->pNext = pEndpoint->AioMgr.pReqsPendingHead; 1360 pEndpoint->AioMgr.pReqsPendingHead = pTask; 1361 1362 /* Create a new failsafe manager if neccessary. */ 1363 if (!pEndpoint->AioMgr.fMoving) 1364 { 1365 PPDMACEPFILEMGR pAioMgrFailsafe; 1366 1367 LogRel(("%s: Request %#p failed with rc=%Rrc, migrating endpoint %s to failsafe manager.\n", 1368 RTThreadGetName(pAioMgr->Thread), pTask, rcReq, pEndpoint->Core.pszUri)); 1369 1370 pEndpoint->AioMgr.fMoving = true; 1371 1372 rc = pdmacFileAioMgrCreate((PPDMASYNCCOMPLETIONEPCLASSFILE)pEndpoint->Core.pEpClass, 1373 &pAioMgrFailsafe, PDMACEPFILEMGRTYPE_SIMPLE); 1374 AssertRC(rc); 1375 1376 pEndpoint->AioMgr.pAioMgrDst = pAioMgrFailsafe; 1377 1378 /* Update the flags to open the file with. Disable async I/O and enable the host cache. */ 1379 pEndpoint->fFlags &= ~(RTFILE_O_ASYNC_IO | RTFILE_O_NO_CACHE); 1380 } 1381 } 1382 1383 /* If this was the last request for the endpoint migrate it to the new manager. */ 1384 if (!pEndpoint->AioMgr.cRequestsActive) 1385 { 1386 bool fReqsPending = pdmacFileAioMgrNormalRemoveEndpoint(pEndpoint); 1387 Assert(!fReqsPending); 1388 1389 rc = pdmacFileAioMgrAddEndpoint(pEndpoint->AioMgr.pAioMgrDst, pEndpoint); 1390 AssertRC(rc); 1376 /* 1377 * Fatal errors are reported to the guest and non-fatal errors 1378 * will cause a migration to the failsafe manager in the hope 1379 * that the error disappears. 1380 */ 1381 if (!pdmacFileAioMgrNormalRcIsFatal(rcReq)) 1382 { 1383 /* Queue the request on the pending list. */ 1384 pTask->pNext = pEndpoint->AioMgr.pReqsPendingHead; 1385 pEndpoint->AioMgr.pReqsPendingHead = pTask; 1386 1387 /* Create a new failsafe manager if neccessary. */ 1388 if (!pEndpoint->AioMgr.fMoving) 1389 { 1390 PPDMACEPFILEMGR pAioMgrFailsafe; 1391 1392 LogRel(("%s: Request %#p failed with rc=%Rrc, migrating endpoint %s to failsafe manager.\n", 1393 RTThreadGetName(pAioMgr->Thread), pTask, rcReq, pEndpoint->Core.pszUri)); 1394 1395 pEndpoint->AioMgr.fMoving = true; 1396 1397 rc = pdmacFileAioMgrCreate((PPDMASYNCCOMPLETIONEPCLASSFILE)pEndpoint->Core.pEpClass, 1398 &pAioMgrFailsafe, PDMACEPFILEMGRTYPE_SIMPLE); 1399 AssertRC(rc); 1400 1401 pEndpoint->AioMgr.pAioMgrDst = pAioMgrFailsafe; 1402 1403 /* Update the flags to open the file with. Disable async I/O and enable the host cache. */ 1404 pEndpoint->fFlags &= ~(RTFILE_O_ASYNC_IO | RTFILE_O_NO_CACHE); 1405 } 1406 1407 /* If this was the last request for the endpoint migrate it to the new manager. */ 1408 if (!pEndpoint->AioMgr.cRequestsActive) 1409 { 1410 bool fReqsPending = pdmacFileAioMgrNormalRemoveEndpoint(pEndpoint); 1411 Assert(!fReqsPending); 1412 1413 rc = pdmacFileAioMgrAddEndpoint(pEndpoint->AioMgr.pAioMgrDst, pEndpoint); 1414 AssertRC(rc); 1415 } 1416 } 1417 else 1418 { 1419 pTask->pfnCompleted(pTask, pTask->pvUser, rcReq); 1420 pdmacFileTaskFree(pEndpoint, pTask); 1421 } 1391 1422 } 1392 1423 }
Note:
See TracChangeset
for help on using the changeset viewer.