diff --git a/sys/dev/mpi3mr/mpi3mr_app.c b/sys/dev/mpi3mr/mpi3mr_app.c --- a/sys/dev/mpi3mr/mpi3mr_app.c +++ b/sys/dev/mpi3mr/mpi3mr_app.c @@ -797,6 +797,8 @@ struct mpi3mr_ioctl_mpt_dma_buffer *dma_buffers = NULL, *dma_buff = NULL; struct mpi3mr_ioctl_mpirepbuf *mpirepbuf = NULL; struct mpi3mr_ioctl_mptcmd *karg = (struct mpi3mr_ioctl_mptcmd *)uarg; + struct mpi3mr_target *tgtdev = NULL; + Mpi3SCSITaskMgmtRequest_t *tm_req = NULL; sc = mpi3mr_app_get_adp_instance(karg->mrioc_id); @@ -1060,6 +1062,18 @@ } } + if (mpi_header->Function == MPI3_FUNCTION_SCSI_TASK_MGMT) { + tm_req = (Mpi3SCSITaskMgmtRequest_t *)mpi_request; + if (tm_req->TaskType != MPI3_SCSITASKMGMT_TASKTYPE_ABORT_TASK) { + tgtdev = mpi3mr_find_target_by_dev_handle(sc->cam_sc, tm_req->DevHandle); + if (!tgtdev) { + rval = ENODEV; + goto out; + } + mpi3mr_atomic_inc(&tgtdev->block_io); + } + } + sc->ioctl_cmds.state = MPI3MR_CMD_PENDING; sc->ioctl_cmds.is_waiting = 1; sc->ioctl_cmds.callback = NULL; @@ -1178,6 +1192,9 @@ sc->mpi3mr_aen_triggered = 0; out_failed: + if (tgtdev) + mpi3mr_atomic_dec(&tgtdev->block_io); + sc->ioctl_cmds.is_senseprst = 0; sc->ioctl_cmds.sensebuf = NULL; sc->ioctl_cmds.state = MPI3MR_CMD_NOTUSED;