Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Mar 2017 06:04:03 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r314582 - stable/11/sys/dev/iscsi
Message-ID:  <201703030604.v23643Yi006059@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Fri Mar  3 06:04:03 2017
New Revision: 314582
URL: https://svnweb.freebsd.org/changeset/base/314582

Log:
  MFC r313852: Freeze CAM SIM when request is postponed due to MaxCmdSN.
  
  This allows to avoid resource allocation (especially offload) for requests
  that can not be executed at this time any way.

Modified:
  stable/11/sys/dev/iscsi/iscsi.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/iscsi/iscsi.c
==============================================================================
--- stable/11/sys/dev/iscsi/iscsi.c	Fri Mar  3 06:03:01 2017	(r314581)
+++ stable/11/sys/dev/iscsi/iscsi.c	Fri Mar  3 06:04:03 2017	(r314582)
@@ -231,14 +231,16 @@ iscsi_session_send_postponed(struct iscs
 
 	ISCSI_SESSION_LOCK_ASSERT(is);
 
-	while (!STAILQ_EMPTY(&is->is_postponed)) {
-		request = STAILQ_FIRST(&is->is_postponed);
+	if (STAILQ_EMPTY(&is->is_postponed))
+		return;
+	while ((request = STAILQ_FIRST(&is->is_postponed)) != NULL) {
 		postpone = iscsi_pdu_prepare(request);
 		if (postpone)
-			break;
+			return;
 		STAILQ_REMOVE_HEAD(&is->is_postponed, ip_next);
 		icl_pdu_queue(request);
 	}
+	xpt_release_simq(is->is_sim, 1);
 }
 
 static void
@@ -252,6 +254,8 @@ iscsi_pdu_queue_locked(struct icl_pdu *r
 	iscsi_session_send_postponed(is);
 	postpone = iscsi_pdu_prepare(request);
 	if (postpone) {
+		if (STAILQ_EMPTY(&is->is_postponed))
+			xpt_freeze_simq(is->is_sim, 1);
 		STAILQ_INSERT_TAIL(&is->is_postponed, request, ip_next);
 		return;
 	}
@@ -339,8 +343,9 @@ iscsi_session_cleanup(struct iscsi_sessi
 	/*
 	 * Remove postponed PDUs.
 	 */
-	while (!STAILQ_EMPTY(&is->is_postponed)) {
-		pdu = STAILQ_FIRST(&is->is_postponed);
+	if (!STAILQ_EMPTY(&is->is_postponed))
+		xpt_release_simq(is->is_sim, 1);
+	while ((pdu = STAILQ_FIRST(&is->is_postponed)) != NULL) {
 		STAILQ_REMOVE_HEAD(&is->is_postponed, ip_next);
 		icl_pdu_free(pdu);
 	}



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