diff options
author | Nicholas Bellinger <nab@daterainc.com> | 2013-08-21 21:10:04 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2013-09-10 19:45:13 -0400 |
commit | a2890087499ae530362139aaf6c120f438e1e679 (patch) | |
tree | 3d43243c62a0efdbd6e42f44d723848953e400c7 /drivers/target | |
parent | 68ff9b9b27525cdaaea81890456f65aed5ce0b70 (diff) |
target: Add compare_and_write_post() completion callback fall through
This patch changes target_complete_ok_work() to fall through
after calling the se_cmd->transport_complete_callback() ->
compare_and_write_post() callback, by keying off the existance
of SCF_COMPARE_AND_WRITE_POST.
This is necessary because once SCF_COMPARE_AND_WRITE_POST has
been set by compare_and_write_post(), the SCSI response needs
to be sent via TFO->queue_status().
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Martin Petersen <martin.petersen@oracle.com>
Cc: Chris Mason <chris.mason@fusionio.com>
Cc: James Bottomley <JBottomley@Parallels.com>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Nicholas Bellinger <nab@daterainc.com>
Diffstat (limited to 'drivers/target')
-rw-r--r-- | drivers/target/target_core_sbc.c | 3 | ||||
-rw-r--r-- | drivers/target/target_core_transport.c | 19 |
2 files changed, 12 insertions, 10 deletions
diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c index dfb6603eab4d..5c822fdc8f6f 100644 --- a/drivers/target/target_core_sbc.c +++ b/drivers/target/target_core_sbc.c | |||
@@ -375,7 +375,8 @@ static sense_reason_t compare_and_write_callback(struct se_cmd *cmd) | |||
375 | buf = kzalloc(cmd->data_length, GFP_KERNEL); | 375 | buf = kzalloc(cmd->data_length, GFP_KERNEL); |
376 | if (!buf) { | 376 | if (!buf) { |
377 | pr_err("Unable to allocate compare_and_write buf\n"); | 377 | pr_err("Unable to allocate compare_and_write buf\n"); |
378 | return TCM_OUT_OF_RESOURCES; | 378 | ret = TCM_OUT_OF_RESOURCES; |
379 | goto out; | ||
379 | } | 380 | } |
380 | 381 | ||
381 | write_sg = kzalloc(sizeof(struct scatterlist) * cmd->t_data_nents, | 382 | write_sg = kzalloc(sizeof(struct scatterlist) * cmd->t_data_nents, |
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 672cb37a43c5..e53c59ba745a 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
@@ -1909,17 +1909,18 @@ static void target_complete_ok_work(struct work_struct *work) | |||
1909 | sense_reason_t rc; | 1909 | sense_reason_t rc; |
1910 | 1910 | ||
1911 | rc = cmd->transport_complete_callback(cmd); | 1911 | rc = cmd->transport_complete_callback(cmd); |
1912 | if (!rc) | 1912 | if (!rc && !(cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE_POST)) { |
1913 | return; | 1913 | return; |
1914 | } else if (rc) { | ||
1915 | ret = transport_send_check_condition_and_sense(cmd, | ||
1916 | rc, 0); | ||
1917 | if (ret == -EAGAIN || ret == -ENOMEM) | ||
1918 | goto queue_full; | ||
1914 | 1919 | ||
1915 | ret = transport_send_check_condition_and_sense(cmd, | 1920 | transport_lun_remove_cmd(cmd); |
1916 | rc, 0); | 1921 | transport_cmd_check_stop_to_fabric(cmd); |
1917 | if (ret == -EAGAIN || ret == -ENOMEM) | 1922 | return; |
1918 | goto queue_full; | 1923 | } |
1919 | |||
1920 | transport_lun_remove_cmd(cmd); | ||
1921 | transport_cmd_check_stop_to_fabric(cmd); | ||
1922 | return; | ||
1923 | } | 1924 | } |
1924 | 1925 | ||
1925 | switch (cmd->data_direction) { | 1926 | switch (cmd->data_direction) { |