Skip to content

Commit

Permalink
[SCSI] target: Fix SCF_SCSI_CONTROL_SG_IO_CDB breakage
Browse files Browse the repository at this point in the history
This patch fixes a bug introduced during the v4 control CDB emulation
refactoring that broke SCF_SCSI_CONTROL_SG_IO_CDB operation within
transport_map_control_cmd_to_task().  It moves the BUG_ON() into
transport_do_se_mem_map() after the TRANSPORT(dev)->do_se_mem_map()
RAMDISK_DR special case, and adds the proper struct se_mem assignment
when !list_empty() for normal non RAMDISK_DR backend device cases.

Reported-by: Kai-Thorsten Hambrecht <kai@hambrecht.org>
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
  • Loading branch information
Nicholas Bellinger authored and James Bottomley committed Feb 12, 2011
1 parent 7c2bf6e commit e63af95
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/target/target_core_transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -4827,6 +4827,8 @@ static int transport_do_se_mem_map(

return ret;
}

BUG_ON(list_empty(se_mem_list));
/*
* This is the normal path for all normal non BIDI and BIDI-COMMAND
* WRITE payloads.. If we need to do BIDI READ passthrough for
Expand Down Expand Up @@ -5008,7 +5010,9 @@ transport_map_control_cmd_to_task(struct se_cmd *cmd)
struct se_mem *se_mem = NULL, *se_mem_lout = NULL;
u32 se_mem_cnt = 0, task_offset = 0;

BUG_ON(list_empty(cmd->t_task->t_mem_list));
if (!list_empty(T_TASK(cmd)->t_mem_list))
se_mem = list_entry(T_TASK(cmd)->t_mem_list->next,
struct se_mem, se_list);

ret = transport_do_se_mem_map(dev, task,
cmd->t_task->t_mem_list, NULL, se_mem,
Expand Down

0 comments on commit e63af95

Please sign in to comment.