target: Fix multi task->task_sg[] chaining logic bug
authorNicholas Bellinger <nab@linux-iscsi.org>
Fri, 20 May 2011 03:19:09 +0000 (20:19 -0700)
committerSteve Conklin <sconklin@canonical.com>
Fri, 15 Jul 2011 17:20:59 +0000 (12:20 -0500)
commitae13b9c8b4d38cef997274929a72f619bbadbd37
tree3cfeb3d036bd9ae20da2c9e8cce07c73858e88c8
parente46f5b6967b50e405de7463815e41613afcc321f
target: Fix multi task->task_sg[] chaining logic bug

BugLink: http://bugs.launchpad.net/bugs/793702

commit 97868c8905a1537153d406c4a3aa39a503a5c299 upstream.

This patch fixes a bug in transport_do_task_sg_chain() used by HW target
mode modules with sg_chain() to provide a single sg_next() walkable memory
layout for use with pci_map_sg() and friends.  This patch addresses an
issue with mapping multiple small block max_sector tasks across multiple
struct se_task->task_sg[] mappings for HW target mode operation.

This was causing OOPs with (cmd->t_task->t_tasks_no > 1) I/O traffic for
HW target drivers using transport_do_task_sg_chain(), and has been tested
so far with tcm_fc(openfcoe), tcm_qla2xxx, and ib_srpt fabrics with
t_tasks_no > 1 IBLOCK backends using a smaller max_sectors to trigger the
original issue.

Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Acked-by: Kiran Patil <kiran.patil@intel.com>
Signed-off-by: James Bottomley <jbottomley@parallels.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
drivers/target/target_core_transport.c