VirtualBox

Ignore:
Timestamp:
Oct 2, 2008 10:09:58 AM (16 years ago)
Author:
vboxsync
Message:

Solaris/vboxnetflt: Flush the queues to see if it helps the SetActive race.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFlt-solaris.c

    r12863 r12921  
    611611     * Check for the VirtualBox instance.
    612612     */
    613     if (RT_UNLIKELY(!g_VBoxNetFltSolarisInstance))
     613    PVBOXNETFLTINS pThis = g_VBoxNetFltSolarisInstance;
     614    if (!pThis)
    614615    {
    615616        LogRel((DEVICE_NAME ":VBoxNetFltSolarisModOpen failed to get VirtualBox instance.\n"));
     
    617618    }
    618619
    619     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    620     PVBOXNETFLTINS pThis = g_VBoxNetFltSolarisInstance;
    621     RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
    622 
    623620    /*
    624621     * Check VirtualBox stream type.
     
    627624    {
    628625        LogRel((DEVICE_NAME ":VBoxNetFltSolarisModOpen failed due to undefined VirtualBox open mode.\n"));
    629 
    630         RTSpinlockRelease(pThis->hSpinlock, &Tmp);
    631626        return ENOENT;
    632627    }
     
    657652        {
    658653            LogRel((DEVICE_NAME ":VBoxNetFltSolarisModOpen failed to allocate promiscuous stream data.\n"));
    659 
    660             RTSpinlockRelease(pThis->hSpinlock, &Tmp);
    661654            return ENOMEM;
    662655        }
     
    679672        {
    680673            LogRel((DEVICE_NAME ":VBoxNetFltSolarisModOpen failed to allocate stream data.\n"));
    681 
    682             RTSpinlockRelease(pThis->hSpinlock, &Tmp);
    683674            return ENOMEM;
    684675        }
     
    700691        default:    /* Heh. */
    701692        {
    702             RTSpinlockRelease(pThis->hSpinlock, &Tmp);
    703693            AssertRelease(pStream->Type);
    704694            break;
     
    715705    *ppPrevStream = pStream;
    716706
    717     RTSpinlockRelease(pThis->hSpinlock, &Tmp);
    718707    qprocson(pQueue);
    719708
     
    783772    vboxnetflt_stream_t **ppPrevStream = NULL;
    784773
    785     qprocsoff(pQueue);
    786 
    787774    /*
    788775     * Get instance data.
     
    795782    }
    796783
    797     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    798     PVBOXNETFLTINS pThis = ASMAtomicUoReadPtr((void * volatile *)&pStream->pThis);
    799     RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
     784    if (pStream->Type == kPromiscStream)
     785    {
     786        flushq(pQueue, FLUSHALL);
     787        flushq(WR(pQueue), FLUSHALL);
     788    }
     789
     790    qprocsoff(pQueue);
     791
     792    if (pStream->Type == kPromiscStream)
     793    {
     794        vboxnetflt_promisc_stream_t *pPromiscStream = (vboxnetflt_promisc_stream_t *)pStream;
     795
     796        int rc = RTSemFastMutexRequest(pStream->pThis->u.s.hFastMtx);
     797        AssertRCReturn(rc, rc);
     798
     799        /*
     800         * Free-up loopback buffers.
     801         */
     802        PVBOXNETFLTPACKETID pCur = pPromiscStream->pHead;
     803        while (pCur)
     804        {
     805            PVBOXNETFLTPACKETID pNext = pCur->pNext;
     806            RTMemFree(pCur);
     807            pCur = pNext;
     808        }
     809        pPromiscStream->pHead = NULL;
     810        pPromiscStream->pTail = NULL;
     811        pPromiscStream->cLoopback = 0;
     812
     813        RTSemFastMutexRelease(pStream->pThis->u.s.hFastMtx);
     814    }
    800815
    801816    /*
     
    817832        default:    /* Heh. */
    818833        {
    819             RTSpinlockRelease(pThis->hSpinlock, &Tmp);
    820834            AssertRelease(pStream->Type);
    821835            break;
     
    830844    NOREF(pCred);
    831845
    832     RTSpinlockRelease(pThis->hSpinlock, &Tmp);
    833 
    834846    return 0;
    835847}
     
    846858static int VBoxNetFltSolarisModReadPut(queue_t *pQueue, mblk_t *pMsg)
    847859{
     860    if (!pMsg)
     861        return 0;
     862
    848863    LogFlow((DEVICE_NAME ":VBoxNetFltSolarisModReadPut pQueue=%p pMsg=%p\n", pQueue, pMsg));
    849864
     
    856871     * is somehow still in the host stream we must try not to panic the host.
    857872     */
    858     if (   pMsg
    859         && pStream
     873    if (   pStream
    860874        && pStream->Type == kPromiscStream)
    861875    {
     
    977991            }
    978992
    979             vboxNetFltRelease(pThis, true);       
     993            vboxNetFltRelease(pThis, true);
    980994        }
    981995        else
     
    15671581static void vboxNetFltSolarisCloseStream(PVBOXNETFLTINS pThis)
    15681582{
    1569     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    1570     RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
    1571 
    1572     vboxnetflt_promisc_stream_t *pPromiscStream = ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pvPromiscStream);
    1573     if (pPromiscStream)
    1574     {
    1575         /*
    1576          * Free-up loopback buffers.
    1577          */
    1578         PVBOXNETFLTPACKETID pCur = pPromiscStream->pHead;
    1579         while (pCur)
    1580         {
    1581             PVBOXNETFLTPACKETID pNext = pCur->pNext;
    1582             RTMemFree(pCur);
    1583             pCur = pNext;
    1584         }
    1585         pPromiscStream->pHead = NULL;
    1586         pPromiscStream->pTail = NULL;
    1587         pPromiscStream->cLoopback = 0;
    1588     }
    1589 
    1590     RTSpinlockRelease(pThis->hSpinlock, &Tmp);
    15911583    ldi_close(pThis->u.s.hIface, FREAD | FWRITE, kcred);
    15921584}
     
    23692361        fIsOurPacket = true;
    23702362
    2371         LogFlow((DEVICE_NAME ":vboxNetFltSolarisIsOurMBlk found packet %p cLoopback=%d\n", pMsg, pPromiscStream->cLoopback));
     2363        LogFlow((DEVICE_NAME ":vboxNetFltSolarisIsOurMBlk found packet %p Checksum=%u cLoopbackQ=%d\n", pMsg, Checksum,
     2364                    pPromiscStream->cLoopback));
    23722365        break;
    23732366    }
     
    27072700    if (pStream)
    27082701    {
    2709         int rc = vboxNetFltSolarisPromiscReq(pStream->pReadQueue, fActive);
    2710         if (RT_FAILURE(rc))
    2711             LogRel((DEVICE_NAME ":vboxNetFltPortOsSetActive failed to request promiscuous mode! rc=%d\n", rc));
     2702        if (pStream->pReadQueue)
     2703        {
     2704            int rc = vboxNetFltSolarisPromiscReq(pStream->pReadQueue, fActive);
     2705            if (RT_FAILURE(rc))
     2706                LogRel((DEVICE_NAME ":vboxNetFltPortOsSetActive failed to request promiscuous mode! rc=%d\n", rc));
     2707        }
     2708        else
     2709            LogRel((DEVICE_NAME ":vboxNetFltPortOsSetActive queue not found!\n"));           
    27122710    }
    27132711    else
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