From: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx> This patch moves control path CDB emulation transport_emulate_control_cdb() calls from IBLOCK, FILEIO and RAMDISK spa->do_task() into a generic location in __transport_execute_tasks(). This code is called by all non TCM/pSCSI backstores to handle internal SCF_SCSI_DATA_SG_IO_CDB emulation. Signed-off-by: Nicholas A. Bellinger <nab@xxxxxxxxxxxxxxx> Reported-by: Christoph Hellwig <hch@xxxxxx> --- drivers/target/target_core_file.c | 3 --- drivers/target/target_core_iblock.c | 3 --- drivers/target/target_core_rd.c | 3 --- drivers/target/target_core_transport.c | 17 ++++++++++++++++- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c index 62b4b4e..a5ad51c 100644 --- a/drivers/target/target_core_file.c +++ b/drivers/target/target_core_file.c @@ -783,9 +783,6 @@ static int fd_do_task(struct se_task *task) struct fd_request *req = task->transport_req; int ret = 0; - if (!(TASK_CMD(task)->se_cmd_flags & SCF_SCSI_DATA_SG_IO_CDB)) - return transport_emulate_control_cdb(task); - req->fd_lba = task->task_lba; req->fd_size = task->task_size; /* diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c index 061c513..d999f10 100644 --- a/drivers/target/target_core_iblock.c +++ b/drivers/target/target_core_iblock.c @@ -584,9 +584,6 @@ static int iblock_do_task(struct se_task *task) int write = (TASK_CMD(task)->data_direction == DMA_TO_DEVICE); int ret; - if (!(TASK_CMD(task)->se_cmd_flags & SCF_SCSI_DATA_SG_IO_CDB)) - return transport_emulate_control_cdb(task); - while (bio) { nbio = bio->bi_next; bio->bi_next = NULL; diff --git a/drivers/target/target_core_rd.c b/drivers/target/target_core_rd.c index fe27e59..374cd16 100644 --- a/drivers/target/target_core_rd.c +++ b/drivers/target/target_core_rd.c @@ -710,9 +710,6 @@ static int rd_MEMCPY_do_task(struct se_task *task) struct rd_request *req = task->transport_req; int ret; - if (!(TASK_CMD(task)->se_cmd_flags & SCF_SCSI_DATA_SG_IO_CDB)) - return transport_emulate_control_cdb(task); - req->rd_lba = task->task_lba; req->rd_page = (req->rd_lba * DEV_ATTRIB(dev)->block_size) / PAGE_SIZE; req->rd_offset = (do_div(req->rd_lba, diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index d02644c..e678686 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -4253,7 +4253,22 @@ check_depth: transport_complete_task(task, 1); } } else { - error = TRANSPORT(dev)->do_task(task); + /* + * Currently for all virtual TCM plugins including IBLOCK, FILEIO and + * RAMDISK we use the internal transport_emulate_control_cdb() logic + * with struct se_subsystem_api callers for the primary SPC-3 TYPE_DISK + * LUN emulation code. + * + * For TCM/pSCSI and all other SCF_SCSI_DATA_SG_IO_CDB I/O tasks we + * call ->do_task() directly and let the underlying TCM subsystem plugin + * code handle the CDB emulation. + */ + if ((TRANSPORT(dev)->transport_type != TRANSPORT_PLUGIN_PHBA_PDEV) && + (!(TASK_CMD(task)->se_cmd_flags & SCF_SCSI_DATA_SG_IO_CDB))) + error = transport_emulate_control_cdb(task); + else + error = TRANSPORT(dev)->do_task(task); + if (error != 0) { cmd->transport_error_status = error; atomic_set(&task->task_active, 0); -- 1.5.6.5 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html