win-pvdrivers

changeset 872:e476e0b66aa6

Fixed stupid bugs in reset handling.
author James Harper <james.harper@bendigoit.com.au>
date Thu Mar 03 21:05:11 2011 +1100 (2011-03-03)
parents babee70630ad
children 4722ecc909c3
files xenvbd/xenvbd_scsiport.c
line diff
     1.1 --- a/xenvbd/xenvbd_scsiport.c	Thu Mar 03 17:28:23 2011 +1100
     1.2 +++ b/xenvbd/xenvbd_scsiport.c	Thu Mar 03 21:05:11 2011 +1100
     1.3 @@ -1005,22 +1005,22 @@ XenVbd_HwScsiInterrupt(PVOID DeviceExten
     1.4          break;
     1.5        case RING_DETECT_STATE_COMPLETE:
     1.6          shadow = &xvdd->shadows[rep->id];
     1.7 -        srb = shadow->srb;
     1.8 -        ASSERT(srb != NULL);
     1.9 -        block_count = decode_cdb_length(srb);
    1.10 -        block_count *= xvdd->bytes_per_sector / 512;
    1.11 -        #if DBG
    1.12 -        srb_entry = srb->SrbExtension;
    1.13 -        elapsed = (ULONG)((current_time.QuadPart - shadow->ring_submit_time.QuadPart) / 10000L);
    1.14 -        if (elapsed > 5000)
    1.15 -          KdPrint((__DRIVER_NAME "     WARNING: SRB completion time %dms\n", elapsed));
    1.16 -        #endif
    1.17          if (shadow->reset)
    1.18          {
    1.19 -          KdPrint((__DRIVER_NAME "     discarding reset SRB %p\n", srb));
    1.20 +          KdPrint((__DRIVER_NAME "     discarding reset shadow\n"));
    1.21          }
    1.22          else
    1.23          {
    1.24 +          srb = shadow->srb;
    1.25 +          ASSERT(srb != NULL);
    1.26 +          block_count = decode_cdb_length(srb);
    1.27 +          block_count *= xvdd->bytes_per_sector / 512;
    1.28 +          #if DBG
    1.29 +          srb_entry = srb->SrbExtension;
    1.30 +          elapsed = (ULONG)((current_time.QuadPart - shadow->ring_submit_time.QuadPart) / 10000L);
    1.31 +          if (elapsed > 5000)
    1.32 +            KdPrint((__DRIVER_NAME "     WARNING: SRB completion time %dms\n", elapsed));
    1.33 +          #endif
    1.34            if (rep->status == BLKIF_RSP_OKAY || (dump_mode &&  dump_mode_errors++ < DUMP_MODE_ERROR_LIMIT))
    1.35              /* a few errors occur in dump mode because Xen refuses to allow us to map pages we are using for other stuff. Just ignore them */
    1.36              srb->SrbStatus = SRB_STATUS_SUCCESS;
    1.37 @@ -1058,6 +1058,7 @@ XenVbd_HwScsiInterrupt(PVOID DeviceExten
    1.38              if (decode_cdb_is_read(srb))
    1.39                memcpy(srb->DataBuffer, xvdd->aligned_buffer, block_count * 512);
    1.40            }
    1.41 +          ScsiPortNotification(RequestComplete, xvdd, srb);
    1.42          }
    1.43          
    1.44          for (j = 0; j < shadow->req.nr_segments; j++)
    1.45 @@ -1073,8 +1074,6 @@ XenVbd_HwScsiInterrupt(PVOID DeviceExten
    1.46                shadow->req.seg[j].gref, FALSE, (ULONG)'SCSI');
    1.47            }
    1.48          }
    1.49 -        if (!shadow->reset)
    1.50 -          ScsiPortNotification(RequestComplete, xvdd, srb);
    1.51          shadow->aligned_buffer_in_use = FALSE;
    1.52          shadow->reset = FALSE;
    1.53          shadow->srb = NULL;