Commit b69c1fcf authored by Nicholas Bellinger's avatar Nicholas Bellinger

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: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent a2e85d18
...@@ -2127,7 +2127,7 @@ transport_generic_new_cmd(struct se_cmd *cmd) ...@@ -2127,7 +2127,7 @@ transport_generic_new_cmd(struct se_cmd *cmd)
/* fabric drivers should only return -EAGAIN or -ENOMEM as error */ /* fabric drivers should only return -EAGAIN or -ENOMEM as error */
WARN_ON(ret); WARN_ON(ret);
return 0; return (!ret) ? 0 : TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
queue_full: queue_full:
pr_debug("Handling write_pending QUEUE__FULL: se_cmd: %p\n", cmd); pr_debug("Handling write_pending QUEUE__FULL: se_cmd: %p\n", cmd);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment