never retry oustanding requests when terminating iscsi session

CAM_REQ_ABORTED sounds natural for aborting outstanding requests when
tearing down a session, but that status actually causes eligible
requests to be tried again.  That's completely useless, so let's use
CAM_DEV_NOT_THERE instead.  Perhaps there is a better status, but this
should be good enough.  The change should affect only the session
termination.

Tested by:	Ben RUBSON <ben.rubson@gmail.com>
Reviewed by:	mav, trasz
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D12653
This commit is contained in:
Andriy Gapon 2017-10-17 16:03:59 +00:00
parent 20e9cab5fa
commit ad10496cf4

View File

@ -291,17 +291,14 @@ iscsi_session_logout(struct iscsi_session *is)
static void
iscsi_session_terminate_task(struct iscsi_session *is,
struct iscsi_outstanding *io, bool requeue)
struct iscsi_outstanding *io, cam_status status)
{
ISCSI_SESSION_LOCK_ASSERT(is);
if (io->io_ccb != NULL) {
io->io_ccb->ccb_h.status &= ~(CAM_SIM_QUEUED | CAM_STATUS_MASK);
if (requeue)
io->io_ccb->ccb_h.status |= CAM_REQUEUE_REQ;
else
io->io_ccb->ccb_h.status |= CAM_REQ_ABORTED;
io->io_ccb->ccb_h.status |= status;
if ((io->io_ccb->ccb_h.status & CAM_DEV_QFRZN) == 0) {
io->io_ccb->ccb_h.status |= CAM_DEV_QFRZN;
xpt_freeze_devq(io->io_ccb->ccb_h.path, 1);
@ -313,14 +310,14 @@ iscsi_session_terminate_task(struct iscsi_session *is,
}
static void
iscsi_session_terminate_tasks(struct iscsi_session *is, bool requeue)
iscsi_session_terminate_tasks(struct iscsi_session *is, cam_status status)
{
struct iscsi_outstanding *io, *tmp;
ISCSI_SESSION_LOCK_ASSERT(is);
TAILQ_FOREACH_SAFE(io, &is->is_outstanding, io_next, tmp) {
iscsi_session_terminate_task(is, io, requeue);
iscsi_session_terminate_task(is, io, status);
}
}
@ -354,11 +351,11 @@ iscsi_session_cleanup(struct iscsi_session *is, bool destroy_sim)
/*
* Terminate SCSI tasks, asking CAM to requeue them.
*/
iscsi_session_terminate_tasks(is, true);
iscsi_session_terminate_tasks(is, CAM_REQUEUE_REQ);
return;
}
iscsi_session_terminate_tasks(is, false);
iscsi_session_terminate_tasks(is, CAM_DEV_NOT_THERE);
if (is->is_sim == NULL)
return;
@ -1021,7 +1018,7 @@ iscsi_pdu_handle_task_response(struct icl_pdu *response)
} else {
aio = iscsi_outstanding_find(is, io->io_datasn);
if (aio != NULL && aio->io_ccb != NULL)
iscsi_session_terminate_task(is, aio, false);
iscsi_session_terminate_task(is, aio, CAM_REQ_ABORTED);
}
iscsi_outstanding_remove(is, io);