Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Oct 2017 16:04:00 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r324694 - head/sys/dev/iscsi
Message-ID:  <201710171604.v9HG40a5014842@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Tue Oct 17 16:03:59 2017
New Revision: 324694
URL: https://svnweb.freebsd.org/changeset/base/324694

Log:
  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

Modified:
  head/sys/dev/iscsi/iscsi.c

Modified: head/sys/dev/iscsi/iscsi.c
==============================================================================
--- head/sys/dev/iscsi/iscsi.c	Tue Oct 17 15:53:22 2017	(r324693)
+++ head/sys/dev/iscsi/iscsi.c	Tue Oct 17 16:03:59 2017	(r324694)
@@ -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 d
 		/*
 		 * 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 *respons
 	} 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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201710171604.v9HG40a5014842>