diff options
| author | Nicholas Bellinger <nab@linux-iscsi.org> | 2013-10-01 19:46:37 -0400 |
|---|---|---|
| committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2013-10-03 07:24:06 -0400 |
| commit | b7191253b302a9b98758c3616761ae111b6264b9 (patch) | |
| tree | 2241583b77697ff47cfce1ef74435bd6eb379b1e | |
| parent | c807f64340932e19f0d2ac9b30c8381e1f60663a (diff) | |
target: Reset data_length for COMPARE_AND_WRITE to NoLB * block_size
This patch resets se_cmd->data_length for COMPARE_AND_WRITE emulation
within sbc_compare_and_write() to NoLB * block_size in order to address
a bug with FILEIO backends where a I/O failure will occur when data_length
does not match the I/O size being actually dispatched for the individual
per block READs + WRITEs.
This is done late enough in sbc_compare_and_write() after the memory
allocations have occured in transport_generic_new_cmd() to not cause
any unwanted side-effects.
Reported-by: Thomas Glanzmann <thomas@glanzmann.de>
Tested-by: Thomas Glanzmann <thomas@glanzmann.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| -rw-r--r-- | drivers/target/target_core_sbc.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c index 6c17295e8d7c..a9dca116011e 100644 --- a/drivers/target/target_core_sbc.c +++ b/drivers/target/target_core_sbc.c | |||
| @@ -508,6 +508,12 @@ sbc_compare_and_write(struct se_cmd *cmd) | |||
| 508 | cmd->transport_complete_callback = NULL; | 508 | cmd->transport_complete_callback = NULL; |
| 509 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 509 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
| 510 | } | 510 | } |
| 511 | /* | ||
| 512 | * Reset cmd->data_length to individual block_size in order to not | ||
| 513 | * confuse backend drivers that depend on this value matching the | ||
| 514 | * size of the I/O being submitted. | ||
| 515 | */ | ||
| 516 | cmd->data_length = cmd->t_task_nolb * dev->dev_attrib.block_size; | ||
| 511 | 517 | ||
| 512 | ret = cmd->execute_rw(cmd, cmd->t_bidi_data_sg, cmd->t_bidi_data_nents, | 518 | ret = cmd->execute_rw(cmd, cmd->t_bidi_data_sg, cmd->t_bidi_data_nents, |
| 513 | DMA_FROM_DEVICE); | 519 | DMA_FROM_DEVICE); |
