diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c --- a/sys/cam/ctl/ctl.c +++ b/sys/cam/ctl/ctl.c @@ -617,6 +617,8 @@ uint32_t sg_entries_sent; int do_sg_copy, i, j; + CTL_IO_ASSERT(io, SCSI); + memset(&msg.dt, 0, sizeof(msg.dt)); msg.hdr.msg_type = CTL_MSG_DATAMOVE; msg.hdr.original_sc = io->io_hdr.remote_io; @@ -1528,6 +1530,8 @@ /* XXX KDM do something here */ break; } + CTL_IO_ASSERT(io, SCSI); + io->io_hdr.msg_type = CTL_MSG_DATAMOVE; io->io_hdr.flags |= CTL_FLAG_IO_ACTIVE; /* @@ -1601,6 +1605,8 @@ * back to the initiator. */ io = msg->hdr.serializing_sc; + CTL_IO_ASSERT(io, SCSI); + io->io_hdr.msg_type = CTL_MSG_DATAMOVE_DONE; io->io_hdr.flags &= ~CTL_FLAG_DMA_INPROG; io->io_hdr.flags |= CTL_FLAG_IO_ACTIVE; @@ -2442,6 +2448,8 @@ union ctl_io *io = (union ctl_io *)ioh; struct ctl_ooa_entry *entry; + CTL_IO_ASSERT(io, SCSI); + /* * If we've got more than we can fit, just count the * remaining entries. @@ -5543,6 +5551,8 @@ struct ctl_lba_len_flags *lbalen; int retval; + CTL_IO_ASSERT(io, SCSI); + ctsio = &io->scsiio; ctsio->io_hdr.status = CTL_STATUS_NONE; lbalen = (struct ctl_lba_len_flags *) @@ -5888,6 +5898,8 @@ uint16_t *len_left, *len_used; int retval, i; + CTL_IO_ASSERT(io, SCSI); + ctsio = &io->scsiio; page_index = NULL; page_len = 0; @@ -8801,6 +8813,8 @@ struct ctl_lba_len_flags *lbalen; int retval; + CTL_IO_ASSERT(io, SCSI); + ctsio = &io->scsiio; ctsio->io_hdr.status = CTL_STATUS_NONE; ctsio->io_hdr.flags &= ~CTL_FLAG_IO_CONT; @@ -10841,6 +10855,8 @@ ctl_check_for_blockage(struct ctl_lun *lun, union ctl_io *pending_io, const uint8_t *serialize_row, union ctl_io *ooa_io) { + CTL_IO_ASSERT(pending_io, SCSI); + CTL_IO_ASSERT(ooa_io, SCSI); /* * The initiator attempted multiple untagged commands at the same @@ -10949,6 +10965,8 @@ const uint8_t *serialize_row; ctl_action action; + CTL_IO_ASSERT(pending_io, SCSI); + mtx_assert(&lun->lun_lock, MA_OWNED); /* @@ -11006,6 +11024,8 @@ union ctl_ha_msg msg_info; ctl_action action; + CTL_IO_ASSERT(io, SCSI); + mtx_assert(&lun->lun_lock, MA_OWNED); if (io->io_hdr.blocker == NULL) @@ -11246,6 +11266,8 @@ static void ctl_failover_io(union ctl_io *io, int have_lock) { + CTL_IO_ASSERT(io, SCSI); + ctl_set_busy(&io->scsiio); ctl_done(io); } @@ -11813,6 +11835,7 @@ if (!other_sc && !(lun->flags & CTL_LUN_PRIMARY_SC)) { union ctl_ha_msg msg_info; + CTL_IO_ASSERT(xio, SCSI); msg_info.hdr.nexus = xioh->nexus; msg_info.task.task_action = CTL_TASK_ABORT_TASK; msg_info.task.tag_num = xio->scsiio.tag_num; @@ -11953,6 +11976,8 @@ */ LIST_FOREACH(xioh, &lun->ooa_queue, ooa_links) { union ctl_io *xio = (union ctl_io *)xioh; + + CTL_IO_ASSERT(xio, SCSI); if ((xioh->nexus.targ_port != io->io_hdr.nexus.targ_port) || (xioh->nexus.initid != io->io_hdr.nexus.initid) || (xioh->flags & CTL_FLAG_ABORT)) @@ -12024,6 +12049,8 @@ mtx_unlock(&softc->ctl_lock); LIST_FOREACH(xioh, &lun->ooa_queue, ooa_links) { union ctl_io *xio = (union ctl_io *)xioh; + + CTL_IO_ASSERT(xio, SCSI); if ((xioh->nexus.targ_port != io->io_hdr.nexus.targ_port) || (xioh->nexus.initid != io->io_hdr.nexus.initid) || (xioh->flags & CTL_FLAG_ABORT)) @@ -12137,6 +12164,8 @@ const struct ctl_cmd_entry *entry; uint32_t targ_lun; + CTL_IO_ASSERT(io, SCSI); + targ_lun = io->io_hdr.nexus.targ_mapped_lun; switch (io->io_hdr.msg_type) { case CTL_MSG_SERIALIZE: @@ -12272,6 +12301,8 @@ { struct ctl_error_desc *desc, *desc2; + CTL_IO_ASSERT(io, SCSI); + mtx_assert(&lun->lun_lock, MA_OWNED); STAILQ_FOREACH_SAFE(desc, &lun->error_list, links, desc2) { @@ -12487,6 +12518,8 @@ struct bintime cur_bt; #endif + CTL_IO_ASSERT(io, SCSI); + memset(&msg, 0, sizeof(msg)); msg.hdr.msg_type = CTL_MSG_DATAMOVE_DONE; msg.hdr.original_sc = io; @@ -12529,6 +12562,7 @@ uint32_t i; io = rq->context; + CTL_IO_ASSERT(io, SCSI); if (rq->ret != CTL_HA_STATUS_SUCCESS) { printf("%s: ISC DMA write failed with error %d", __func__, @@ -12573,6 +12607,8 @@ int retval; void (*fe_datamove)(union ctl_io *io); + CTL_IO_ASSERT(io, SCSI); + /* * - Get the data from the host/HBA into local memory. * - DMA memory from the local controller to the remote controller. @@ -12601,6 +12637,8 @@ { uint32_t i; + CTL_IO_ASSERT(io, SCSI); + for (i = 0; i < io->scsiio.kern_sg_entries; i++) free(CTL_LSGLT(io)[i].addr, M_CTL); free(CTL_RSGL(io), M_CTL); @@ -12623,6 +12661,7 @@ void (*fe_datamove)(union ctl_io *io); io = rq->context; + CTL_IO_ASSERT(io, SCSI); if (rq->ret != CTL_HA_STATUS_SUCCESS) { printf("%s: ISC DMA read failed with error %d\n", __func__, @@ -12657,6 +12696,8 @@ int retval; int i; + CTL_IO_ASSERT(io, SCSI); + retval = 0; local_sglist = CTL_LSGL(io); len_to_go = io->scsiio.kern_data_len; @@ -12694,6 +12735,8 @@ rq = ctl_dt_req_alloc(); + CTL_IO_ASSERT(io, SCSI); + /* * If we failed to allocate the request, and if the DMA didn't fail * anyway, set busy status. This is just a resource allocation @@ -12845,6 +12888,7 @@ static void ctl_datamove_remote(union ctl_io *io) { + CTL_IO_ASSERT(io, SCSI); mtx_assert(&((struct ctl_softc *)CTL_SOFTC(io))->ctl_lock, MA_NOTOWNED); @@ -13104,6 +13148,7 @@ uint32_t initidx, p, targ_lun; CTL_DEBUG_PRINT(("ctl_queue_sense\n")); + CTL_IO_ASSERT(io, SCSI); targ_lun = ctl_lun_map_from_port(port, io->io_hdr.nexus.targ_lun);