diff options
author | Nicholas Bellinger <nab@linux-iscsi.org> | 2017-04-11 19:24:16 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-05-20 08:28:34 -0400 |
commit | a4e52cc7d81b387e7285aaf4b8d74562f05f99b9 (patch) | |
tree | 0148bfeb2189217decd9a8e0c2b9c65e04557cdc | |
parent | f2b8de98f737a1c9a1a1c58b4cbbcc139f917a35 (diff) |
target: Fix compare_and_write_callback handling for non GOOD status
commit a71a5dc7f833943998e97ca8fa6a4c708a0ed1a9 upstream.
Following the bugfix for handling non SAM_STAT_GOOD COMPARE_AND_WRITE
status during COMMIT phase in commit 9b2792c3da1, the same bug exists
for the READ phase as well.
This would manifest first as a lost SCSI response, and eventual
hung task during fabric driver logout or re-login, as existing
shutdown logic waited for the COMPARE_AND_WRITE se_cmd->cmd_kref
to reach zero.
To address this bug, compare_and_write_callback() has been changed
to set post_ret = 1 and return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE
as necessary to signal failure status.
Reported-by: Bill Borsari <wgb@datera.io>
Cc: Bill Borsari <wgb@datera.io>
Tested-by: Gary Guo <ghg@datera.io>
Cc: Gary Guo <ghg@datera.io>
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_sbc.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c index a53fb23a0411..b3b1461ec60d 100644 --- a/drivers/target/target_core_sbc.c +++ b/drivers/target/target_core_sbc.c | |||
@@ -506,8 +506,11 @@ static sense_reason_t compare_and_write_callback(struct se_cmd *cmd, bool succes | |||
506 | * been failed with a non-zero SCSI status. | 506 | * been failed with a non-zero SCSI status. |
507 | */ | 507 | */ |
508 | if (cmd->scsi_status) { | 508 | if (cmd->scsi_status) { |
509 | pr_err("compare_and_write_callback: non zero scsi_status:" | 509 | pr_debug("compare_and_write_callback: non zero scsi_status:" |
510 | " 0x%02x\n", cmd->scsi_status); | 510 | " 0x%02x\n", cmd->scsi_status); |
511 | *post_ret = 1; | ||
512 | if (cmd->scsi_status == SAM_STAT_CHECK_CONDITION) | ||
513 | ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | ||
511 | goto out; | 514 | goto out; |
512 | } | 515 | } |
513 | 516 | ||