From patchwork Tue Mar 29 18:03:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 555088 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF8C0C433F5 for ; Tue, 29 Mar 2022 18:05:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240409AbiC2SHH (ORCPT ); Tue, 29 Mar 2022 14:07:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240406AbiC2SHG (ORCPT ); Tue, 29 Mar 2022 14:07:06 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B871B1896 for ; Tue, 29 Mar 2022 11:05:21 -0700 (PDT) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 22THsnGO013411; Tue, 29 Mar 2022 18:03:39 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=bAEErtzoJOJAVH4e9aK2fZDKQWh6MPwFOuK/BSiaNDs=; b=eM64eVIr8kN8JS+2A6syu2m0mWXnzfBiQ7/gwrs0f8mvqaGVNUeJgeZUBfSVly3Vp5es JTEb9BPKkkYJSIWh+gnQWsk76Czea/GhQcxXCLFYL4eb8OdgFcEmWWUjUSSUX/GWBjts HHZBLYfd8JIq2Pc70qEyc66kmoi61aSfMxVmo/ioO7DV6v3IXci5HmOSjKwg3bV2NY9e w1O9bEvwIFVih8BuU5efmDipDnuP8kWgYc35+3OPoUsfLd3BTxWl0Et2LXddIVRZUKeI PY6wQ80NaZUwLmPZvM3R6B6dpGr7tM4I1ml/mgxYMxn1SHz9Zw1XbRnXtcfrgoTMXUhK 8w== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by mx0b-00069f02.pphosted.com with ESMTP id 3f1uctqf6d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Mar 2022 18:03:39 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 22THvFJF048570; Tue, 29 Mar 2022 18:03:38 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2171.outbound.protection.outlook.com [104.47.57.171]) by userp3020.oracle.com with ESMTP id 3f1v9fhge0-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Mar 2022 18:03:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mS+9iJP4rL38+HuZzvu8qNa/QtVdYoL1PrdcXEes5a6IqK+CUjKGUCrOV1p1C2AUcGeBLgTr+IJMC93/ZlGwLe0LLqDdVTL7eyIIzMR11NMTFIMY3c5VSqTtgBdcVrNm7XEi+R7Cu451xf5WkYSbiEdRfouLp/4WFrJkJw1HYPdbjVMUxAD8QTcaP4pTKNl3NLkRxCq67Pr3rzb/RMV6AJzHD26bsQAKqKPP82ZMk7Ki+kUTj/p1bkWCis5581EWz9ovLkxHLkCDvhwHnNSC18a4gBKTTeOiu4JKYvRkLEHZ37JMtmSaXW3S7PvlRigtyjOnyQsklS4PZKraYQ1c9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=bAEErtzoJOJAVH4e9aK2fZDKQWh6MPwFOuK/BSiaNDs=; b=PuGhbsf2GD4t3MD5yWP8DQvcz/lewlzMPaI459TFD58e3rmk7YWBRiM8CrqaadK4vWwGm9MgSMzsTNFgPzj23GlDKOi0JiCZA3AttgqT/E/6dfjqcnG8IxE+hMxelDaVJA2vf/weBa+AVd/yfC/mB+EDATsv1j5u4YQJBtQajgasEFw419jSPtoq+zLk5aWQti1dfZdq4uOigVGoRRmc+O3EB8mw3JuMo7YiVaCJpXWY34R/C4nAkZhNdxbzjtUd8pfAVkM+Nn1ZkveoW/0Q85Tf94RZ41MhXjOgBka9Ix6rjvxhQ8kMTHyzGrvzebksnERYr9UuQkXyepY5iq696Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bAEErtzoJOJAVH4e9aK2fZDKQWh6MPwFOuK/BSiaNDs=; b=kEpQITbI8VtFpVcdZzh+yrZBhqNj8vbmLMQN/f3wa7SX48Jv3sycOaMMghkHgwANd+r9O8JOAfjHAetWP2vLf4Nd8Z5tOvfKgpn//he6Bgs1wBnHeGPcmHzlQKp+MpcevcCwW1mcoahHDNBpKWF2yz4/vyQ+nQuEbYF/I7EACts= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by MN2PR10MB3584.namprd10.prod.outlook.com (2603:10b6:208:11e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.19; Tue, 29 Mar 2022 18:03:36 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::29a7:bae9:9b3c:c9f2]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::29a7:bae9:9b3c:c9f2%10]) with mapi id 15.20.5102.023; Tue, 29 Mar 2022 18:03:36 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, njavali@marvell.com, mrangankar@marvell.com, GR-QLogic-Storage-Upstream@marvell.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH V3 02/15] scsi: iscsi: Fix offload conn cleanup when iscsid restarts Date: Tue, 29 Mar 2022 13:03:13 -0500 Message-Id: <20220329180326.5586-3-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220329180326.5586-1-michael.christie@oracle.com> References: <20220329180326.5586-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR11CA0002.namprd11.prod.outlook.com (2603:10b6:3:115::12) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d82f8d25-e4b0-44d2-3d37-08da11ae71be X-MS-TrafficTypeDiagnostic: MN2PR10MB3584:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OU1oxbXxqI/LQ19C+dSTM7Yp0C82PvBg9KBJCVApJaNgTHeDK2v6iw6ZtMvrPExe91WCLjilLhg3fNBEdbvruiYptKwfVw7m6/qUr3OBx2T01gs5n3zqZYa+RbskObBmOSS64BwxtCq6J7dU2b7RV5G+VQlexBInnThAb99i+dmhPrey3tnxvchDxpXLQhFDVd9M3GH4HAbJny3/QcxJ3AfTRQqQAHIo/k5MVe14JyuPBeUvHrOi3V1LqHPjis/oZFpfKGF2mDB8JQTmOei7iqCT/CEkMyqc/eGKs2SGF47XszmnbYTZ1RD9xceFEMmRv2gm9TlQ67gAaOoFhUOu2lhLXfDgUTAtBFe6U+xdaJWFUVCmoOhyHRtwlX2GqS9kpcdMarUSZ9FhocAMAjU01iaT3IWQOGaorYt3mwOpU87HqDElDt7hgpQQ5GB6pBH7aLtXHUAdNLBOJw51XTx51GQsoC6zmrtZQtPBwl039X0rzXtkHBAfo8VPuZUrrnTiPEgaFpf8TrFyVxcxTTgVQkQHRreRhvoDGJb0idNPZfj4BuWM0fc1yk4EvKKJ3cJIL1snjA6rCyPw2p4dGR7evlPkE/rtT+kFhMNgTJ7L9FJOfRD8CQS+asXw2SY/pg2TzKSImPwIHiZtvUMZXSWPQhkoBJu+FKwGswlpMBYC8kDnEZPshOw1QsTOVSFh5c+CZASaIkC5WdpRnHfHQV9CIA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(66476007)(66946007)(316002)(8936002)(8676002)(6512007)(66556008)(38100700002)(2616005)(36756003)(508600001)(26005)(6486002)(2906002)(5660300002)(6506007)(107886003)(52116002)(6666004)(86362001)(83380400001)(4326008)(1076003)(186003)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: o2ErCpwnZYSerq20DL1RBu7S4gKHWHeyvm15we9g6WzdjO30XwRiTJBGUAKTIE8028PUKeIowSJb1UkXt4fi/JOnxwPyfLE9b4d30qoHUvggGuU2EslfJy3SMF+47dvzzCqw8FE9acxYEFuWlmAcf/fHGo5bP9LpTBfFAlvqRL0pMfTbac/ZC0/SbUhI2BG2/v8mRdRXj/xlrZrEr3MlWjfVGNDtSJT4onPw2c9jtKHoDa0oZmrWdx1p0FIpg1WLivyHPC2Tz4KPJ5+i9J5AWKbR04LVmy9OU1LP0xkKzZeL9Cdo5qQq/E7+OyqGcuq4gIlbAF3H/geWEHnUOZcEYdf/8BRMWFmylXN2OQYy3GzWftEewnFWUWY4cWBVbw0biybagY5FT31iN6owdHRa/scq6NZ5Et8YgOC73b86IH7LSPlltByLmsvBvw1lJXhD+KmxyJ7QkqxnPZrBocdyBGFm6YI93P/EuH1/JT71TRfGA5Oe36/zxtXJdWVsmfuhA3TshGYyXk8k3fRbTATwFyu0nPpA6k4M5SO5rxzuxJjCy2RNljSHhT+a5kdv6xunaXAAsquO/p80bvTVGNf/vdbSNzxfk+AapwPghITAVbkicJsG+q1Dp5X1Qt1vB5egyveKyvlOmlL0aJN3fCM66I2JQrd3sYkExizFHaHN6rSXmr23qOYv/rTr7kpTnA1Ka4mjwwYvepYwuT4EdZuDRjcsViZPUw1w6OqPsT89YVgwAo1pUR/dNDjfLOsvZusmn6ddmqolRpbuM0lAYOY3vAnkWvatpM4UZQ3cdneBym+Tpk3d3wd+NF9Xr/GT2UkKqI0uqBBcI0qt1gQmjgPWWwiKMZuEnKdJtTJt+kiK5htQLrNgTzyTDJfkU7ZdD42pMKmoQtMOKs12auoZBQTTm4mrlle6iwwIT7EfUMJunr5G0xhe8cynLXJQPAKTJCpnBkwSJKf1JEtCycCqAk+9ldNszrhZozx+wdXwC76q8mItuABKkkLqZOACVUQ4V4SrezX/pyr/CqJHYEAcfQ7Wo/wpLmHIHXv5o4E5Ek8QRg4LP1RwH13aRybpqNdls/eL5lMln/gkpnNPLOKs+ilIyyo14iJRb8jPEtQl9EaQQYKxCEsWqyarDrgn3VK7ptFDI5vFP5XbG+O4lqEzNqv9D2UioCJss57TfN0mGKAJuGsrHwYjzZC8jUdqj6ZHZ0+j5pcpIzI1nugYSRxhQdvs4va0eD/Rb8mPgmPn+mo17kO5ykyd68IOu8Q0Ov9+6pLwzW2cM5s7JY44ty5hXBtfm6ZkJKuSbn4aaOqFPh9Upg1PtXvo2JbWKxey1GuoWlDhQGvVm+0hlf9+hobzsZZ44VRET1rP/mFHEuBBfVl+7boPoFdSSIjduAUewg72LaS0e3y7cY+TGyKjUmDjkwdIvOaSiwOetczQVYLOYK057GxJ5NzGAolMa8fj+ociH4R+OZUHwVognx4lm5pIRJcP//XE3v1H+2RHRiW5EVzt5wFR3ptZTchaNi/kFtEMq5am/jR4zpGFpO9rwWOoaH8t9yd5B6uNEA4bQag9SUT0wZGupLe8Ht61NP6ozrf4ubg/SAJZz8py6CHMUq0qPt5RnQIDbdiVpAjsSH5vQsLAlpNQbGYNPzEbhIEyVW2xNfphHUs/Fc1mXEfkTK6mZ1f0ed/J6Lq9eysSJlTGDhUwFHWIqsVo4F23mj7yg64ScwbZVYqASBZdt+oBggXD90jZSH3afdyG0kvtbpO196INNtQ= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d82f8d25-e4b0-44d2-3d37-08da11ae71be X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Mar 2022 18:03:35.8183 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: LqYTgTrdfJLBf62UOr0uS411dzNL+dEuA6KugJUuUirF5c3avMbWXofXsUA+PfC6QWuPIpJVqHZSC3uozawN/f9dhW0b+/bPML8y2qTzxsg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB3584 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10301 signatures=695566 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 spamscore=0 adultscore=0 mlxlogscore=999 phishscore=0 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203290101 X-Proofpoint-ORIG-GUID: UR4jTJO9-q7UTyZKOdpkLf4-zaHWh9fK X-Proofpoint-GUID: UR4jTJO9-q7UTyZKOdpkLf4-zaHWh9fK Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org When userspace restarts during boot or upgrades it won't know about the offload driver's endpoint and connection mappings. iscsid will start by cleaning up the old session by doing a stop_conn call. Later if we are able to create a new connection, we cleanup the old endpoint during the binding stage. The problem is that if we do stop_conn before doing the ep_disconnect call offload drivers can still be executing IO. We then might free tasks from the under the card/driver. This moves the ep_disconnect call to before we do the stop_conn call for this case. It will then work and look like a normal recovery/cleanup procedure from the driver's point of view. Signed-off-by: Mike Christie Reviewed-by: Lee Duncan --- drivers/scsi/scsi_transport_iscsi.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 4e10457e3ab9..4aee0441e624 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -2260,6 +2260,15 @@ static int iscsi_if_stop_conn(struct iscsi_transport *transport, * Figure out if it was the kernel or userspace initiating this. */ if (!test_and_set_bit(ISCSI_CLS_CONN_BIT_CLEANUP, &conn->flags)) { + if (conn->ep) { + /* + * For offload, when iscsid is restarted it + * won't know about existing endpoints. We + * clean it up here for userspace. + */ + iscsi_ep_disconnect(conn, true); + } + iscsi_stop_conn(conn, flag); } else { ISCSI_DBG_TRANS_CONN(conn, @@ -3704,16 +3713,6 @@ static int iscsi_if_transport_conn(struct iscsi_transport *transport, switch (nlh->nlmsg_type) { case ISCSI_UEVENT_BIND_CONN: - if (conn->ep) { - /* - * For offload boot support where iscsid is restarted - * during the pivot root stage, the ep will be intact - * here when the new iscsid instance starts up and - * reconnects. - */ - iscsi_ep_disconnect(conn, true); - } - session = iscsi_session_lookup(ev->u.b_conn.sid); if (!session) { err = -EINVAL; From patchwork Tue Mar 29 18:03:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 555087 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E877C433FE for ; Tue, 29 Mar 2022 18:05:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240420AbiC2SHM (ORCPT ); Tue, 29 Mar 2022 14:07:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240407AbiC2SHG (ORCPT ); Tue, 29 Mar 2022 14:07:06 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50E91B0D3D for ; Tue, 29 Mar 2022 11:05:21 -0700 (PDT) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 22THsnjx013410; Tue, 29 Mar 2022 18:03:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=dSVVvnRo7jDyQF1UEfJ9nfGfuTuhMtgmUInw4qCJyjw=; b=AqSUb9zNIhGMKr4Uw4h3Bb1Jl77FgNn5r/eZxDVnprjsROxH8LD0bJtjJP5ELBRXnVVF pyF3SKKeobCtTjJ2j13p0PW0zHzMoxWxm++GifFFEs7/fniRVHP2Hn4yJ0kWBCrpaJIB JwuJukUDlRkENCYbvcO5sHb4h17hR2Eqc1xXoGuO4OmujxNeGUx2XypVflu6A1Oolcxp T0eo3sUjd6/FpswMyf+i5U/u0zaXUpSeYkbmdkOxitTbe6kuil/UE9+qND/HESRdwPmX uq1b4Yg9ZeivYGRR6DawI9qP/Kyl2W+Gxi/xpN5X4Ye/5rH1zAfBEXpMiafE1J35otl1 2g== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by mx0b-00069f02.pphosted.com with ESMTP id 3f1uctqf6e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Mar 2022 18:03:40 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 22THvFJG048570; Tue, 29 Mar 2022 18:03:38 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2171.outbound.protection.outlook.com [104.47.57.171]) by userp3020.oracle.com with ESMTP id 3f1v9fhge0-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Mar 2022 18:03:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DBjonTz2fQoIFb/nyyMdu7Ze1mZn139Le4VHlp9wSHyxtSrQzK1r0lSbecxANmIdMWf1v3EXeL9MVfIhCBiqw5fhlb0EMhSmXFM9vW7QA7OkYVmlyf0duBihWlXeda/q9HUUl84tHrtBMipWuJzr4Wl0QGVU75kueUy3kubLK0z4xIAEamj6fdiGVRmARx16oop6ZhmMKCG8AheMvs347s01TrXjUHzhE7P4EAwP4TMoXx5Wjvk9ji1zHS8FUIYh/5Fy1sldsz7sXnmprbROzPdJ292sezH7ABK+Hu1cmOlL7GNwVgefthzTNiXdKV2V+rF0IvI+xOdxoCDvKEH3fA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=dSVVvnRo7jDyQF1UEfJ9nfGfuTuhMtgmUInw4qCJyjw=; b=VBxmuCPcMeCH1ZHwPtyKEiFh+cIdgJq0A6sI5kk5+vJ6iWq0En7yAbQRlIvidn7GV3vuyC70vkyQCUvr4GbdCDlA+VjSOg2rdFVkQzk7znPoQgCAH3jyQUD5Ss/XzE5QC3NCjDJA4hjKu4cJI8l2QOEm35rAx+GMCM4fNEiRQycYK/nmr5zI/40fRtoI+YZudmniq6DG2LWCuntG6gKDntUb6Dhmk+Bmwu5KSZ9PTnkxklggb3Yj1r/oQv4fvjhF3HmvpdxWja3Iyz4yJElZ3Dfe/gCfsQkelmu7oU+52KUVIsyzMW4rEVNh1hLNGkbwT7I9mBwClEEVyEqXRKJ5LA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dSVVvnRo7jDyQF1UEfJ9nfGfuTuhMtgmUInw4qCJyjw=; b=WxSMOmjhdVoXrMKXY/Q344fHAeKAq87OsLc60LnqkJUoQ7n2kSnFbf/mWYddRTzyIEjn0gouWqVYtGcnkpSETw78hoajo6zfoUFZD8Erk9w20hZY+5nHgY+rKD3wn7iy2w85CHDsudECFzo9+6Mpy7VrmMSVs1lQoDcz/E9j3Xc= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by MN2PR10MB3584.namprd10.prod.outlook.com (2603:10b6:208:11e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.19; Tue, 29 Mar 2022 18:03:36 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::29a7:bae9:9b3c:c9f2]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::29a7:bae9:9b3c:c9f2%10]) with mapi id 15.20.5102.023; Tue, 29 Mar 2022 18:03:36 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, njavali@marvell.com, mrangankar@marvell.com, GR-QLogic-Storage-Upstream@marvell.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH V3 03/15] scsi: iscsi: Merge suspend fields Date: Tue, 29 Mar 2022 13:03:14 -0500 Message-Id: <20220329180326.5586-4-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220329180326.5586-1-michael.christie@oracle.com> References: <20220329180326.5586-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR11CA0002.namprd11.prod.outlook.com (2603:10b6:3:115::12) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a6962e68-8b76-4dfd-261d-08da11ae7208 X-MS-TrafficTypeDiagnostic: MN2PR10MB3584:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FHkbashCqeI9KDvwQ0VOxYMfRlc8dKQOuYLvmWACHiFqSjumuFY2oZIm1FkaC+S5Ebyd716e85F38LtbWDvV0GcCKQqir5ogzTqI+iZ2gwvBSRn+srvv4Iq8LffGXP+LKpw5XbzxSqrRtGdJAonfRlIQVujHixeLuB+OIGQgkiM3lYJoqNQXmb4EL2N6fGAuUdGbPB/2HieBe8UTibLhaDki5J/H7ljrKDgpUo9yH1+/Wrxby3fQG1tW9mLCbLa1PtU0wAHfczsdZl3YRGOhpTP7FwfQaMSHwVR/VjobnzwY5W7r0ghQQKfW3RZ64mNMsue+dL4sce3N+gw39Rrcw2jHZ9pRWfB91UXFN4ylC2hY2Us9+FKhqHhN52sS9MoD+w6jz/034UJemyhkckMe+qCmvyal4ZEe2gt/aDhmDVmwYAa2u9vq+IGKNlcj/Hl5YlFnsjgil8y6kWDGqEkWjdEGFCFuRJZ8FRD/FoddvzlBTrwmw59CLq9uRz1FAtmBbwH93tCZgVcdQy0h/UMAgENvpeZFDv8PmQQFeBPv8kVecaMBZIH/u5YdnPch4Ns1zGqhtMNf1iIXRUG9awhfbVizbtGQsF9ro5nzLIsDirXNuODYiXWVjgFd4j28z6riTH8H6GM/oGsgCx0GJpZsMrFqpQsQUK3Bn7ZB+jekVs/2vXE6a2c3IsCoeUXKKaPVjT685xEJavV2kRDuoUTuUw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(66476007)(66946007)(316002)(8936002)(8676002)(6512007)(66556008)(38100700002)(2616005)(36756003)(508600001)(26005)(6486002)(2906002)(5660300002)(6506007)(107886003)(52116002)(6666004)(15650500001)(86362001)(83380400001)(4326008)(1076003)(186003)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Fz2b/9PYsIwv/CUhL1gcaCeh03ziGdRb70xbG8NsKyRUoT+Rpr/5VkbBdkN/ZhbDgsQLQ6fRPPQD/Ea3oAfUU1M3ymcreSzNe/r006W/jApBdBuH3STTKYSFKL23/HVNKzaVdkXcqqzp82qEm9uiFGZx2DKTZxG2KbwRWRMYKTUVGgWukUZkCji4RN+ro3GUImN36KUEznUGHw3nqowFRaQQTBSMbghh6BvJ/kU7b5wfXjhxHRU36/08lNYeR1+4jjToJlu83eLcT9SfhgPAy85NtVBwK9yrA4l0FCau+ZaBMKBWcGo5fUsjzNVijplVYKvO/IzhGXZge2bYyrzNRbAgJ1111bkMqfBkvZYvndjot/mpY9QWKDH6pw1c9c0g5cp0gaSNQVSvzchL3UMlemRaK+4pAvy+HHomVi8Oe+3AqhFZr0E6jyA2FRFSNzrrhYUMYJyIKAwiiHRMIS8w6jdtTjTmZfQIC42aTQ5zeW+acIYNQR3oVF0DFtRjX+6HqIWR3C3ZRqRH7CJBeGYCm8ipYHp6CQ7RJXEKxyyIlN++dKYfBFndC+fPYUPF/7SkEICPXlcRrLjiJT6tf0C6V2TEeqhTka+SwTXW5gGPguOq+H5buMlOb1X+U3J7Km5jcvIK5ZVx/+aRsp/H4DWYjd1LD/0ptEGegHQkEIgbk16kot/doVKH1TaCOY3NMdLSP5i6JE2+rXRsAfYaprfGCCSxqke2HPnTZ0XzE8MmoXBPWEDxu0YfHryCZjhgmXDpTsN76+V/ghc0aY2+a67/Rqozc3GltFylw3M4GXNpAqBKPvkWyv0J2WSY7b3mHzKsyN/+AA6jCY9ruGzIFLAkhQ+I15IBjdAqYb4kUjR4bbhPENiM61bx8Gr6dI2u7VzoDRznbw9LtqbLdh6NkbBHkSAJThHsuEKUyQhtictA05oDJ4YA86LQcaKesJe3xPUhyoIkrRXI6ubkAaB8z5VSmSAf2HRHInwiJw/2NeR4cSBalL6kRDvwU0mGqGI71Zraj4GXXhTYU1r8XSzyVm7wROyVEydGe3/DFcn0SYj/QaYfCZ97dGhzzPd8Pvr1xEglQCw4xbftIUMfaWpgQS7KFjni/8vewVXHQg31WIHwWN3/DJ1nCrfmM8MIt7d3fpZ9K3MXwcTo4RDwMfcgBCzDdF5AVDoGcF+FpP465ekzJqbswEmFnrfwFWIeM3YvdxRbyKVZIKvtqcRPvT0E5HNSFMe1zK0H3aA3uIMpOJLSbHVS6xhV7pgNdH3HDtc16v+7XNxRFKSvEDJVtk73rWXUhDFKL/pUo2IdubQB6LwshoD5sYpC5Cj7rPieXWOnZrPMS6sEkquIpG1MBTvV1iKaM4mfs0/Oi2qqrXWYECwFXlWxCizwf/yHd7KYNmV0ffwAAr6wu2iyGNyGMStV8C6rgPLQj/idA/eFP5C4a6ooU/Hfg9zL1jPopWsffn3z928unBpEhW1xMdjcFYXwKP+x6NhCkXwleh2Ch6E10j9dxjQ2aH5VuxM8raehMWgEf3CxWTXSxt2MqxNlnptyIh0tSEVPjxE9tznlO/3KT814BmhckbnXEDPjyoS27u33xy0MDwTo00W80e0Psosh260nZccP+hF7+dKPI3TrHjCQhWhszVgkHrteCQg6/4H889n0ABRo3DKJQVNNbND/vZm58sNsS3AOZ5cwfDbPKvwm1v+u+mfRb24mlBziNx5q3G5wvsh42Rwu70EX/MDcOFh6dUBSsdpZdfBEfpmWqR0iZb0= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a6962e68-8b76-4dfd-261d-08da11ae7208 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Mar 2022 18:03:36.2871 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: KgvMRveLgsc5c2Hh3+kHArYf6ly11/mc7Blc/FWnBD9Uaucq3WTkhqD11K/Uxz1Ugd2Ntsvq+5PlWjrwqjfQWSAcoLYSm1xPw+bR2xfEUhU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB3584 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10301 signatures=695566 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 spamscore=0 adultscore=0 mlxlogscore=999 phishscore=0 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203290101 X-Proofpoint-ORIG-GUID: i7Ig6aG6_cYVPScQ8eESmT2ubsdONYMA X-Proofpoint-GUID: i7Ig6aG6_cYVPScQ8eESmT2ubsdONYMA Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Move the tx and rx suspend fields into one flags field. Reviewed-by: Lee Duncan Signed-off-by: Mike Christie Reviewed-by: Wu Bo --- drivers/scsi/bnx2i/bnx2i_hwi.c | 2 +- drivers/scsi/bnx2i/bnx2i_iscsi.c | 2 +- drivers/scsi/cxgbi/libcxgbi.c | 6 +++--- drivers/scsi/libiscsi.c | 20 ++++++++++---------- drivers/scsi/libiscsi_tcp.c | 2 +- include/scsi/libiscsi.h | 9 +++++---- 6 files changed, 21 insertions(+), 20 deletions(-) diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c index 5521469ce678..e16327a4b4c9 100644 --- a/drivers/scsi/bnx2i/bnx2i_hwi.c +++ b/drivers/scsi/bnx2i/bnx2i_hwi.c @@ -1977,7 +1977,7 @@ static int bnx2i_process_new_cqes(struct bnx2i_conn *bnx2i_conn) if (nopin->cq_req_sn != qp->cqe_exp_seq_sn) break; - if (unlikely(test_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx))) { + if (unlikely(test_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags))) { if (nopin->op_code == ISCSI_OP_NOOP_IN && nopin->itt == (u16) RESERVED_ITT) { printk(KERN_ALERT "bnx2i: Unsolicited " diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c index fe86fd61a995..15fbd09baa94 100644 --- a/drivers/scsi/bnx2i/bnx2i_iscsi.c +++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c @@ -1721,7 +1721,7 @@ static int bnx2i_tear_down_conn(struct bnx2i_hba *hba, struct iscsi_conn *conn = ep->conn->cls_conn->dd_data; /* Must suspend all rx queue activity for this ep */ - set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx); + set_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags); } /* CONN_DISCONNECT timeout may or may not be an issue depending * on what transcribed in TCP layer, different targets behave diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c index 8c7d4dda4cf2..4365d52c6430 100644 --- a/drivers/scsi/cxgbi/libcxgbi.c +++ b/drivers/scsi/cxgbi/libcxgbi.c @@ -1634,11 +1634,11 @@ void cxgbi_conn_pdu_ready(struct cxgbi_sock *csk) log_debug(1 << CXGBI_DBG_PDU_RX, "csk 0x%p, conn 0x%p.\n", csk, conn); - if (unlikely(!conn || conn->suspend_rx)) { + if (unlikely(!conn || test_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags))) { log_debug(1 << CXGBI_DBG_PDU_RX, - "csk 0x%p, conn 0x%p, id %d, suspend_rx %lu!\n", + "csk 0x%p, conn 0x%p, id %d, conn flags 0x%lx!\n", csk, conn, conn ? conn->id : 0xFF, - conn ? conn->suspend_rx : 0xFF); + conn ? conn->flags : 0xFF); return; } diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index d09926e6c8a8..5e7bd5a3b430 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -1392,8 +1392,8 @@ static bool iscsi_set_conn_failed(struct iscsi_conn *conn) if (conn->stop_stage == 0) session->state = ISCSI_STATE_FAILED; - set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx); - set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx); + set_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags); + set_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags); return true; } @@ -1454,7 +1454,7 @@ static int iscsi_xmit_task(struct iscsi_conn *conn, struct iscsi_task *task, * Do this after dropping the extra ref because if this was a requeue * it's removed from that list and cleanup_queued_task would miss it. */ - if (test_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx)) { + if (test_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags)) { /* * Save the task and ref in case we weren't cleaning up this * task and get woken up again. @@ -1532,7 +1532,7 @@ static int iscsi_data_xmit(struct iscsi_conn *conn) int rc = 0; spin_lock_bh(&conn->session->frwd_lock); - if (test_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx)) { + if (test_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags)) { ISCSI_DBG_SESSION(conn->session, "Tx suspended!\n"); spin_unlock_bh(&conn->session->frwd_lock); return -ENODATA; @@ -1746,7 +1746,7 @@ int iscsi_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc) goto fault; } - if (test_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx)) { + if (test_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags)) { reason = FAILURE_SESSION_IN_RECOVERY; sc->result = DID_REQUEUE << 16; goto fault; @@ -1935,7 +1935,7 @@ static void fail_scsi_tasks(struct iscsi_conn *conn, u64 lun, int error) void iscsi_suspend_queue(struct iscsi_conn *conn) { spin_lock_bh(&conn->session->frwd_lock); - set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx); + set_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags); spin_unlock_bh(&conn->session->frwd_lock); } EXPORT_SYMBOL_GPL(iscsi_suspend_queue); @@ -1953,7 +1953,7 @@ void iscsi_suspend_tx(struct iscsi_conn *conn) struct Scsi_Host *shost = conn->session->host; struct iscsi_host *ihost = shost_priv(shost); - set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx); + set_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags); if (ihost->workq) flush_workqueue(ihost->workq); } @@ -1961,7 +1961,7 @@ EXPORT_SYMBOL_GPL(iscsi_suspend_tx); static void iscsi_start_tx(struct iscsi_conn *conn) { - clear_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx); + clear_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags); iscsi_conn_queue_work(conn); } @@ -3330,8 +3330,8 @@ int iscsi_conn_bind(struct iscsi_cls_session *cls_session, /* * Unblock xmitworker(), Login Phase will pass through. */ - clear_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx); - clear_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx); + clear_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags); + clear_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags); return 0; } EXPORT_SYMBOL_GPL(iscsi_conn_bind); diff --git a/drivers/scsi/libiscsi_tcp.c b/drivers/scsi/libiscsi_tcp.c index 2e9ffe3d1a55..883005757ddb 100644 --- a/drivers/scsi/libiscsi_tcp.c +++ b/drivers/scsi/libiscsi_tcp.c @@ -927,7 +927,7 @@ int iscsi_tcp_recv_skb(struct iscsi_conn *conn, struct sk_buff *skb, */ conn->last_recv = jiffies; - if (unlikely(conn->suspend_rx)) { + if (unlikely(test_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags))) { ISCSI_DBG_TCP(conn, "Rx suspended!\n"); *status = ISCSI_TCP_SUSPENDED; return 0; diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index e76c94697c1b..84086c240228 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h @@ -53,8 +53,10 @@ enum { #define ISID_SIZE 6 -/* Connection suspend "bit" */ -#define ISCSI_SUSPEND_BIT 1 +/* Connection flags */ +#define ISCSI_CONN_FLAG_SUSPEND_TX BIT(0) +#define ISCSI_CONN_FLAG_SUSPEND_RX BIT(1) + #define ISCSI_ITT_MASK 0x1fff #define ISCSI_TOTAL_CMDS_MAX 4096 @@ -211,8 +213,7 @@ struct iscsi_conn { struct list_head cmdqueue; /* data-path cmd queue */ struct list_head requeue; /* tasks needing another run */ struct work_struct xmitwork; /* per-conn. xmit workqueue */ - unsigned long suspend_tx; /* suspend Tx */ - unsigned long suspend_rx; /* suspend Rx */ + unsigned long flags; /* ISCSI_CONN_FLAGs */ /* negotiated params */ unsigned max_recv_dlength; /* initiator_max_recv_dsl*/ From patchwork Tue Mar 29 18:03:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 555083 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A6BDC433EF for ; Tue, 29 Mar 2022 18:08:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238562AbiC2SKe (ORCPT ); Tue, 29 Mar 2022 14:10:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232456AbiC2SKc (ORCPT ); Tue, 29 Mar 2022 14:10:32 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9592B1ADA0 for ; Tue, 29 Mar 2022 11:08:49 -0700 (PDT) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 22THsDHC029587; Tue, 29 Mar 2022 18:03:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=cg3mDLxHSNZm5z0U9jnw4HdMWMJYX3xC0x7Bpwgs0Iw=; b=Bdt47IoM77wN0wUIyX2xlD/6rITxa7nO3qDEI00GwEFEkv29G5vjb7hDpXHFQjo/98e5 Tl3LidGbEQ+cNG/NOXEu7L/CbU27OdJpAC41GjtpeEnU5HjpoTEMJlzt83ufNLy567xS IvD2l4h0XIlaZ1DCwpmSdaIRj67EOMOxIR4CEIiv6dXalDfnXhlb6HDGa53YGE48gY6l cg+oCPKB0jDY9B+CNd8VRs+IG4JzGZsN6eDLZCbTS2gX4EVb0n5y4FlrXPD1NgNeiDsc Z4G/FshQ+gN9bFkse60ng73arO+lu5z7ckx0gMA8qhRBX0ZelDx0AJJRu9Ym184J7gzK xQ== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by mx0b-00069f02.pphosted.com with ESMTP id 3f1se0fcv1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Mar 2022 18:03:41 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 22THvFJJ048570; Tue, 29 Mar 2022 18:03:40 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2171.outbound.protection.outlook.com [104.47.57.171]) by userp3020.oracle.com with ESMTP id 3f1v9fhge0-7 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Mar 2022 18:03:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TnAkyblm4HlUX9Q+XWV/mQNj1KwFk7TPvN5CCWrdCchI48O4mRRafmJNsND9EjnqHwbmRc0qe/eIcGwetlbEiyZVejNiDIxsGCHw3bF14JfdIYfhsXMNFOGxfdrdDbNApREHaNmVhO5l41ytx4rv/EellFQ1w2ZNgiWNEVjaGTFUnYVSLjVqNRvcQvMmQlFLtkrdFWscQkSvUQ04jmSdaCkBgXA1FueqzaunqA+DpZO94NSZT1nK0CjQk6e6Ko5+Fet8aI0lMqj1wTgIje+ZHzN723wOT+Bqtav8yYzc4qysCf2A+yyMrANUFuVYetgTn1JUMuRRHkOIgvmUTA2boA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cg3mDLxHSNZm5z0U9jnw4HdMWMJYX3xC0x7Bpwgs0Iw=; b=K35Gq43QvU+Z4J2bns3/CuEhDmTUF5i/fT5muVX/IbtzWcpbuWhYvO6HcqI1NoC97rTEo4KFtKw/pB4LFcLuO4gB3WWGnqtoS9iJcUWxjFbT6Jp0W1Tobn/jivsCUMGzGJYzg0HNY/iAn5nKeYAOYbs7yCmZyoNxSrqgMR4oeU8Ek5SKmtxCA+Mh/dhMdGBIO6MStu5knMDnT++GfpazUKQOsuUANGHY+nJjDcDZ7mc7usnROaCBFgULbAo575iL878uf2qhSp2xix4wsKF5I03mf2tLSv0BwOhr/qIZZgoZWnwITvy/cjfos2NntBBlLQ+B8URKn+fMvJwBaFFXBQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cg3mDLxHSNZm5z0U9jnw4HdMWMJYX3xC0x7Bpwgs0Iw=; b=NsvFQMSLwLwErHpDw9MyhTI+3Sh2VkFbXCGOhADxHi/AkrAQbDPOefSSXJOQGvzFtnHJgTOyayw+YCE9/UaPyc/FYBFq7BtCsvo6oH8uPSvOBrgqK1+sHo0XXyYKX3ck5z5Nr4Azm9D2DeRQ8s4Kk33bOLO+xRUbNqRjDe0ie3Q= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by MN2PR10MB3584.namprd10.prod.outlook.com (2603:10b6:208:11e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.19; Tue, 29 Mar 2022 18:03:38 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::29a7:bae9:9b3c:c9f2]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::29a7:bae9:9b3c:c9f2%10]) with mapi id 15.20.5102.023; Tue, 29 Mar 2022 18:03:38 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, njavali@marvell.com, mrangankar@marvell.com, GR-QLogic-Storage-Upstream@marvell.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH V3 06/15] scsi: iscsi: Add recv workqueue helpers Date: Tue, 29 Mar 2022 13:03:17 -0500 Message-Id: <20220329180326.5586-7-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220329180326.5586-1-michael.christie@oracle.com> References: <20220329180326.5586-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR11CA0002.namprd11.prod.outlook.com (2603:10b6:3:115::12) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6962af4c-cd90-41a1-e0d1-08da11ae72e5 X-MS-TrafficTypeDiagnostic: MN2PR10MB3584:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: laPJqNBlNG5oztSt+34GBdVWh/vXudMviPUeOseIE/bY8m+2UrTy4sM7wHkswFEOqsPnB4idfVGoF/HXOE6F59FXRjkSFwJx8H5229ezd7dwzpBGTLg0Z+wv+MDza23zsY5BXpCp2PYLWc2o//72eJhvj6fOFLd7su6u79FLDDiRlMM9Wze5TztgAaKfjKqHxUdNxnVrCtM8Rb+sz+KXIzz3ulScVuRap4Yyy7v/1U+A9r/nRJCTVE0/nts7TkUEjwCDp7c5dcsIjTS3moPh/mv9CMC+Nf5Dbkn/v2Ofwm7L1kH5r9PRlO8wBvTbC+O/LS0dT33mhJ5XO81pNIW0HjHDbmx1fFJBr6CQf9OmVe12Sy4qs24Dm5zJMVzOHDy4c29LzrkUaLe3YN3T+J0D6uflhuyHCdw9M5bgxxUsdCpDKd6hyH/IZYhQTt8caPLEP9w3gaMltzxFGYyJySqisJ93t7r9+VHn0RcRsxHCzA9IAHI9vPTsmBvIxtUeC5p9malLHlG3/wZ8JgDifD/SLFpU5wzN3diig8lbX/nqX1+we9BQ/qZZ9UjoPCzt8Fa7LZBeCLxR++8BuzHI0539seVzu7JDfkmvg3J3m03/pfiGkz6oFjII85JKvKyqByQvIEsTBs6U2D4qXogZo9+dmWR1A0SnJlHlBDoh7KUGfXNxZD+IHbyw0XUHRlfGJtWvrN+10Ss3tJR0Pq24pD9qfA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(66476007)(66946007)(316002)(8936002)(8676002)(6512007)(66556008)(38100700002)(2616005)(36756003)(508600001)(26005)(6486002)(2906002)(5660300002)(6506007)(107886003)(52116002)(6666004)(86362001)(83380400001)(4326008)(1076003)(186003)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Qwd4AysxffVWnk5aJRAaJiRaJg8uj8/EZcooFseBTSU7nkvEWbXo1JKhjSTyvgarhCnJTdlpnTm6I9rMyyGHVW/D1lUCWz0Qn5eE4cYVy/Qscc0nQsqLkDa89BTWLBNrITpdN7FJfOTAbfO5FT8UEfaZ+7TInsn4n76j20AF0cZdJZrsGxnvGX6+fLATPFPZwn1zxdRiG1k7UZFFYReSLT74TKcGYll3eFQGchWLGYYx3dlLQlPJB1ueqgSOMaBYci4nD0zdinD2LQ2OO2KCiTLmsstEO+b7W+bq3aeDE/zExsVoQu5VMdC1q71CykCoaqcSoM+vdyXvVRZntm2fUOVni//2SoUsNuI8JQq6mGNw4jJrufeGk2cq9UnK1W3Eyi4WZLhh+OFuNT5qXqDFU8O0KfgLDf/A9xQwt2no8zXlW4OUcaVf0k2D/ie6Q8nz2IW24WFQ0S5msl5T658ofDjmxtwfGtik0gPTt+jQdQsapWai1QNl8ay++NecEBl56qyBnE2SgCxuNrwEPS3RSg6TWjEvBZ57Equ0qzwzPCGRzBVlL3z5oACYIEEZHwnV1Quy1lEkuDKKvdmg0wXw/+Ny7VUbR80WYZ1H8CuCVr9K2IzYszDs5dKnanPaku02fr4/145BvCGI/QUfbrqgzkjpuz9GmI8i4GGJOoi17QTOrhybX5zlt0UIu7k7hkD2citD5Ba7GtP9LerOcFOo2x1jU0CqLGKGc4D2NHuXv//r405RRE03RUhfTwVhIRebiDJD3ZjIDbOrDiC+16jyfrf4St7NNS+5O5mNUITc9VjUa3S2RnxXvPGGl3x0H+/1chC2xGeIoOd4WkimAEHFq8kjLXgY3Bsv51hlwEQVzyyQnjVK14U/xX9Yz1JnK4cR5Hgmgp/Kc/citP1ttM5E+kUDRiTBqANt40HWWiPOjO/PCxoB5doUEImvhPhCkGo39LmW0sqAMLI+DFLK5SlgYyPNeFxa9Ow3vxAPxiUBVzkUJ4wGLt730k3FSgEePrlHDwcY1bly3MYKdcw2/5sFZV8EXUnJMvkK15mFHMgT/K7kflXD54AZZxC1nB2oc6oPJ20A4+/IMDzhH5fqpep0XijwUuMZld5h/M8Y/uC4BQQQwujclSxZRo7D3dFZ8HJEUCgzBTMwX9Ek6zkPCU6IIHzrLcjfwL/m0oipB8D72QKkDgfqAGuY8+qbnPGjVvVIBw0SwBJHT21AyZCCzIEbr9czcDoMEOjtEyNkJkdCQtjpTXxK3JNN9Iz+s6HdybCiD5UzxHpkwBAs7+wSTHARQ8S2/0QS1guA7/69W0ahyRMhTxIk6yp2aldKy7nrxPduzvjhPOsUZp9/lhmlnm4Q8LR3sFGNfOnlhHwjGbD1bnaSZN6fi3KmuP+130br1AYGtnB+W68xaID6ooL/wm7dOFNHOIXDeaJ3C/RjrjdA2hpPFaOva8wvB0rFrxZqv+LvSMkd3U+D/5DnM1ZdNXyavXDwxJOhRprrpCNRxV/tLhwTKP/SHZFW90X7Ojg92jMRdBnYoQ3Se688dxI2Zgg3JUds/vHZo7715XpmOm0f2AgaId0wJlj7y8fWpLh5a5wxmiklWGJvo7u1ng8lq2w11AwVuSe4c2zOzYPj43taGcZtLxUTmh1x2rwD7+0k/N6+IlffC1baNYTY+4mbOK5FXuuV4YjUodoiJgugBgDRsNzzWoLW5Uxxs4+b70NNjN+V6QN0wdPfzslc6CZ22mRh8Tf3xTuG8P7GNxr7/gYBm64= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6962af4c-cd90-41a1-e0d1-08da11ae72e5 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Mar 2022 18:03:37.7402 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Cf4lu9uh4LpRte+fT7g6I8IdrMVFaSjUSIHLpXu8EG8vNtoM0dGZ5AubYGEBGVLmI0m8LxPzAKFeL7mQM9iY8QevAiI0Mq3Wi8+PZNR1Mvk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB3584 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10301 signatures=695566 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 spamscore=0 adultscore=0 mlxlogscore=999 phishscore=0 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203290101 X-Proofpoint-ORIG-GUID: 22263bw7QVwpFJULUYTh4wAehu6d0d1u X-Proofpoint-GUID: 22263bw7QVwpFJULUYTh4wAehu6d0d1u Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Add helpers to allow the drivers to run their recv paths from libiscsi's workqueue. Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/libiscsi.c | 29 +++++++++++++++++++++++++++-- include/scsi/libiscsi.h | 4 ++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index f86cad75a68d..3701f8d7f87e 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -93,6 +93,16 @@ inline void iscsi_conn_queue_xmit(struct iscsi_conn *conn) } EXPORT_SYMBOL_GPL(iscsi_conn_queue_xmit); +inline void iscsi_conn_queue_recv(struct iscsi_conn *conn) +{ + struct Scsi_Host *shost = conn->session->host; + struct iscsi_host *ihost = shost_priv(shost); + + if (ihost->workq && !test_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags)) + queue_work(ihost->workq, &conn->recvwork); +} +EXPORT_SYMBOL_GPL(iscsi_conn_queue_recv); + static void __iscsi_update_cmdsn(struct iscsi_session *session, uint32_t exp_cmdsn, uint32_t max_cmdsn) { @@ -1943,7 +1953,7 @@ EXPORT_SYMBOL_GPL(iscsi_suspend_queue); /** * iscsi_suspend_tx - suspend iscsi_data_xmit - * @conn: iscsi conn tp stop processing IO on. + * @conn: iscsi conn to stop processing IO on. * * This function sets the suspend bit to prevent iscsi_data_xmit * from sending new IO, and if work is queued on the xmit thread @@ -1956,7 +1966,7 @@ void iscsi_suspend_tx(struct iscsi_conn *conn) set_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags); if (ihost->workq) - flush_workqueue(ihost->workq); + flush_work(&conn->xmitwork); } EXPORT_SYMBOL_GPL(iscsi_suspend_tx); @@ -1966,6 +1976,21 @@ static void iscsi_start_tx(struct iscsi_conn *conn) iscsi_conn_queue_xmit(conn); } +/** + * iscsi_suspend_rx - Prevent recvwork from running again. + * @conn: iscsi conn to stop. + */ +void iscsi_suspend_rx(struct iscsi_conn *conn) +{ + struct Scsi_Host *shost = conn->session->host; + struct iscsi_host *ihost = shost_priv(shost); + + set_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags); + if (ihost->workq) + flush_work(&conn->recvwork); +} +EXPORT_SYMBOL_GPL(iscsi_suspend_rx); + /* * We want to make sure a ping is in flight. It has timed out. * And we are not busy processing a pdu that is making diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index 91672c89a794..09bac9e3efaa 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h @@ -213,6 +213,8 @@ struct iscsi_conn { struct list_head cmdqueue; /* data-path cmd queue */ struct list_head requeue; /* tasks needing another run */ struct work_struct xmitwork; /* per-conn. xmit workqueue */ + /* recv */ + struct work_struct recvwork; unsigned long flags; /* ISCSI_CONN_FLAGs */ /* negotiated params */ @@ -452,8 +454,10 @@ extern int iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn, extern int iscsi_conn_get_addr_param(struct sockaddr_storage *addr, enum iscsi_param param, char *buf); extern void iscsi_suspend_tx(struct iscsi_conn *conn); +extern void iscsi_suspend_rx(struct iscsi_conn *conn); extern void iscsi_suspend_queue(struct iscsi_conn *conn); extern void iscsi_conn_queue_xmit(struct iscsi_conn *conn); +extern void iscsi_conn_queue_recv(struct iscsi_conn *conn); #define iscsi_conn_printk(prefix, _c, fmt, a...) \ iscsi_cls_conn_printk(prefix, ((struct iscsi_conn *)_c)->cls_conn, \ From patchwork Tue Mar 29 18:03:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 555086 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75011C433EF for ; Tue, 29 Mar 2022 18:05:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240425AbiC2SHW (ORCPT ); Tue, 29 Mar 2022 14:07:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240411AbiC2SHH (ORCPT ); Tue, 29 Mar 2022 14:07:07 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68923B18B4 for ; Tue, 29 Mar 2022 11:05:21 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 22THsKZR022190; Tue, 29 Mar 2022 18:03:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=mT+cNDzutjEVSuQGt/GyujEmq72DoPYTpCd3Pa+uLfc=; b=bS/vKB2Jo0zgIx5C1mZd5tjxDINId6k0aIdWWXpBWeqpT/vtU9xRO/BSvK+FPmM/WdtL zVhfyBIw592EPnvA+lGaoM448azy7SXVfRwH/z+N+mjnqq2opPL9NU2c+/M9uN1EALMZ kNqXwnYlWprd+MBDpDBLy6aF7F6fLY8LByt8ebbsxTupP4Afjk70NUWzXXI3Ua5vu4ow s0oCneG3/jLTeNmDjMcB1tVvcX9oaL0IEq3jX+i4KOjFdIOz4gAW4sgb/ikC/z2xc2Wm AU+j45og5ezP/bwHPKC0UpjxkgyUNUqQeGoz/YFWkAmskrUkzo4CggEIFQZoCRqkdoxn TQ== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by mx0b-00069f02.pphosted.com with ESMTP id 3f1tqb78tj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Mar 2022 18:03:42 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 22THvFJK048570; Tue, 29 Mar 2022 18:03:40 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2171.outbound.protection.outlook.com [104.47.57.171]) by userp3020.oracle.com with ESMTP id 3f1v9fhge0-8 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Mar 2022 18:03:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h/eOnwnV9AT+AsgbbY/ExpsUuV2JN6X/ZhcOnjWSIn/gFSvCHxTOKkdM8CXXBZZMHN6qALKjwGY/29+hZY2TLwAdZFr5RMoOIOiklG3rqdRMVGN36ey0tpPLbaLjdA7mg6j6rDaAIgFod7y8l/AMi4ORai4wXUOr1NCZCDvRcCAePmW8f2uYTpdVp881fZeUQNnt7R5U9B24wMowhSeBGkPq7QrpzQStTBvWtk3IxPV+IuC0t/ZSH942DfYSXYCTfHb2beUeSJD/iSd3EY98BleSxKobL0QIZSW5BgvRnOJdQtJ/WPe2XwyKgtfdk0fKIdyNmDYrVrG8YJ+IHNMuTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mT+cNDzutjEVSuQGt/GyujEmq72DoPYTpCd3Pa+uLfc=; b=IGR2/wA4BFdhYlHiIexPvgktYa+t3+t3h0eVDMR4QLbqyQfWcDKifQuJfc/0vReuGFhLGSQvoDtSWTNo3WuXSTPPZ21kACB8K9FlPatgg6sqPYqkgqR0DzezM8TQJoqA3KrKKcW7X1/Hh6nDtzfqp3An1ri42JBnGlnfu3hLfGzWqjWYxS7LCXG29EITN//6XTTd2f5x13YknyyyW68QVQ/bCl8oTSNSCNSns+Xn9KVLd75TIxsvjrZ9bpy/xLSF2Cn7JYZStmUagdBmHfLCuNS0wNYEI+b5PpfT8mc193owcZ0uQkWlalkkcUKj4sOfdIUaBvp/Mm/Qxb0JYp7qoQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mT+cNDzutjEVSuQGt/GyujEmq72DoPYTpCd3Pa+uLfc=; b=jtok/OImbEOGVA3S6z0uun5HBEatt1YkW9k/jxGAM7jdFRA/5NctpJHVFB9p8NnxH63U/8jAF7bCrUJsZ5nDSqWCR2Zcm0VlXjUO9m4FvBG27gDlIkDf2j5AJBthKAytAA0H+Emj5hzy+kxTwbURIS9y0970W5DH7nAcircsrlI= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by MN2PR10MB3584.namprd10.prod.outlook.com (2603:10b6:208:11e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.19; Tue, 29 Mar 2022 18:03:39 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::29a7:bae9:9b3c:c9f2]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::29a7:bae9:9b3c:c9f2%10]) with mapi id 15.20.5102.023; Tue, 29 Mar 2022 18:03:39 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, njavali@marvell.com, mrangankar@marvell.com, GR-QLogic-Storage-Upstream@marvell.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH V3 07/15] scsi: iscsi: Allow a recv and xmit work to run Date: Tue, 29 Mar 2022 13:03:18 -0500 Message-Id: <20220329180326.5586-8-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220329180326.5586-1-michael.christie@oracle.com> References: <20220329180326.5586-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR11CA0002.namprd11.prod.outlook.com (2603:10b6:3:115::12) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a5fe7479-dc1b-4ad1-6763-08da11ae732d X-MS-TrafficTypeDiagnostic: MN2PR10MB3584:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pcOpntsXr9iVDbBWFg+eZhoTQjw/laysYSnNC0i4hK7QsPnRlbHnS7JiSPWzLB6BwaOKIhXxsZ/sapWPqMNK+rjxij/hQ++OmIstpj0XBtTCHSx6mXzIWJ9tcMwOwt5mfWTGXj1A+H7o0P8V+4HvB0jA5LU0zUuyBZ1M993R3qNp4HCCF2RN8K2fKzTOHrddRSAeVKJo8FUExvq7FN/8e6mcKMlAaNibtiXFOVakWbdg3+qlCDv9rpPR/MvCBpbtxdt1Jp50alkUEwRuH3eslEwU4NqHm/uraMlENJQICldz+HZSVf63R0UKITicafE36CEXxAMq1TzaIRZFn0PxGxSdXhhYWCdHt/eoT/GUYBZGALVhRs1OJuiwywFWe4YQuaMLcLy0a/n7itUnILv9ZUqCtDKUtUKdq+stWNz9Tt1F4Amnj9xMyhIMQmAuHAFRb7B1KwB6UqHYJXTeAsy3hNNrRM0N7bKPVE27ItNEwM6fmloIfzVnImkdZDscee8coU27SW5kn0KgboCwwxYomNSyHvUslbuQZWJgC8UXI8CO2t/iW3rbPmQeyZKybPElnwQRG0gVw35uSXaBcUMEd/2tmVnzL93bpK6dyte14vkqitPUj3DFDqV4riKB6mSA+3aw3Gp8zfNwBepV/pwxidi6xpEY1VOQVVMMhDqYTo3YxJCW76L7KSfYa7lO3DME8xFnsTUFJmJge9AanVGuqw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(66476007)(66946007)(316002)(8936002)(8676002)(6512007)(66556008)(4744005)(38100700002)(2616005)(36756003)(508600001)(26005)(6486002)(2906002)(5660300002)(6506007)(107886003)(52116002)(6666004)(86362001)(83380400001)(4326008)(1076003)(186003)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: x7FgNRZqYPR5emlaBjLRjGy4zI4pVcU8mQt6BZNchoCxWoYgzNgT/eL30E8O8FsmHQpDFgXO5AgcjuO3naaJP2TIFrlM32RCKKAMltYBlweWlmYYj9KOKVzreZv/Osv70gwy/PtjUGQROY98jCip4FxCtURcXnxrO6+UqKmQxWLTxpYXx6jtWKwnNdMJi9fUpOfmKnzkT5zPCGPdjlquq9XYVNXsom/QLQVwNdafRaDBWvpIh/H+mkF8SQCJWHaMGzVLuFRq/yYJ8CVfVQUMkoymnb9OmsVi5qHt/4JqLu83MLTe/78dFb+YfAoB6hvkr09i0OEYLw3LcyEm8bOB7HVGWehXJAy1UipjmSr7lXbVWP5i/pbV4F05FB3+iJnUlSVigW+fFij20jLSJLva3dQx3kD6vyi+a8xTTh2DYU8fjLFC0yDrgIsgeIwRlSIzAW4efSHUTxR8kCArN6oaVMSw58QwrMKXmX/adoAra+z9l+ab7LafSNrY2G0JTjcqUe81DCkAk1dwRcnVxbO4TCcXKA36D0pKqx8ZqyG0Y7A0gZ2j/nlH90IWm8Y/56lW1gleWKaRb+mDe57onSmZeYFceruJC1w3tnzw5zL7tpx2se0nU3++4afCsskq1nCV3228Xmqb/V00tajj5hsootVATzdpAE+wZiv29RoKWdat0rBe1EkTp4yxwo2k69S6UYyP21h3cAY4klTIbh8KPIZJjJVCK/rQraik/pPr+yDFnNWdK1M4B0oeuzASJAe25XPsZ6lZ1/uP/k+yE7sVwWZQUtS5CIo3t1fE2mw67bfC9geh5xA0rGHS4FxnfPqgHMrhR7ZAVXvbb25hVCaohl6jOmwKj7SS5k8jZ6ZWMNZ8eZrhL5oJimQqdBrLpXfrsCwLtCGEMI/mjfD7j/2nU4/YuM6sENw91+gvZ9DbdJNyJ5wMMYANed6ocYYnkIfWDb/g51ZOhlwxGWsJBsTOwbUrV/ZFamUuZED8fy0CR/3iREK2vwl3geWy2NZPpVqnXij6nIGvGHTznPO+H+tE2YVsasT3E9XbgYIG2W/nPSIQugdkAG/khk2rJghkSlTxRLtZmkzYx1Osg/LKKtITqIJU2XIPBDmaDYrN0tW9wUUaOnGJrHCt9+ihIdJpVDPGUs/nnZVoLNV2zQZ8JPy66WQMGX7cnr3t82N6F6UcvlEGbI7CLBSyzS+zCK/h61aMfmC785Oh+3u9yoEOyk+CJRDGjkQkJNMjE8dnO9CrYu4m6S7IfrhcOyZtZ9u6tIVOsS15GxLrkgwMa6f3kDfdYyp2zWeIO9l912TYKhbeKdGplqeErv5ys9pRf0LGqVC9mKFLae2bGfGrFhut4BiHekkftR23CJouNepk91XHG41aVD7Ex/OVxt+ajpSuUBAdFDMcontSJ6ijVvn9LVb5If6hhTK+upO1Ioxe8PixjjLKPgi3M6UcHPZpIeWd7N9LIKPR3BaGmlRicmC0buVLrWreh1jiycA4xAWiqfoWGRYQx1/yPkvf3KUzvEaIpOtPLIVWTVSjbxUYouHtkoPd1jr2l1zRx/TS8Ysse4xHjrZn1C4Rj4PWQ2hVHZ3uD7e8R9X1ruayi6Uz0BWPf87q3vv0OkeQqVKkEkajeRpf72fKbuxUucAHYDZe0vaMQTAqrWqpG6z3M+0K4lOUwTGQPSyivFV43HakMTcRSXrpYZYES8DegdIBzDafdvxvMKxX9gL74aTVoZJCJ/l4+JI4tt4j5l0Mh5UA2ckfPEoTq2Q= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a5fe7479-dc1b-4ad1-6763-08da11ae732d X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Mar 2022 18:03:38.2089 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: zsH3GBIBlKNUeI5Lu8U7kecN2Y+/YKORVb0wAbnIVL0hsvEjeCO5bMLAwBdNWjg5ug+7/9vHFM/xmzt15y3AeGff8zLDQ2ungQJvaXbLFQs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB3584 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10301 signatures=695566 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 spamscore=0 adultscore=0 mlxlogscore=999 phishscore=0 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203290101 X-Proofpoint-GUID: w7xKAZeYhJeHS264S38MdVyZoZWG3R69 X-Proofpoint-ORIG-GUID: w7xKAZeYhJeHS264S38MdVyZoZWG3R69 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Allow the recv and xmit works to run from different threads if the user has set it up. This also removes the __WQ_LEGACY since it was never needed. Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/libiscsi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 3701f8d7f87e..4b4333bb53f5 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -2827,8 +2827,8 @@ struct Scsi_Host *iscsi_host_alloc(struct scsi_host_template *sht, if (xmit_can_sleep) { ihost->workq = alloc_workqueue("iscsi_q_%d", - WQ_SYSFS | __WQ_LEGACY | WQ_MEM_RECLAIM | WQ_UNBOUND, - 1, shost->host_no); + WQ_SYSFS | WQ_MEM_RECLAIM | WQ_UNBOUND, + 2, shost->host_no); if (!ihost->workq) goto free_host; } From patchwork Tue Mar 29 18:03:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 555081 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 164F2C433EF for ; Tue, 29 Mar 2022 18:09:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240439AbiC2SKs (ORCPT ); Tue, 29 Mar 2022 14:10:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240427AbiC2SKk (ORCPT ); Tue, 29 Mar 2022 14:10:40 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDC641ADAA for ; Tue, 29 Mar 2022 11:08:56 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 22THsK5B022185; Tue, 29 Mar 2022 18:03:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=kvd3bTvnQHtjazNjw39p1ZUPgxJrfugP5PHexVx/GvY=; b=qHssOGnNqzKOoCX6wIvA+e/v9g40Gov7k7+j4x/daHwTFDqfj8Xq9yS0BW59Gqb9g513 80Z04AuWT/jhNoHL7KVwK+Tbt33edpBG0mR/rGxdNglD0lBbRlIrV2LivjEBNpW2xUrX uz3RBEWql68WAn3d0TIthuHNi0DyH1aZb7tPvKcWdInWwgFeZ3u/k1q2lS7iM6D9ip6j d3a2DDEu7keDerH+rm4efsoIeZ0+hE5kLI+j5u7Cqzdz/vkLD3Z+6HxeT0wf1t2VNBuL 64S6mq1XAqVgefkXZEGOn0T7g9oo6BZIYzXM/85kQQ6OXMeqaKPtIqeMyySLrreVZDR0 Gw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by mx0b-00069f02.pphosted.com with ESMTP id 3f1tqb78tm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Mar 2022 18:03:43 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 22THvFJO048570; Tue, 29 Mar 2022 18:03:42 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2171.outbound.protection.outlook.com [104.47.57.171]) by userp3020.oracle.com with ESMTP id 3f1v9fhge0-11 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Mar 2022 18:03:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fky7sAl5PiTfmpW5iGBM/Qz82C2Z4XctfR33T59qu3+0mpSHp3vWPAzsYXWo1UqVCvbJ2ntD0dsT2S0DxyTw5xZHe5cDiqEzzcsry4cIuFSUXFd6I9BfXrb730BsLAsKnq4TtGWrgUJndl13i+1tROdFatcMIIqv97u60vO9kZMWjITlhLlgpldSrMJTeCLsY6UMN6R0FbY0O5L5kZCW9gRLJDudOdSqFV3qgevlm05MnFEFec2/JOdpFAyn7LV621WjGbGbJiNsZBF5FNr1Zqq83URiYsjGecBpyyTOE+5Eci5w/W4dzJjFyZGZGJlS31NwYxBIz5ChkEmrbJYAtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kvd3bTvnQHtjazNjw39p1ZUPgxJrfugP5PHexVx/GvY=; b=F1IDdjd8mb12wLb2vFR6RZnb8qrEtcJSuLCKNwxn3In1a67KcZbNCUY6l0xSnoYsbvQuN0zIVu5lWK+HHsE/l6b1V6+cWzVJqvOS9qA9vNOPEK8QlK9YgNrm5NgUZfn7r863soL7jPSvsQIaEjihY/2FrEJ/zEoif4MGz+CL5PNA5ZZB+pu8A+VbGTXaW6y7xnMfpUv898f/YCDqnz2M92nlY4zPFPjLhuuosfZzVV8XuG3algNWUIT5VntPLKXURKOKqY+lUvNUhER8lPZ9+gyqbnrtjB7bllUfW5YJxr+ns7uTezcOEQZ3EeKrc9/N2RmK+1+jsJvJKYeCDMlm8w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kvd3bTvnQHtjazNjw39p1ZUPgxJrfugP5PHexVx/GvY=; b=SKgvMGbLar2gCPTRCLp3RTFcLObw2uRZBNsmhMbd3Hq9oLSPlp0WsY1H6VQl0Y20gWhfHOd810vy33cTCqwx9v5kBx7DX01CTPD2k5+nLf7of3rlj2MHPCNc40jZprVniw72XfkWPfpmUNg83fWG4yAF69s0SJ+JUEOFv5CFCiY= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by MN2PR10MB3584.namprd10.prod.outlook.com (2603:10b6:208:11e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.19; Tue, 29 Mar 2022 18:03:40 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::29a7:bae9:9b3c:c9f2]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::29a7:bae9:9b3c:c9f2%10]) with mapi id 15.20.5102.023; Tue, 29 Mar 2022 18:03:40 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, njavali@marvell.com, mrangankar@marvell.com, GR-QLogic-Storage-Upstream@marvell.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie , Wu Bo Subject: [PATCH V3 10/15] scsi: iscsi_tcp: Drop target_alloc use Date: Tue, 29 Mar 2022 13:03:21 -0500 Message-Id: <20220329180326.5586-11-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220329180326.5586-1-michael.christie@oracle.com> References: <20220329180326.5586-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR11CA0002.namprd11.prod.outlook.com (2603:10b6:3:115::12) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d9c7617c-fcfc-43bb-f996-08da11ae7422 X-MS-TrafficTypeDiagnostic: MN2PR10MB3584:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bAhjypnIKCpsxNKVvXhUBO/bloG/Nc39T0ej0/pWnSLOiVwmDe1XQSCWrJ4SBlMnmHolaALk/AYe0JA7P6uJwtkXPvDCtMaZUEHMI94peZj2Wr2Delo7pQEfXRKB5vw4sGGhV0Kz53eX5YLbxHNMscJdCYO47XewW5w4XShFN5xzhxsPx2PLml977K289VfdjG+oUgnP+i3NLh+eFYTD3YBODHU0sfJgUHQfcjlgSo8BgNBxbf/XVXIsSIfhSL0EFctLLaAyqK5TZNAlY5MlK6CmQeyJmHJeX4GQvtEYQBNX4po022PVLUduEGdFmuwdRZuKBcbd8XyEGEwcqrcMf6iU0qZBOLWn4QMLwcReisKu1HozqTorVYesA3GFnyDofOPR3Px5tplqBVyHIjKq8uum+Q3pli5HNyeEuYPhN0mH9Z+yh/SDtvguw8NkT3x6EM3Nli+I90GNZszAsUF5XHnWr6RXz2YMZ3i4bb1Fc1oyYUj02LmNx5PChPqJkWZCsOnNMYxV9f0oezX5BDMY4TY9EjsxB3d0suEkFFL+CwCTMQtzcGouSXGGHhon7NsMOgjGHxVJiHZXGXGH+gCwKnFOscljGEPiZRp7egD5hsLsw5bYlu6C98YXsLDIYkHcczDqKRipV9wfIYfuaGOvoAgvj21EgRBjnEkMvtEU5hIBDl6cOjduWVOmECv/FUCGNqkk5/uwwx22/dCCnoihMQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(66476007)(66946007)(54906003)(316002)(8936002)(8676002)(6512007)(66556008)(4744005)(38100700002)(2616005)(36756003)(508600001)(26005)(6486002)(2906002)(5660300002)(6506007)(52116002)(6666004)(86362001)(83380400001)(4326008)(1076003)(186003)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: CHqqsUAhrz5tb8q8+MMWO0KqE/bRpWvoaix20YxPCeL1csExzIpuPGhlXXMbt0HwMZSLI/54IK+5RUB2zwzz83b84RVLUWicIKAM5QJnh/LI4QieokPaBuA7mdku99iy8oCfnb2lKrQm4l4mIDhWpWW+dZ0lMR/qOiwP0Q5wPvts/cBb2mcDtWV+75vigDNxVEfcr6gTUwTzPSQMg8+mJgL9UK+2brMNtWbDxkEUc+OTF5UbbIJv3ypNG9zNeVckl8BAVlXNx+RPe4tBUmX1S0Jn+YO9eMAWhNNB6Mh1F8FRuid3DL3SIOhvmscmPzHbnlaOQlANBoC7bO09NuuObumZ9Itn8Yrw4pP72LJKi1VES2YzgQO47jcD4rhYHViKeDu8vb75SWqDsQ/jfyI747bLE3mnNyRhIfBvMC3IrBDDEVrpE0VSOCBi4TZUBz+IuDWvdGVFwah40VDArFmBdITw9JUtPyHdkPr2TDxTPkNP3hh6O0uwaqDXU1Mw5Kl7ySpEENZSEv3apVKtz/+d6u1ljsPyr12nEtOLQpmyftxSR5isCApvcYdPDZKagHiEscO0IrSj8/SHZlUZYfgDBBReZyGuvQVhNO6Gn+lOqW0hq/PoNOqTfjnEl82XjpDdkqtlwygLSyS5UoArp8a5XsO5ObZ4Up9qqjU8KYM6QK57EQLhAWpS3/XmpvBuYWm1+WfQ5hFLip041bG4dHUQqUOxFYwHyZn44YQSBpJRTvPimPdFwgq5WGSMV+aXlx5uTAkzrBOXzfeva8Vd8IcU5uC5Q+oITy1c8CGPGiaONeOpGP91XesRJvQbxkuvbWZG3bbxQ0ZkeUGR8kGhW8TS9MLiFFc4f5p7Mxa8F0YhrOttVTakeyfNTPBWjBynUSetKm+/juIshJe5EvHhTaThs9vXv7VZVMN9PZzeyfxhM7P40plyU94WZBpH8q2hqXSXXQO16dJrJPnZRA8l0Sze97XQvi9pHqCw3DIHwTqosE4cdT057m5Jq1ZAYjogzcAd2RRBqlpkk2jrVsAr9UYTBdOPIFy4CXbALpMD8ONGjFECG4Sg3YAaKEzhGG8//150hI+8ZnWVyjgJXW2OQHxfB1vgKcHhCHFjVD6FTBd01HBFkKNftxELr5DX1kk1sRsi8pYpW/XEKmXGzQKOihwQmriVCMav7zDlOeQRZqix88bT60WVGyf8G2AYO9/8JmWdMz2nJ19CPT5a7poF0O4YyHwlsajeFWOgxjZRIeMwQkTpzqCFCtriibph3Q8Ac1dycfVKNEa2cNYfKS5nnfmgiyleJSW6Dgz+AqvGg9PwDKP5MBtT++1XLRkkyFqfe6QyIwlLTLQE2aQ+vdql1MWzf0ocvk5cR7+m6lqNjpQgqueCfiUomPBBeDbSd2Z+dlewQqn7Z2DE7lOUpomyRK1yvTuq3UArK0MuK/hujtSqSt59s0oXotrFqiBIIynOeoGKSGCYeAmoLEPeU+INVAaoYQPiEwalfJMrHvN6i/M6INs3p3UCyYpq6BGePFSIhHNYM4BTXfOdEvzsrFOSycbq7SuFWIdAWw53C2Ap4R7sVlnaLAQNxBuOpNcEOksvxeCPrkb71XtdsnlbjMrQQG5pv34/BCZBkQn9LXxQ7QbR7+BTOR8DeG4EoXS57KbQvPSaYrGQ4M0ey+5ZpbzwUsaRs7uHhch3ccP6A2HBPQo1aTQczDIIzcFRKRqq1GJXx5yx7QPFyf2f2wDQ5Cfiu8vPcs5FfwZTlFDbIucQ9j9geg4= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d9c7617c-fcfc-43bb-f996-08da11ae7422 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Mar 2022 18:03:39.8183 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: da+ogg3WIw3UN94TSf+CQwxP6gOhLQLghveK5diFBPAd5YW9NzdaMjEQjMdzhVQzTgifkqcrHPoakcrNniki4/TjVyZIxjAJJFvYqyOUgdQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB3584 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10301 signatures=695566 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 spamscore=0 adultscore=0 mlxlogscore=999 phishscore=0 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203290101 X-Proofpoint-GUID: txviblKk8WYhN5PkjGH82XyovIQ0Zw8w X-Proofpoint-ORIG-GUID: txviblKk8WYhN5PkjGH82XyovIQ0Zw8w Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org For software iscsi, we do a session per host so there is no need to set the target's can_queue since its the same as the host one. It just results in extra atomic checks in the main IO path. Reviewed-by: Lee Duncan Reviewed-by: Wu Bo Signed-off-by: Mike Christie --- drivers/scsi/iscsi_tcp.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index f50c00f2ef9b..69218c8830f6 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -1039,7 +1039,6 @@ static struct scsi_host_template iscsi_sw_tcp_sht = { .eh_target_reset_handler = iscsi_eh_recover_target, .dma_boundary = PAGE_SIZE - 1, .slave_configure = iscsi_sw_tcp_slave_configure, - .target_alloc = iscsi_target_alloc, .proc_name = "iscsi_tcp", .this_id = -1, .track_queue_depth = 1, From patchwork Tue Mar 29 18:03:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 555084 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA9C9C433EF for ; Tue, 29 Mar 2022 18:05:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240416AbiC2SH3 (ORCPT ); Tue, 29 Mar 2022 14:07:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240348AbiC2SHK (ORCPT ); Tue, 29 Mar 2022 14:07:10 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85202B1A99 for ; Tue, 29 Mar 2022 11:05:21 -0700 (PDT) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 22THsG7v029601; Tue, 29 Mar 2022 18:03:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=zWQOx5LiJnZqbbK7wWXDL/Wvw4RTT+5gnGvCkxuHEXY=; b=nbfi6Io+AolxTAwtS6yZYnFRZd8wyTfWoIVG8Qh7FwCJZ7T/uQ92/RX5J5vw4EJs+YaJ /TJ6rKH155MiJ/ElPY5s1pmb3kjreUePR4F7MAWqD48e+I+q5OLcgtlJ2P+ucw+swNKt U4lC/e6RN9iDapjSt26ipZ3SeCxSVTVrgnxBUfPxNdl2hUGuY/ZopQDFKm8n/rJB27M5 QOJmTnrQibsE1RzG+6KOj5Uz8DDxlV6I5xXMqBhdf9yX+ZPpFGtqTASQ/wPfvE6Az/DK 6+ppCryHLJY9TZhafc/QLGSQ4hLiiJJI6d6nQB6OEhan0QnDwzVj7YHY0VRn9p64JDhC 7g== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80] (may be forged)) by mx0b-00069f02.pphosted.com with ESMTP id 3f1se0fcv8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Mar 2022 18:03:45 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 22THw2uI013210; Tue, 29 Mar 2022 18:03:44 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2175.outbound.protection.outlook.com [104.47.57.175]) by userp3030.oracle.com with ESMTP id 3f1qxqfdqq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Mar 2022 18:03:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i6vA1H6Ogyda5XfENANlTz2C3AZclzB1bOktl2wnqwftWrhmoY0bWNVwBFK0EQBsedgqHLSsaPjBDzUI2EUygE5Dy9HnyE3MXTxXQN5qDj1qLTVA85yTpBbVwyapFFgPoYZ2MvVWkR8l5N2o/o8SJza6cRkzWuGxBiiKu08Q+kmNRUyvaWK6xlK/T4ifWruU1dKvP0sJ/aWma7HhbLVweFK9Pbdd135OEbdg9S4TVzjbaFOmLs86+tvUiSPtBY83FfP1YlaSi8jg+PJxARo3vxfPx9zXm4deJHmH3QgPYKBpIJTiNLgqbRqBhKmQ9X8cRww7mLFsX1yyyWsDcML20g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zWQOx5LiJnZqbbK7wWXDL/Wvw4RTT+5gnGvCkxuHEXY=; b=MY6DRvOYillJ8TQEXCZx++vHSVlcRfdK7vj8Fyyhbw6NfTlA9GbPpg3VPSmu3vkkFeSC25hosvmm1cPxDKgvHiw2ipg/JOuW4ubRjt4UF8nmrsTH4Bl1UaOTUHE1suDFvHcs4eRFy0WVslozYQdB2Nq01scFEI9iquvUe10KU6XyBuf7xloP411JjI65/M2KfvKwDFX8NFfMUH5Kuz3SFmTYzY9W4gOFn7DeyAkV0BmIPXkRiSj7v9keFF86QwLJsh/eAAuE85bKQ7WtK9++orygibrtesrXb9sEo+46DFcEbM18uHeOHVXZEyS4//pdp622PEJMU1MakoWspviqRg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zWQOx5LiJnZqbbK7wWXDL/Wvw4RTT+5gnGvCkxuHEXY=; b=QGKvEfNfA8CCti/eaRvyWyJ9HC4SyWUJ3Lfu5E5A/OVo2jQSg76udkCGWChsYT4c0QKriZK0cOcZWrS7MAuU39GHnRMC2eMGNQwU7qC9AWDYi1ihP5tTiyCzfHwXeUA0QNxtuF5RsoRDjJDEZIiWQapKM5GSQjBLAZnvESCIT9E= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by MN2PR10MB3584.namprd10.prod.outlook.com (2603:10b6:208:11e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.19; Tue, 29 Mar 2022 18:03:42 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::29a7:bae9:9b3c:c9f2]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::29a7:bae9:9b3c:c9f2%10]) with mapi id 15.20.5102.023; Tue, 29 Mar 2022 18:03:41 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, njavali@marvell.com, mrangankar@marvell.com, GR-QLogic-Storage-Upstream@marvell.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH V3 12/15] scsi: iscsi: Remove iscsi_get_task back_lock requirement Date: Tue, 29 Mar 2022 13:03:23 -0500 Message-Id: <20220329180326.5586-13-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220329180326.5586-1-michael.christie@oracle.com> References: <20220329180326.5586-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR11CA0002.namprd11.prod.outlook.com (2603:10b6:3:115::12) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e8ca6efe-7a5f-4724-de2e-08da11ae74c9 X-MS-TrafficTypeDiagnostic: MN2PR10MB3584:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: liBanBX3cFyGrVhZNURNxBekb9pTpNJ4OL4c5H4tWuitWjPdRHPFA9Rt+7azkO7ZbGx+SIG/2niZHBmwnZZ36E5uNtqqwjd9OozWnDIXff1iyaMl9Wc+lXt+lpBTsVBneHxqybZlxRNwgYZcmevub8l9rAotQsa2QZxW7P5iv9Tde+5AhBMRqkr5Dsth5+ou18zu66BptmwxxnahZ/pGsZNXeuXXzkEQji1bCLQzzhXyX4929lYNv6VQQkhbwVMhi7y265Okb0yADO3zSghOIUrr4CStv4G7dNdgjRd59uot7ZVHcHO3Qs8LArpaNpaYd+agYIRSCHw0FEjpbZzWliCRsfaZCp6lP6JOvtPkQqdXQ4mmLKIudwBprixgkVeTgkqQpF+cGOP69kmf9L8TPZ5+zsL8DpUMYMHJk73/+6x5/7hSOQZewH/nboLwA/uLh71xxGrGDTYdQBmWQxLR7ZAM2hLlljsFMUZXy/YCJzm6q1bYlJK/iM6PI6LeJO59POEbJXuKmzG4lY5ze98Hd0+/18iFWrs1vwdiCuz7CXfTmjX9NjTqjEwr8yEscabxlGDO3+H6CvVYG4H0MW1rSRFGuokdOCqJzDiPMrWB4+f/wo1Hdssc1R0lNHhpJpHnb5Z+0FrsxxoEDhO1YWBhM2Vd/hz/sUEt2cu4HOF1qfAqz/9Av7D3o+BCSbwWqrp56ji9MA8DwBMGqYiXHMFxag== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(66476007)(66946007)(316002)(8936002)(8676002)(6512007)(66556008)(38100700002)(2616005)(36756003)(508600001)(26005)(6486002)(2906002)(5660300002)(6506007)(107886003)(52116002)(6666004)(86362001)(83380400001)(4326008)(1076003)(186003)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5oFQiDm5lmPjslgSoVgcurO4kzeEGhJoToaqFTnkyHS99+JqvPVnGf8xM4MpfZHK+c0wL71MriSpM8NbUnWLYfEWTFKUAV3ikOCe8V4xYVHev71lGGRcwuCKNT1sndrLoX2jQAfwJ6vcVKx3w7kNEi1jVNeicLFj3Uu07lasIrzACYXT5ILfBcwG+GA3Z7RqhkdpJwxNkivrD7s2++VVEqmQCnc6yVPA9xL313Mas7ZFdoyEamxkevTrihGsK3yrYvbvIZvxv7LB1/rD2qRYBqXVJPk8HSVPiAvfVKiuRwWn+lP2fALXkiKKTu8/1FWjwTZH4J2jjSEsTMn2TGjAfe/fLRgcpZ3W09l4jN7sjhewA5GzhVEgs1FSHg0Gchi3mltrdw8HUnStrKGnUJPI3J3Dr2G2ucf8527OiTRgbjMo3D9PpZG0IFhNnnrsxjI5CjF7kGhEj044cyyuE++OJ9gnRnROqfJJXoyyjWKgaSaxFtywkByFXzH3OtXC0dY57cQrGGc6ABmJybgztyC6htc9RAn0x/istNPIbCUwYwsD+EEebGjy3DEjaGg6alWwi6sOYUZt01LGevNtPjqRU4391F+A6fHZCnhTbVQBFgRcyaUPcuV0tunZT+xCqhtyW5gmqlRPopx9FLnQ3A2zsZPgug9t7rz4nFfZBB1O2ZjxEudrnl9PQkd+FVLZymnHH0tpj/dJzgkP0axy6UQz9fqrio6GHVpJS1N5oKi8b7ZTp5IZ2GHbLIB1SGdGXCSjiq6Sh3GAt7tlvC7SaKIQAyqCjrHFhsf2ykcLMtZc8/jRrWDytxp1OfyFrutGiKY2oVU7y8brYjAeMEW+hrD+mM6i10SguvHHHwWv11+5J+l4/pqiEkKKt8QZUSlTRsosVdZHeV/gDCUC2d4w4BAI9hB3b1VKRgttTH2vFqezkEhUoAC1Oo/WyOamnXds8VkptLETmLSCFk9Aiq4aJf93Sq2g3eXG0SFMCTdpufOtrwRDgZpvOylT3za+drUxwNlnwk1ms3ALwioGoqto9H77TFawGJtcOZmfVGopkoyZ53eDolSLPy8NcfJ6HEEv1tIeBusZIvxV6pKSjPbZO1SKH1AS4Bn3MKQy4CIJpIqi6XIjjQYht/PiJNYZ/CZVJPVXJQoLaV8iac0Z7kPpwle0/ogAJpYT4hWnOB5fZ+qgFAb0Ml3rb1GFdwSLhuEZyvMHhP36Hq/QSnU1AmkmBCQnQ0cbrdNJHX5hLxZsnsknNeievIBt5uYIAwGE2NDj3KV+TPXz7uVND6irRjNjs4te7/Y/+9wdPRd79K9TwzvgswAAQhJ+UFwCIitXVeEQMVU+zOlW8KFwIbb+xgOVeY8B4903+dOB70Vd20RLzKjRGJnaNRFViXLOZZqH4UpsU0xFSYES3hvn0MvP2Uiy8leZMBO04w21nToR/Cb/5z4VShTiCkbVSUjsg5zNA1kQ+ItkX/tx/X/WBr84WzePxEKZl8dHzXC7oKQ2TQcxb9GMVp+m9dczd3hLNutKJLYAKLzIR99yCJ45Er+NRVCMfe8lsWej/1UZkiX7kSdIeMkqDPedd7KGchQZ46BohuVcwOtqsgwmwXtfu0dpEB3E1fduv0bo4qaS5JmONTZTNdRWSuT2n5It6IPV0qGFpgqYdR4fJtxGkoNUOTyi5S+x85QRSzcqgVXS3fffP+NmzW1WZEUm5PWtYdRVxrEo4t5fhp4qTATbFe67Xos7AZhPdpersOJIcVupEvmK1nuQoiXWRss= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e8ca6efe-7a5f-4724-de2e-08da11ae74c9 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Mar 2022 18:03:40.9746 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: BwexW46G2Nbgv5v3fjnr3y2gPyrBX7Avb3zBbVXutWtl28AgF+rNUkdFgoI6gu9+SZ3VILFZWSI0Y44UHqlyHDOxl/DDiUVgxh8pFwNJpus= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB3584 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10301 signatures=695566 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 bulkscore=0 adultscore=0 spamscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203290101 X-Proofpoint-ORIG-GUID: r0JdQ45keSitvdNxdFJk2FFxQXk7czzy X-Proofpoint-GUID: r0JdQ45keSitvdNxdFJk2FFxQXk7czzy Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org We currently require that the back_lock is held when calling the functions that manipulate the iscsi_task refcount. The only reason for this is to handle races where we are handling SCSI-ml eh callbacks and the cmd is completing at the same time the normal completion path is running, and we can't return from the EH callback until the driver has stopped accessing the cmd. Holding the back_lock while also accessing the task->state made it simple to check that a cmd is completing and also get/put a refcount at the same time, and at the time we were not as concerned about performance. The problem is that we don't want to take the back_lock from the xmit path for normal IO since it causes contention with the completion path if the user has chosen to try and split those paths on different CPUs (in this case abusing the CPUs and igoring caching improves perf for some uses). This patch begins to remove the back_lock requirement for iscsi_get/put_task by removing the requirement for the get path. Instead of always holding the back_lock we detect if something has done the last put and is about to call iscsi_free_task. The next patch will then allow iscsi code to do the last put on a task and only grab the back_lock if the refcount is now zero and it's going to call iscsi_free_task. Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/be2iscsi/be_main.c | 19 ++++++- drivers/scsi/libiscsi.c | 95 +++++++++++++++++++++++---------- drivers/scsi/libiscsi_tcp.c | 5 +- include/scsi/libiscsi.h | 2 +- 4 files changed, 88 insertions(+), 33 deletions(-) diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c index 3bb0adefbe06..dd32a90ef9c2 100644 --- a/drivers/scsi/be2iscsi/be_main.c +++ b/drivers/scsi/be2iscsi/be_main.c @@ -231,6 +231,7 @@ static int beiscsi_eh_abort(struct scsi_cmnd *sc) cls_session = starget_to_session(scsi_target(sc->device)); session = cls_session->dd_data; +completion_check: /* check if we raced, task just got cleaned up under us */ spin_lock_bh(&session->back_lock); if (!abrt_task || !abrt_task->sc) { @@ -238,7 +239,13 @@ static int beiscsi_eh_abort(struct scsi_cmnd *sc) return SUCCESS; } /* get a task ref till FW processes the req for the ICD used */ - __iscsi_get_task(abrt_task); + if (!iscsi_get_task(abrt_task)) { + spin_unlock(&session->back_lock); + /* We are just about to call iscsi_free_task so wait for it. */ + udelay(5); + goto completion_check; + } + abrt_io_task = abrt_task->dd_data; conn = abrt_task->conn; beiscsi_conn = conn->dd_data; @@ -323,7 +330,15 @@ static int beiscsi_eh_device_reset(struct scsi_cmnd *sc) } /* get a task ref till FW processes the req for the ICD used */ - __iscsi_get_task(task); + if (!iscsi_get_task(task)) { + /* + * The task has completed in the driver and is + * completing in libiscsi. Just ignore it here. When we + * call iscsi_eh_device_reset, it will wait for us. + */ + continue; + } + io_task = task->dd_data; /* mark WRB invalid which have been not processed by FW yet */ if (is_chip_be2_be3r(phba)) { diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 03a0561ba768..544113f3a9c6 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -83,6 +83,8 @@ MODULE_PARM_DESC(debug_libiscsi_eh, "%s " dbg_fmt, __func__, ##arg); \ } while (0); +#define ISCSI_CMD_COMPL_WAIT 5 + inline void iscsi_conn_queue_xmit(struct iscsi_conn *conn) { struct Scsi_Host *shost = conn->session->host; @@ -482,11 +484,11 @@ static void iscsi_free_task(struct iscsi_task *task) } } -void __iscsi_get_task(struct iscsi_task *task) +bool iscsi_get_task(struct iscsi_task *task) { - refcount_inc(&task->refcount); + return refcount_inc_not_zero(&task->refcount); } -EXPORT_SYMBOL_GPL(__iscsi_get_task); +EXPORT_SYMBOL_GPL(iscsi_get_task); void __iscsi_put_task(struct iscsi_task *task) { @@ -600,20 +602,17 @@ static bool cleanup_queued_task(struct iscsi_task *task) } /* - * session frwd lock must be held and if not called for a task that is still - * pending or from the xmit thread, then xmit thread must be suspended + * session back and frwd lock must be held and if not called for a task that + * is still pending or from the xmit thread, then xmit thread must be suspended */ -static void fail_scsi_task(struct iscsi_task *task, int err) +static void __fail_scsi_task(struct iscsi_task *task, int err) { struct iscsi_conn *conn = task->conn; struct scsi_cmnd *sc; int state; - spin_lock_bh(&conn->session->back_lock); - if (cleanup_queued_task(task)) { - spin_unlock_bh(&conn->session->back_lock); + if (cleanup_queued_task(task)) return; - } if (task->state == ISCSI_TASK_PENDING) { /* @@ -632,7 +631,15 @@ static void fail_scsi_task(struct iscsi_task *task, int err) sc->result = err << 16; scsi_set_resid(sc, scsi_bufflen(sc)); iscsi_complete_task(task, state); - spin_unlock_bh(&conn->session->back_lock); +} + +static void fail_scsi_task(struct iscsi_task *task, int err) +{ + struct iscsi_session *session = task->conn->session; + + spin_lock_bh(&session->back_lock); + __fail_scsi_task(task, err); + spin_unlock_bh(&session->back_lock); } static int iscsi_prep_mgmt_task(struct iscsi_conn *conn, @@ -1450,8 +1457,17 @@ static int iscsi_xmit_task(struct iscsi_conn *conn, struct iscsi_task *task, spin_lock_bh(&conn->session->back_lock); if (!conn->task) { - /* Take a ref so we can access it after xmit_task() */ - __iscsi_get_task(task); + /* + * Take a ref so we can access it after xmit_task(). + * + * This should never fail because the failure paths will have + * stopped the xmit thread. WARN on move on. + */ + if (!iscsi_get_task(task)) { + spin_unlock_bh(&conn->session->back_lock); + WARN_ON_ONCE(1); + return 0; + } } else { /* Already have a ref from when we failed to send it last call */ conn->task = NULL; @@ -1493,7 +1509,7 @@ static int iscsi_xmit_task(struct iscsi_conn *conn, struct iscsi_task *task, * get an extra ref that is released next time we access it * as conn->task above. */ - __iscsi_get_task(task); + iscsi_get_task(task); conn->task = task; } @@ -1908,6 +1924,7 @@ static void fail_scsi_tasks(struct iscsi_conn *conn, u64 lun, int error) struct iscsi_task *task; int i; +restart_cmd_loop: spin_lock_bh(&session->back_lock); for (i = 0; i < session->cmds_max; i++) { task = session->cmds[i]; @@ -1916,22 +1933,25 @@ static void fail_scsi_tasks(struct iscsi_conn *conn, u64 lun, int error) if (lun != -1 && lun != task->sc->device->lun) continue; - - __iscsi_get_task(task); - spin_unlock_bh(&session->back_lock); + /* + * The cmd is completing but if this is called from an eh + * callout path then when we return scsi-ml owns the cmd. Wait + * for the completion path to finish freeing the cmd. + */ + if (!iscsi_get_task(task)) { + spin_unlock_bh(&session->back_lock); + spin_unlock_bh(&session->frwd_lock); + udelay(ISCSI_CMD_COMPL_WAIT); + spin_lock_bh(&session->frwd_lock); + goto restart_cmd_loop; + } ISCSI_DBG_SESSION(session, "failing sc %p itt 0x%x state %d\n", task->sc, task->itt, task->state); - fail_scsi_task(task, error); - - spin_unlock_bh(&session->frwd_lock); - iscsi_put_task(task); - spin_lock_bh(&session->frwd_lock); - - spin_lock_bh(&session->back_lock); + __fail_scsi_task(task, error); + __iscsi_put_task(task); } - spin_unlock_bh(&session->back_lock); } @@ -2036,7 +2056,16 @@ enum blk_eh_timer_return iscsi_eh_cmd_timed_out(struct scsi_cmnd *sc) spin_unlock(&session->back_lock); goto done; } - __iscsi_get_task(task); + if (!iscsi_get_task(task)) { + /* + * Racing with the completion path right now, so give it more + * time so that path can complete it like normal. + */ + rc = BLK_EH_RESET_TIMER; + task = NULL; + spin_unlock(&session->back_lock); + goto done; + } spin_unlock(&session->back_lock); if (session->state != ISCSI_STATE_LOGGED_IN) { @@ -2285,6 +2314,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc) ISCSI_DBG_EH(session, "aborting sc %p\n", sc); +completion_check: mutex_lock(&session->eh_mutex); spin_lock_bh(&session->frwd_lock); /* @@ -2324,13 +2354,20 @@ int iscsi_eh_abort(struct scsi_cmnd *sc) return SUCCESS; } + if (!iscsi_get_task(task)) { + spin_unlock(&session->back_lock); + spin_unlock_bh(&session->frwd_lock); + mutex_unlock(&session->eh_mutex); + /* We are just about to call iscsi_free_task so wait for it. */ + udelay(ISCSI_CMD_COMPL_WAIT); + goto completion_check; + } + + ISCSI_DBG_EH(session, "aborting [sc %p itt 0x%x]\n", sc, task->itt); conn = session->leadconn; iscsi_get_conn(conn->cls_conn); conn->eh_abort_cnt++; age = session->age; - - ISCSI_DBG_EH(session, "aborting [sc %p itt 0x%x]\n", sc, task->itt); - __iscsi_get_task(task); spin_unlock(&session->back_lock); if (task->state == ISCSI_TASK_PENDING) { diff --git a/drivers/scsi/libiscsi_tcp.c b/drivers/scsi/libiscsi_tcp.c index 883005757ddb..defe08142b75 100644 --- a/drivers/scsi/libiscsi_tcp.c +++ b/drivers/scsi/libiscsi_tcp.c @@ -558,7 +558,10 @@ static int iscsi_tcp_r2t_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr) return 0; } task->last_xfer = jiffies; - __iscsi_get_task(task); + if (!iscsi_get_task(task)) { + /* Let the path that got the early rsp complete it */ + return 0; + } tcp_conn = conn->dd_data; rhdr = (struct iscsi_r2t_rsp *)tcp_conn->in.hdr; diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index 09bac9e3efaa..97eb793f4c55 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h @@ -482,7 +482,7 @@ extern struct iscsi_task *iscsi_itt_to_task(struct iscsi_conn *, itt_t); extern void iscsi_requeue_task(struct iscsi_task *task); extern void iscsi_put_task(struct iscsi_task *task); extern void __iscsi_put_task(struct iscsi_task *task); -extern void __iscsi_get_task(struct iscsi_task *task); +extern bool iscsi_get_task(struct iscsi_task *task); extern void iscsi_complete_scsi_task(struct iscsi_task *task, uint32_t exp_cmdsn, uint32_t max_cmdsn); From patchwork Tue Mar 29 18:03:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 555082 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE62AC433FE for ; Tue, 29 Mar 2022 18:09:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240435AbiC2SKr (ORCPT ); Tue, 29 Mar 2022 14:10:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232456AbiC2SKg (ORCPT ); Tue, 29 Mar 2022 14:10:36 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5639A1ADA0 for ; Tue, 29 Mar 2022 11:08:53 -0700 (PDT) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 22THsmNc013396; Tue, 29 Mar 2022 18:03:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=IW1mzUwcowJ3d47nka+SUJO3AiBxgKrMZZEnTf7UjF8=; b=Fko1Dcb5TNC8It8Eh/YtaFo4v7ZitlxZjkpytXcyE1cmhMgkalIXyc35oR5VrrS+bZS/ y4bhc+GO2k8qEzN/Idk45VH/Mxn1JYqHs1rR2ti60lr2ZRKGQjmBD3QkRfh5Ooi6XgCA DOV01wNpPD3V8hPX+F2G93s5ciHciL25LRD2HalPasKmRik3YnxOyHNNnFjLr26vk2IM 1qL1mshvb5/514L05OzezqrZ2XdJnJpf8rS+145dHfVQ5XFIH6BrUccHSjAmQWYB2FOY 672RytW88ceYUJAtqByluzEhfGsLnB0z+IYDHpi3BcNnBiSz8j6PCsGtjtsO4FGxmnD4 pA== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80] (may be forged)) by mx0b-00069f02.pphosted.com with ESMTP id 3f1uctqf6q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Mar 2022 18:03:46 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 22THw2uJ013210; Tue, 29 Mar 2022 18:03:44 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2175.outbound.protection.outlook.com [104.47.57.175]) by userp3030.oracle.com with ESMTP id 3f1qxqfdqq-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Mar 2022 18:03:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F3MlCZ4MdYU1OcrYB00vGHREEslt9EGt72egcFNbcWoUQho5J+nqcjx75Y12RGlD88XRrCb73mwK3PlC6Fu2inglrvMteNowMEKYpCkugBS8zA185fDj2/S5c1odWFggUvCHnOF6ClE+ZgblRVo2h45iSAuqKFsiq2aJBxN4Ynm6Is5N3RsxlNNAEI2g0Tbh0IHrXhmIZkGr1P/wwoxs7PFV5Mh7PCnyH2sJuk1bvdgPcKoW9dD7nr3o2Bl6GCosRq3becIEpmRIyz6KwnIqjna348mxmWcyvVCW99hrKX7hMsLfs2UaYkI56Fj/5XKCEKcEzF82YLxGTU2hBdHEXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=IW1mzUwcowJ3d47nka+SUJO3AiBxgKrMZZEnTf7UjF8=; b=At+F+O6jyAJeaJCLHabIy1S0k439wy12GYHVoqQSRCPvb/2CizntwFE4wHxDWek9izQl8BE2gqTgGpVFerr9vxCvJ6iofvYQR9eGP6MvvAs/oUjpR5WpnoiURBImYuH8RZXn6JO7jCYhGHZcKl0P3XiF6kZcnJZMreHUScTwR1YfD0FBep9SDzwAZYDrogi/dfmzRjgjqLgheNSe+KNPdbOc4Lp5NKMcxbysn26DvLVnpETf6Zzq9TofkHE1gJIgMD1RGnvO5rkOGrd3k46HK/hXPzOpFkn+B6IU04OTC2ZmfNQXBggb20U48Q6jxORK6gI/KdV+VB5ICBEvNZ8BKQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IW1mzUwcowJ3d47nka+SUJO3AiBxgKrMZZEnTf7UjF8=; b=XqrZXcsXSMB33ZrkJjlsOOQM3WpnmBUqmyjuEvWr4AEbmJqLrhQCpgEO4zKnEhhXtNJ+3CJ/0n4X8PMJCRypxc9P1X/EYOXA65U5xpPA/EMy/po2SnhsIV6RZegxxdylol4iGfHX+6+p0ewEnCOaUlnt/riLm1dxunSOHv2AGHo= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by MN2PR10MB3584.namprd10.prod.outlook.com (2603:10b6:208:11e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.19; Tue, 29 Mar 2022 18:03:42 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::29a7:bae9:9b3c:c9f2]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::29a7:bae9:9b3c:c9f2%10]) with mapi id 15.20.5102.023; Tue, 29 Mar 2022 18:03:42 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, njavali@marvell.com, mrangankar@marvell.com, GR-QLogic-Storage-Upstream@marvell.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH V3 13/15] scsi: iscsi: Try to avoid taking back_lock in xmit path Date: Tue, 29 Mar 2022 13:03:24 -0500 Message-Id: <20220329180326.5586-14-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220329180326.5586-1-michael.christie@oracle.com> References: <20220329180326.5586-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR11CA0002.namprd11.prod.outlook.com (2603:10b6:3:115::12) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ffe30ee4-cff6-4aad-b2d9-08da11ae751f X-MS-TrafficTypeDiagnostic: MN2PR10MB3584:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hzjYWcVu0C3rGmz8MJlTDfuySoJtgzvZJiQ4YbpXMCHtkjZvLm+Q3NXOcXU0/6ZRin5qTkO7RSVLOg4fW9LrI+QH1oy/qpRHdrSQ14sThhtLYhKBey2urhmbDfwvmOqPxzA7Arutn43kNBzVs/nueUp7k9NBaXpekO4yAJ+3O3eMKJN4LRTUYWkyTo7aKOtsn5e6WPwDQDd5i3lXIohtZF5JIikPLJHgOSZ5xRtsJcx6W/csCdBxULf6te4eJJetkVEfpUYDLZ6Nt6KGbiUKVffBmixF0D8FC2UzqfEdFFWcoAhqRIqEZQidrITOOfGJLibGrEkqATFyAw/vZvaxkv+y0DJvtX7YQbq+JsfS5T+OpJ34AwynpRgFtmWLeyfK0fvGrq34PHQUpjfaMtaXvvQ3NU8q9+GRfH+fk3myAA0uKqkuXDsy0cRXTexql7TPBESB8KyJHNd2Uwf0w6WhKCx93gFN+j2WSHQeb4GC2e1cfskPglTHwsN78vWUdpngh6w8QkQILLzfxX9t5zBYPwmQ0ROUoFbxhAheh1GI4nWvM712e8WaWWuZFmqfI8odZOnOagtlWINwpgjI+XWRnmZ8d2RmbRhGXhfpR1LzoQWR/AmY9a+sw1Ykf4tsY21TVTbxCJhgyjKZ+TRXqLdmTyLsD2YhgJ7rwd7NUBeQgLyiTAS67Ylp1XSkn9Rj88lEd4WZ96Pc/RRaAQUkC8odHg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(66476007)(66946007)(316002)(8936002)(8676002)(6512007)(66556008)(38100700002)(2616005)(36756003)(508600001)(26005)(6486002)(2906002)(5660300002)(6506007)(107886003)(52116002)(6666004)(86362001)(83380400001)(4326008)(1076003)(186003)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: F4d+4mj743gxmtSBP30MUnnKtRoLfmX2TutW4Ccp/AwbH+8t8qK+Rnjz4Ms36aq6CMUFj3i7CyX0Ob8tMKFntJ9UpvjjP27wijZfM1UQIPcBCwhSdDwPNh1h2FRrucrejOgq64VAKScKAMWOrVrQfH7p6XMqDptxqojfd76LefEPNdFR/jIiH6629M2A2YFUM9OWH/TCjddGgrJiSz7vnzhH4EpKqmgKZztBd/R03/VorKSlJxQkHIy2b4fNh9rmZNUz97l86bh1OxxDkamk42xKUW7d3WMRdju0caL8m4mbD98fC+NQiMq819WYcs6AkqbKSAcZZLtQWGurqHLS6FBTgajnkwWPypugsbcvWgrhFKa59t1gwnpkXX1eFVMS+yj/F6Xta1StPI2S+J4zGLxANC4yl8U2DA0qSz6UC3Bz3g3eXl3xZMRhNAc1R20/KVg1P9fPtGaWF2trZD21Qb98/RlLjy/tDDBM8Q94aoBCGNItX/VN0FGzOAiHN83U5Uw4ZFkzy2xE3IomPh6vYvSDNpTuDT82wRk5Zvhwuf4Vk8GiG/xzFAeTVksfOi5ciXWoiS4OG+Rh+jItBiwYDa3NDWXrmzk7snGLkREHleBPAloERPjz9PP1ctLmgJ4l6Z+ucN3eRZJKhRHEjoptIcfo1sYgFUoB1WZoBSeYLfLoRW6+j4wQvd5h9iQQDWWrTc//T6AQoXhHsCy9XgvQIao4bOd66PD71+qLxJY07WO2drQB5EoLVZzheayj/nbQiw9xn3lUeepsVoLpZWe33+tny7qzYOIWQA7DuvvfHFtqWjlszcvqr+Cwk36YrVSi9QJLyEDS38Ve+4+KtYh4pgkVV05VbBQIVihznMAIeFK35yFDJ7S7+BnIi8/942ErWlTk+9pmhE+G2B2b5wy06+3Z+XuP5O8eaj0F4xX5IqpaZ3y5G8bhFhmbz82/itarZTUMqZudkYdUwKWPV8DntIc4cf7af1UvXx/mvfVFCFq8Is8sj6ru04KoSjDEAZTJkgBlNyeOLMULIEHZ0/Km369s82C9JP1D2+YZ4oK8GrAroxrqNa9pu7/QUZRYqo+L8vw4hYar9i/kMOGMdzv+0erwmU+lwkvpGc3IuIZVjKDmD+AU27xhq1c37S8tFhm/QVKrqyMJFUkoQS1/MeNQFglGzBdsz7Lytnqs5z3ffx8CCnB/Yv2l4Qg3Y0BPc8azLN3xqUHTSXEtceBxHKp0ux+/p6+T7obOG6pb1hbTW1XsADR4Ujo9Z65HtrrrtSsbJMhSSqSX/4ywOoLktP5SHrvsffq24FFRU8FWNVevLiTtMVaFcd82t6TeaYEvH789z8D1Up3eHSMBFM6bklGNnVxLtC5BMuTuAAiMj+qpK33ggfNxEkejhn45M2hcYnFMMGeMTsDeMkRDcn67h09zRsmUENbOyWe+s0t7isWyzbZn/rmjpFoAqUdBVFxG/L3VM8d9n1J+PP8IczUMUJ9rqDklORgtRkR+1RitRc5cNCDlvbXCeknxTHK3+jnXOrXfcb+6/12MHE2Q/8+o3AsLbnJ0So6vSz+Fa1tDCsDNYUlClj0wm43h41AtP1EUhqrvlvZuUbpcKU6OtHoM1ZW8glUSPxcI0qccXcQkdFNt2DS/LdXyJ0x6R6kMIMV/6T5vD7gwZO9D0UEm9FeEKUF1ZAglfj2oFNKJ+seKXNgnKP6l1PvuMayeLp++ZbYBTqvZufRubZVa2JqGf+Sr5qMdG+oCwiWkWn73gMVUVNMHMMQ= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ffe30ee4-cff6-4aad-b2d9-08da11ae751f X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Mar 2022 18:03:41.4902 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: f4/CPWt919pHuHEf2AfRiKuYFBym+tybw/XwdA53azhf6ZeZ/5qvL61X0IEWplB/m47qVpbkgSJnYFV35pr1KGBfVcYzqYF8PtKoZUHYmT0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB3584 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10301 signatures=695566 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 bulkscore=0 adultscore=0 spamscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203290101 X-Proofpoint-ORIG-GUID: xA6E3Uc-JjveRnY9z-qOhrbe0JhhiF3L X-Proofpoint-GUID: xA6E3Uc-JjveRnY9z-qOhrbe0JhhiF3L Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org We need the back lock when freeing a task, so we hold it when calling __iscsi_put_task from the completion path to make it easier and to avoid having to retake it in that path. For iscsi_put_task we just grabbed it while also doing the decrement on the refcount but it's only really needed if the refcount is zero and we free the task. This modifies iscsi_put_task to just take the lock when needed then has the xmit path use it. Normally we will then not take the back lock from the xmit path. It will only be rare cases where the network is so fast that we get a response right after we send the header/data. Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/libiscsi.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 544113f3a9c6..eede1f88a407 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -490,6 +490,12 @@ bool iscsi_get_task(struct iscsi_task *task) } EXPORT_SYMBOL_GPL(iscsi_get_task); +/** + * __iscsi_put_task - drop the refcount on a task + * @task: iscsi_task to drop the refcount on + * + * The back_lock must be held when calling in case it frees the task. + */ void __iscsi_put_task(struct iscsi_task *task) { if (refcount_dec_and_test(&task->refcount)) @@ -501,10 +507,11 @@ void iscsi_put_task(struct iscsi_task *task) { struct iscsi_session *session = task->conn->session; - /* regular RX path uses back_lock */ - spin_lock_bh(&session->back_lock); - __iscsi_put_task(task); - spin_unlock_bh(&session->back_lock); + if (refcount_dec_and_test(&task->refcount)) { + spin_lock_bh(&session->back_lock); + iscsi_free_task(task); + spin_unlock_bh(&session->back_lock); + } } EXPORT_SYMBOL_GPL(iscsi_put_task); @@ -1454,8 +1461,6 @@ static int iscsi_xmit_task(struct iscsi_conn *conn, struct iscsi_task *task, { int rc; - spin_lock_bh(&conn->session->back_lock); - if (!conn->task) { /* * Take a ref so we can access it after xmit_task(). @@ -1464,7 +1469,6 @@ static int iscsi_xmit_task(struct iscsi_conn *conn, struct iscsi_task *task, * stopped the xmit thread. WARN on move on. */ if (!iscsi_get_task(task)) { - spin_unlock_bh(&conn->session->back_lock); WARN_ON_ONCE(1); return 0; } @@ -1478,7 +1482,7 @@ static int iscsi_xmit_task(struct iscsi_conn *conn, struct iscsi_task *task, * case a bad target sends a cmd rsp before we have handled the task. */ if (was_requeue) - __iscsi_put_task(task); + iscsi_put_task(task); /* * Do this after dropping the extra ref because if this was a requeue @@ -1490,10 +1494,8 @@ static int iscsi_xmit_task(struct iscsi_conn *conn, struct iscsi_task *task, * task and get woken up again. */ conn->task = task; - spin_unlock_bh(&conn->session->back_lock); return -ENODATA; } - spin_unlock_bh(&conn->session->back_lock); spin_unlock_bh(&conn->session->frwd_lock); rc = conn->session->tt->xmit_task(task); @@ -1501,10 +1503,7 @@ static int iscsi_xmit_task(struct iscsi_conn *conn, struct iscsi_task *task, if (!rc) { /* done with this task */ task->last_xfer = jiffies; - } - /* regular RX path uses back_lock */ - spin_lock(&conn->session->back_lock); - if (rc) { + } else { /* * get an extra ref that is released next time we access it * as conn->task above. @@ -1513,8 +1512,7 @@ static int iscsi_xmit_task(struct iscsi_conn *conn, struct iscsi_task *task, conn->task = task; } - __iscsi_put_task(task); - spin_unlock(&conn->session->back_lock); + iscsi_put_task(task); return rc; } From patchwork Tue Mar 29 18:03:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 555085 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9DDBFC433EF for ; Tue, 29 Mar 2022 18:05:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240406AbiC2SHZ (ORCPT ); Tue, 29 Mar 2022 14:07:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240414AbiC2SHH (ORCPT ); Tue, 29 Mar 2022 14:07:07 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 626E5B189E for ; Tue, 29 Mar 2022 11:05:21 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 22THsKZT022190; Tue, 29 Mar 2022 18:03:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=WYfCC13MYd7QUwbyVlWNiC65FQBeucz6JPSge6nANr0=; b=GaB+Qec6r4jyMnt4gvBovHW9v5lWwrvEoBiRtIKctsy0GIExiIjxdd0CTCwOzDJ5yWvz OwdfB2FJZf9XvcNEUh3RGK8fZOWQJ9yR9HcaR0t4KB/opVasrR+ESh/83Gtx9IOyIVIB p2iaUvC5e8nDVMM5pMJn18ty4XUAZAXOxwm5rm2SVKNyJgZ2095Ncz9AbbPYARgyySrZ Go09L5sVIyxlOyD94z7yHuBcBtBEsZhFS9V85Ax1UywGJIycK+ltYOYLXDfQyu223fqY OBLWa4hVxvu+t2XDqlRJeWa4O5UptFA5S46wqdTAEiPjeets2b07Rn/mlxWGQy1hC0wm Hw== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by mx0b-00069f02.pphosted.com with ESMTP id 3f1tqb78tt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Mar 2022 18:03:47 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 22THuk6W127683; Tue, 29 Mar 2022 18:03:46 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2173.outbound.protection.outlook.com [104.47.57.173]) by aserp3020.oracle.com with ESMTP id 3f1tmymau4-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Mar 2022 18:03:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bhwVZL+20uuS7Huaie8/VaHAR2tkyFxapqiER4dk7j0jeHGzvwsa2tc8gPbChqLIh+PAqjfZ/eA8tReAUHWXqxA5vV6WiimUS7z8ryMpugnYKAtmY9RQC72GrWNavDPv6qwocqOECp1CojisAkTSVJbSRJvGliB0bCv7vKqyAu7gc0pKvoY7olE4w+6SqJK3GEN2abE3Niot0XguQbfulMeWIHQ/KnopBHYbPqEel+OhmnQnQi0wV+LM/UPdl9P1CO6xDiRMfemaZeD8fRhqV1vpRicEHBbTACAS0InoR4+5WnHZ2uo1z2CPHeeM3PvodsnmfAM4YISE+tiAYnvrIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WYfCC13MYd7QUwbyVlWNiC65FQBeucz6JPSge6nANr0=; b=EdfNUrRW4lZvezXhimc/iPJTS+kf9iYQBUoCeXffFJqj/V9mfrWcZReApHCXHaQdI6Zokkr9nIedu0V2FTIt2mRzrEKZfgji1UKQHOITUIY8PlIui36eDcq9DWXJW55nf6cw5bXOBFmp8GQ5/fsi0gzZe9M8k22cM4Y+9fvProKiEIzE4TNr3HO1/99UfB7QiEwNotvI667a6y82NgyfdHH3fKgmP8bEb+LlIzT7wevNbt+C7Q91wz7FpG9wmnQnNFBr+JWX0pAAbf+sAOu+cCGwUkvAPOsXB87XHlZELfgwVr6WXjEl4dFV+AmaLIUrkzv0QY29+niD4dI51q4Bmg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WYfCC13MYd7QUwbyVlWNiC65FQBeucz6JPSge6nANr0=; b=Run825l7Q6C84NkES3gmz63ejAlPIU/pbCewo5cMF4jfSnpJezg0TbiWFbPsfK/nSOqx2HGKRiu56IY2kaXnO2l2rM38fC0XgK7NVYm/A+Le6Q4yc+x+v8peV20jQzxmnqMhkKIpA37y8qDSpZ2kYGZunCiSd9N+ZUJ2G/nuw6Y= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by MN2PR10MB3584.namprd10.prod.outlook.com (2603:10b6:208:11e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.19; Tue, 29 Mar 2022 18:03:43 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::29a7:bae9:9b3c:c9f2]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::29a7:bae9:9b3c:c9f2%10]) with mapi id 15.20.5102.023; Tue, 29 Mar 2022 18:03:43 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, njavali@marvell.com, mrangankar@marvell.com, GR-QLogic-Storage-Upstream@marvell.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH V3 14/15] scsi: libiscsi: improve conn_send_pdu API Date: Tue, 29 Mar 2022 13:03:25 -0500 Message-Id: <20220329180326.5586-15-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220329180326.5586-1-michael.christie@oracle.com> References: <20220329180326.5586-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR11CA0002.namprd11.prod.outlook.com (2603:10b6:3:115::12) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3c67fa7c-7c27-41b4-fe1d-08da11ae756b X-MS-TrafficTypeDiagnostic: MN2PR10MB3584:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Z6DNMQ1PbD08mnpL3/K210ecS6h2DnyLuk+ADvK/04bOyx/fwzI/zgQpsaX2pG7bze4h0dWpFl5fPbboN5okSUV1eNV4kNGRiYgvOh58hgybpARVEs5oe2BDHIqA7FFsWSZZCLknhZXV2+k20JDXVyrbNZjs/Mv5Mh/rCbkg6niiBDEScbFk1WVuNil1eZFCo/YlN05bnjZjtVIGIYMqdaoh8QbdYybI/lnaZR06UYzUOdzf8D8L21eWeC/a+KX8/zfyY0Tzq+PGnVJbNM59L/1IZHCwRfm6W1RBRDChHm/zDiRDBgBh20Br9G5yr7/+wKvOv5RMTDfCmoQTNTwjx7u4VL64HcT6sC0+xPkY+fL8JnQNR9PWUe2A7tNQBZKYJz4kgmieTMlQFTrq+wCVxqfusUEPUP3CQPRKR3k9gKkvMYRHadctomYnGg7BSf0iBDpoQ9a0edWCVorry4yc3vaOmKynITwf1yM2MCNV+mUsno0GOkoysDP22GNRD3+dWS/+z2CapT0SKi2SdBP9oD3indC+SPtYgtWEYru3xLindoHLtGYk8YXBEZ/Bt4jmFzVRzRIQyusixphg1daAaqD4lSmM9dwEmQ7i0f7GQzj9OoueTVM9y5o06zy0RGwFd4gPDhzpE/ZxnxBuisSairT4+MyQU+aop4v2MJBGdUS3u07TfZTvsKhovar/WgM+R26C/bkmRZxFElzgZwaxCg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(66476007)(66946007)(316002)(8936002)(8676002)(6512007)(66556008)(38100700002)(2616005)(36756003)(508600001)(26005)(6486002)(2906002)(5660300002)(6506007)(107886003)(52116002)(6666004)(86362001)(83380400001)(4326008)(1076003)(186003)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rD7T6AnoXXMP+CsCe2+Nbo7x8zWdUzF0Tw1VH/npvuo2f36wyq/+XVjqtRIBDvI+wltHKLjs1dJiHLVzMSvOjxkM0RPqnT45FAaHMeWnFa+rIV3VvkoLNls/zChj9h+XLVdAZNosy7P48EMIeuDUbtyqnehdnKoVEgCiwHUlKtSGHeTHluUNd7pI/lp/WAEdOT6UN6J+KfLbmzIekeZ+cqzIjN1Q9lBw96bei4wsGxG47QZxc1dnIQd1KrAuq8F5/SiSJFUKDTx0Rup5FnR4TtYXLNnmDaDFVToWnaF8/fD3RcndTE5YvQ//gk7TanGf+NzbhWX3raU44UOTVdpIcn3miNP7Hwy5I/ywSj6HBVq1Q49IZcqmFCh+rFAj5hNOI/GLj/ycLpQM2wlNXQP7Il8+xxMLIplhGhMhqrRi3xhgtkDZAdL5rKnw5BPE5oi3+7PtQccZWePdqVMyWhDSFM+8JvPhdEQWahE8ULT8OpojT1aOfyBjXD38YgF11LmU4V6QsqGxvJJgFflDbUb1WKRPT5Ea/6VT8wwPzYRfO93Vzyz+E6BRaj7u6lWl/2l99KDmfQ8xfzXcpM4dewHAsUS7Q9C8O9cANyy3wLjDJBtaOBjJ/gi1s2rdMkt4YarQto8LhFGicx9dRLnYqO21/uJ52UgYnsFvkpVJr4ykWDefwbpZ+XG/jf9cZ87c6MNk9Xs++wq36cP1fVB4xzby3LPA+v6H/XJUzLRn0jnCKpvoJBBq29mIaPQgPl2GkvtIr99MqRXrW1D0UDUTocRxTkPf7gJR8SuZw5B8ThIzGRhF0xDP3GceyqrJrAN3WyHB8Amdu+34ws6c51nu4gqgU1ut+iP9AgBTiuq0VhpzQq03hg9NchviYQRBtODGMF56TXnVVcOYQx9AHUmPUAkSAGbQUBnfsT5r9wpaIrEMDaiJa1ne+xV9N7oGRlMJNLJBk7KlRbH12Moxy9enudp2hHGZkrIvoel97v+Q/BrysSskfNMS2G/8Ar7BLn2L+PwAu0rw+g8q4ARgFn/bwLX1MztWwfrUwSxib63Mddfdo353Vg1dPJnHpZJtwfkIrVwnVNjUggPR8xfPw+3TcQPmEOu4I7eyjVewOk+aNoJ3j6Nh4Iqy07TRvARjuQPBtC/oRMaIj8Ycfwcs35x3UBOBY7T6Nl2j+Q1a8tMyku/10sbwGgxJnbdVaj9/b+fafw9Z9T7jsQdenMY9DhN13lL2mTMMsk3GMMdlB6E3EVVKxfroydBnTW5Z3GZiI4IZRhr0yX8rL9MNuT5S3Xfdf8XQASKJdV4HeoWR5gATfaDBVe4c7TjCq8+w+b+ZiccErQFO3xZEzMHak21ANsZnE6CBkIomL6fcpSPovX9R/eaBZziP1ZqLopUouT20zADKwRdZonutxnQAVzjpk+I65PfWOht2UlIypI2PgAtu1P7PEP81c3wiHBINl0DacYiOq633OIY3aQDn/i4HQEde3u1VwaoqNjd51BYiwbZfmtU9qn6DQqh/0v6P4Sg/1N0QF6VWb04fsMOD1o69W79anlajFNdAabXruJ7Rp2LewXHJyCBBsWO2Qi0HV3tbIrc+JlKaWlcteee+B331fevg0kjvJfuFbB2+m7LoGBQGwNm4xBih4tArse+ogzGqATVDOX0ScGw8cnFfNKp/aRx6V55is/FJrpb2lVB3fFjL8gVgSbvL7S+iL/+61PIPF55dldyaux3VMyujAX+BTbwrLPe14JLjUt4BMxHv+G0LiJblUtc= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3c67fa7c-7c27-41b4-fe1d-08da11ae756b X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Mar 2022 18:03:42.0058 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: //ijW3YuqeSkRonOxZjSEPjaodl6LnsZNaYPZgqXSLeQ+nrYM8XIWyEHS22nDlb6w6YNe79oWKOmZgXjM18CLruky/ttHpowh7xepqem0OI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB3584 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10301 signatures=695566 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 spamscore=0 phishscore=0 adultscore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203290101 X-Proofpoint-GUID: dap4-9ZdcFccSzZoD-m-JKav_QZmUGTn X-Proofpoint-ORIG-GUID: dap4-9ZdcFccSzZoD-m-JKav_QZmUGTn Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The conn_send_pdu API is evil in that it returns a pointer to a iscsi_task, but that task might have been freed already so you can't touch it. This patch splits the task allocation and transmission, so functions like iscsi_send_nopout can access the task before its sent and do whatever book keeping is needed before it's sent. Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/libiscsi.c | 85 ++++++++++++++++++++++++++++++----------- include/scsi/libiscsi.h | 3 -- 2 files changed, 62 insertions(+), 26 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index eede1f88a407..5380216f7c05 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -695,12 +695,18 @@ static int iscsi_prep_mgmt_task(struct iscsi_conn *conn, return 0; } +/** + * iscsi_alloc_mgmt_task - allocate and setup a mgmt task. + * @conn: iscsi conn that the task will be sent on. + * @hdr: iscsi pdu that will be sent. + * @data: buffer for data segment if needed. + * @data_size: length of data in bytes. + */ static struct iscsi_task * -__iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, +iscsi_alloc_mgmt_task(struct iscsi_conn *conn, struct iscsi_hdr *hdr, char *data, uint32_t data_size) { struct iscsi_session *session = conn->session; - struct iscsi_host *ihost = shost_priv(session->host); uint8_t opcode = hdr->opcode & ISCSI_OPCODE_MASK; struct iscsi_task *task; itt_t itt; @@ -781,28 +787,57 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, task->conn->session->age); } - if (unlikely(READ_ONCE(conn->ping_task) == INVALID_SCSI_TASK)) - WRITE_ONCE(conn->ping_task, task); + return task; + +free_task: + iscsi_put_task(task); + return NULL; +} + +/** + * iscsi_send_mgmt_task - Send task created with iscsi_alloc_mgmt_task. + * @task: iscsi task to send. + * + * On failure this returns a non-zero error code, and the driver must free + * the task with iscsi_put_task; + */ +static int iscsi_send_mgmt_task(struct iscsi_task *task) +{ + struct iscsi_conn *conn = task->conn; + struct iscsi_session *session = conn->session; + struct iscsi_host *ihost = shost_priv(conn->session->host); + int rc = 0; if (!ihost->workq) { - if (iscsi_prep_mgmt_task(conn, task)) - goto free_task; + rc = iscsi_prep_mgmt_task(conn, task); + if (rc) + return rc; - if (session->tt->xmit_task(task)) - goto free_task; + rc = session->tt->xmit_task(task); + if (rc) + return rc; } else { list_add_tail(&task->running, &conn->mgmtqueue); iscsi_conn_queue_xmit(conn); } - return task; + return 0; +} -free_task: - /* regular RX path uses back_lock */ - spin_lock(&session->back_lock); - __iscsi_put_task(task); - spin_unlock(&session->back_lock); - return NULL; +static int __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, + char *data, uint32_t data_size) +{ + struct iscsi_task *task; + int rc; + + task = iscsi_alloc_mgmt_task(conn, hdr, data, data_size); + if (!task) + return -ENOMEM; + + rc = iscsi_send_mgmt_task(task); + if (rc) + iscsi_put_task(task); + return rc; } int iscsi_conn_send_pdu(struct iscsi_cls_conn *cls_conn, struct iscsi_hdr *hdr, @@ -813,7 +848,7 @@ int iscsi_conn_send_pdu(struct iscsi_cls_conn *cls_conn, struct iscsi_hdr *hdr, int err = 0; spin_lock_bh(&session->frwd_lock); - if (!__iscsi_conn_send_pdu(conn, hdr, data, data_size)) + if (__iscsi_conn_send_pdu(conn, hdr, data, data_size)) err = -EPERM; spin_unlock_bh(&session->frwd_lock); return err; @@ -986,7 +1021,6 @@ static int iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin *rhdr) if (!rhdr) { if (READ_ONCE(conn->ping_task)) return -EINVAL; - WRITE_ONCE(conn->ping_task, INVALID_SCSI_TASK); } memset(&hdr, 0, sizeof(struct iscsi_nopout)); @@ -1000,10 +1034,18 @@ static int iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin *rhdr) } else hdr.ttt = RESERVED_ITT; - task = __iscsi_conn_send_pdu(conn, (struct iscsi_hdr *)&hdr, NULL, 0); - if (!task) { + task = iscsi_alloc_mgmt_task(conn, (struct iscsi_hdr *)&hdr, NULL, 0); + if (!task) + return -ENOMEM; + + if (!rhdr) + WRITE_ONCE(conn->ping_task, task); + + if (iscsi_send_mgmt_task(task)) { if (!rhdr) WRITE_ONCE(conn->ping_task, NULL); + iscsi_put_task(task); + iscsi_conn_printk(KERN_ERR, conn, "Could not send nopout\n"); return -EIO; } else if (!rhdr) { @@ -1870,11 +1912,8 @@ static int iscsi_exec_task_mgmt_fn(struct iscsi_conn *conn, __must_hold(&session->frwd_lock) { struct iscsi_session *session = conn->session; - struct iscsi_task *task; - task = __iscsi_conn_send_pdu(conn, (struct iscsi_hdr *)hdr, - NULL, 0); - if (!task) { + if (__iscsi_conn_send_pdu(conn, (struct iscsi_hdr *)hdr, NULL, 0)) { spin_unlock_bh(&session->frwd_lock); iscsi_conn_printk(KERN_ERR, conn, "Could not send TMF.\n"); iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED); diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index 97eb793f4c55..46e026153292 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h @@ -135,9 +135,6 @@ struct iscsi_task { void *dd_data; /* driver/transport data */ }; -/* invalid scsi_task pointer */ -#define INVALID_SCSI_TASK (struct iscsi_task *)-1l - static inline int iscsi_task_has_unsol_data(struct iscsi_task *task) { return task->unsol_r2t.data_length > task->unsol_r2t.sent;