VirtualBox

Changeset 31619 in vbox


Ignore:
Timestamp:
Aug 12, 2010 7:01:05 PM (14 years ago)
Author:
vboxsync
Message:

iSCSI: Read timeout handling for poll to catch broken connections

File:
1 edited

Legend:

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

    r31617 r31619  
    618618    /** PDU we are currently transmitting. */
    619619    PISCSIPDUTX         pIScsiPDUTxCur;
    620 
     620    /** Number of commands waiting for an answer from the target.
     621     * Used for timeout handling for poll.
     622     */
     623    unsigned            cCmdsWaiting;
    621624    /** Table of commands waiting for a response from the target. */
    622625    PISCSICMD           aCmdsWaiting[ISCSI_CMD_WAITING_ENTRIES];
     
    751754    pIScsiCmd->pNext = pIScsiCmdOld;
    752755    pImage->aCmdsWaiting[idx] = pIScsiCmd;
     756    pImage->cCmdsWaiting++;
    753757}
    754758
     
    780784            Assert(!pImage->aCmdsWaiting[idx] || VALID_PTR(pImage->aCmdsWaiting[idx]));
    781785        }
    782 
     786        pImage->cCmdsWaiting--;
    783787    }
    784788
     
    32653269
    32663270        /* Wait for work or for data from the target. */
    3267         rc = iscsiIoThreadWait(pImage, RT_INDEFINITE_WAIT, pImage->fPollEvents, &fEvents);
     3271        RTMSINTERVAL msWait;
     3272
     3273        if (pImage->cCmdsWaiting)
     3274            msWait = pImage->uReadTimeout;
     3275        else
     3276            msWait = RT_INDEFINITE_WAIT;
     3277
     3278        rc = iscsiIoThreadWait(pImage, msWait, pImage->fPollEvents, &fEvents);
    32683279        if (rc == VERR_INTERRUPTED)
    32693280        {
     
    32933304                pIScsiCmd = iscsiCmdGet(pImage);
    32943305            }
     3306        }
     3307        else if (rc == VERR_TIMEOUT)
     3308        {
     3309            /*
     3310             * We are waiting for a response from the target but
     3311             * it didn't answered yet.
     3312             * We assume the connection is broken and try to reconnect.
     3313             */
     3314            LogFlow(("Timed out while waiting for an asnwer from the target, reconnecting\n"));
     3315            iscsiReattach(pImage);
    32953316        }
    32963317        else if (RT_SUCCESS(rc))
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