diff options
| author | Bart Van Assche <bart.vanassche@sandisk.com> | 2017-05-04 18:50:47 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-05-20 08:28:34 -0400 |
| commit | f788fa43d87a4a2575deafb54e5333b06d34399d (patch) | |
| tree | c340c9e4d4636e7c5c661579ed3ad667c6a48a96 | |
| parent | a4e52cc7d81b387e7285aaf4b8d74562f05f99b9 (diff) | |
target/fileio: Fix zero-length READ and WRITE handling
commit 59ac9c078141b8fd0186c0b18660a1b2c24e724e upstream.
This patch fixes zero-length READ and WRITE handling in target/FILEIO,
which was broken a long time back by:
Since:
commit d81cb44726f050d7cf1be4afd9cb45d153b52066
Author: Paolo Bonzini <pbonzini@redhat.com>
Date: Mon Sep 17 16:36:11 2012 -0700
target: go through normal processing for all zero-length commands
which moved zero-length READ and WRITE completion out of target-core,
to doing submission into backend driver code.
To address this, go ahead and invoke target_complete_cmd() for any
non negative return value in fd_do_rw().
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Andy Grover <agrover@redhat.com>
Cc: David Disseldorp <ddiss@suse.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| -rw-r--r-- | drivers/target/target_core_file.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c index d545993df18b..29f807b29e74 100644 --- a/drivers/target/target_core_file.c +++ b/drivers/target/target_core_file.c | |||
| @@ -594,8 +594,7 @@ fd_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, | |||
| 594 | if (ret < 0) | 594 | if (ret < 0) |
| 595 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 595 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
| 596 | 596 | ||
| 597 | if (ret) | 597 | target_complete_cmd(cmd, SAM_STAT_GOOD); |
| 598 | target_complete_cmd(cmd, SAM_STAT_GOOD); | ||
| 599 | return 0; | 598 | return 0; |
| 600 | } | 599 | } |
| 601 | 600 | ||
