aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target/iscsi
diff options
context:
space:
mode:
authorShlomo Pongratz <shlomop@mellanox.com>2013-05-05 10:36:26 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2013-05-07 19:51:58 -0400
commit3eccfdb01da58fbd0f789ae6ca61cee3769e26de (patch)
treed737a4dd65cfa7754277ae53a97fc8109c831b99 /drivers/target/iscsi
parent80690fdb959a652e02d4f40a684bd39586be9f32 (diff)
iscsi-target: Fix processing of OOO commands
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 <shlomop@mellanox.com> Cc: <stable@vger.kernel.org> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/iscsi')
-rw-r--r--drivers/target/iscsi/iscsi_target_erl1.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/target/iscsi/iscsi_target_erl1.c b/drivers/target/iscsi/iscsi_target_erl1.c
index 7816af6cdd12..40d9dbca987b 100644
--- a/drivers/target/iscsi/iscsi_target_erl1.c
+++ b/drivers/target/iscsi/iscsi_target_erl1.c
@@ -823,7 +823,7 @@ static int iscsit_attach_ooo_cmdsn(
823 /* 823 /*
824 * CmdSN is greater than the tail of the list. 824 * CmdSN is greater than the tail of the list.
825 */ 825 */
826 if (ooo_tail->cmdsn < ooo_cmdsn->cmdsn) 826 if (iscsi_sna_lt(ooo_tail->cmdsn, ooo_cmdsn->cmdsn))
827 list_add_tail(&ooo_cmdsn->ooo_list, 827 list_add_tail(&ooo_cmdsn->ooo_list,
828 &sess->sess_ooo_cmdsn_list); 828 &sess->sess_ooo_cmdsn_list);
829 else { 829 else {
@@ -833,11 +833,12 @@ static int iscsit_attach_ooo_cmdsn(
833 */ 833 */
834 list_for_each_entry(ooo_tmp, &sess->sess_ooo_cmdsn_list, 834 list_for_each_entry(ooo_tmp, &sess->sess_ooo_cmdsn_list,
835 ooo_list) { 835 ooo_list) {
836 if (ooo_tmp->cmdsn < ooo_cmdsn->cmdsn) 836 if (iscsi_sna_lt(ooo_tmp->cmdsn, ooo_cmdsn->cmdsn))
837 continue; 837 continue;
838 838
839 /* Insert before this entry */
839 list_add(&ooo_cmdsn->ooo_list, 840 list_add(&ooo_cmdsn->ooo_list,
840 &ooo_tmp->ooo_list); 841 ooo_tmp->ooo_list.prev);
841 break; 842 break;
842 } 843 }
843 } 844 }