[Devel] [PATCH RHEL7 COMMIT] ms/target: return UNSUPPORTED TARGET/SEGMENT DESC TYPE CODE sense

Konstantin Khorenko khorenko at virtuozzo.com
Tue Apr 3 16:11:36 MSK 2018


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.3
------>
commit 4064a0b1d1c14e7b79ccbb5b17878fdd008cb298
Author: David Disseldorp <ddiss at suse.de>
Date:   Tue Apr 3 16:11:35 2018 +0300

    ms/target: return UNSUPPORTED TARGET/SEGMENT DESC TYPE CODE sense
    
    ML: c243849720ac237e9e7191fe57f619bb3a871d4c
    
    Use UNSUPPORTED TARGET DESCRIPTOR TYPE CODE and UNSUPPORTED SEGMENT
    DESCRIPTOR TYPE CODE additional sense codes if a descriptor type in an
    XCOPY request is not supported, as specified in spc4r37 6.4.5 and 6.4.6.
    
    Signed-off-by: David Disseldorp <ddiss at suse.de>
    Reviewed-by: Christoph Hellwig <hch at lst.de>
    Signed-off-by: Bart Van Assche <bart.vanassche at sandisk.com>
    Signed-off-by: Andrei Vagin <avagin at openvz.org>
---
 drivers/target/target_core_xcopy.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/target/target_core_xcopy.c b/drivers/target/target_core_xcopy.c
index 495c0431dba2..9a6e7d8d9005 100644
--- a/drivers/target/target_core_xcopy.c
+++ b/drivers/target/target_core_xcopy.c
@@ -211,6 +211,7 @@ static int target_xcopy_parse_target_descriptors(struct se_cmd *se_cmd,
 	if (offset != 0) {
 		pr_err("XCOPY target descriptor list length is not"
 			" multiple of %d\n", XCOPY_TARGET_DESC_LEN);
+		*sense_ret = TCM_UNSUPPORTED_TARGET_DESC_TYPE_CODE;
 		return -EINVAL;
 	}
 	if (tdll > 64) {
@@ -244,6 +245,7 @@ static int target_xcopy_parse_target_descriptors(struct se_cmd *se_cmd,
 		default:
 			pr_err("XCOPY unsupported descriptor type code:"
 					" 0x%02x\n", desc[0]);
+			*sense_ret = TCM_UNSUPPORTED_TARGET_DESC_TYPE_CODE;
 			goto out;
 		}
 	}
@@ -334,6 +336,7 @@ static int target_xcopy_parse_segment_descriptors(struct se_cmd *se_cmd,
 	if (offset != 0) {
 		pr_err("XCOPY segment descriptor list length is not"
 			" multiple of %d\n", XCOPY_SEGMENT_DESC_LEN);
+		*sense_ret = TCM_UNSUPPORTED_SEGMENT_DESC_TYPE_CODE;
 		return -EINVAL;
 	}
 	if (sdll > RCR_OP_MAX_SG_DESC_COUNT * XCOPY_SEGMENT_DESC_LEN) {
@@ -361,6 +364,7 @@ static int target_xcopy_parse_segment_descriptors(struct se_cmd *se_cmd,
 		default:
 			pr_err("XCOPY unsupported segment descriptor"
 				"type: 0x%02x\n", desc[0]);
+			*sense_ret = TCM_UNSUPPORTED_SEGMENT_DESC_TYPE_CODE;
 			goto out;
 		}
 	}


More information about the Devel mailing list