From patchwork Thu May 4 22:50:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 9712877 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 97DE760387 for ; Thu, 4 May 2017 22:51:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8BD2B28639 for ; Thu, 4 May 2017 22:51:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 809EF286A9; Thu, 4 May 2017 22:51:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DBD9028639 for ; Thu, 4 May 2017 22:51:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753046AbdEDWvj (ORCPT ); Thu, 4 May 2017 18:51:39 -0400 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:18484 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753136AbdEDWvX (ORCPT ); Thu, 4 May 2017 18:51:23 -0400 X-IronPort-AV: E=Sophos;i="5.38,289,1491235200"; d="scan'208";a="111976847" Received: from mail-bl2nam02lp0088.outbound.protection.outlook.com (HELO NAM02-BL2-obe.outbound.protection.outlook.com) ([207.46.163.88]) by ob1.hgst.iphmx.com with ESMTP; 05 May 2017 06:57:19 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-sharedspace-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=kg7tHReR/xwIfdKDXrga4Dd09e3T+t+BI8us0SYf4EA=; b=JLsBRAzNV7p2wR5Am/NDkdtVTUmjisAfjnLDvaQQvvM8sEs3aEW7WQDfFyAvLHy7xxFDhXtmfgpshKR6uj17KZ4iz9Oyb1rx2FcdmYACOSqbG12YJGBawkz76QCFmt6DYi3iPcbslq65b4TrZgZwKfrdl76PqC+edAqwFrfubnU= Received: from BN3PR04CA0018.namprd04.prod.outlook.com (10.166.70.156) by CY1PR0401MB1550.namprd04.prod.outlook.com (10.163.19.156) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1061.12; Thu, 4 May 2017 22:51:12 +0000 Received: from BN3NAM04FT038.eop-NAM04.prod.protection.outlook.com (2a01:111:f400:7e4e::208) by BN3PR04CA0018.outlook.office365.com (2a01:111:e400:7a4f::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1075.11 via Frontend Transport; Thu, 4 May 2017 22:51:12 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.225) smtp.mailfrom=sandisk.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=sandisk.com; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.225 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.225; helo=milsmgep14.sandisk.com; Received: from milsmgep14.sandisk.com (63.163.107.225) by BN3NAM04FT038.mail.protection.outlook.com (10.152.92.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.1047.9 via Frontend Transport; Thu, 4 May 2017 22:51:11 +0000 Received: from MILHUBIP04.sdcorp.global.sandisk.com (Unknown_Domain [10.201.67.162]) (using TLS with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by (Symantec Messaging Gateway) with SMTP id 2F.11.19026.B50BB095; Thu, 4 May 2017 15:51:10 -0700 (PDT) Received: from milsmgip11.sandisk.com (10.177.9.6) by MILHUBIP04.sdcorp.global.sandisk.com (10.177.9.97) with Microsoft SMTP Server id 14.3.319.2; Thu, 4 May 2017 15:51:03 -0700 X-AuditID: 0ac94371-0a7ff70000004a52-8e-590bb05b7f65 Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id 13.F0.11415.850BB095; Thu, 4 May 2017 15:51:04 -0700 (PDT) From: Bart Van Assche To: Nicholas Bellinger CC: , Bart Van Assche , Hannes Reinecke , "Christoph Hellwig" , Andy Grover , David Disseldorp , Subject: [PATCH 05/19] target: Allocate sg-list correctly Date: Thu, 4 May 2017 15:50:48 -0700 Message-ID: <20170504225102.8931-6-bart.vanassche@sandisk.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20170504225102.8931-1-bart.vanassche@sandisk.com> References: <20170504225102.8931-1-bart.vanassche@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrALMWRmVeSWpSXmKPExsXCddJ5kW7cBu5Ig3XfZSz2z3rGZPH1/3QW iwVv9rJZrFx9lMmibfUZRosFGx8xWrQufcvkwO5xf/sRJo/dNxvYPN7vu8rmsX7LVRaPzaer PT5vkgtgi+KySUnNySxLLdK3S+DK+PtkHXPBZuWKy3PnsDUwzpfpYuTkkBAwkei/fIS1i5GL Q0hgKZNE/8K9UM5WRommve8YYaq2fXjNDpHYzCgx7dc6VpAEm4CRxLf3M1lAbBEBHYlZd1+A FTELfGWUaNz7lwkkISxgKXHy7WOwIhYBFYkfPSvB4rwCdhK/ev8zQWyQlzi7ZScziM0pYC+x d8Z9sLgQUM2a/s2MIEMlBJaxSryc95sNollQ4uTMJ2BDmQU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S-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:63.163.107.225; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10019020)(39850400002)(39400400002)(39410400002)(39450400003)(39840400002)(39860400002)(2980300002)(438002)(199003)(189002)(9170700003)(38730400002)(2950100002)(478600001)(6666003)(305945005)(106466001)(53936002)(6916009)(33646002)(36756003)(76176999)(50986999)(5003940100001)(50226002)(110136004)(54906002)(8936002)(81166006)(50466002)(8676002)(48376002)(47776003)(189998001)(2906002)(86362001)(1076002)(5660300001)(4326008)(77096006)(356003); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR0401MB1550; H:milsmgep14.sandisk.com; FPR:; SPF:Pass; MLV:sfv; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN3NAM04FT038; 1:IA/qnD4jmR7Nqk76Oe7Za4uqwKDALSuv4VSCiggrJtPYfGfrdB+OT3SIuzrLAup7xxcryPbSbER6Zve20TW7zJAjuRX4WYfCEJjIFq+IyjNQMnWPhDWLKWb5kT+9DyAegWzbP0W0FJLG78coqQoSoN1AcEqK/kl+pn4FKh8gLGrEZQmVou5l+f5J90UahkNpyLykc6LCotpjx39kbmIj8Ds/db8OOrnJDPZ+af4TawxSz8oB9B67CTuVD3+fzmfZFGTuWnAH+Aml3MmrXnz0lVHzX1EexTFeTjCUMd5oE/OaF2MAo1LskXHelR7ukNdUPyD0VyLiS0hkrdAAe0B3ZEm16L0zZFky50zckb+sKFtYNMQDnZCycEtLU8vluweGVbzjT0qw72trD6Y4ov0NfVYPzCL7sco5A07/OLnod3qCoqi8ajfhH6c2B3wlfANDYnp7xn6YMzqllnqaL55eAwYYLHXUAOUwLzL8gfv/OQccsZtKGMTtwsQ6I6/t5UU+1fOpKVI+kMUQpQBmnx0NUqzc423kBaoAi1K3oOCVZ/k= X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f824f42a-2b70-49d0-a18b-08d493400feb X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002)(2017030254075)(201703131423075)(201703031133081); SRVR:CY1PR0401MB1550; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0401MB1550; 3:TjhqvktcdTfYAbTMsgk1IPrxdFUgaFMGNVVvIhM6Gxrhe7HxY3fN7MczvccNxaakOy4xMNXsSoyutZW4drC4J37pGBuUX9tQkSWNjIZsbVIU2jLF9MvPL/PU4YzVsRgeAICgCmqStZPmhyIIhXCOEkMcQs7viR10IskGsrRrJPNzNsr9iMHb2p1MMwWMNyD0+Pg0FBUwe8ljKQMAwQoXYA9DXa0YORIomGw0adHxXxkzdG81mY4MTTZLOXeQ6fI7dZVFt3sR198OcIIYCafTxPGsyGE7IHTljymHunFWarr9+P5C4MaZboxhsqigwC+x0ejWtrgydPhP1QG5XGnMluasTpIazqU37gd9mxgRhgIAtOc2VVyW1BM2mWBDGYlJIRQ4uxA7VBPylldz/csBeHnQjGLABUw6fcQBl7QZr5CB91LovG5XggWx1fq+hqJsEHQwBDE01pT3rstPWVzX2w94DfdjZft4aytamfp3yDEVZk1Q8eaADDLi8H3v7TAF X-Microsoft-Exchange-Diagnostics: 1; CY1PR0401MB1550; 25:CBlyyOzvcja/kPmcIXtxPks4cOsw/kdM7orNq4kUMX71HSjCSCUOEcaL7NZvoPiBaTJ4bghvja7qBgnBVIIh5H2lm3it6mCr7/d1DBJDA4yKHLvukqQSlGY0KGN2v3F9K5VQVaO8SMfuY1GK3yQsrOfaXHp2Z2EAj2/18kmQ9hxhH0YVKnf1WE55nrwdQcp+B9j2cF/3NFoSuh7xd6Lo5zVq2oPC6BXOcDcc85BhLV1+46cQD/pGQpzDkIREHmOjEeUuADA4GsLc/5fzb93m7Uhma/ykJ5ae1RAu0imJrD7xn3Rg9Pplur04ui3NiLjtrY1kyA/eiEci6qa8ndvkVR7Qawtyb8xYafiSU+JEDpUOhFbb+nVAGOAKRourr0n/dN9i9G+qe0H+VKSLHmSFyGDfZadSOPhZD5w7qmZa1u95YhSh/Dspfnv7pIpeyrX6iFBu1ZfPcA/ITlaQ6AYNTA==; 31:pNXhBpzV/Q7wXOyPxHv0O34xheUAf+hOOlWnr3LVK+UgzUv18ElpXHwctsmRNha4hs7FiFv19hbBX1gg7g5m8G7tIyG66gKt3kXpJ5E7NYGfBsJemD1t/8uI5JRt9od9Kw4ZGL1GIbWvR6HO4V4pkyLLuOsjyl6KUQVLXM7RpSBfBvjMejL1+FKxGJRsRQcj53Y3WsuumpklyDb8wd17IciwQaylPtxsCw4y30GWgjz28PdOVogBScYMfBh6z+aFlDu3WADAfPKMJ2dnx9r2Tw== WDCIPOUTBOUND: EOP-TRUE X-Microsoft-Exchange-Diagnostics: 1; CY1PR0401MB1550; 20:M5OsC50ui0Jjb7//oLwTaEzj1tkShrDsZmktjxi2Pa85V5xObye8d0ZriRIkZ5M1rudc4fFqyEuzG6r2vHmLr1ULkV6m9dUCZgu5HqSB5sJdULQGMRdjJykviik4ACDPzysksgfh7clMRuh0YDexPWUcNw2EOUbMfjYJSoVWzRswzBhstolG2Xc3RipHA4IzCqVlnsq1S1XY9nYw7VNaJkMUVeI7axn9RJnPhGEhZlTp1TrlJs0/k3C47B12kEdLwhMcDz/zH5U17YF7tV7XPRyDWDYlYq3SUTytXCwjkQBVQJa/1tzZs++neUz8I9QzEqypUNKQu5AZzSfMXiW6s1otrolEC5VRFGm2HcXQmSydKfdvFhq6u/g0XZBP6oLPENRVYaWvDOabmN6iRM2JKORsXsGohYsbymxvyu3X34jOh7VBj8kPbqyyYsNq1eUYDj+p6/4/cd3uoQya3lDPC+Xl0dwPu0Y/6BgcFs+Z30ueVCA7Rrk1geDN2Ra7zjJZ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(9452136761055)(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(5005006)(8121501046)(13016025)(13018025)(3002001)(10201501046)(93006095)(93004095)(6055026)(6041248)(20161123558100)(20161123555025)(20161123560025)(20161123562025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148); SRVR:CY1PR0401MB1550; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0401MB1550; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0401MB1550; 4:wXjh5HlG7UarHnJGx0Q9ORi+6d0KrMSlrDM4x+k9qcPJGn6W/E6LwhD1ObbR7LekYYCep2a0GyAUmcttVvcTg7zYf9GGyzexrBCo6V59cx1Fy76oJzetZPaF8ZxAuQoz1Ss+CW/vn9S6pq0Wq0vAjssZA0wv9dy6Bz3CFpzaQGPmmelcgtlYneQ582YD8CH5HvxdwbW62VTZfA04r08E64mBVA6nqEkHSi/xUnQ5ZOWDtUVVFCnix1q8BXYkWq7jxoxKKO1tKBS6or9QNabNVYRikFMI7pl7qbPIQcJrf7i0KFN6RRiYM1oYx08bSz2yTfrmVhPiT/pu6DcyPECPUcvAr5JJMDX8s+NernodJ0fwchWyxx3GGHkHXXGvND9f4AYFPUk1EZT3xJlhS0glZwZUEtW1Pmgh4kc6a15YzC/8lWMFXwDS3edIfDPWhIXtutfZBQgyrzvq9TOB36gDactWX476wmAPnnvYak15LBrCOaPYQKmf8tg1stA+qm7JF2FT4UnV2aODs6EOoysfa2FRTk4nXMfwVCSH0sifJ0D1shYOWHf3lDJ4lckwMHbPXqwXLPf9s4E5XWY2QghhIbwx5mLM4GhTdqnfDujQavYe/OK0ucWPAl5YM/OXpDPk/YgkmUyT53p4nbfrSAe0m41Srcat2Qll8/2q5aKOdPznSgXLckzuIi9ZQhq3CgyYTdzX4TmVwTHKMZazjKSLnj9K+Z2u/2TiRrdu3eJw2lda0B1oZO93GWJ9U2ls2HyYVdmDJ3Fw0t711d5+vAVEM5wmswJH/USmcsbYDKYWtU1h2ed2zBjchhYturYWP8ZRgnD09yXgIjweZXlidHfg+prPpVoOn4VCvTx8+CHEXHju/YB+HC1UsEGyQD8hdF51pAt/cw3ueoNDiBktjL/7z1L1fULK5qu6wqgDcXHm oSE= X-Forefront-PRVS: 02973C87BC X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0401MB1550; 23:IkOElgu3iGLEFin1BiTeKdqCnwhw71nvY44p2z6?= =?us-ascii?Q?Bj+MOeoY8cCnw87WTY8Lpa2CJnUyJzjk3pQ3zzmn8Thx/JMcbArJ/8RkXx4Y?= =?us-ascii?Q?3mX8+8U3Z47lOaC6W0pYe9OjRXJJCJaznjszoxSovSwuJWOda6wgkhqURN6z?= =?us-ascii?Q?N2uENK0cUmv612FMoWkO4qaxAsctTo0FDwfPLFbKLCpktGexIVx0ZDMWmUo3?= =?us-ascii?Q?qdxOnyl8Xv3iJKAH2DMQPGjRMcnLvzezwDVvWE6dIc8XGMtKQi3JEB3B606t?= =?us-ascii?Q?uUNfne5bmZ1vwXJ4CJCJgaQhkdo5bm+SNYLAzsE1h83EANzbnB9blfcEwV1a?= =?us-ascii?Q?LGESPFOkYE19d0TVGECtoRjV5IKEUEnZ/JrbTxI7phaIUvzp/283z1AXVV2f?= =?us-ascii?Q?khRTm15GH03Bd1UaZZ7JLmXuiGRMCEWEISk653Z0k/vECgSxGLJlRLQvpy55?= =?us-ascii?Q?bapGCaxawfMXnPkOnwg+tkD4qMRICDlcRaTVWw2abmEILECHw+i5aG/fm1Uk?= =?us-ascii?Q?4hRj/3qYCdu4vu42o0LTxfLPg23uk0fF8dU9wVGAckGq9FoLEow9zpMW4123?= =?us-ascii?Q?dSt8zFQKXp0RHqg1d3PaQYRbZhmksAkdKR+blmRX4+xwzwAiNGX0OPupW6Fe?= =?us-ascii?Q?RgBogFPh6X6xqGmvQwW7ghHGRMICQVBZzuEYBo7iY3p0mr2wXhHlOVJp6Og8?= =?us-ascii?Q?QUc6FKqTWHiPPwiBjVbboV8HmwoV9Rw+EQnvdIXriWjgbOuwuoskNeO91oBE?= =?us-ascii?Q?V4UWeV3Q/IgdzvyPZbDZfcNd2THI23RcP/IGpzcJBfQJEPsL4VyZR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BK54B6ig==; 24:FzW/fyrChE8OGYByHgU9dD9cENZcLkElPiWeSZ5ZcLrM5X8fiXRPgxgJPgF1cnW5FUqJg7wrJ8p9SqTwDBdK0EXHMIh/uV63izAnZEFzd7I= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR0401MB1550; 7:j0dVt2/Q1yle/Y5UqthzyAG772vl+kVoWkIJulT/RJ94taARP5f3rcNpuGY5B1ut+yYKO5LzSz45/Kuyj/T/soiqBLLz9j+v5Sl5xGp/oOujiLIL0Ew9Af4TL2rxl22qh+k9Lt2afursNKD5ELtX3HKJPbV68CHVJbgdH+vYcjhWbWHoq9TME16cbV6p87wS9HGokN0FTAo4P7QGikL8XTxR+39eB3SpBzFeS2guRoOUvOyGdm8eH6zTJJvOwWtiJMRHtb4xkBuTDKTI679cH9sXOh4pbB+JHFYGcYIMylgkA+AUiHJIUkzbl88XpEQ3Bi7Oq1h64nMCA1wDWac2MQ==; 20:ChpnMjT75M4sUV9mpiJWsMgx330PbO1XReaE5WWOvjRTe+/CEfqncsVgELSSm6aoHldGXvDEcDmDE3bxiIoGepG08YXoZiAT1EBRhrcQ76Ms4N9VHK/EZFLFa5+hGCEDw/Ta2oYbxEEqH6fA0fr13ynVgY2xUwy3Hl0i9lMukBI= X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2017 22:51:11.3654 (UTC) X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=b61c8803-16f3-4c35-9b17-6f65f441df86; Ip=[63.163.107.225]; Helo=[milsmgep14.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0401MB1550 Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Avoid that the iSCSI target driver complains about "Initial page entry out-of-bounds" and closes the connection if the SCSI Data-Out buffer is larger than the buffer size specified through the CDB. This patch prevents that running the libiscsi regression tests against LIO trigger an infinite loop of libiscsi submitting a command, LIO closing the connection and libiscsi resubmitting the same command. Signed-off-by: Bart Van Assche Cc: Hannes Reinecke Cc: Christoph Hellwig Cc: Andy Grover Cc: David Disseldorp Cc: Reviewed-by: Hannes Reinecke --- drivers/target/target_core_transport.c | 29 ++++++++++------------------- include/target/target_core_base.h | 4 +++- 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index df1ceb2dd110..86b6b0238975 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -1159,11 +1159,11 @@ target_cmd_size_check(struct se_cmd *cmd, unsigned int size) if (cmd->unknown_data_length) { cmd->data_length = size; - } else if (size != cmd->data_length) { + } else if (size != cmd->buffer_length) { pr_warn("TARGET_CORE[%s]: Expected Transfer Length:" " %u does not match SCSI CDB Length: %u for SAM Opcode:" " 0x%02x\n", cmd->se_tfo->get_fabric_name(), - cmd->data_length, size, cmd->t_task_cdb[0]); + cmd->buffer_length, size, cmd->t_task_cdb[0]); if (cmd->data_direction == DMA_TO_DEVICE && cmd->se_cmd_flags & SCF_SCSI_DATA_CDB) { @@ -1183,7 +1183,7 @@ target_cmd_size_check(struct se_cmd *cmd, unsigned int size) } /* * For the overflow case keep the existing fabric provided - * ->data_length. Otherwise for the underflow case, reset + * ->buffer_length. Otherwise for the underflow case, reset * ->data_length to the smaller SCSI expected data transfer * length. */ @@ -1227,6 +1227,7 @@ void transport_init_se_cmd( cmd->se_tfo = tfo; cmd->se_sess = se_sess; + cmd->buffer_length = data_length; cmd->data_length = data_length; cmd->data_direction = data_direction; cmd->sam_task_attr = task_attr; @@ -2412,41 +2413,31 @@ transport_generic_new_cmd(struct se_cmd *cmd) * beforehand. */ if (!(cmd->se_cmd_flags & SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC) && - cmd->data_length) { + cmd->buffer_length) { if ((cmd->se_cmd_flags & SCF_BIDI) || (cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE)) { - u32 bidi_length; - - if (cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE) - bidi_length = cmd->t_task_nolb * - cmd->se_dev->dev_attrib.block_size; - else - bidi_length = cmd->data_length; - ret = target_alloc_sgl(&cmd->t_bidi_data_sg, &cmd->t_bidi_data_nents, - bidi_length, zero_flag, false); + cmd->buffer_length, zero_flag, + false); if (ret < 0) return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; } ret = target_alloc_sgl(&cmd->t_data_sg, &cmd->t_data_nents, - cmd->data_length, zero_flag, false); + cmd->buffer_length, zero_flag, false); if (ret < 0) return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; } else if ((cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE) && - cmd->data_length) { + cmd->buffer_length) { /* * Special case for COMPARE_AND_WRITE with fabrics * using SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC. */ - u32 caw_length = cmd->t_task_nolb * - cmd->se_dev->dev_attrib.block_size; - ret = target_alloc_sgl(&cmd->t_bidi_data_sg, &cmd->t_bidi_data_nents, - caw_length, zero_flag, false); + cmd->buffer_length, zero_flag, false); if (ret < 0) return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; } diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 49cd03c2d943..0660585cb03d 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -455,7 +455,9 @@ struct se_cmd { enum transport_state_table t_state; /* See se_cmd_flags_table */ u32 se_cmd_flags; - /* Total size in bytes associated with command */ + /* Length of Data-Out or Data-In buffer */ + u32 buffer_length; + /* Number of bytes affected on storage medium */ u32 data_length; u32 residual_count; u64 orig_fe_lun;