Patchwork [3.8.y.z,extended,stable] Patch "iscsi-target: Fix processing of OOO commands" has been added to staging queue

mail settings
Submitter Kamal Mostafa
Date May 22, 2013, 9:55 p.m.
Message ID <>
Download mbox | patch
Permalink /patch/245739/
State New
Headers show


Kamal Mostafa - May 22, 2013, 9:55 p.m.
This is a note to let you know that I have just added a patch titled

    iscsi-target: Fix processing of OOO commands

to the linux-3.8.y-queue branch of the 3.8.y.z extended stable tree 
which can be found at:;a=shortlog;h=refs/heads/linux-3.8.y-queue

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.8.y.z tree, see



From f1fd94136d91ee11b489bda99ee80e482babcade Mon Sep 17 00:00:00 2001
From: Shlomo Pongratz <>
Date: Sun, 5 May 2013 17:36:26 +0300
Subject: iscsi-target: Fix processing of OOO commands

commit 3eccfdb01da58fbd0f789ae6ca61cee3769e26de upstream.

Fix two issues in OOO commands processing done at iscsit_attach_ooo_cmdsn.

Handle command serial numbers wrap around by using iscsi_sna_lt and not regular comparisson.

The routine iterates until it finds an entry whose serial number is greater than the serial number of
the new one, thus the new entry should be inserted before that entry and not after.

Signed-off-by: Shlomo Pongratz <>
Signed-off-by: Nicholas Bellinger <>
Signed-off-by: Kamal Mostafa <>
 drivers/target/iscsi/iscsi_target_erl1.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)



diff --git a/drivers/target/iscsi/iscsi_target_erl1.c b/drivers/target/iscsi/iscsi_target_erl1.c
index 0b52a23..805f3d2 100644
--- a/drivers/target/iscsi/iscsi_target_erl1.c
+++ b/drivers/target/iscsi/iscsi_target_erl1.c
@@ -819,7 +819,7 @@  static int iscsit_attach_ooo_cmdsn(
 		 * CmdSN is greater than the tail of the list.
-		if (ooo_tail->cmdsn < ooo_cmdsn->cmdsn)
+		if (iscsi_sna_lt(ooo_tail->cmdsn, ooo_cmdsn->cmdsn))
 		else {
@@ -829,11 +829,12 @@  static int iscsit_attach_ooo_cmdsn(
 			list_for_each_entry(ooo_tmp, &sess->sess_ooo_cmdsn_list,
 						ooo_list) {
-				if (ooo_tmp->cmdsn < ooo_cmdsn->cmdsn)
+				if (iscsi_sna_lt(ooo_tmp->cmdsn, ooo_cmdsn->cmdsn))

+				/* Insert before this entry */
-					&ooo_tmp->ooo_list);
+					ooo_tmp->ooo_list.prev);