Skip to content

Commit

Permalink
target: Fix possible TFO->write_pending() sense_reason_t silent WRITE…
Browse files Browse the repository at this point in the history
… 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>
  • Loading branch information
Nicholas Bellinger committed Nov 8, 2012
1 parent a2e85d1 commit b69c1fc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/target/target_core_transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -2127,7 +2127,7 @@ transport_generic_new_cmd(struct se_cmd *cmd)
/* fabric drivers should only return -EAGAIN or -ENOMEM as error */
WARN_ON(ret);

return 0;
return (!ret) ? 0 : TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;

queue_full:
pr_debug("Handling write_pending QUEUE__FULL: se_cmd: %p\n", cmd);
Expand Down

0 comments on commit b69c1fc

Please sign in to comment.