Author: mav
Date: Sun Feb 26 12:54:27 2017
New Revision: 314300
URL: https://svnweb.freebsd.org/changeset/base/314300

Log:
  Use resid field of CTIO to detect under/overruns.
  
  MFC after:    2 weeks

Modified:
  head/sys/cam/ctl/scsi_ctl.c

Modified: head/sys/cam/ctl/scsi_ctl.c
==============================================================================
--- head/sys/cam/ctl/scsi_ctl.c Sun Feb 26 12:52:44 2017        (r314299)
+++ head/sys/cam/ctl/scsi_ctl.c Sun Feb 26 12:54:27 2017        (r314300)
@@ -1253,7 +1253,8 @@ ctlfedone(struct cam_periph *periph, uni
                         */
                        switch (done_ccb->ccb_h.status & CAM_STATUS_MASK) {
                        case CAM_REQ_CMP:
-                               io->scsiio.kern_data_resid -= csio->dxfer_len;
+                               io->scsiio.kern_data_resid -=
+                                   csio->dxfer_len - csio->resid;
                                io->io_hdr.port_status = 0;
                                break;
                        default:
@@ -1280,8 +1281,8 @@ ctlfedone(struct cam_periph *periph, uni
                         * pieces, figure out where we are in the list, and
                         * continue sending pieces if necessary.
                         */
-                       if ((cmd_info->flags & CTLFE_CMD_PIECEWISE)
-                        && (io->io_hdr.port_status == 0)) {
+                       if ((cmd_info->flags & CTLFE_CMD_PIECEWISE) &&
+                           io->io_hdr.port_status == 0 && csio->resid == 0) {
                                ccb_flags flags;
                                uint8_t *data_ptr;
                                uint32_t dxfer_len;
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to