Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/iscsi/iscsi.c
Show First 20 Lines • Show All 361 Lines • ▼ Show 20 Lines | iscsi_session_cleanup(struct iscsi_session *is, bool destroy_sim) | ||||
if (is->is_sim == NULL) | if (is->is_sim == NULL) | ||||
return; | return; | ||||
ISCSI_SESSION_DEBUG(is, "deregistering SIM"); | ISCSI_SESSION_DEBUG(is, "deregistering SIM"); | ||||
xpt_async(AC_LOST_DEVICE, is->is_path, NULL); | xpt_async(AC_LOST_DEVICE, is->is_path, NULL); | ||||
if (is->is_simq_frozen) { | if (is->is_simq_frozen) { | ||||
xpt_release_simq(is->is_sim, 1); | |||||
is->is_simq_frozen = false; | is->is_simq_frozen = false; | ||||
xpt_release_simq(is->is_sim, 1); | |||||
} | } | ||||
xpt_free_path(is->is_path); | xpt_free_path(is->is_path); | ||||
is->is_path = NULL; | is->is_path = NULL; | ||||
xpt_bus_deregister(cam_sim_path(is->is_sim)); | xpt_bus_deregister(cam_sim_path(is->is_sim)); | ||||
cam_sim_free(is->is_sim, TRUE /*free_devq*/); | cam_sim_free(is->is_sim, TRUE /*free_devq*/); | ||||
is->is_sim = NULL; | is->is_sim = NULL; | ||||
is->is_devq = NULL; | is->is_devq = NULL; | ||||
▲ Show 20 Lines • Show All 1,094 Lines • ▼ Show 20 Lines | iscsi_ioctl_daemon_handoff(struct iscsi_softc *sc, | ||||
if (is->is_sim != NULL) { | if (is->is_sim != NULL) { | ||||
/* | /* | ||||
* When reconnecting, there already is SIM allocated for the session. | * When reconnecting, there already is SIM allocated for the session. | ||||
*/ | */ | ||||
KASSERT(is->is_simq_frozen, ("reconnect without frozen simq")); | KASSERT(is->is_simq_frozen, ("reconnect without frozen simq")); | ||||
ISCSI_SESSION_LOCK(is); | ISCSI_SESSION_LOCK(is); | ||||
ISCSI_SESSION_DEBUG(is, "releasing"); | ISCSI_SESSION_DEBUG(is, "releasing"); | ||||
xpt_release_simq(is->is_sim, 1); | |||||
is->is_simq_frozen = false; | is->is_simq_frozen = false; | ||||
xpt_release_simq(is->is_sim, 1); | |||||
ISCSI_SESSION_UNLOCK(is); | ISCSI_SESSION_UNLOCK(is); | ||||
} else { | } else { | ||||
ISCSI_SESSION_LOCK(is); | ISCSI_SESSION_LOCK(is); | ||||
is->is_devq = cam_simq_alloc(ic->ic_maxtags); | is->is_devq = cam_simq_alloc(ic->ic_maxtags); | ||||
if (is->is_devq == NULL) { | if (is->is_devq == NULL) { | ||||
ISCSI_SESSION_WARN(is, "failed to allocate simq"); | ISCSI_SESSION_WARN(is, "failed to allocate simq"); | ||||
iscsi_session_terminate(is); | iscsi_session_terminate(is); | ||||
▲ Show 20 Lines • Show All 854 Lines • ▼ Show 20 Lines | iscsi_action(struct cam_sim *sim, union ccb *ccb) | ||||
is = cam_sim_softc(sim); | is = cam_sim_softc(sim); | ||||
ISCSI_SESSION_LOCK_ASSERT(is); | ISCSI_SESSION_LOCK_ASSERT(is); | ||||
if (is->is_terminating || | if (is->is_terminating || | ||||
(is->is_connected == false && fail_on_disconnection)) { | (is->is_connected == false && fail_on_disconnection)) { | ||||
ccb->ccb_h.status = CAM_DEV_NOT_THERE; | ccb->ccb_h.status = CAM_DEV_NOT_THERE; | ||||
xpt_done(ccb); | |||||
return; | |||||
} | |||||
/* | |||||
* Make sure CAM doesn't sneak in a CCB just after freezing the queue. | |||||
*/ | |||||
if (is->is_simq_frozen == true) { | |||||
ccb->ccb_h.status &= ~(CAM_SIM_QUEUED | CAM_STATUS_MASK); | |||||
ccb->ccb_h.status |= CAM_REQUEUE_REQ; | |||||
/* Don't freeze the devq - the SIM queue is already frozen. */ | |||||
xpt_done(ccb); | xpt_done(ccb); | ||||
return; | return; | ||||
} | } | ||||
switch (ccb->ccb_h.func_code) { | switch (ccb->ccb_h.func_code) { | ||||
case XPT_PATH_INQ: | case XPT_PATH_INQ: | ||||
{ | { | ||||
struct ccb_pathinq *cpi = &ccb->cpi; | struct ccb_pathinq *cpi = &ccb->cpi; | ||||
▲ Show 20 Lines • Show All 252 Lines • Show Last 20 Lines |