win-pvdrivers

changeset 779:fff1d7255040

handle the xenvbd out-of-grant-references condition sensibly
author James Harper <james.harper@bendigoit.com.au>
date Tue Feb 09 22:18:47 2010 +1100 (2010-02-09)
parents e0cfc7938e06
children 3da023729e6b
files xenvbd/xenvbd.c
line diff
     1.1 --- a/xenvbd/xenvbd.c	Sun Feb 07 14:16:15 2010 +1100
     1.2 +++ b/xenvbd/xenvbd.c	Tue Feb 09 22:18:47 2010 +1100
     1.3 @@ -407,7 +407,24 @@ XenVbd_PutSrbOnRing(PXENVBD_DEVICE_DATA 
     1.4      
     1.5      gref = xvdd->vectors.GntTbl_GrantAccess(xvdd->vectors.context, 0,
     1.6                (ULONG)(physical_address.QuadPart >> PAGE_SHIFT), FALSE, INVALID_GRANT_REF);
     1.7 -    ASSERT(gref != INVALID_GRANT_REF);
     1.8 +    if (gref == INVALID_GRANT_REF)
     1.9 +    {
    1.10 +      ULONG i;
    1.11 +      for (i = 0; i < shadow->req.nr_segments; i++)
    1.12 +      {
    1.13 +        xvdd->vectors.GntTbl_EndAccess(xvdd->vectors.context,
    1.14 +          shadow->req.seg[i].gref, FALSE);
    1.15 +      }
    1.16 +      if (shadow->aligned_buffer_in_use)
    1.17 +      {
    1.18 +        shadow->aligned_buffer_in_use = FALSE;
    1.19 +        xvdd->aligned_buffer_in_use = FALSE;
    1.20 +      }
    1.21 +      srb->SrbStatus = SRB_STATUS_BUSY;
    1.22 +      ScsiPortNotification(RequestComplete, xvdd, srb);
    1.23 +      KdPrint((__DRIVER_NAME "     Out of gref's. Deferring\n"));
    1.24 +      return;
    1.25 +    }
    1.26      offset = physical_address.LowPart & (PAGE_SIZE - 1);
    1.27      length = min(PAGE_SIZE - offset, remaining);
    1.28      ASSERT((offset & 511) == 0);