Skip to content

Commit

Permalink
target: Remove duplicate task completions in transport_emulate_contro…
Browse files Browse the repository at this point in the history
…l_cdb

This patch removes a duplicate set of transport_complete_task() calls in
target_emulate_unmap() and target_emulate_write_same() as the completion
call is already done within transport_emulate_control_cdb()

This patch also adds a check in transport_emulate_control_cdb() for the
existing SCF_EMULATE_CDB_ASYNC flag currently used by SYNCHRONIZE_CACHE
in order to handle IMMEDIATE processing.

Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
  • Loading branch information
Nicholas Bellinger committed Aug 22, 2011
1 parent 1285062 commit 72f4ba1
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions drivers/target/target_core_cdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1077,8 +1077,6 @@ target_emulate_unmap(struct se_task *task)
size -= 16;
}

task->task_scsi_status = GOOD;
transport_complete_task(task, 1);
err:
transport_kunmap_first_data_page(cmd);

Expand Down Expand Up @@ -1115,8 +1113,6 @@ target_emulate_write_same(struct se_task *task, u32 num_blocks)
return ret;
}

task->task_scsi_status = GOOD;
transport_complete_task(task, 1);
return 0;
}

Expand Down Expand Up @@ -1228,8 +1224,14 @@ transport_emulate_control_cdb(struct se_task *task)

if (ret < 0)
return ret;
task->task_scsi_status = GOOD;
transport_complete_task(task, 1);
/*
* Handle the successful completion here unless a caller
* has explictly requested an asychronous completion.
*/
if (!(cmd->se_cmd_flags & SCF_EMULATE_CDB_ASYNC)) {
task->task_scsi_status = GOOD;
transport_complete_task(task, 1);
}

return PYX_TRANSPORT_SENT_TO_TRANSPORT;
}

0 comments on commit 72f4ba1

Please sign in to comment.