diff options
author | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-11-06 18:43:53 -0500 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-11-07 23:10:56 -0500 |
commit | b69c1fcf0a7cb2b7dff12ce4e8506b395431a52c (patch) | |
tree | 9bd450b152ed11dee3d617a5345da78c543f23dc | |
parent | a2e85d18146857ffddea4dfe3b245055af8e3db3 (diff) |
target: Fix possible TFO->write_pending() sense_reason_t silent WRITE corruption
This patch fixes a possible case in transport_generic_new_cmd() where a
failure from TFO->write_pending() from a fabric module return something
other than -EAGAIN or -ENOMEM would cause a failed WRITE to silently
succeed.
Go ahead and return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE for this
special case instead of only just making noise with WARN_ON().
(v2: Fix incorrect exception return for all cases)
Cc: Christoph Hellwig <hch@lst.de>
Cc: Roland Dreier <roland@purestorage.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r-- | drivers/target/target_core_transport.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 98044bf1da08..63d7848bf96c 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
@@ -2127,7 +2127,7 @@ transport_generic_new_cmd(struct se_cmd *cmd) | |||
2127 | /* fabric drivers should only return -EAGAIN or -ENOMEM as error */ | 2127 | /* fabric drivers should only return -EAGAIN or -ENOMEM as error */ |
2128 | WARN_ON(ret); | 2128 | WARN_ON(ret); |
2129 | 2129 | ||
2130 | return 0; | 2130 | return (!ret) ? 0 : TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
2131 | 2131 | ||
2132 | queue_full: | 2132 | queue_full: |
2133 | pr_debug("Handling write_pending QUEUE__FULL: se_cmd: %p\n", cmd); | 2133 | pr_debug("Handling write_pending QUEUE__FULL: se_cmd: %p\n", cmd); |