From patchwork Thu Sep 3 06:58:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nicholas A. Bellinger" X-Patchwork-Id: 7115251 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5BA88BEEC1 for ; Thu, 3 Sep 2015 07:04:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4D35F20770 for ; Thu, 3 Sep 2015 07:04:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 346022076C for ; Thu, 3 Sep 2015 07:04:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752763AbbICHEZ (ORCPT ); Thu, 3 Sep 2015 03:04:25 -0400 Received: from mail-oi0-f49.google.com ([209.85.218.49]:33921 "EHLO mail-oi0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750818AbbICHEY (ORCPT ); Thu, 3 Sep 2015 03:04:24 -0400 Received: by oiev17 with SMTP id v17so20590399oie.1 for ; Thu, 03 Sep 2015 00:04:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=/ZAppIXlh92b3OAkfeOLhXWrKswmxj8iQvFkN1Rz2cs=; b=FFFjbYLAJhniDuQx9wb0C37891EiJwlcTxR7T+F/qyrDa9rGXUOK56Gf4bA80uQxb2 8R3JE3M8JgTreNAlyhSUavVPAJoT88cSit8poK4wHkfKRVtjrE5kauiiMEjCUpQAOAqW wZJ4msYuj2S+ui+gXWkU/Mg/uGifpxz1mRzeP5L/eDddv10T+sq3pS3omYjoRLHH+abj +GNMBlXS0H9Ilj+poQtLqnHeoLLLop/xABcgIk5p8un9LuGWXA5HsClxFn1CgaprXY40 qeN74XXRKYY6Qdy3ZMRr3++BCDkFZ96StFgO0glnRxCZ+KB3pCh64XcFu22YAM8R0yz0 6oRA== X-Gm-Message-State: ALoCoQkSVb1iQsbUxBhZPPs+XAp2iHiRyEfNeh4rX/KMdWLh9hhnYjqaINaWFCiEk/7+mJDoAzTA X-Received: by 10.202.169.65 with SMTP id s62mr9670723oie.28.1441263862536; Thu, 03 Sep 2015 00:04:22 -0700 (PDT) Received: from localhost.localdomain (mail.linux-iscsi.org. [67.23.28.174]) by smtp.gmail.com with ESMTPSA id k5sm16204252oev.16.2015.09.03.00.04.21 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 03 Sep 2015 00:04:22 -0700 (PDT) From: "Nicholas A. Bellinger" To: target-devel Cc: linux-scsi , Nicholas Bellinger , Alex Gorbachev , "Martin K. Petersen" , Hannes Reinecke , Christoph Hellwig , Doug Gilbert Subject: [PATCH] target: Attach EXTENDED_COPY local I/O descriptors to xcopy_pt_sess Date: Thu, 3 Sep 2015 06:58:25 +0000 Message-Id: <1441263505-19277-1-git-send-email-nab@daterainc.com> X-Mailer: git-send-email 1.7.2.5 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Nicholas Bellinger This patch is a >= v4.1 regression bug-fix where control CDB emulation logic in commit 38b57f82 now expects a se_cmd->se_sess pointer to exist when determining T10-PI support is to be exposed for initiator host ports. To address this bug, go ahead and add locally generated se_cmd descriptors for copy-offload block-copy to it's own stand-alone se_session nexus, while the parent EXTENDED_COPY se_cmd descriptor remains associated with it's originating se_cmd->se_sess nexus. Note a valid se_cmd->se_sess is also required for future support of WRITE_INSERT and READ_STRIP software emulation when submitting backend I/O to se_device that exposes T10-PI suport. Reported-by: Alex Gorbachev Cc: Alex Gorbachev Cc: "Martin K. Petersen" Cc: Hannes Reinecke Cc: Christoph Hellwig Cc: Doug Gilbert Cc: # v4.1+ Signed-off-by: Nicholas Bellinger --- drivers/target/target_core_xcopy.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/target/target_core_xcopy.c b/drivers/target/target_core_xcopy.c index 4515f52..47fe94e 100644 --- a/drivers/target/target_core_xcopy.c +++ b/drivers/target/target_core_xcopy.c @@ -450,6 +450,8 @@ int target_xcopy_setup_pt(void) memset(&xcopy_pt_sess, 0, sizeof(struct se_session)); INIT_LIST_HEAD(&xcopy_pt_sess.sess_list); INIT_LIST_HEAD(&xcopy_pt_sess.sess_acl_list); + INIT_LIST_HEAD(&xcopy_pt_sess.sess_cmd_list); + spin_lock_init(&xcopy_pt_sess.sess_cmd_lock); xcopy_pt_nacl.se_tpg = &xcopy_pt_tpg; xcopy_pt_nacl.nacl_sess = &xcopy_pt_sess; @@ -644,7 +646,7 @@ static int target_xcopy_read_source( pr_debug("XCOPY: Built READ_16: LBA: %llu Sectors: %u Length: %u\n", (unsigned long long)src_lba, src_sectors, length); - transport_init_se_cmd(se_cmd, &xcopy_pt_tfo, NULL, length, + transport_init_se_cmd(se_cmd, &xcopy_pt_tfo, &xcopy_pt_sess, length, DMA_FROM_DEVICE, 0, &xpt_cmd->sense_buffer[0]); xop->src_pt_cmd = xpt_cmd; @@ -704,7 +706,7 @@ static int target_xcopy_write_destination( pr_debug("XCOPY: Built WRITE_16: LBA: %llu Sectors: %u Length: %u\n", (unsigned long long)dst_lba, dst_sectors, length); - transport_init_se_cmd(se_cmd, &xcopy_pt_tfo, NULL, length, + transport_init_se_cmd(se_cmd, &xcopy_pt_tfo, &xcopy_pt_sess, length, DMA_TO_DEVICE, 0, &xpt_cmd->sense_buffer[0]); xop->dst_pt_cmd = xpt_cmd;