VirtualBox

Changeset 32943 in vbox


Ignore:
Timestamp:
Oct 6, 2010 1:42:59 PM (14 years ago)
Author:
vboxsync
Message:

Storage/ATA: Clean up suspending the VM on certain errors, and make sure that a paused VM can be powered off straight away.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/DevATA.cpp

    r32108 r32943  
    14361436    int rc;
    14371437    LogRel(("PIIX3 ATA: Host disk full\n"));
    1438     rc = PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "DevATA_DISKFULL",
     1438    rc = PDMDevHlpVMSetRuntimeError(pDevIns, VMSETRTERR_FLAGS_SUSPEND | VMSETRTERR_FLAGS_NO_WAIT, "DevATA_DISKFULL",
    14391439                                    N_("Host system reported disk full. VM execution is suspended. You can resume after freeing some space"));
    14401440    AssertRC(rc);
     
    14451445    int rc;
    14461446    LogRel(("PIIX3 ATA: File too big\n"));
    1447     rc = PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "DevATA_FILETOOBIG",
     1447    rc = PDMDevHlpVMSetRuntimeError(pDevIns, VMSETRTERR_FLAGS_SUSPEND | VMSETRTERR_FLAGS_NO_WAIT, "DevATA_FILETOOBIG",
    14481448                                    N_("Host system reported that the file size limit of the host file system has been exceeded. VM execution is suspended. You need to move your virtual hard disk to a filesystem which allows bigger files"));
    14491449    AssertRC(rc);
     
    14541454    int rc;
    14551455    LogRel(("PIIX3 ATA: iSCSI target unavailable\n"));
    1456     rc = PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "DevATA_ISCSIDOWN",
     1456    rc = PDMDevHlpVMSetRuntimeError(pDevIns, VMSETRTERR_FLAGS_SUSPEND | VMSETRTERR_FLAGS_NO_WAIT, "DevATA_ISCSIDOWN",
    14571457                                    N_("The iSCSI target has stopped responding. VM execution is suspended. You can resume when it is available again"));
    14581458    AssertRC(rc);
    14591459}
    14601460
    1461 /**
    1462  * Suspend I/O operations on a controller. Also suspends EMT, because it's
    1463  * waiting for I/O to make progress. The next attempt to perform an I/O
    1464  * operation will be made when EMT is resumed up again (as the resume
    1465  * callback below restarts I/O).
    1466  *
    1467  * @param pCtl      Controller for which to suspend I/O.
    1468  */
    1469 static void ataSuspendRedo(PATACONTROLLER pCtl)
    1470 {
    1471     PPDMDEVINS  pDevIns = CONTROLLER_2_DEVINS(pCtl);
    1472     int         rc;
    1473 
    1474     pCtl->fRedoIdle = true;
    1475     rc = VMR3ReqCallWait(PDMDevHlpGetVM(pDevIns), VMCPUID_ANY,
    1476                          (PFNRT)PDMDevHlpVMSuspend, 1, pDevIns);
    1477     AssertReleaseRC(rc);
    1478 }
    1479 
    1480 bool ataIsRedoSetWarning(ATADevState *s, int rc)
     1461static bool ataIsRedoSetWarning(ATADevState *s, int rc)
    14811462{
    14821463    PATACONTROLLER pCtl = ATADEVSTATE_2_CONTROLLER(s);
     
    14841465    if (rc == VERR_DISK_FULL)
    14851466    {
     1467        pCtl->fRedoIdle = true;
    14861468        ataWarningDiskFull(ATADEVSTATE_2_DEVINS(s));
    1487         ataSuspendRedo(pCtl);
    14881469        return true;
    14891470    }
    14901471    if (rc == VERR_FILE_TOO_BIG)
    14911472    {
     1473        pCtl->fRedoIdle = true;
    14921474        ataWarningFileTooBig(ATADEVSTATE_2_DEVINS(s));
    1493         ataSuspendRedo(pCtl);
    14941475        return true;
    14951476    }
    14961477    if (rc == VERR_BROKEN_PIPE || rc == VERR_NET_CONNECTION_REFUSED)
    14971478    {
     1479        pCtl->fRedoIdle = true;
    14981480        /* iSCSI connection abort (first error) or failure to reestablish
    14991481         * connection (second error). Pause VM. On resume we'll retry. */
    15001482        ataWarningISCSI(ATADEVSTATE_2_DEVINS(s));
    1501         ataSuspendRedo(pCtl);
    15021483        return true;
    15031484    }
     
    15061487
    15071488
    1508 static int ataReadSectors(ATADevState *s, uint64_t u64Sector, void *pvBuf, uint32_t cSectors, bool *fRedo)
     1489static int ataReadSectors(ATADevState *s, uint64_t u64Sector, void *pvBuf,
     1490                          uint32_t cSectors, bool *pfRedo)
    15091491{
    15101492    PATACONTROLLER pCtl = ATADEVSTATE_2_CONTROLLER(s);
     
    15221504
    15231505    if (RT_SUCCESS(rc))
    1524         *fRedo = false;
     1506        *pfRedo = false;
    15251507    else
    1526         *fRedo = ataIsRedoSetWarning(s, rc);
     1508        *pfRedo = ataIsRedoSetWarning(s, rc);
    15271509
    15281510    STAM_PROFILE_START(&pCtl->StatLockWait, a);
     
    15331515
    15341516
    1535 static int ataWriteSectors(ATADevState *s, uint64_t u64Sector, const void *pvBuf, uint32_t cSectors, bool *fRedo)
     1517static int ataWriteSectors(ATADevState *s, uint64_t u64Sector,
     1518                           const void *pvBuf, uint32_t cSectors, bool *pfRedo)
    15361519{
    15371520    PATACONTROLLER pCtl = ATADEVSTATE_2_CONTROLLER(s);
     
    15571540
    15581541    if (RT_SUCCESS(rc))
    1559         *fRedo = false;
     1542        *pfRedo = false;
    15601543    else
    1561         *fRedo = ataIsRedoSetWarning(s, rc);
     1544        *pfRedo = ataIsRedoSetWarning(s, rc);
    15621545
    15631546    STAM_PROFILE_START(&pCtl->StatLockWait, a);
     
    49234906                        LogRel(("PIIX3 ATA: Ctl#%d: redo PIO operation\n", ATACONTROLLER_IDX(pCtl)));
    49244907                        ataAsyncIOPutRequest(pCtl, &g_ataPIORequest);
    4925                         ataSuspendRedo(pCtl);
    49264908                        break;
    49274909                    }
     
    56815663            ASMAtomicWriteU32(&pThis->aCts[i].fShutdown, true);
    56825664            rc = RTSemEventSignal(pThis->aCts[i].AsyncIOSem);
     5665            AssertRC(rc);
     5666            rc = RTSemEventSignal(pThis->aCts[i].SuspendIOSem);
    56835667            AssertRC(rc);
    56845668        }
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