[RHEL7,COMMIT] ms/target: Use correct SCSI status during EXTENDED_COPY exception

Submitted by Konstantin Khorenko on April 2, 2018, 2:28 p.m.

Details

Message ID 201804021428.w32ESMgv023976@finist_ce7.work
State New
Series "target: backport bug fixes from the upstream kernel"
Headers show

Commit Message

Konstantin Khorenko April 2, 2018, 2:28 p.m.
The commit is pushed to "branch-rh7-3.10.0-693.21.1.vz7.46.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-693.21.1.vz7.46.2
------>
commit 18f9c25c5b1613911af11e42b4a7e739629d3dd4
Author: Nicholas Bellinger <nab@linux-iscsi.org>
Date:   Mon Apr 2 17:28:22 2018 +0300

    ms/target: Use correct SCSI status during EXTENDED_COPY exception
    
    ML: 0583c261e6325f392c1f7a1b9112e31298e1a4bd
    
    This patch adds the missing target_complete_cmd() SCSI status
    parameter change in target_xcopy_do_work(), that was originally
    missing in commit 926317de33.
    
    It correctly propigates up the correct SCSI status during
    EXTENDED_COPY exception cases, instead of always using the
    hardcoded SAM_STAT_CHECK_CONDITION from original code.
    
    This is required for ESX host environments that expect to
    hit SAM_STAT_RESERVATION_CONFLICT for certain scenarios,
    and SAM_STAT_CHECK_CONDITION results in non-retriable
    status for these cases.
    
    Reported-by: Nixon Vincent <nixon.vincent@calsoftinc.com>
    Tested-by: Nixon Vincent <nixon.vincent@calsoftinc.com>
    Cc: Nixon Vincent <nixon.vincent@calsoftinc.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Cc: stable@vger.kernel.org # 3.14+
    Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
    Signed-off-by: Andrei Vagin <avagin@openvz.org>
---
 drivers/target/target_core_xcopy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/drivers/target/target_core_xcopy.c b/drivers/target/target_core_xcopy.c
index 9f5a002bfa04..94e95748e815 100644
--- a/drivers/target/target_core_xcopy.c
+++ b/drivers/target/target_core_xcopy.c
@@ -881,7 +881,7 @@  static void target_xcopy_do_work(struct work_struct *work)
 			" CHECK_CONDITION -> sending response\n", rc);
 		ec_cmd->scsi_status = SAM_STAT_CHECK_CONDITION;
 	}
-	target_complete_cmd(ec_cmd, SAM_STAT_CHECK_CONDITION);
+	target_complete_cmd(ec_cmd, ec_cmd->scsi_status);
 }
 
 sense_reason_t target_do_xcopy(struct se_cmd *se_cmd)