Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F178224284
D60340.1796280758.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
4 KB
Referenced Files
None
Subscribers
None
D60340.1796280758.diff
View Options
Index: sys/dev/mpi3mr/mpi3mr.h
===================================================================
--- sys/dev/mpi3mr/mpi3mr.h
+++ sys/dev/mpi3mr/mpi3mr.h
@@ -475,6 +475,7 @@
struct callout callout;
bool callout_owner;
U16 hosttag;
+ U16 targ_dev_handle;
U8 req_qidx;
Mpi3SCSIIORequest_t io_request;
};
Index: sys/dev/mpi3mr/mpi3mr.c
===================================================================
--- sys/dev/mpi3mr/mpi3mr.c
+++ sys/dev/mpi3mr/mpi3mr.c
@@ -5502,6 +5502,7 @@
cmd->data_dir = 0;
cmd->ccb = NULL;
cmd->targ = NULL;
+ cmd->targ_dev_handle = MPI3MR_INVALID_DEV_HANDLE;
cmd->state = MPI3MR_CMD_STATE_BUSY;
cmd->data = NULL;
cmd->length = 0;
@@ -5525,6 +5526,7 @@
TAILQ_INSERT_HEAD(&(sc->cmd_list_head), cmd, next);
cmd->state = MPI3MR_CMD_STATE_FREE;
cmd->req_qidx = 0;
+ cmd->targ_dev_handle = MPI3MR_INVALID_DEV_HANDLE;
mpi3mr_dprint(sc, MPI3MR_TRACE, "Release command SMID: 0x%x\n", cmd->hosttag);
mtx_unlock(&sc->cmd_pool_lock);
@@ -6392,6 +6394,7 @@
int i;
struct mpi3mr_cmd *cmd = NULL;
union ccb *ccb = NULL;
+ struct mpi3mr_target *target;
for (i = 0; i < sc->max_host_ios; i++) {
cmd = sc->cmd_list[i];
@@ -6401,7 +6404,27 @@
ccb = (union ccb *)(cmd->ccb);
ccb->ccb_h.status = CAM_SCSI_BUS_RESET;
mpi3mr_atomic_dec(&sc->fw_outstanding);
- mpi3mr_atomic_dec(&cmd->targ->outstanding);
+ target = mpi3mr_find_target_by_dev_handle(sc->cam_sc,
+ cmd->targ_dev_handle);
+ if (target != NULL) {
+ if (mpi3mr_atomic_read(&target->outstanding) > 0)
+ mpi3mr_atomic_dec(&target->outstanding);
+
+ if (!target->exposed_to_os && target->pending_remove) {
+ bool do_free = false;
+
+ mtx_lock_spin(&sc->target_lock);
+ if ((mpi3mr_atomic_read(&target->outstanding) == 0) &&
+ target->pending_remove) {
+ TAILQ_REMOVE(&sc->cam_sc->tgt_list, target, tgt_next);
+ target->pending_remove = false;
+ do_free = true;
+ }
+ mtx_unlock_spin(&sc->target_lock);
+ if (do_free)
+ free(target, M_MPI3MR);
+ }
+ }
mpi3mr_cmd_done(sc, cmd);
} else {
cmd->ccb = NULL;
Index: sys/dev/mpi3mr/mpi3mr_cam.c
===================================================================
--- sys/dev/mpi3mr/mpi3mr_cam.c
+++ sys/dev/mpi3mr/mpi3mr_cam.c
@@ -554,7 +554,7 @@
}
ccb = cmd->ccb;
- tgtdev = cmd->targ;
+ tgtdev = mpi3mr_find_target_by_dev_handle(sc->cam_sc, cmd->targ_dev_handle);
if (tgtdev == NULL) {
mpi3mr_dprint(sc, MPI3MR_ERROR, "Device does not exist target ID:0x%x,"
"TM is not required\n", ccb->ccb_h.target_id);
@@ -774,18 +774,17 @@
sc = cmd->sc;
- target = cmd->targ;
+ target = mpi3mr_find_target_by_dev_handle(sc->cam_sc, cmd->targ_dev_handle);
if (target == NULL) {
- mpi3mr_dprint(sc, MPI3MR_XINFO, "Device does not exist for target:0x%p,"
- "target reset is not required\n", target);
- return retval;
+ mpi3mr_dprint(sc, MPI3MR_XINFO, "Device does not exist for target handle:0x%x,"
+ "target reset is not required\n", cmd->targ_dev_handle);
+ return (retval);
}
mpi3mr_dprint(sc, MPI3MR_INFO,
"attempting target reset on target(%d)\n", target->per_id);
-
- if (mpi3mr_atomic_read(&target->outstanding)) {
+ if (!mpi3mr_atomic_read(&target->outstanding)) {
mpi3mr_dprint(sc, MPI3MR_INFO,
"no outstanding IOs on the target(%d),"
" target reset not required.\n", target->per_id);
@@ -890,7 +889,7 @@
* TMs are not supported for IO timeouts on VD/LD, so directly issue controller reset
* with max timeout for outstanding IOs to complete is 180sec.
*/
- targ_dev = cmd->targ;
+ targ_dev = mpi3mr_find_target_by_dev_handle(sc->cam_sc, cmd->targ_dev_handle);
if (targ_dev && (targ_dev->dev_type == MPI3_DEVICE_DEVFORM_VD)) {
if (mpi3mr_wait_for_host_io(sc, MPI3MR_RAID_ERRREC_RESET_TIMEOUT))
trigger_reset_from_watchdog(sc, MPI3MR_TRIGGER_SOFT_RESET, MPI3MR_RESET_FROM_SCSIIO_TIMEOUT);
@@ -1215,6 +1214,7 @@
cm->length = csio->dxfer_len;
cm->targ = targ;
+ cm->targ_dev_handle = targ->dev_handle;
int_to_lun(csio->ccb_h.target_lun, req->LUN);
cm->ccb = ccb;
csio->ccb_h.qos.sim_data = sbinuptime();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 3, 6:52 AM (20 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42174612
Default Alt Text
D60340.1796280758.diff (4 KB)
Attached To
Mode
D60340: mpi3mr: Re-resolve target handle during error recovery and flush
Attached
Detach File
Event Timeline