[Devel] [PATCH RHEL7 COMMIT] ms/target: use XCOPY TOO MANY TARGET DESCRIPTORS 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 5cc5f175cb0193f854f616575fa3f9709861075e
Author: David Disseldorp <ddiss at suse.de>
Date:   Tue Apr 3 16:11:36 2018 +0300

    ms/target: use XCOPY TOO MANY TARGET DESCRIPTORS sense
    
    ML: 61c359194c46cbffec9a1f2c59c1c4011222ad84
    
    spc4r37 6.4.3.4 states:
      If the number of CSCD descriptors exceeds the allowed number, the copy
      manager shall terminate the command with CHECK CONDITION status, with
      the sense key set to ILLEGAL REQUEST, and the additional sense code
      set to TOO MANY TARGET DESCRIPTORS.
    
    LIO currently responds with INVALID FIELD IN PARAMETER LIST, which sees
    it fail the libiscsi ExtendedCopy.DescrLimits test.
    
    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, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/target/target_core_xcopy.c b/drivers/target/target_core_xcopy.c
index 9a6e7d8d9005..a688b7513bae 100644
--- a/drivers/target/target_core_xcopy.c
+++ b/drivers/target/target_core_xcopy.c
@@ -214,9 +214,11 @@ static int target_xcopy_parse_target_descriptors(struct se_cmd *se_cmd,
 		*sense_ret = TCM_UNSUPPORTED_TARGET_DESC_TYPE_CODE;
 		return -EINVAL;
 	}
-	if (tdll > 64) {
+	if (tdll > RCR_OP_MAX_TARGET_DESC_COUNT * XCOPY_TARGET_DESC_LEN) {
 		pr_err("XCOPY target descriptor supports a maximum"
 			" two src/dest descriptors, tdll: %hu too large..\n", tdll);
+		/* spc4r37 6.4.3.4 CSCD DESCRIPTOR LIST LENGTH field */
+		*sense_ret = TCM_TOO_MANY_TARGET_DESCS;
 		return -EINVAL;
 	}
 	/*


More information about the Devel mailing list