[3.5.y.z,extended,stable] Patch "iscsi-target: Fix immediate queue starvation regression with" has been added to staging queue

Submitted by Luis Henriques on March 4, 2013, 8:49 p.m.


Message ID 1362430162-22720-1-git-send-email-luis.henriques@canonical.com
State New
Headers show

Commit Message

Luis Henriques March 4, 2013, 8:49 p.m.
This is a note to let you know that I have just added a patch titled

    iscsi-target: Fix immediate queue starvation regression with

to the linux-3.5.y-queue branch of the 3.5.y.z extended stable tree 
which can be found at:


If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.5.y.z tree, see



From beba5d727beeae6f12f12a1df21cfbe413b4a501 Mon Sep 17 00:00:00 2001
From: Nicholas Bellinger <nab@linux-iscsi.org>
Date: Wed, 27 Feb 2013 17:53:52 -0800
Subject: [PATCH] iscsi-target: Fix immediate queue starvation regression with

commit fd3a9025c0349bc9b01d627529f54e6e1e389015 upstream.

This patch addresses a v3.5+ regression in iscsi-target where TX thread
process context -> handle_response_queue() execution is allowed to run
unbounded while servicing constant outgoing flow of ISTATE_SEND_DATAIN
response state.

This ends up preventing memory release of StatSN acknowledged commands
in a timely manner when under heavy large block streaming DATAIN

The regression bug was initially introduced with:

commit 6f3c0e69a9c20441bdc6d3b2d18b83b244384ec6
Author: Andy Grover <agrover@redhat.com>
Date:   Tue Apr 3 15:51:09 2012 -0700

    target/iscsi: Refactor target_tx_thread immediate+response queue loops

Go ahead and follow original iscsi_target_tx_thread() logic and check
to break for immediate queue processing after each DataIN Sequence and/or
Response PDU has been sent.

Reported-by: Benjamin ESTRABAUD <be@mpstor.com>
Cc: Andy Grover <agrover@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
 drivers/target/iscsi/iscsi_target.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)


Patch hide | download patch | download mbox

diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index ac41f04..3e7ac0c 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -3608,6 +3608,10 @@  check_rsp_state:
 				cmd->i_state = ISTATE_SENT_STATUS;
+				if (atomic_read(&conn->check_immediate_queue))
+					return 1;
 			} else if (ret == 2) {
 				/* Still must send status,
@@ -3697,7 +3701,7 @@  check_rsp_state:

 		if (atomic_read(&conn->check_immediate_queue))
-			break;
+			return 1;

 	return 0;
@@ -3741,12 +3745,15 @@  restart:
 			goto transport_err;

 		ret = handle_immediate_queue(conn);
 		if (ret < 0)
 			goto transport_err;

 		ret = handle_response_queue(conn);
-		if (ret == -EAGAIN)
+		if (ret == 1)
+			goto get_immediate;
+		else if (ret == -EAGAIN)
 			goto restart;
 		else if (ret < 0)
 			goto transport_err;