From patchwork Thu Jul 26 17:20:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10546267 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8B5BF139A for ; Thu, 26 Jul 2018 17:20:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7BCF328C6C for ; Thu, 26 Jul 2018 17:20:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6F3AC2BA93; Thu, 26 Jul 2018 17:20:55 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,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 A2A2228C6C for ; Thu, 26 Jul 2018 17:20:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731443AbeGZSij (ORCPT ); Thu, 26 Jul 2018 14:38:39 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:28569 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730085AbeGZSij (ORCPT ); Thu, 26 Jul 2018 14:38:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1532625654; x=1564161654; h=from:to:cc:subject:date:message-id:mime-version; bh=q4TqTjOVrlo2WQfIJsAa7OqDH4Jvbz46ilPl0bQNPmM=; b=qh2oIjA65lBWs7cAPARkLQyGAsLVVCgR4oy7gK0a0v0lvp/vKW1YIALX 5XX3eMMMQgtfsyPrEAo9G4X4kuRJPywHjOEyoy3OV1Ey4J/be0SvzOqsf qI8mphqDSy0UcUeRECRWf7QFQdvchDPUKfbr9b6cD+g251heCc/spdoQI pkQT30pLK2rVabcKk/OvvM/QN5sWrmVDeoKJgIXdpF8Jw5mTU+PxQdpOw 1WjOxbCgBiBdT1JZQRDNrIZuSH9Y4zmt1bsg/hCjhnrrP/hUY83xdT41j L9LvyrMOhduh69MPoBbb1vMqb/qEoIdcyDX/p4OBO1W3MVl0JoJkZPQAP g==; X-IronPort-AV: E=Sophos;i="5.51,406,1526313600"; d="scan'208";a="86498202" Received: from mail-cys01nam02lp0047.outbound.protection.outlook.com (HELO NAM02-CY1-obe.outbound.protection.outlook.com) ([207.46.163.47]) by ob1.hgst.iphmx.com with ESMTP; 27 Jul 2018 01:20:54 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-wdc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3Cf6S02MtD5prTf5km36FqUGSMu+Dy2pMA70f/NRYUE=; b=hE2BX/hbcdlTv97mGlu+0fZg2ud5UEKAKD8E1dvB4izWxY96+oQoId0UuRqxN5+6BEj7m/BwNu5nEYPdxBrGObl0g4u7fqHqvePoocpPJ0NHEOPcev/gBgCDP+xQ72hA2gYBpqdAJbmnliThH10Jbo3qYv9SP8u/ywyrE2Ve5FY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Bart.VanAssche@wdc.com; Received: from asus.hsd1.ca.comcast.net (174.62.111.89) by CY4PR04MB1190.namprd04.prod.outlook.com (2603:10b6:903:b8::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.17; Thu, 26 Jul 2018 17:20:51 +0000 From: Bart Van Assche To: "Martin K . Petersen" Cc: Christoph Hellwig , target-devel@vger.kernel.org, Bart Van Assche , Varun Prakash , Mike Christie , Hannes Reinecke Subject: [PATCH] Revert "scsi: target/iscsi: Reduce number of __iscsit_free_cmd() callers" Date: Thu, 26 Jul 2018 10:20:37 -0700 Message-Id: <20180726172037.2658-1-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 X-Originating-IP: [174.62.111.89] X-ClientProxiedBy: SN6PR0102CA0002.prod.exchangelabs.com (2603:10b6:805:1::15) To CY4PR04MB1190.namprd04.prod.outlook.com (2603:10b6:903:b8::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2dce5db7-3ce7-4410-42f8-08d5f31c233a X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600073)(711020)(4618075)(2017052603328)(7153060)(7193020);SRVR:CY4PR04MB1190; X-Microsoft-Exchange-Diagnostics: 1;CY4PR04MB1190;3:JagFLlRPZ30SBTWz1qed2YMY3c/11ltN0viwnB4XbP9Bqlerib1Jb0eu0RQ3qOamX6XcuDnsUouQ8mZmMfOGbt1vQVfwUYvi+DPKVVEupX5+JyrLhSbTRsD0sx3tE0nZJAc+4fEVwuXVkvXHAwkJyhljXNakNDiv526BiJwavCrOVXCENIBTLCiqtmBW70lrdmXcnnCmmhJlBFdr8JlsBm3bIH6OfoOv7JMGOtiuZA1hO73Cnsu5e1zbRnBUW+LG;25:gH4yQwX/xt+GfghugVFkaPqlqzXBfzaIVUWVpv2YMxr88BFxVyY/UqTt3XLNqRw3LhyNiTv1w8usB6OE40kjFBa80JzuffJlK6l8js26yWl0yinPxaMq0tKzPNkWzETWIDK41T56xH3lnLObWcNpT+5RPES4sLe0j5Z5l3muJAlu+J5osB4t3WKnSF86lDxwlDMX+pe+GIgW5L3KFbz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FmW2UV4x9o4nB47mJXZIlJng0F3mu99MT9oL4aQAGMOfpOznZqFrete4h5NS3/QCvS/j38nxZ1OS4okAI2tp0IXgWBNN6TGEPLFhoee++WJ+N8nNr6+Aqtr0bqu0EQjYWqP+EMn0bXFfNJaZXKuqjAFQiteWPjYhARk08exlV5gfdL5rqRuSa0jQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(3231311)(944501410)(52105095)(93006095)(93001095)(10201501046)(3002001)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(20161123562045)(6072148)(201708071742011)(7699016);SRVR:CY4PR04MB1190;BCL:0;PCL:0;RULEID:;SRVR:CY4PR04MB1190; X-Forefront-PRVS: 07459438AA X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(346002)(396003)(376002)(136003)(366004)(39860400002)(189003)(199004)(476003)(6486002)(2616005)(486006)(16526019)(6916009)(186003)(7736002)(305945005)(386003)(6506007)(97736004)(956004)(6666003)(6116002)(1076002)(3846002)(575784001)(86362001)(2906002)(81156014)(81166006)(8676002)(47776003)(66066001)(1857600001)(5660300001)(8936002)(14444005)(51416003)(54906003)(105586002)(48376002)(68736007)(50466002)(52116002)(478600001)(26005)(6512007)(36756003)(316002)(50226002)(16586007)(106356001)(25786009)(53936002)(4326008)(72206003);DIR:OUT;SFP:1102;SCL:1;SRVR:CY4PR04MB1190;H:asus.hsd1.ca.comcast.net;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; X-Microsoft-Exchange-Diagnostics: 1;CY4PR04MB1190;23:x7z1uAYqvsGHkDm7OcLa3qwJXuoRNI8N7j3E3s2Lk7vjyUJDiwSiam89QhC+OF8Fvh1Ebc4VinZVSBbulCCpoo8TBZW81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WAAJW3JniB/h71qxvyPF7WmuMEU19QPeBJoBrAzzmfWymQ6S1qPetAAt1Pgzvgez4yQDcxUGzf/s2OY=;7:5ezmv1nyZ9tfXZjl14wy3W6PcgpPrCSaeXuUnfVer/PiyN36GKjX5DfnsohT9seLU8AU6bYCTU7cHnNM7gnIUX9++5DDKjtoKcHo4m5cviAWFoCXah/+GZSCrIPY81WunQjyIY3UNUEQPImAq2KikSvFkMdrwrjqkLxPRWrTRftgSUFulZdhTNFu31Sk0UvfDCBpGITXlkPSvtGUDqApY/ZbsYj2kMxpr+EgwfY5VGvsi1Vcr2PNx1u5dw5Yw790 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY4PR04MB1190;20:a8e24hTx7hK8i6xzVRQZcRxB71WIHUZl2anwLh5A/+dRwTdr3rcw/hQ3fiev9hXmqpJrZWBNW1QGCBBNIOv9GxlAIWxwCiEHr1kVqQxh7RDzhI2TatmloNFxx/FnqdJYkHwHY23aOpQ1W2tnsJzmH8k484PwhztjrEJ8yg0qSLs= X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jul 2018 17:20:51.1832 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2dce5db7-3ce7-4410-42f8-08d5f31c233a X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR04MB1190 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 The cxgbit driver expects that __iscsit_free_cmd() is called before the target core frees the command page list. Since this patch breaks the cxgbit driver, revert it. Reported-by: Varun Prakash Fixes: ed88f055788a ("scsi: target/iscsi: Reduce number of __iscsit_free_cmd() callers") Signed-off-by: Bart Van Assche Cc: Varun Prakash Cc: Mike Christie Cc: Hannes Reinecke Cc: Christoph Hellwig Reviewed-by: Mike Christie --- drivers/target/iscsi/iscsi_target.c | 2 ++ drivers/target/iscsi/iscsi_target_configfs.c | 1 - drivers/target/iscsi/iscsi_target_util.c | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index d547dcd625d9..8e223799347a 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c @@ -497,6 +497,8 @@ void iscsit_aborted_task(struct iscsi_conn *conn, struct iscsi_cmd *cmd) !(cmd->se_cmd.transport_state & CMD_T_FABRIC_STOP)) list_del_init(&cmd->i_conn_node); spin_unlock_bh(&conn->cmd_lock); + + __iscsit_free_cmd(cmd, true); } EXPORT_SYMBOL(iscsit_aborted_task); diff --git a/drivers/target/iscsi/iscsi_target_configfs.c b/drivers/target/iscsi/iscsi_target_configfs.c index 1fcd9bc7189d..95d0a22b2ad6 100644 --- a/drivers/target/iscsi/iscsi_target_configfs.c +++ b/drivers/target/iscsi/iscsi_target_configfs.c @@ -1544,7 +1544,6 @@ static void lio_release_cmd(struct se_cmd *se_cmd) struct iscsi_cmd *cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd); pr_debug("Entering lio_release_cmd for se_cmd: %p\n", se_cmd); - __iscsit_free_cmd(cmd, true); iscsit_release_cmd(cmd); } diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c index 5a645b5f1eb4..8cfcf9033507 100644 --- a/drivers/target/iscsi/iscsi_target_util.c +++ b/drivers/target/iscsi/iscsi_target_util.c @@ -772,8 +772,10 @@ void iscsit_free_cmd(struct iscsi_cmd *cmd, bool shutdown) __iscsit_free_cmd(cmd, shutdown); if (se_cmd) { rc = transport_generic_free_cmd(se_cmd, shutdown); - if (!rc && shutdown && se_cmd->se_sess) + if (!rc && shutdown && se_cmd->se_sess) { + __iscsit_free_cmd(cmd, shutdown); target_put_sess_cmd(se_cmd); + } } else { iscsit_release_cmd(cmd); }