]>
Commit | Line | Data |
---|---|---|
b0c1a8bd GKH |
1 | From a71a5dc7f833943998e97ca8fa6a4c708a0ed1a9 Mon Sep 17 00:00:00 2001 |
2 | From: Nicholas Bellinger <nab@linux-iscsi.org> | |
3 | Date: Tue, 11 Apr 2017 16:24:16 -0700 | |
4 | Subject: target: Fix compare_and_write_callback handling for non GOOD status | |
5 | ||
6 | From: Nicholas Bellinger <nab@linux-iscsi.org> | |
7 | ||
8 | commit a71a5dc7f833943998e97ca8fa6a4c708a0ed1a9 upstream. | |
9 | ||
10 | Following the bugfix for handling non SAM_STAT_GOOD COMPARE_AND_WRITE | |
11 | status during COMMIT phase in commit 9b2792c3da1, the same bug exists | |
12 | for the READ phase as well. | |
13 | ||
14 | This would manifest first as a lost SCSI response, and eventual | |
15 | hung task during fabric driver logout or re-login, as existing | |
16 | shutdown logic waited for the COMPARE_AND_WRITE se_cmd->cmd_kref | |
17 | to reach zero. | |
18 | ||
19 | To address this bug, compare_and_write_callback() has been changed | |
20 | to set post_ret = 1 and return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE | |
21 | as necessary to signal failure status. | |
22 | ||
23 | Reported-by: Bill Borsari <wgb@datera.io> | |
24 | Cc: Bill Borsari <wgb@datera.io> | |
25 | Tested-by: Gary Guo <ghg@datera.io> | |
26 | Cc: Gary Guo <ghg@datera.io> | |
27 | Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org> | |
28 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
29 | ||
30 | --- | |
31 | drivers/target/target_core_sbc.c | 5 ++++- | |
32 | 1 file changed, 4 insertions(+), 1 deletion(-) | |
33 | ||
34 | --- a/drivers/target/target_core_sbc.c | |
35 | +++ b/drivers/target/target_core_sbc.c | |
36 | @@ -507,8 +507,11 @@ static sense_reason_t compare_and_write_ | |
37 | * been failed with a non-zero SCSI status. | |
38 | */ | |
39 | if (cmd->scsi_status) { | |
40 | - pr_err("compare_and_write_callback: non zero scsi_status:" | |
41 | + pr_debug("compare_and_write_callback: non zero scsi_status:" | |
42 | " 0x%02x\n", cmd->scsi_status); | |
43 | + *post_ret = 1; | |
44 | + if (cmd->scsi_status == SAM_STAT_CHECK_CONDITION) | |
45 | + ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | |
46 | goto out; | |
47 | } | |
48 |