From patchwork Thu May 19 00:35:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 574864 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 F3D98C433EF for ; Thu, 19 May 2022 00:35:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231877AbiESAfk (ORCPT ); Wed, 18 May 2022 20:35:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232197AbiESAfg (ORCPT ); Wed, 18 May 2022 20:35:36 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AA1DAEE2F for ; Wed, 18 May 2022 17:35:34 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24IMIp1S027449; Thu, 19 May 2022 00:35:28 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=ZEL+3pR/443NwTvVEVQLHpAFT5+e/wWGoZYmoOARmjA=; b=p+BjYxsmpokXQ27nNJT0ct1PMtnXfXiF18p3JzyfGi+LnvqoHxp9OWvv9AxqpOYLvTNS 9dK69QF3O9MehmdLVRh5KogtpVYZItuV4PGcT0BRLnuVPLeHid4VZWH+vSlZMzGcJOFo g9QQVbaQy+MWUNOtR74kUSBgOfipkQreVgb+AlAzzn63du0zmUkdLZgzen+9Z5NLcYEQ BZvQhx4s6g5JV5a+BtOmUWBZ4IRe3Xm6pyV3ipQjOHFKEwwcf2sD3x1Bp7Qe1dBT+fpN YjAI87odTBiqbGk8J6H9rflo5/pGU2P9jCPLABjMjEvmF+214AivJlCPnyZossUtNzv8 GQ== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3g241saut7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 May 2022 00:35:27 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 24J0U2SI020228; Thu, 19 May 2022 00:35:27 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2174.outbound.protection.outlook.com [104.47.55.174]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3g22va9pcg-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 May 2022 00:35:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jvHjJDkJF+8+0mHaPHUN1NtNeeoDo3+zAz2hEKPkTR0bNfkVfe6JhJGPA5H5n4MFSDApHJKoZUpk2im91vEWzHrgF2dd71RzzScaEQ965gO0T//u3EVJ1lVhVviLj/SPKZ2OuKVregBI3LxwE+5YmTYyefRbtTjBYmt4cGCeFEyQm2HjTtAnOgJC4blp2ccUPI2XYku7nBZ5su5/ofWbnLRI8p3OvsILpbgGXLS3goF8KuWKBVkx3Yp4t1lHnXSfteXPzeh4w7BWVN+G6DJP3GWJGSxG/bpvY4KovcP4DhE4qvIhSziN6Ff02WuZ7YX0ckNfpBTZjZAyGqXNeqERgQ== 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=ZEL+3pR/443NwTvVEVQLHpAFT5+e/wWGoZYmoOARmjA=; b=AUF30tKPIrsejhzfTvoqCLaoLRhcf8jCrWBICF761/XSk3O9ON7nbIZnEj6vihoueU/f2cvyCJESZyks73IfGzsMl8Z240DR/vNqOS9WykqitcKrSGcH1GyR+atHqlnUTtEEq/EOCpmb4gpse0G8slKRuqhoAEnQOldp05Udwbl2jg0wZ5ni9oL/PKR64mESkvYLXesd8UmoxwRZSkyPrfdNYqhdLICNAVnlbv/9qGoIxDfKG8yJ+zJyCc+yaYw6OwjalQbusHzB/ltOrXwBA3x1QVYAk4sga6YkrRxA+QDu259ntPKZcG+4WiOWsdqxqWwfhwnuF429NFhW0U+1uA== 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=ZEL+3pR/443NwTvVEVQLHpAFT5+e/wWGoZYmoOARmjA=; b=SG+HKdByZMJpCUsIalf/8NF5w8LQ5a4zMxnn8Ghb3FS4oEYxj01jnSacQCVpBIXUR+jIgaPtYR0NPSFJIN7kb3mEItTGgFKqiFtFohKVoMDnx9vUpPn6qKmUgqkjGNrHl/rgQ12XaFgqTqKgpyW6xkEcuhaHBkfXu5JjK3uUEO4= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by DM6PR10MB3020.namprd10.prod.outlook.com (2603:10b6:5:67::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.18; Thu, 19 May 2022 00:35:26 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b%3]) with mapi id 15.20.5250.018; Thu, 19 May 2022 00:35:26 +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 V2 01/13] scsi: iscsi: Fix HW conn removal use after free Date: Wed, 18 May 2022 19:35:06 -0500 Message-Id: <20220519003518.34187-2-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220519003518.34187-1-michael.christie@oracle.com> References: <20220519003518.34187-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR17CA0015.namprd17.prod.outlook.com (2603:10b6:5:1b3::28) 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: b78be213-0f61-4012-317f-08da392f7765 X-MS-TrafficTypeDiagnostic: DM6PR10MB3020: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: U5vD8UH/QZOI/OmkAoqtTvxbSYyOikMVYySsCvm7Azdxrb11rUYKal6741pa7XPctPmz6bB2fZhYNGl0wwL1Ft7gu9kWuxzMYLMJttLep038th70WWFR4awKYX6yhLGrPsaloBjdIr75noJI7fBCHwkIOeT8IioO54yNrNaKOtKff8Ez2tPkxKzh60Td51//GmQaYFXXKHWh96feVSSHVLVOUM6xP0T88ZqW5SY8CYCjNXutbVGVRi2Hj9FRriyybEkpNoIvuiU+fZWu4D41bth76yVvxFZQj7ee9fxa5Y70JnHI297bbMi3ejdNjtsIxP1oQtRigXFM+lXS+Yn9uq/iA8JmG24fNVmVbXW0xhjxPcZyyl5kvXY3uEMDd+f78TPk3RFRuP7BLJ5sv2Ohw0iOrFo/kvSQKsBQ0oitTumxmtxG2NUu5ilSTjNbypZINVLH3240natddLv3MBk1DAdNI4R49kj71EJcXN5ZHjZG0tuWI0RyYNNbWSargfh5uN1dZxg38fiDsfxv6obGPiOESMbKACPRAL761CEPKmZhqk+xVbGmnTExs8/Ue5ySL1VJ4rsxpksplv1XiTsTd9Y1W6cfQBQDyn4zLMzLZNhf+wlrdkCWVjWMoRzdxuqYIrvab1gIHDuef1jnIIUrvTFxTLSMtV6CgbrNtpiwVciFjuobWx4QPZ4+WcA3SExxVhOPmG1EILBMquhjzgPUZA== 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)(316002)(83380400001)(186003)(66556008)(1076003)(4744005)(52116002)(2616005)(2906002)(6512007)(36756003)(26005)(107886003)(8936002)(66476007)(38100700002)(86362001)(66946007)(5660300002)(8676002)(6666004)(38350700002)(4326008)(508600001)(6506007)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 42u1gFcNggWtxzEAHi2G24k2ktszrygJKumyTOYpnRvcAKEjPtyZimU5aDf6XGRvhQTWGGCT0o6sfmlJgrmz+X+UpzlOjPCt++ijXkbf7PYmmcnBrS8pYUPWaVK6ECuZtcEWbGlhWBHkAGS2YgZTglhw2Xxs50xkunjUv436jtm7sQ2CFimAAZN5e2NPr78l0D+cgg/ymZXDDy1WRBM2ho351/Ryz2em/TNuVn8NJI/bL8BErpkQ0pkn2nEIsCx9zadoRKqYiesgk3NRzk6FwuKOThn9y6aNDoRDD0P4ip3EZtAFnGg4fQdLHKx44FuPIu7KyvXdj+dld/FO7Q5xlkXHDHzBAln2mxK3Y0E4NQMXrUy1lK9qEONnEOfnLY6guiK7Z4/b1/fgVX6iy8BE0FexXRh602cRNDvJpBCqHU/rd/Q8Vg09d2w9SvpRJxJgHlCfPqacayGqVjxfimxKi2stC2GNywqF/vtVH8AHa9BY2IkbSuInNxQCtNeow2mGINvr25DTaFybpfa4sWjQJUELFZJq2YB8TAVQThY4KjRcJFLP6REsx7Ig0lPg/uCBie/we0+m48cnl5U6Dk/rJHJQNBbquuSpv7Q/r3ueeAS0McXI5exTOiQgbuGLIYoV4v1bUe4JQ4c/5VL1Nk/6J4F52AhZYstsnetcJzFjRBA84kZ/WPPBobouxt8hjfy0Cs7xrnjeYut9FLjM/Pn4AhaFF/yTeMatzqSaR4/A1QDLGdwxxXJoKzeBSO/fLDdmQFiY3p2qO3szi+ym44y4zkXoJLGoS8/jTJLnOX/9bgDbNYOoYf5jQKyODkVEDxPKJc+SyFFq0on3ENXIA3NFBebl5V18qM1zXaAJCtRKrow2t7uvDNUioGQZeSnFAz6w5+gGMrdxORc4cPP1yi9Tou8WARHoHoyeGn+aCRXqwlRCpk9e899WdB8LVsPWvbWPjkbWEm9FXHqlZTp889ekz9dmCVzoVhZQvmhMWbJsZRhjrhvXAA31CoH/+d6NgCJbIi9+vaqbfP8FEWuJy1NQ54x5M0OxyfGLQjaikjraweS1kE5gbz53Pnfiqk0f4meL4hBoQQkVxqc/KIOGizrmhknMTLEEwxkFr3VF6Ycej9NYOTf+ZduzXMugl2ees2dHsrQyym5UbxtJF51AdkGzYChvutebkF6kQRYr6WMSKTnUqGjGzK3q1LATmEZQII4e/4NBLhxIk/+RRVp4XbVJHVMExiVJQyXhs2Az+griy9yULVIFSL7yKxHyexKDG4v0D5Qk2iZyEWz/o8plJAUZZudoxq5k+07qiMBFo6seLqzeekCVRpazqvStFqdh+dSAZQZBWIYMtL/E0cRKTCMNPRqBXXPwxQ3gcvRaVpfGXIpxNnHb4t3Ql/GpmHtTr47esGK9mqS/MOl9l+R8YFVLJdJdwscMHYVtQK7BUuprGpHsO8iLdTfqXCChjBQaoTWqmJoBZPLDTtFLmFd00AgQeeRWn6RIWsEQx4ETr4nWpk3RSjQQN/ukqPIv86IlPwwYmwFTABrmAIMuqRBljUeu9UtgIywET+oZchxh4x487rYEZ35d7IBjlPyv4VQ1qnTSHG1E0VT2TAw/i+hbqsOSoWN7BQJBXeQcelGK4fURQYpF7N9nwenWrQzan7R86dYq2dOiWDqzp8XAtffu0BX9m4N2mYryXIweeG0IIht4uNqy3Oh8gWtzV3NEVrms4Yr/hn54LccjRDm4/Tw+nvyffoxFrv/kKPAtvovUTvAA0Zc= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b78be213-0f61-4012-317f-08da392f7765 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2022 00:35:25.6806 (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: Lax7YkRnMfP4Bvejfl3gSBDI7HWkdk4j9cjDm0Ox18Jc1wz0SOjOBswNmiSIC0HPaHQrsjl3SZaOsvWzjfQQBILAN2yt+yUIPg5w13bwm9M= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3020 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.486, 18.0.874 definitions=2022-05-18_06:2022-05-17, 2022-05-18 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 spamscore=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205190002 X-Proofpoint-GUID: MZbN2t4orqvZUQf1DoyktudmXyy1R2Wl X-Proofpoint-ORIG-GUID: MZbN2t4orqvZUQf1DoyktudmXyy1R2Wl Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If qla4xxx doesn't remove the connection before the session the iscsi class tries to remove the connection for it. We were doing a iscsi_put_conn in the iter function which is not needed and will result in a use after free because iscsi_remove_conn will free the connection. Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/scsi_transport_iscsi.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 2c0dd64159b0..e6084e158cc0 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -2138,8 +2138,6 @@ static int iscsi_iter_destroy_conn_fn(struct device *dev, void *data) return 0; iscsi_remove_conn(iscsi_dev_to_conn(dev)); - iscsi_put_conn(iscsi_dev_to_conn(dev)); - return 0; } From patchwork Thu May 19 00:35:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 574863 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 1E6E6C4332F for ; Thu, 19 May 2022 00:35:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232064AbiESAfp (ORCPT ); Wed, 18 May 2022 20:35:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232203AbiESAfg (ORCPT ); Wed, 18 May 2022 20:35:36 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1ACEFB0423 for ; Wed, 18 May 2022 17:35:34 -0700 (PDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24IMIqx6007842; Thu, 19 May 2022 00:35:28 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=aP28afUftfGNFLdlhzChriGKi3ybIJWdm/D4+7lFQyM=; b=Tj4toyiOAmu1318A9L9t+c9qx9kIVrQe1QDYDgxdpWJn2l12sTtieh/z1Ubrx/4od0SS kn3imonFusQMUAb1KeIma5CaDjgI9dz8RytjsgtxuHkCUKpZTBosG1a2YDxtJM2Luil0 TjdqYW4ycJUwRmBI5ItMsDQZl2D5uFdMxzRddHvmFVt6ix58NeF2b1TXBDkH/C0h58ny Epj6ohTbw7MDygxzFXG3T16nSvDNKRwJ6xsK7gY8Dfp3DA5Z0o78neSxXr+h478HbczO NiWtp2lC7PBxT0pbnwQwG8mG3icazRl9jf26oGD8mUcH1dQaCmJgiujLY/Rxy5CraPgG jw== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3g22ucajj5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 May 2022 00:35:28 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 24J0U2SJ020228; Thu, 19 May 2022 00:35:27 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2174.outbound.protection.outlook.com [104.47.55.174]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3g22va9pcg-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 May 2022 00:35:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GZ78R5oU8aUm/a2kj8lRxrVMZZgBD+xUePDUwn76kLx2p1RBTWHUctRs78E/m3kM1oETI4uq+wI7bHxxza0xP1U2+cKvG5rWirShjmiqKWfSTnVEqH/ArmOpV9Z5VUxXeWtnzb8IzZFL0JtpGeFd+9+88WIW4P7WpTzMVGkNKvoAnXc6YIYc0AmBE10C2esNyscsj4n6pObM0OIXR8Nz2BB2KKej5GdLK98qmHGRPEtHOJMXOUrb72WduufYe+u58zPvKpaiouo3m1iaaCRmgllW/Yf8PxyKDTFy+Xxawa7UfjmQ4Bn1SwR/Fx3gvb2yUlzonHTKV0m7rKh50izxgg== 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=aP28afUftfGNFLdlhzChriGKi3ybIJWdm/D4+7lFQyM=; b=S2wqCo0k8b1Ebh369GjgRq3RYfQdLLrYHs07k4rN8onzaEaH3f/XvzPp8WGVazBhJ0iKnlTSG2nxC1fQ5K33I0wvxDUznKlmqYoBXZ7McFI+ZMoSIJ6Bcg2Jj7wISUSXN8cdEBybCrha993uZXrFgVT4hS2tf2T8LKZ0D501wN6Dk6U48XW5loiiOWgyM+ocOcLNIjF//ZYHuPyJcE54w1Hi8Hy3s6io4hr6VRWsT/Dhf4sjPPyKpYyndO0zLaCYUaAyUmGDpeMaBB4+8o2kJman5IUjhL84JuUrnJdAryT8dN7HM6TM6aKeYoaXtdWb8rrogzmYr4utflvOV2gAkA== 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=aP28afUftfGNFLdlhzChriGKi3ybIJWdm/D4+7lFQyM=; b=0BRZ2y6tscppC6I3XKGVjewriXOvC/+LZxSQJpUg777EML+KwWYGp//eJweMdIFuNl6Rfm38ubsNlzBvfbBhB3zUUoAud8Qpz7G94ajJWAsJhEq1vsbiN5XlynECC4Ruk9QLL4YVghtCJ34Jx478jpJi7EXR3fmTHRJ3lAdzpEE= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by DM6PR10MB3020.namprd10.prod.outlook.com (2603:10b6:5:67::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.18; Thu, 19 May 2022 00:35:26 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b%3]) with mapi id 15.20.5250.018; Thu, 19 May 2022 00:35:26 +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 V2 02/13] scsi: iscsi: Add helper to remove a session from the kernel Date: Wed, 18 May 2022 19:35:07 -0500 Message-Id: <20220519003518.34187-3-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220519003518.34187-1-michael.christie@oracle.com> References: <20220519003518.34187-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR17CA0015.namprd17.prod.outlook.com (2603:10b6:5:1b3::28) 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: 97644ddb-1a6d-40c3-543c-08da392f77aa X-MS-TrafficTypeDiagnostic: DM6PR10MB3020: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: douPfuZcUwbwCOspMXyFHpalUBqTSW5WV/GE2c7NRm4n+j78sfBgZQRtXVLdGgMmrk4ehfdFdcVHZYrfNN5N2rsOegG66ZBbR4uoPpEBe9I6cggubFCM2F8AXfPQ6CESECvvqJyXXw6VfSyhA3Zu/CZ7bvG2OydxUPPDP8Mhg6jFKGB9CixY632Z9aYQmNKx6NsiM1yskq0xtPV2HSI+teLbUmVBnOKm3eOpjQP+3CGMjaKAuweyWnwCbGqtMc5mgcT0FdC4OgDOignQizMzb1gQCI5AaGmYDNnT8EXhhW/9hCaEgJinbp1AZ2sNlrk0j2fIn6OpjpB03cEViWMI7jLMrk7FZMIOVAnqNMhwHv9GAclPFdjS91dZiqdC1v9A5PnytzH4vQkwyGY31G01yK+dzDYJBcIfLURGkmKD9SxcF2hVVjY53vvfoqMD1HqQ909ma79G7PFxtZH8vYJjwNgnv/TdWNIlImeAb34d0zdNevVo8zSOieY2gDdRa9GWwl3NZe7J74UDzgc6ZTgPaKzH2rsAGFHlX281V+jvFhMVD6VpmxGrCKsthSr7twedmCX1YSmPD0rbfHhMVUp58mGyhEMomBClMDIUXTCf5KCyJx37Ih22lsEgATt4CRWXIajeYddRjT1Q1mMexQcJkk7IszDqIuN/F9V8AR5295vd+IJqgcJaZVFZJSRC8HcuwwGC6vxp83E+1uo7RVLQMA== 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)(316002)(83380400001)(186003)(66556008)(1076003)(52116002)(2616005)(2906002)(6512007)(36756003)(26005)(107886003)(8936002)(66476007)(38100700002)(86362001)(66946007)(5660300002)(8676002)(6666004)(38350700002)(4326008)(508600001)(6506007)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: C5G3yQYFYRZ3PFU/o3V5nfMLAPSgIJTdcJxZZBKUBzuYR4OWvNTK3hXcmfJhaFQ12ua6W3M32CVD/yVVwGz0WPFz57OD+MkkCC9qCLhNvpB8pePHcyQDxNzHOlwoFsKFWTReFLo0hKQzcDCS2w55E0GRIWxBF3DZALFtMWe3pYS5sZFuFKOL+1Yiu//XVLgGqBDart1+yOEGCPjGSNOXgUF3/7pqLS4kJ2D5ppHT9Agv1YzcOX7h7+qNSkPe3OFmICcS+KYtwq6Oh6d2oijHwo5oX7eSUmJLzDyROdmSpNVs667Vn5meRCgLv/9rzGrv1spWW1v8Pq5zuKONAWPRgdP7f6KdQHjYQrl3HBUFsmZzzeMZcpd8QA4knh/yMZdp7xJYcH0tXVxb06d/cU6du+02gGGCwKFlC9e6x2Pts59R9jI+hf2ebqjlK3p6+JyxvbDw8B3vAHbxQMv+/oYC+E/FRYP+/WdJ+SQZHA/cCCvmp6n+nGXwhKSFTs3KqvXI/spd61veo8hBrfY7SJ6IaWMz6NEoLBOWcL175rPuELSoZwTt1hFn2pSjECFRcLiatRGakZAmQbUjn2FwWUjVYQ6Y19z8E5rf5VgQn4Ug/e7X5/DplgF83gbJFTAACzjvgOszKWg3PyGY1UAoYjkp4C3mwP2pnZjS8cfqLOcMSRSXjL0VZ+TO1iYLdiZ87jSUc6RwAbAOzIJFbE4OzrBAHOi6WlhU5WrlJ4fHKJo+bbdtuZ1eTl+Y0PqQURaoE6kuofjR5wdbbsYFG0fJl7SPY/eb3pmQzxsG64XxlImlHdfRfhtt4N/noBvrVO4IbekX8tBnKBjr1cAqctwrwSqwTRXraw4RJFBHEZQCkgAWEoXXgE8onbQ6i6Ex6DnGDLL0fgrKf+cjphPQomKkg77oA6R28vdd33ZpRfg6zJRrq6nDSb4DOUhoKfLUxrgkg71P0qOIv5ZO9ztQsK5kqWOgDcRmqTdixbQyOwqDt5EGzDHUCSjwIUejkPPQEBteEWNeVlnchAfBHQj2wooObL4oVFsyMxroFiV0GdLS9uYE2wJuX11ArjmEiymq5KJVmR8yBTP7b/AX67IFBw1EJ0KUu6DVdvAEK2unVLez0CDxs+BKM8UYavfBsTbCziQ2Hmanef7V33pdUSb0vBwqfcbJHWT35PBQFYLlX/rnox5TxqlT7eFUrz/O4iE6NgEBjamAQ55KNWoA8itFgo5jWowII4eBu+r5g3IAFUkexZcmzzXNC6Xbk4zIhwrJKU1QrqXaYqD4HwZSymRLZ+6USt+nltC9T/mYEg450Dz2hVG0gQmL7WLS6/SooqZrlf/W/mch8opAHkBQYHHokoRd9kX0u2DdJG6H5RM5OewiN8/CEj1LlxS98bcxmJNSlbqF8jZkmRoNV5ERmGrBHkZhOUj2gdAwyOCnVDLGMi3r9gJ1O/oSxBr3sJbmFRbCUXj3RSaJnLTCavYFjOU3t4SYQOeH11r626t/dxQhzLYa9SubXoktWmT+1CyDeRAwaxc7T1og8n5BcpHj3mQKATEYpYqap3/m0s/7m7UhlXj0/bEQoafxIh3Gz3Lx92TlzpP/4g9u/Hw2UNPgN4j+3XzR4i6ZYMycf21ClDi7YphW3MynDFRaK3uMDh65ljQCCxI6idzWrXIWNnWg7fH5Mzn8M+h/Nal4qq/4eIPVNPZBwgTtY7S0qyq/gPqLTwbrcjtrTD9ENaFrCEtz+9ZOB6bq0YXgeYBjGNTaJgp4Hebnx1qlDRE= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 97644ddb-1a6d-40c3-543c-08da392f77aa X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2022 00:35:26.1337 (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: 6C3x2A7sroQbhn/Qb4fZoit4pOT37EXkmmPLL2bPggkaBPlTo3pEanbwGuvWjFBKdWZ2dIPkWeovsWnAD77JuAWpy/OSZ7r1WMXvlT+vw6s= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3020 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.486, 18.0.874 definitions=2022-05-18_06:2022-05-17, 2022-05-18 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 spamscore=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205190002 X-Proofpoint-GUID: CokJiys_RVeQ_irdw2XXl_H6cm_jGjw9 X-Proofpoint-ORIG-GUID: CokJiys_RVeQ_irdw2XXl_H6cm_jGjw9 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org qedi requires that we at least tell the FW to disconnect and cleanup connections during shutdown, and patch: commit d1f2ce77638d ("scsi: qedi: Fix host removal with running sessions") converted the driver to use the libicsi helper to drive session removal. The problem is that during shutdown iscsid will not be running so when we try to remove the root session we will hang wait for userspace to reply. This patch adds a helper that will drive the destruction of sessions like these during system shutdown. Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/scsi_transport_iscsi.c | 54 +++++++++++++++++++++++------ include/scsi/scsi_transport_iscsi.h | 1 + 2 files changed, 45 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index e6084e158cc0..cdaa54b6f763 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -2257,16 +2257,8 @@ static void iscsi_if_disconnect_bound_ep(struct iscsi_cls_conn *conn, } } -static int iscsi_if_stop_conn(struct iscsi_transport *transport, - struct iscsi_uevent *ev) +static int iscsi_if_stop_conn(struct iscsi_cls_conn *conn, int flag) { - int flag = ev->u.stop_conn.flag; - struct iscsi_cls_conn *conn; - - conn = iscsi_conn_lookup(ev->u.stop_conn.sid, ev->u.stop_conn.cid); - if (!conn) - return -EINVAL; - ISCSI_DBG_TRANS_CONN(conn, "iscsi if conn stop.\n"); /* * If this is a termination we have to call stop_conn with that flag @@ -2342,6 +2334,43 @@ static void iscsi_cleanup_conn_work_fn(struct work_struct *work) ISCSI_DBG_TRANS_CONN(conn, "cleanup done.\n"); } +static int iscsi_iter_force_destroy_conn_fn(struct device *dev, void *data) +{ + struct iscsi_transport *transport; + struct iscsi_cls_conn *conn; + + if (!iscsi_is_conn_dev(dev)) + return 0; + + conn = iscsi_dev_to_conn(dev); + transport = conn->transport; + + if (READ_ONCE(conn->state) != ISCSI_CONN_DOWN) + iscsi_if_stop_conn(conn, STOP_CONN_TERM); + + transport->destroy_conn(conn); + return 0; +} + +/** + * iscsi_force_destroy_session - destroy a session from the kernel + * @session: session to destroy + * + * Force the destruction of a session from the kernel. This should only be + * used when userspace is no longer running during system shutdown. + */ +void iscsi_force_destroy_session(struct iscsi_cls_session *session) +{ + struct iscsi_transport *transport = session->transport; + + WARN_ON_ONCE(system_state == SYSTEM_RUNNING); + + device_for_each_child(&session->dev, NULL, + iscsi_iter_force_destroy_conn_fn); + transport->destroy_session(session); +} +EXPORT_SYMBOL_GPL(iscsi_force_destroy_session); + void iscsi_free_session(struct iscsi_cls_session *session) { ISCSI_DBG_TRANS_SESSION(session, "Freeing session\n"); @@ -3713,7 +3742,12 @@ static int iscsi_if_transport_conn(struct iscsi_transport *transport, case ISCSI_UEVENT_DESTROY_CONN: return iscsi_if_destroy_conn(transport, ev); case ISCSI_UEVENT_STOP_CONN: - return iscsi_if_stop_conn(transport, ev); + conn = iscsi_conn_lookup(ev->u.stop_conn.sid, + ev->u.stop_conn.cid); + if (!conn) + return -EINVAL; + + return iscsi_if_stop_conn(conn, ev->u.stop_conn.flag); } /* diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h index 9acb8422f680..d6eab7cb221a 100644 --- a/include/scsi/scsi_transport_iscsi.h +++ b/include/scsi/scsi_transport_iscsi.h @@ -442,6 +442,7 @@ extern struct iscsi_cls_session *iscsi_create_session(struct Scsi_Host *shost, struct iscsi_transport *t, int dd_size, unsigned int target_id); +extern void iscsi_force_destroy_session(struct iscsi_cls_session *session); extern void iscsi_remove_session(struct iscsi_cls_session *session); extern void iscsi_free_session(struct iscsi_cls_session *session); extern struct iscsi_cls_conn *iscsi_alloc_conn(struct iscsi_cls_session *sess, From patchwork Thu May 19 00:35:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 574858 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 50259C433F5 for ; Thu, 19 May 2022 00:36:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232287AbiESAgb (ORCPT ); Wed, 18 May 2022 20:36:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232223AbiESAfi (ORCPT ); Wed, 18 May 2022 20:35:38 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9431A14D16 for ; Wed, 18 May 2022 17:35:37 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24IMIl9r005304; Thu, 19 May 2022 00:35:30 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=rijvphyjeMnhCbpdcL8uF0LN9Dq0GApnePASr9KfJao=; b=Oegq+R3x3ed/SpNXy9Chtnx3tQdTDLBXlyNf5VyKm7THFNsdEjrl+furEvbohe/PDYBl roRTh3o+EoBRdv5BAs5oOVoVyBLxXd5Opmtit08LLkN4eo3GvZ6ftPgwHEgft5EtYm1G cEGon9eLLxrt0eJ/soY/OI1hBKuclNgnsOx6miXGzR9IJig+Rdr2u4WTazzapEZ+BKSV oOZSeuSLe4ubRLH3cV4Uy8FJAzyVoPkN7hO+ZD801JmRdV6BRfVgDfGVkEdl7wna1sQf I31ZA/yxn4NkgW0osFOYDKEoh5CrjEo/PG6jOORRfEIEQ7kFyDb0b43/jhLcik+jisuO vQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3g23723162-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 May 2022 00:35:29 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 24J0V4V7015306; Thu, 19 May 2022 00:35:29 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2176.outbound.protection.outlook.com [104.47.55.176]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3g22v4s0u2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 May 2022 00:35:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GOqcZFbi8rK0I57cxQV3pQbaiF1qhze+3kMPRGopllBlRKxjaI/RRlsGAzB7vqdOL+sL9VDIq65nwGzD6IO8VsTfpqDUBLvUX0XfRXDT9H4TTzhMo90UnbNXSoo91RVR8ZbH8dnr7Jf7Eke4UnxIMIi1ooJQrVROGFfiSFb3DoF3SgWD2rmYmzZsrbCiF8RPKWzshn+LCCjai7c/gDRO+LVidICZIBnWzVsiqNZrYuSDxu9T8xSETOCRbaTw32eauL6s8wmGdX73ulWoOH6oC1wZJWuHD/OPmwDV501MfDpI5AD/K15N+X84dW1OlBIE4dNUtHtLeNR3oOnH7Rnwpg== 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=rijvphyjeMnhCbpdcL8uF0LN9Dq0GApnePASr9KfJao=; b=j4Wj6+NgaIXg9gEdAeqPSO7oFfdjThdUYDdqGUmOoikey/PZSqdJ7feE1Z4r09AF3zr1LQHQHiTmAP/rEe4+mIJEJvRuisBhS7Pl1iCmZGyAHpcxzor5HEEsNwdkNSVan+GkKiWiXtw+gEOFrYvIUk44XWxj44YaFhdbAgH7WShNeq4iES4gI78OCRIDac2j45Dpo4ohG0NyHXaPzS/hNRj/rGQUDwL4upnnc4u854S4JoKU9o3xNOO1WNTV6kcCabzo1z54Kko0AQ7Yf9Cl49TA+IaVQN93/GyM52N7xiOdThAkGxI4eIu9xVeaZoqsXj6eQNyhJ3qqX6k1f/ygHA== 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=rijvphyjeMnhCbpdcL8uF0LN9Dq0GApnePASr9KfJao=; b=jZb4bwP1asJg8RmCjt8e7W2te6x6S8dtkJgz0sQ3eMxUX9l/FKVGQKPBIQJ4x5CTbs3TucYLhQWsQTR6QhCwxVg0lu5PEWWUwYYJPpD59iDiwJQa5zRHlPw5TUS7vhjH4l4e+EJLn/xx35/vqwm/rLsP2kjWM1FuZhrwXbu2dQM= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by DM6PR10MB3020.namprd10.prod.outlook.com (2603:10b6:5:67::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.18; Thu, 19 May 2022 00:35:27 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b%3]) with mapi id 15.20.5250.018; Thu, 19 May 2022 00:35:27 +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 V2 03/13] scsi: qedi: Use QEDI_MODE_NORMAL for error handling Date: Wed, 18 May 2022 19:35:08 -0500 Message-Id: <20220519003518.34187-4-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220519003518.34187-1-michael.christie@oracle.com> References: <20220519003518.34187-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR17CA0015.namprd17.prod.outlook.com (2603:10b6:5:1b3::28) 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: 21e99e98-d771-45a0-d954-08da392f77f1 X-MS-TrafficTypeDiagnostic: DM6PR10MB3020: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: kNYwFrE71LW3QYU8mDXIgmzRRpttnUJNU4S5GGWKg4vWKJbtthbRdVz1VtViOSPo1oFA+A8mAAUp1ORt6Kv9dirDULyVDaq2Z6A36vZMfCIBxcS5lROQF2Cknz4rGvNPuXZNaJbEdvrD9cEm0a9zuh7YFM79l7BmOCWHY7ps5ea+y9dhu/8wVqm8FESA20kAqQzyEl2JZ3MdX4r0PAeW3ENIHWuqMB0bboZ4ZwSn1P78L3jfWKdsoqhOqrw+Tw/ffZakZycwGhaShVuaHjsybEbl9Nj6jpHRqbchekixBUQTkfZIRxsJUcLXOU0FhoGwiMRWYExidisVvf4ZrNjmZNKSlQvgHzRh1d7TRPEkv9Vs3solA0Q5DYQPqo9lL2qNAfipnb9YQC1SmBhxIQEGydhRfp5rTwEiGgikzsS75664FR5wTU/cByOkGvwjJ+93qx9cdTiSZgy9gT0CVJPN4za7K2LxfpMs07sGWWnEkJMkFTXm41wIS8r+qm7krXBoE1KhXtLYMal/o2C4qrbTTOrknNO/QWY1Z6mOrkF6hBkNFF4v0QprhDcdAVt2V9xBFNfAwsk1RgruxeRRet/e6kyj8fseUckWBUoRLby1+P+9si8AWf5XauCv/Ea8kYHofbMtec4G900yUYxYhhv3W6VLj972fQji1bWyqPqq4GsK32GQfcNTfaUyWt09fvqPSCPQlg1WpfXO/bjenO68SQ== 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)(316002)(83380400001)(186003)(66556008)(1076003)(4744005)(52116002)(2616005)(2906002)(6512007)(36756003)(26005)(107886003)(8936002)(66476007)(38100700002)(86362001)(66946007)(5660300002)(8676002)(6666004)(38350700002)(4326008)(508600001)(6506007)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: AXA7foLROuVEsU1ZcAv7Ve5PsBxISBDfiB7b46crC489lc2IGZtD5NLxipNGdsM3TK3zH9j8n+8kanmeG2xUF+dKcQ6psZuHoVeAj1Dcz2r8CXr9uP+ww91UqgXFxxtzNAWVFH2lBvzeZ+ssVW2rB4K+nuADSu/iphe+9Dw23UkR0WbNKQl2qFqQ91bT8oZ3QqaSARBzlOkaUwZSFvzPb8P+xJgpHmJx6UvzqAVTKXT7YA0FxOtbcHLW1MCTpTBKwRoONrO8RkVPbotVOIZzUOVwm9kGR5BIZZMUXlhmBi5fjGxGS9hFdUE6PghqhmQEe7HqcARhXKaLQxDvCrqR/7GHTbo7jdsaQpCstp+GGU35L0RrDvY6sW3hn7eSI6lVPcYMIOigZsassNkoP0M/aDkfcMn1OmtmfhJdD/FBjaVdBrpt5EzB/fG6keuLwNMYbpZElodqqj7g80tko5lS2pZiBjA0f3y0iZ2uLuHJvnhWg2u1G6gKdMLKlQeTzav5Nzs5bwGXr10cadt5+ZJC6Bb8ui+jh4bHYNWFQx8bDxM9+MhS9AaUYoy9aihPv09OcfkK+uizItOzbZPSoBgbWLzaXxWMLTt4UljbRyW8AxUk/hJNIdCw8FWsKAtT2fZdiOkC3iBiLILeES7FQj3+12dSabYlmqT+WuTYT4Uy8OqfQZZlIX4SgfCqjV2ucx0kKibewjUbSaQi4hRL9rUHxHTgZpBf2IlheyRqHmf9MtRZZ8ToTz49TgtZEqgaHSMDhyl4xEjVR46t61gcAmxxk9m8IeTHNOVrRQioNYKOK5SPWYmScBM1/kX14vLnHPi0rvVQBxnIQ+FSyQMRme8AyeNwUSzbdo4KRSf4Advk62EJf0HUAxNqj2IOHWGetkWQMGIuDLiiq+zNKV3xfgmiq4Ym4xWykRzW//P9pyyT4WU0Wqg8k3EOXp6JHBuCgLxIcpUHEibWFpJQO1QTOPoy5YoVUv4KwJ5HDW70AS+5vjH8rtqVM8387hG7/3pcuCgJeYD3Nra3IdXPCt8vjxzI2wUet4mumx47HWX5bZcqXrD0OIXIPgykob8KkeiJKfgww95FHRhmYHwdW++l48u7BA1mtrp+cNpbs9xttEbnHr1DdCpc1TzbZ1EuzZfVL9uaYP5VcGJjD9CRq6+KtNLIu3YwrinrceUt38FMuXxJPRHaJ8G9GhIGMhEt39+PVfRT7D2/UyzXziu1HizfJPC4ksdM7sqdLPvYNcZeCmjKkmom2t/KcIV16Pl6kTkAGRRcQ4d0B8nEynGJhTuqZf5owmFZeYQjK2jtvnmR1oAcflN16mhh4EzKwQ4IoNo6ijjVs/65UdQBX4dBa9Q9ULtNCYhHQlpOSq9OD6rf3iKCtLcD8rldkB5HktUWBRuqm1UDCojxA1PNkPGdnAveH3TA/WK6Pl4wwmboTwFb+uITdFzpi6H5GUO+hKiFWebUYIWvJ9OKNxpMIRXl72jADdVrkOnlBhaK3FWoaqqBLtFPlgbd0knqf3WaeHxSf29k+HU4qUZjMQHNgCcuTMR4bzo5ycQt9GW67KhUpL42KLvLik3qMe242UjkwB6t2XKwWp44xb0q5C/NydA3YQg9ndaX6rwYj+6vF+AQuKPySPzkWc41w+qcAv43qq7+jpqkx05GfcDkg27928wkJ4ldiOdtK8jiZo65fWAi9mzQPBd04XhgD3/ESZOiwvSXWa+08UMp49VW/0nTjLG9yd4tyeTeKrRnYNfURDFO5T53+OTAQsM= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 21e99e98-d771-45a0-d954-08da392f77f1 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2022 00:35:26.6181 (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: u5+Olhho3kLCkBIIyn1cTUmVPTH3vwhl4/h7/oUn6YLSWm+wb2a3FPqh4rsLw6eXS3dIzmFByjEbKS9Kh36WhYo3Lw+oOqN7KxAlLPTEuNk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3020 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.486, 18.0.874 definitions=2022-05-18_06:2022-05-17, 2022-05-18 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 adultscore=0 phishscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205190002 X-Proofpoint-GUID: MMMRgnoHrvFwTCW9qo_SAQvLfupHTJKj X-Proofpoint-ORIG-GUID: MMMRgnoHrvFwTCW9qo_SAQvLfupHTJKj Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org When handling errors that lead to host removal use QEDI_MODE_NORMAL. There is currently no difference in behavior between NORMAL and SHUTDOWN, but in the next patch we will want to know when we are called from the pci_driver shutdown callout vs remove/err_handler so we know when userspace is up. Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/qedi/qedi_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c index 83ffba7f51da..deebe62e2b41 100644 --- a/drivers/scsi/qedi/qedi_main.c +++ b/drivers/scsi/qedi/qedi_main.c @@ -2491,7 +2491,7 @@ static void qedi_board_disable_work(struct work_struct *work) if (test_and_set_bit(QEDI_IN_SHUTDOWN, &qedi->flags)) return; - __qedi_remove(qedi->pdev, QEDI_MODE_SHUTDOWN); + __qedi_remove(qedi->pdev, QEDI_MODE_NORMAL); } static void qedi_shutdown(struct pci_dev *pdev) From patchwork Thu May 19 00:35:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 574480 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 ACF9EC433F5 for ; Thu, 19 May 2022 00:36:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232277AbiESAg3 (ORCPT ); Wed, 18 May 2022 20:36:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232220AbiESAfh (ORCPT ); Wed, 18 May 2022 20:35:37 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82E27193209 for ; Wed, 18 May 2022 17:35:36 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24IMIp1U027449; Thu, 19 May 2022 00:35:30 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=86XGjOLi8OjRi9dTyaXzdBvBndRof8FVXMhnuhZUIYo=; b=lblaU8Po7RbR1SpTxweGqWnAidAwnOlaSOESDYDl/qQFXfA1qIcchfK4L5NgLsC+Hjit bOnOOX4dGTSs/6pO730r2vYs5zurzLU6w07sxCP9o8GcApIbPNxz9CiG1VDFTQ7qYAj6 /pkgU15jyQmUk7ZKjU0EbtY9gXdVATZ0ryg89KUB1wsv9V/5F+jxaC/4Oze+Bmu3ed6M x/IfuUei2Uo62w+EZrz7NopL9pKQRVbT/YBb1dqzW2QgIcR1GR0H8k/LaF0m+U97DGYX YcWRh6147PmusKb4E++DJSfSQUbpb/WfOn3HBGv51jEluFCnppq5P/XBFAzJx2rQqk1K bA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3g241sautb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 May 2022 00:35:30 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 24J0V4V8015306; Thu, 19 May 2022 00:35:29 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2176.outbound.protection.outlook.com [104.47.55.176]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3g22v4s0u2-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 May 2022 00:35:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lnQa90QQNsx7oDd3Xnaz2lVe46HYo4mHOXbfFjs5d9iig7+Irq9rCgs2WarxJXPEGp7I0BrmSrUsdwmU8AbUGCuR+iWjCTtFlYP/n02xleARE9AXpEOOzr9lc4boTy3bXmKdttFmEoZCXmcui5YqWv64r9DpMNV3ODfohOsoU108c3KtAPWolnxwlADkmc9fb+UPpzp/+gQVxOV2G5g0qOjHxdL1gaNovyFt9l72fwNg0JIibNEws3o7+brxhvhSK9XMqvAoiDEcefJKo8Adii+gajLKhk0SovpUJA1crCxEMtjiDyvyTG7K+Oa55igCd7xkG/JOldHlDJ9RhNIY8A== 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=86XGjOLi8OjRi9dTyaXzdBvBndRof8FVXMhnuhZUIYo=; b=AEXkwlfPByuEkh79tyD799zGMskNmbs3Pdg4FEA/tUV7FSGwtDULTajtgEwhTWtz2cLs3QCHzfb9DCt5OBjiJBMRw4UEPwUi/BEHxFiuUZdP2fa0Oq3HQv7Ig94aKzfvC8BRiMnud1HnC8I0jTtWR+Uu1PI1WzdqAnnpohbqC16kmQIq4VJe/GhHe2MEEBRGI/FLLY9K5Vbi36hUahoR1R36rlpKUFB2oMsIIQxC+TubxQ8jrpi/qVRrvfWsD8XXeVzZRXi8cENI63xrmQn3VhLRjQkwo9dZFBjGTgmMQdhzX4KWQrW+MSzdaQodpAAlA3UwLfhQQ2k6TDbQF8htJA== 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=86XGjOLi8OjRi9dTyaXzdBvBndRof8FVXMhnuhZUIYo=; b=Y9FbszO8hla57pazUNBO/0n6Res6iVZqyZ3gVE0WkBPCKtYm3t1TKd6Q597Xq67JDjTtuN7myYp0epFgMh9imSfcOSCDt4Y/MCXxmzmHE3nKk54V504dgtG8ZkRnimO5JP2euIyviJXiO1k8TszCEdGfs3x/ONnuPDD0KOxvGuM= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by DM6PR10MB3020.namprd10.prod.outlook.com (2603:10b6:5:67::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.18; Thu, 19 May 2022 00:35:28 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b%3]) with mapi id 15.20.5250.018; Thu, 19 May 2022 00:35:28 +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 V2 04/13] scsi: iscsi: Fix session removal on shutdown Date: Wed, 18 May 2022 19:35:09 -0500 Message-Id: <20220519003518.34187-5-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220519003518.34187-1-michael.christie@oracle.com> References: <20220519003518.34187-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR17CA0015.namprd17.prod.outlook.com (2603:10b6:5:1b3::28) 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: e7e98917-8749-4010-8550-08da392f7840 X-MS-TrafficTypeDiagnostic: DM6PR10MB3020: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: gT1rmUL6e8IQDkMcm2T5dNJtHak9e/EB4Zs3dfssd2P4QBX3OlAFPDuOqAykENBNBAc/Fgu168YOGkWnApMnhmyISZZND7pdwGB/nWHqe3GJuHP3FEqFaSpiz/qWsuDKEevwk2Ex2JNUTvlX705t3F1XKGbjzfR9fcw5NxL/F1Jk4spvyqOkVK6TvT6s0mayNQVToxurVmwwm+r3XXP4+Xlj+jYbtaoDWydvXAWkFqQ3e0X3Yo1mrLB+F04WDq7TaSrhppI+D1noQDQlruCnHsFpU62OY9q/RiKStn8/W+1ytUaeYahOcp49zSj3nMMgx66e4kFRw3MSYrjeHToCiXPhVZqPS5vT+7eZ81Gb/5fj3jyfBr6tw6lDA2vw3MJF2+Xx1YEa/tLYMG+EQIlJiN4IX7fGRiOM9OxDfYROdbx1nB2aJu+dbNBEfb674r7k+llHFmj7X0UpZVV37NHaw2fpyVxEzuNmi+Kk2NatZ904HRcKu1hkK5LznTWNWn44Z0ig8t+G0F1FZS4ZTSmSZl32UPhIzsdB7POsCvi9MbLK4Lj4Yrs75+49uvtqY1TOOKDKVZNzIU0BpIoKdp5AwsuYpbJJKBISlsuJc9wm62gTB6gsv1HuIA9iKauTPdYaDl8LlVxFxA+xnOPF6FBKO/beCeNYiuHBYIaJudpMyAj4zGhrK7S2vBcHmZuSqtAzmKYRlYETu+0sxi4OupcCHw== 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)(316002)(83380400001)(186003)(66556008)(1076003)(52116002)(2616005)(2906002)(6512007)(36756003)(26005)(107886003)(8936002)(66476007)(38100700002)(86362001)(66946007)(5660300002)(8676002)(6666004)(38350700002)(4326008)(508600001)(6506007)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 704Mm9j610hjqYysXwfyF4VNRSLHcAqqIYkH+vmCWux/GKwpmbb1fWtKFukjDdc5cwDCrpjQLEZXiTxLAzSO+c6y17SX+//m5b/u+nWThsvFQB6Jl6EuIlS2bdPXoqkWjfWA70CXrTjS2fKq5JP1LoMxlULp06QvI6m6FgD4FjGXXR0KGKHSMYGOpWYeAcGLnKaGQ6qQt6WVDpRFynt/UCM+83cSB0BhdaHL9G622Tnho45fI8eTUtcZQuyXHyvfAM6jMlzZ4He8ekUExPyWEpguto11Pl0vteohZX3CFeTwdw0+R3bw5VUEzCu/D82yBqiB6RA9WFbiYYaLeC9JVpLdCqv4pmcn5b8UXuyq512/PDQRe8y7EmWbTjsa1vnw5M+B0cYi8rW+Bi7w+UrnKuqw+NxuJ4u8y3K3B3pnNCc/JJd7WFVviIBQK5GQN/sKkbsjtZf3CclzljxohhKRC/8tyd5L0f6ZKW0hGKd4AjTwmmWbwIzbrw3EQxytttfVQdg9MwRCPyqfoREe/OjvQ3L2v0rHzC+hRD7au4HOg9MMjax+fmnm8RgU55x8rJLpOR5fcR/uIhcr4gvZA3b73k06jBg/mwNYbTgRJZxsu4Y28W+maSa3zkOeDHRHzsOmKsHUiAQZ+9zdf2EX3UiNrUbS9tiVXvduNluEx6J7HD6YoVOSy+XtsEOHghpYwkou1aIMazZPctRB0dD8fvR13GExPHZpGcLMnyw4urAlRTjnRnGf040aV0T4UjutXk/PH5y8pRmLdB8nBbjQLgUsCUOhWC5ue3hEn12Mn3nrXTnTWanbTMHVCrmyJX30Xr0b/6R+F/b8V231m+TzDuKFijWk1dT/881XzpUP1XScUeSKDKG3xPlxzmb3fvKXfUAFtVBlNymLo3XIxsEbIfCES9wxBhGsQKY3IZafMd+LXC/8n3LrewP8fV8WEsiRxhKGrqs5XaHTrqAaPaxsiaxRP9yz01oH3uSs+diGKL/RRV3gm9u9L5pTylJK3v5V2Ne1kGra6xL+ZTfX9Bn7mn2eQabZxmoxaDvAs/Jaocly5PpilJEAhFd/g3ZVjC3ihI/DyGZh9IVYO8557KRTuoL0lxRbPBB5JUfk+ndZ/XnZyJ8StF76UAlgkBsgRYSk1csZbeA7YiyPMiZfzGKaNoBGySChoWE4gbRo6bz73dtD8dqTPfrwf9vTVNrNe2ZYJtbo16pBrGVPJcxmm81ydSwX0N5E4E0ZdjoxpjjvYqoePUROuln6wk6hEFQKPjMMtZY4pbFhkuMZirIWdrGpV4CsRZzEz3qfHBee6OVGd3AkeGl6uU7nH/LHehiTPG+NTqDcfGlLDxzmqKMP/fJ0Y13g2c8hbnzQ6dHBuf/Bqir3Gbimkdo4n8Tr0/IoOab0UsaUGq+ScczIt13lQPhbfOHQsC4E1LVbODm1zRjfh000VdvBTUDmx/pGjejCGU436dYZ/LaGWUrTeNV1jJtS5QkSnxvraXn91y0UPNwsud9F++/BJsRXlJGr48FubqjTtJ+qi98or1DqZeX/KYFCuUfDxt6Rb9D++eTf572D+Yk4oQOWzwbBz8qWxiQyU7oJufnqUbs1Py7zTCw1R3d0YNAhpap3N+44oQzcCQ4USplKBRmGdeTrQQICA7dRntda0TTuROcpN0DQ2/oUbn3HlyP6sThftUdD9fxdYmfbzpUxGVsjCRKkBxlzzIIRFHOcnhCi8LgWK9z59coCmva706DgAVJ6o5JkJ7n8kqOL0qaFIkk= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e7e98917-8749-4010-8550-08da392f7840 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2022 00:35:27.4461 (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: nqgzKO+98+gZsCzpFBlwwMnV6K1JQjTDVpo5Ls+fdW7gF9wo/RbD5xJ3XtmtAPJKvgjWCh5298kIL47edTh0JkU4mHxpw/EQltVYd+NFjtY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3020 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.486, 18.0.874 definitions=2022-05-18_06:2022-05-17, 2022-05-18 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 adultscore=0 phishscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205190002 X-Proofpoint-GUID: X8kYMF443pKHRS2mlA6GRfFcO0Lq9QCX X-Proofpoint-ORIG-GUID: X8kYMF443pKHRS2mlA6GRfFcO0Lq9QCX Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org When the system is shutting down iscsid is not running, so we will not get a response to the ISCSI_ERR_INVALID_HOST error event. The system shutdown will then hang waiting on userspace to remove the session. This has libiscsi force the destruction of the session from the kernel when iscsi_host_remove is called from a driver's shutdown callout. This fixes a regression added in qedi boot with patch: commit d1f2ce77638d ("scsi: qedi: Fix host removal with running sessions") where in that patch I had qedi use the common session removal function that waits on userspace instead of rolling it's own kernel based removal. Fixes: d1f2ce77638d ("scsi: qedi: Fix host removal with running sessions") Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/infiniband/ulp/iser/iscsi_iser.c | 4 ++-- drivers/scsi/be2iscsi/be_main.c | 2 +- drivers/scsi/bnx2i/bnx2i_iscsi.c | 2 +- drivers/scsi/cxgbi/libcxgbi.c | 2 +- drivers/scsi/iscsi_tcp.c | 4 ++-- drivers/scsi/libiscsi.c | 9 +++++++-- drivers/scsi/qedi/qedi_main.c | 9 ++++++--- include/scsi/libiscsi.h | 2 +- 8 files changed, 21 insertions(+), 13 deletions(-) diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c index f8d0bab4424c..e36036b8f386 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.c +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c @@ -568,7 +568,7 @@ static void iscsi_iser_session_destroy(struct iscsi_cls_session *cls_session) struct Scsi_Host *shost = iscsi_session_to_shost(cls_session); iscsi_session_teardown(cls_session); - iscsi_host_remove(shost); + iscsi_host_remove(shost, false); iscsi_host_free(shost); } @@ -685,7 +685,7 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep, return cls_session; remove_host: - iscsi_host_remove(shost); + iscsi_host_remove(shost, false); free_host: iscsi_host_free(shost); return NULL; diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c index 3bb0adefbe06..02026476c39c 100644 --- a/drivers/scsi/be2iscsi/be_main.c +++ b/drivers/scsi/be2iscsi/be_main.c @@ -5745,7 +5745,7 @@ static void beiscsi_remove(struct pci_dev *pcidev) cancel_work_sync(&phba->sess_work); beiscsi_iface_destroy_default(phba); - iscsi_host_remove(phba->shost); + iscsi_host_remove(phba->shost, false); beiscsi_disable_port(phba, 1); /* after cancelling boot_work */ diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c index 15fbd09baa94..a3c800e04a2e 100644 --- a/drivers/scsi/bnx2i/bnx2i_iscsi.c +++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c @@ -909,7 +909,7 @@ void bnx2i_free_hba(struct bnx2i_hba *hba) { struct Scsi_Host *shost = hba->shost; - iscsi_host_remove(shost); + iscsi_host_remove(shost, false); INIT_LIST_HEAD(&hba->ep_ofld_list); INIT_LIST_HEAD(&hba->ep_active_list); INIT_LIST_HEAD(&hba->ep_destroy_list); diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c index 4365d52c6430..32abdf0fa9aa 100644 --- a/drivers/scsi/cxgbi/libcxgbi.c +++ b/drivers/scsi/cxgbi/libcxgbi.c @@ -328,7 +328,7 @@ void cxgbi_hbas_remove(struct cxgbi_device *cdev) chba = cdev->hbas[i]; if (chba) { cdev->hbas[i] = NULL; - iscsi_host_remove(chba->shost); + iscsi_host_remove(chba->shost, false); pci_dev_put(cdev->pdev); iscsi_host_free(chba->shost); } diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 9fee70d6434a..52c6f70d60ec 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -898,7 +898,7 @@ iscsi_sw_tcp_session_create(struct iscsi_endpoint *ep, uint16_t cmds_max, remove_session: iscsi_session_teardown(cls_session); remove_host: - iscsi_host_remove(shost); + iscsi_host_remove(shost, false); free_host: iscsi_host_free(shost); return NULL; @@ -915,7 +915,7 @@ static void iscsi_sw_tcp_session_destroy(struct iscsi_cls_session *cls_session) iscsi_tcp_r2tpool_free(cls_session->dd_data); iscsi_session_teardown(cls_session); - iscsi_host_remove(shost); + iscsi_host_remove(shost, false); iscsi_host_free(shost); } diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 797abf4f5399..3ddb701cd29c 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -2828,11 +2828,12 @@ static void iscsi_notify_host_removed(struct iscsi_cls_session *cls_session) /** * iscsi_host_remove - remove host and sessions * @shost: scsi host + * @is_shutdown: true if called from a driver shutdown callout * * If there are any sessions left, this will initiate the removal and wait * for the completion. */ -void iscsi_host_remove(struct Scsi_Host *shost) +void iscsi_host_remove(struct Scsi_Host *shost, bool is_shutdown) { struct iscsi_host *ihost = shost_priv(shost); unsigned long flags; @@ -2841,7 +2842,11 @@ void iscsi_host_remove(struct Scsi_Host *shost) ihost->state = ISCSI_HOST_REMOVED; spin_unlock_irqrestore(&ihost->lock, flags); - iscsi_host_for_each_session(shost, iscsi_notify_host_removed); + if (!is_shutdown) + iscsi_host_for_each_session(shost, iscsi_notify_host_removed); + else + iscsi_host_for_each_session(shost, iscsi_force_destroy_session); + wait_event_interruptible(ihost->session_removal_wq, ihost->num_sessions == 0); if (signal_pending(current)) diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c index deebe62e2b41..cecfb2cb4c7b 100644 --- a/drivers/scsi/qedi/qedi_main.c +++ b/drivers/scsi/qedi/qedi_main.c @@ -2414,9 +2414,12 @@ static void __qedi_remove(struct pci_dev *pdev, int mode) int rval; u16 retry = 10; - if (mode == QEDI_MODE_NORMAL || mode == QEDI_MODE_SHUTDOWN) { - iscsi_host_remove(qedi->shost); + if (mode == QEDI_MODE_NORMAL) + iscsi_host_remove(qedi->shost, false); + else if (mode == QEDI_MODE_SHUTDOWN) + iscsi_host_remove(qedi->shost, true); + if (mode == QEDI_MODE_NORMAL || mode == QEDI_MODE_SHUTDOWN) { if (qedi->tmf_thread) { destroy_workqueue(qedi->tmf_thread); qedi->tmf_thread = NULL; @@ -2791,7 +2794,7 @@ static int __qedi_probe(struct pci_dev *pdev, int mode) #ifdef CONFIG_DEBUG_FS qedi_dbg_host_exit(&qedi->dbg_ctx); #endif - iscsi_host_remove(qedi->shost); + iscsi_host_remove(qedi->shost, false); stop_iscsi_func: qedi_ops->stop(qedi->cdev); stop_slowpath: diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index d0a24779c52d..471422641ab3 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h @@ -411,7 +411,7 @@ extern int iscsi_host_add(struct Scsi_Host *shost, struct device *pdev); extern struct Scsi_Host *iscsi_host_alloc(struct scsi_host_template *sht, int dd_data_size, bool xmit_can_sleep); -extern void iscsi_host_remove(struct Scsi_Host *shost); +extern void iscsi_host_remove(struct Scsi_Host *shost, bool is_shutdown); extern void iscsi_host_free(struct Scsi_Host *shost); extern int iscsi_target_alloc(struct scsi_target *starget); extern int iscsi_host_get_max_scsi_cmds(struct Scsi_Host *shost, From patchwork Thu May 19 00:35:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 574862 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 EA0B7C433F5 for ; Thu, 19 May 2022 00:36:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232177AbiESAgN (ORCPT ); Wed, 18 May 2022 20:36:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232260AbiESAgE (ORCPT ); Wed, 18 May 2022 20:36:04 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFCEE2191 for ; Wed, 18 May 2022 17:35:42 -0700 (PDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24IMIlnP007800; Thu, 19 May 2022 00:35:31 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=OOpU95j513/xmh5ldZxVMaUwQztUYGtfyOuLzQG0DVQ=; b=W+BjEI2WE4XO70HYip2KRX/+1jDiON6iMjdqx5/7vFWZmsd/wtTwSBoI0ydeURwZVRsg Eam+DX1FvfwC9ZWPsXaEYBrryi0ouS+LCt48kGv0q6bEr70mrx2fpiZIwdxspjE9l9vE KBBYtVnoAybcoR7a3QAg5FLE3wBu5fIZzY5OUzFdqVpZ3mgemCTLrgejWObOcgL0hg+e pwl0GLiWqHBpM+9NRN2lz/OaEK6SlHFn7bQ6+tBOK0bpcuEiPq/DzRLlMt5EMhJZvb4C mOAPtJLwmQMau0Msw8YhVuW8kqNc/Zstr1wMOmuiesW0a++1hic4sS1Zqzph5Gv0Avoq /w== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3g22ucajj7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 May 2022 00:35:30 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 24J0V4VA015306; Thu, 19 May 2022 00:35:30 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2176.outbound.protection.outlook.com [104.47.55.176]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3g22v4s0u2-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 May 2022 00:35:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eU/5hJ9GgNFmtjFTo5PB99kgkHiALlbWdJAPR+A3vwbyCP3MP1FANc+P7MjkfpJbFkuXHLDr5LoNfjiaCNyuh358v9HsIHm0yJWqnxfylSq+vQqDFkv/Tf4yjVZp3Y1vs1XnGv+8u7XtMF/MUBNAlSpxI1TUkwP3EuCLYvXcTtoFOLzf5Rx5piL1w+LytxKqUOaSzRy4VkYQitD8EybD62xzsTcRsABlGrAGJCFfCZ3WJiID140Io/if6BRwCpnVMw8WFW+F5DcAhUFtkwi5wsJB1IHHIAZrRlCREqBlVV0j9tuaMHgXZMb0Ye1DXP9ohkQsntSbqJRlOqfc2l5Dgg== 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=OOpU95j513/xmh5ldZxVMaUwQztUYGtfyOuLzQG0DVQ=; b=mqlSbptHofQ63IeJ4Kb9SpFLK+feRMkKA5KdXLHMEUkjGgIWjR5maZpeS2hqHHsW6By07YWESlN2FMgBc1YpOAELer9AgQFagdMf+Yq53XdkIaSRUAjDApngODI403QFhogiNlIfAv5AYb3j8iwyG7rlOIdeCM9BAJLO2W+pZvhlhM/+DkSv/a4Z3GsenQoMksmC+eumq9Pnt7fl2F2DHPXTh2GXAgFTjHbYILkuvgXUyyKUoas1WyQlYzDI2EqptkBjdkRc4X76xqe3ks5IY1JFqGNlXdRpJ2xMT3vHMJLCODGSDqWNOdibBpOPxZ9gIzxIf792j8mqpPwN19QF+A== 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=OOpU95j513/xmh5ldZxVMaUwQztUYGtfyOuLzQG0DVQ=; b=Fvi1BjRthxt60OoNpKHWZ9tbEMNtVzc8U/vBDF/Fie3KKoRLFLEtITVPcdbAVamW5B7whjoJxONUW0sDAsI4ekD+r8hhL0cqlfYR9L998lm2KNd8erKn2cOYCm11nQ8YWEWYK6iUcD/GYnKudeKp3fenhIb7KyeEXa9d62FkcfQ= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by DM6PR10MB3020.namprd10.prod.outlook.com (2603:10b6:5:67::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.18; Thu, 19 May 2022 00:35:28 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b%3]) with mapi id 15.20.5250.018; Thu, 19 May 2022 00:35:28 +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 V2 05/13] scsi: iscsi: Rename iscsi_conn_queue_work Date: Wed, 18 May 2022 19:35:10 -0500 Message-Id: <20220519003518.34187-6-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220519003518.34187-1-michael.christie@oracle.com> References: <20220519003518.34187-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR17CA0015.namprd17.prod.outlook.com (2603:10b6:5:1b3::28) 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: 9cdd3973-7d55-42b4-686f-08da392f78c8 X-MS-TrafficTypeDiagnostic: DM6PR10MB3020: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: u5EMr3Tt3ZiWMM3nlq1jlDYNwwXg7RsDyzCeUBSnick9CHGyBJzjuTimMNZ7CQbKXyJjtbj0gNgs1PFIJp34/ANOvJLMM3kAsb7jo1ZNUK0Rc+26ezDuJoxbMQ+Glw30ExTm0Xl+8L/csvnOcAHypVxz/1F4+msrYntCAxoXqc0aVaGdVHF1s2BmXjBeVDFCptUg/H8xcO9xkkckRX4dn3VmKE94mJlcxfz1yfAbpKp5os7u+HLfcCa1busIQqgaVAInAo5i2N1KXF8aJQuwlbQw2rWxNwBy+28ueSnesEHqmJZAhJRgDwtjicBYedd9tId9b/apIOm2gIYDYiCSdt9Mxhq57614BSQlktXt5K8tTXVk9757UbMUSse9+E9l8B10elBsMwj7Ws4EkQQfYe0arDc53IgQhDP/HzxiyjtDSuh7YsnglcT4VVA6GhaU+2i1xjkB88+pSnJ146H6IdeixagMCERyhsL3XDJcwWb4fA8sRq2VhtZUWkYPSvuVqTvi23lLSweKFvaw8A9Abbo3UDCXK06lbqMWPvBgdqvDDwVLIECS9btvEBLZDB1NiFAwuqcNPMAOcB3kEFvJg8ctZTXEq3fye3QTjKSBdJG9cb6S23rvMBFDNkXrfYvY2qooexfPgyrGle9ko/huLkIWqaehu6P5XoeVbJU8Td8sCfJ6+FTY1aC2PLIoDkPhNfpNtjV5z2Ge1FDQVP3cMA== 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)(316002)(83380400001)(54906003)(186003)(66556008)(1076003)(52116002)(2616005)(2906002)(6512007)(36756003)(26005)(8936002)(66476007)(38100700002)(86362001)(66946007)(5660300002)(8676002)(6666004)(38350700002)(4326008)(508600001)(6506007)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: A+TQD9OgCcHGNv3A/FWzhwmrjXVfRm2mFi+osN4ZsFsjcRaRS5w7SMAnJpfNQf1XIKv3uen5y+ORQe3IBDkTk1h1KbEcxi4vCC1h70LM81b2BKiAUsyA7IREeRPl4bLNCNC7XN0ovk580ANDS5YHS4791xevsdZhPk8ncYCZMi3U7tj14ZLBQKgnpZQilb0KcidFKZT3Ax7XmsvVRHp4DPCQBbQLHdXqdAgws3UsRd5X+idH/wTYZARJ6WbHX+UG57MzwAu/r2NQLgp1C3wtHzOuH2erdtVAHvaiqV0pW5wnkNjarGlhrFY2dxBkGRw9xlSoKoklJo65mIH66rjOeFw7wRfHPMZGu+BJzoJbsnXhOKlvTKztvzLxaNHId1SRbmfy1tyhmxozMazYSMICjvfYisVKAOEqlHKS3txcPc3f4NHCqQsssVFucMCmrfUqSpqe7TT4eOk1Fd5pFZ9XaLQPm0Jb3gSmt8AyVAbbCXSO7u3txrBkPwPlBrQPbOUXpR295MlpdcPtsJOGVHsTEvh+fQYdpyy0W2Idv+Mqx8uJplg94k+bY+adjnPaExFqqOlu/Mh9XCsvVmD3mCbAzw15FNeuFnMGZOvl+JJnHsW3p6f/y01E7plmr8apN1MBX1YTTfYtkv20R5Rkc6lR60MQB0MpYwuCEKinzXKCghOpUT6QpANI5fcDxz3fGEHdGBEOhMcdSTrkMyG1l1KZVTifK/rPMYyyP7BQU+2AC3pwcKbG8euyX2KovsSqarBPbgg+IvfbYgscjQ6qTAscdrKssv7f9UdD/OO6RehmwJFAK8gX+pDnPyEqxqzNLGy7ZFVOli6ne9JQyqo3e2ivo8XYQ/qIS81cNaV8VplhXZGZWaXgYvwJrgAJh0GKaqrLPZxvNc1LggHNnZJWp2wz7DcoA5BEvLDlFtRgagf1Zj7r37bVMk5yROGa622yBFAkaHgmdU8ZmreceowFZHRbv0DqVSc5ZViO48uDILdaFqZyF7q0OUYCK5Gr38bw6jTlizz+cegRxgwB1WWjpaGsxtdAvk2w15NtwITU2ITXRg5Nhv7MTPK7qj0N38YdJ5V8PgNHyRDcNG9USr8qG5ipB/FbWNmNjlNBhU848zh7aqFtX6noShpnb1NsPxk8xlqzIfUF/t78qQBVGAR6fd+iqM2DRd9HwfwxxJ+9dE7LP5rZMrUJmhyOBVwGjbSsjJN5hwJIsix7cYAEOs4HCmeyV6nSfDw+qprq9dgYHN5CRk7/tE6h4Om8q4MMzsH1/ih+YD/ZNX6kA1s+B6/iNSj8IFUpLNmPZ/E6hfxBxp5vn6QHGVqifQIMhfKNAiqYwNk8T3GsW2GOk6BokkcNPnLK/+NiP9yxYiUDcp666F7jfSIuiGxlruVKyL7buJ2GpjXlq1gVp3ydUDGKI93za/eXfdRvRpXuEOFV3VQ1BRKVijWDKKUY4ldsM8TTQYr4PUXpFdlZeY1MWy0bF8PUk6jVN6Pd5FlqtUWNrIfHEsRdwdBAxKLcvgSJW9yBwXnEevqEtJK+odI9oRL7RLicQZbfOzIrdlrL/t/C2XYVVznbjy+hnKR6BIoAjr2LXgIyzUyE7sgvW06av1a5iQkcTCqbflfMvkbJLB5/p6L168usJA53YwWEQ5lwHHsHBJgBVgvxGY+v4JFy7gEVYKHPFnGXiRBrtIR0BD/MEaZl/8HF9+QttBKXkJrx+pkD759oyd8+Td/0CKoV/RxLBeCxvPIJxZSnF1I2Z+/sArvKCgDFhbA= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9cdd3973-7d55-42b4-686f-08da392f78c8 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2022 00:35:28.0398 (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: 0oLVcJYszqQG27C96RDYv8UxF3dL/VfZIdUrXB4DOHIIPYcwJQZ+P/Cd5iYzFbYgYALpkBCk5oLxZx7Z2P8Pun2sQI0EKJTWoN4F5vIpDU4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3020 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.486, 18.0.874 definitions=2022-05-18_06:2022-05-17, 2022-05-18 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 adultscore=0 phishscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205190002 X-Proofpoint-GUID: LP-6l83pOXAhtwy926H8KcwdxM4c0pVB X-Proofpoint-ORIG-GUID: LP-6l83pOXAhtwy926H8KcwdxM4c0pVB Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Rename iscsi_conn_queue_work to iscsi_conn_queue_xmit to reflect it handles queueing of xmits only. Reviewed-by: Lee Duncan Reviewed-by: Wu Bo Signed-off-by: Mike Christie --- drivers/scsi/cxgbi/libcxgbi.c | 2 +- drivers/scsi/iscsi_tcp.c | 2 +- drivers/scsi/libiscsi.c | 12 ++++++------ include/scsi/libiscsi.h | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c index 32abdf0fa9aa..af281e271f88 100644 --- a/drivers/scsi/cxgbi/libcxgbi.c +++ b/drivers/scsi/cxgbi/libcxgbi.c @@ -1455,7 +1455,7 @@ void cxgbi_conn_tx_open(struct cxgbi_sock *csk) if (conn) { log_debug(1 << CXGBI_DBG_SOCK, "csk 0x%p, cid %d.\n", csk, conn->id); - iscsi_conn_queue_work(conn); + iscsi_conn_queue_xmit(conn); } } EXPORT_SYMBOL_GPL(cxgbi_conn_tx_open); diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 52c6f70d60ec..da1dc345b873 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -205,7 +205,7 @@ static void iscsi_sw_tcp_write_space(struct sock *sk) old_write_space(sk); ISCSI_SW_TCP_DBG(conn, "iscsi_write_space\n"); - iscsi_conn_queue_work(conn); + iscsi_conn_queue_xmit(conn); } static void iscsi_sw_tcp_conn_set_callbacks(struct iscsi_conn *conn) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 3ddb701cd29c..1bd772d9b804 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -83,7 +83,7 @@ MODULE_PARM_DESC(debug_libiscsi_eh, "%s " dbg_fmt, __func__, ##arg); \ } while (0); -inline void iscsi_conn_queue_work(struct iscsi_conn *conn) +inline void iscsi_conn_queue_xmit(struct iscsi_conn *conn) { struct Scsi_Host *shost = conn->session->host; struct iscsi_host *ihost = shost_priv(shost); @@ -91,7 +91,7 @@ inline void iscsi_conn_queue_work(struct iscsi_conn *conn) if (ihost->workq) queue_work(ihost->workq, &conn->xmitwork); } -EXPORT_SYMBOL_GPL(iscsi_conn_queue_work); +EXPORT_SYMBOL_GPL(iscsi_conn_queue_xmit); static void __iscsi_update_cmdsn(struct iscsi_session *session, uint32_t exp_cmdsn, uint32_t max_cmdsn) @@ -765,7 +765,7 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, goto free_task; } else { list_add_tail(&task->running, &conn->mgmtqueue); - iscsi_conn_queue_work(conn); + iscsi_conn_queue_xmit(conn); } return task; @@ -1513,7 +1513,7 @@ void iscsi_requeue_task(struct iscsi_task *task) */ iscsi_put_task(task); } - iscsi_conn_queue_work(conn); + iscsi_conn_queue_xmit(conn); spin_unlock_bh(&conn->session->frwd_lock); } EXPORT_SYMBOL_GPL(iscsi_requeue_task); @@ -1782,7 +1782,7 @@ int iscsi_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc) } } else { list_add_tail(&task->running, &conn->cmdqueue); - iscsi_conn_queue_work(conn); + iscsi_conn_queue_xmit(conn); } session->queued_cmdsn++; @@ -1963,7 +1963,7 @@ EXPORT_SYMBOL_GPL(iscsi_suspend_tx); static void iscsi_start_tx(struct iscsi_conn *conn) { clear_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags); - iscsi_conn_queue_work(conn); + iscsi_conn_queue_xmit(conn); } /* diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index 471422641ab3..cd1049393733 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h @@ -453,7 +453,7 @@ 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_queue(struct iscsi_conn *conn); -extern void iscsi_conn_queue_work(struct iscsi_conn *conn); +extern void iscsi_conn_queue_xmit(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 Thu May 19 00:35:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 574484 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 DE0FDC433EF for ; Thu, 19 May 2022 00:36:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231608AbiESAgL (ORCPT ); Wed, 18 May 2022 20:36:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232221AbiESAfh (ORCPT ); Wed, 18 May 2022 20:35:37 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4FFF195786 for ; Wed, 18 May 2022 17:35:36 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24IMIrZ6005352; Thu, 19 May 2022 00:35:31 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=rwVpXPQz+ovPXjwqTcFprCI2d0/MaY6/euKpOGg+E68=; b=v4eCxmDaTTpa8h9k6Ijx8dLzgaHFajvx4+sSOqVGJwSuVISEeHeiXzLdFsM2O8yPag5f G62X5DxVEnS68zKcqXvgVjhVjSpjZVQg9iyxRY3ryDq5b/bF8eSANXlM5O3A4/97AZ42 TUgC/jCatAClW65J8iz+feup+cLUhjNijBT23NQMxQPiAkB0D4DfnzFzt6+O/u+MzepX Pz5i9KvOn9L4NB+L1A2mdKyPZ4x6POq6oOeIIVV1kn1sRZy4PSW6xA52w5E2k0/aoJBR hb/ccDUMoQHAF4kfH7pa908FRpnPq8k8Q4aEeyxOZJYNBVQahAEMX+f92nHcPmFqJeDJ UQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3g23723165-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 May 2022 00:35:31 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 24J0V4VB015306; Thu, 19 May 2022 00:35:30 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2176.outbound.protection.outlook.com [104.47.55.176]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3g22v4s0u2-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 May 2022 00:35:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=maFXJ+S0PQ5KD2PvLqSi7zidBXaMvnc0F6pOZC275d12/zmAixdTPgIBzfSi02Xqo5N8RT6hBYTayhlbDM7WjVWAAqyLiIBNwaLY6pu4eubQsdIL48qnnK7U/3vRWDHdE72TXTyTNI47YC8cuhBAAcFeB2V4wYXHZsWy7Ra64zNLWgrrJWv14IlcsTMkpySs9fxqME+WnDoEiF2cZnEBsEWMJiPOqnmKxb0vndQ9N6DtZbH1vVkfvmQr7H+GRLTmXP4f0xoP8LlLZeFAdt5UiqTYHksaMKCUMUvFWXCXn0/uOwERL17qeIU1dwyE468EnWFDidfOEXeRt8N7GGZshg== 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=rwVpXPQz+ovPXjwqTcFprCI2d0/MaY6/euKpOGg+E68=; b=A51VqOYcyUNbUC5GkP34bgbGH6+qfMqhfeJtZU2FVM5H7dm2ypPEEjxnA9wlAJ12vqTyOxZvkc1jw+CtGuf9gl1NmNArqv0PFaORE/wLWRC3re5TT3MlzzTXeeSA6NF9b5DP54YXVWFVuqv6uhrh5p/XINDnD19zKtohYDOhJVin/Ai/KbyKp0YllQ7Hn86UuK+/AEA/sHXfKr5rKLdElMDSz/33m0qUt63awrQgUwNzgjuGQBiCbEhZP+gdgqo7MCV5+eAcr1Yeol1frOi4SeZdN5j8d7e1sj5IxaEI2x/jZsqAyV6y3Qmv64BmblTDEirgVcnWnFpX1UQnsiHa2Q== 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=rwVpXPQz+ovPXjwqTcFprCI2d0/MaY6/euKpOGg+E68=; b=OoT+HAd9APfkgnlejwbgvbnkDOGTpg92yB1XrN7m/Jkhn3wc7Hmeh2FODR6sDUO8Vr8CcSOUuN8H4cEzAF7ax9tkFHvGeKmcqCoJddwppZqvMprF2TT65LZocSkqEzF/iIW/ym0b5ARm10P7Wv3C/LxiG+0v3myu/ep6Wne/hTs= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by DM6PR10MB3020.namprd10.prod.outlook.com (2603:10b6:5:67::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.18; Thu, 19 May 2022 00:35:29 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b%3]) with mapi id 15.20.5250.018; Thu, 19 May 2022 00:35:29 +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 V2 06/13] scsi: iscsi: Add recv workqueue helpers Date: Wed, 18 May 2022 19:35:11 -0500 Message-Id: <20220519003518.34187-7-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220519003518.34187-1-michael.christie@oracle.com> References: <20220519003518.34187-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR17CA0015.namprd17.prod.outlook.com (2603:10b6:5:1b3::28) 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: 4b897a9e-3c0e-4a06-146e-08da392f7917 X-MS-TrafficTypeDiagnostic: DM6PR10MB3020: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: 2Os5VNYBydCOp2C/kTgwl4NoaaN7kLHc70Z9CyglEIUwFFy8aDohpbuVoOlA1yxDRmEiO4rhxq+8G/TJ/yQ+N+EiFblPmF9ah8LOrHh/YoABCxuxbx7/Nib34F/VIW/4nkE3mHWS0mNjG9tQ9Y7ZbwdOiQXE2SxkV1amYtadXdIUjWWUG01rwlI1W30RsLRs1YwC3aql3jfI1oKlGkFb6Mq2Wo8r+HeIK1Iu/7Wok8MwX0T9iIW62jMQVPm5zhAePvha1bKmlEpeklRDkklu+qzd1qireyVA+0rC5MjHEpaM6WSQe/DKogMnjO/hwT3rnjcda32CvSmrPcBXKqsGQZmxBLyd1wvnqL0w0a0H2vBFjGNnj+Pf4VgVRSb7sogOgd8a90OmgiIh0gB0cHyyADGH6tBz8rObNrw/6B/EUoEn2eCqUqCuPxLj9SAHu5Gjy4C43fe4WJyQLUI5qgMFiourKDFL2yKbk/oi2mshaLav8w2os+1uqc/ShthbrFMAf29tP8mZzbrnFUzaqQgG5GMiXTrI68X7+9Xf/sGu40d+okmUC7Q5VGqGBZkRn9u9vPm8WITSiDWl5zFaAws8oOW7tGNivolrxKfUD2ED/eTs/wHRUd/lnRm1+EaQuwqZoWWqMWV24uWO0/5zazXTzyGKVDqDPTsj8nM8RyaV6DdXYbQ8uXLmMHdcWskB/EgL39jQuNCbPjrAPH3DfQk5mA== 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)(316002)(83380400001)(186003)(66556008)(1076003)(52116002)(2616005)(2906002)(6512007)(36756003)(26005)(107886003)(8936002)(66476007)(38100700002)(86362001)(66946007)(5660300002)(8676002)(6666004)(38350700002)(4326008)(508600001)(6506007)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8snS1otmEoJNKx1BA0c66DyXDqc2MmKHkXmLfhqA3kh4Ibdq7F68nUssqgFqmhL5SlIeBmX+LBsoSZFb7wLk29JdGSqaDPFnTa8wwTJMaAv9wi3ddzbLWgoaIYul0veQuBowBQxrPPm8jp5YdBsq/YXe+Rh+OHF2gQWW11YWTGbrW5KrtKXgAfeJX5RZWSwSUdgAKB6zG2ubKpHl1m05fC/LM6R8XViUlEDZsMtXNx3V+VNTy4oTs68K81qtswheQELBAXB9Ly75r++KEMDJMnTpjvQObSASJjHTAA1j+y9EdSrDug44T0vXg9+2PcxnW2BmHv0A+LQccV1YhpoUHlru0zA2hUbTAgsNHbexxWVNWGfFag9X8hEveL6re3MwF8EgkUFyA+kxarkQI1wtvQJgdfz4Y58BXo8c11mtY2722EDO3tN7eKLKzlI4a3pZLbAvnR7w1pXZ58r0irm5282T01+Rv7cWThVBxHOMgHrRPIm9uxi4Ru4Fi+VWIVEjzmt+Ry5lCbXW1O2ZFCQ49A23R9m/XfHyUXbhL40PoSO2KRSteLx1AYP6gJh3Zcfa9ps5gnW/7ZJd3G9ug/rxIgqcKq/QL904VnZJEUK3qRJPx4YE5HL10WCOylQlhpOiqKpQXJp2KWThRC8tOP8HvghhRYM6iC5eY8Fs5Uiu+7V/M2pULKN9bDtgl02X3PdCepIIz3Gyws4UketDvqh95yGZ3kdzUGxwVUoBy7C7CCErfHeXftYsPcu8Y2ae1Bx1JgiFtjn6hCnkw/OQeGlD4MvqDMaoslCFLV+TgLcEBcfjFnJxNOkvVGw29W8THPjKyIS1AaW0Vu2gJLDwhU3ZI1yH/b2oAOs9X++dAOkVlNsmNJZQ089KZ6/iEv+JNHeOauVj9RLDPVCzQkvVm9zoTkdsuQTjuQ3kzpyGbfnQW0bLvuQG6LWhzobMgPu6cTsRz+mFAoTyaiSoSz4uPfUMFddLtB8fqyV3k+XiAMp6itLc8RElEoCIjiw5J6PCJh6j2jicgi1uE9gs8dOd4OtVQmdNTkmZ7cuc6e917s1rM0NL7A4hngL3NzFaMGWAQoZT3OKJMNX4QGQjwgn98ceIx1hQPAK0l8cj/g0x703C3qM2OsbA3/bBHwX7YNH2YMevi1SeqyCpsJSfuVtNQsqjKRO4OAxtJZ4KETNHe1jqvMk5qMfCrhw6YVK0HN6vDh1sOrWlgBudrPOtrUzt6TVvlOhdeGdqk6tGH/eOipUE1Ze5yGv+E7obFIMBcDyH75SvljVkqs5ugubwhd9wNFLs3FlaF5bx/2kBPGGqFELcbsgQUcpXYIFs5jP6gjD2Ai3glFQSAa2f0F39C3rHYBK3BTa765COUgLyMtrkdtZ6L8TWrAikGwPD6M4LoooTz9C+yXLkS5ciBhgSapyPC8fug4suQCrZyZKas5ywoRvg488HzMVmLB0yewM7i+wXmPzlDWNrKwff8+ljJ7n7SBIVvjZ2tRZK7uTNsDI4JfuvVsn6FbKZaI4Iodz0zduN74CDPcB/abythTu0DRpeIxr+GcJL6H4k0oxrHF/XkhubS6OPhvduspGgVm7jjwxFFsCcY/y6QZFNZebJZVLxM0FYuVAk6AcukOoKItA8PeS4NWsjUqJTZhloambXrNMulLxWMwITl0LomuZUDwIsAeXNaCDTK+z3S7gho2Ypr+TfrixZtmtCnrGlUKJHM48/tbQLsltJcz2+6kyJjLR6NqL1g+8Rn2HHPPmJhDedgys+PgQ= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4b897a9e-3c0e-4a06-146e-08da392f7917 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2022 00:35:28.5398 (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: FLjDVnsa+jKowjkOE7ayxHrAxlLvA6XVjNFDDpO41l82mW+ADXHqOCE+57DkoGXAAXlQHF/rtwhX9k/eb7i1yh6RxvdyQcJqppypIXHdo5k= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3020 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.486, 18.0.874 definitions=2022-05-18_06:2022-05-17, 2022-05-18 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 adultscore=0 phishscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205190002 X-Proofpoint-GUID: kltPY3xGDSTjHZJ-HJJkr-dVfAMVyv4_ X-Proofpoint-ORIG-GUID: kltPY3xGDSTjHZJ-HJJkr-dVfAMVyv4_ 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 1bd772d9b804..8f73c8d6ef22 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 cd1049393733..1e7c5c7f19ac 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 Thu May 19 00:35:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 574861 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 E3EC6C433EF for ; Thu, 19 May 2022 00:36:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232212AbiESAgR (ORCPT ); Wed, 18 May 2022 20:36:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232226AbiESAfi (ORCPT ); Wed, 18 May 2022 20:35:38 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9436E195793 for ; Wed, 18 May 2022 17:35:37 -0700 (PDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24IMIlnQ007800; Thu, 19 May 2022 00:35:31 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=YmtvY3NQ8T8KYEC+iwpe/E5LqmjyPen/J8TytaQ/++U=; b=uTkhxwFoO9E/hu3wwM6rErjeWJXuylhTGezbVAAcOSagRDSmVwuCJ6DUsjb0L83bg/AR mpV2sX5eo2zw8cox+jscGgynx6zHoEGW0a2vpn2OPM8rVKhb/o3+6i/mOMHq2/4VMqNr 8jM0WqM3z8Tby02Ei6bzCL0MQHisojp8zdf2Hc7A3HG6PxKcpX/5/5NfXH0qY4mU2qCd tNJH8U8U3CPixLSQq1aV3AXI1DZBzdwYGYi8m1FldjclUjRMOg+0o4qnSR5gn+HwWFLF rNp3olkKioYWeHvAYvpCrHtPQvpEd2ApMOVRhZdyih04NId9WjoF+rpIA/KeGe/JndVe 8A== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3g22ucajj8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 May 2022 00:35:31 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 24J0V4VC015306; Thu, 19 May 2022 00:35:31 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2176.outbound.protection.outlook.com [104.47.55.176]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3g22v4s0u2-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 May 2022 00:35:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bs7Ww9TGItoRcrbqf6KKbQQU5C7ijVKFg+iUmWFq8PzYMIr0UY0OO3ugHnH9Nkul3zJRHXUI19NhR0SzK30eeAhdIzCKJ1I2O1VbbxDkdbFjuTiQBIkX0AJ2eLIGXeU6arjWFWfeZpO3KcntwwxJfCAuatL6QdngVxRfm6VmZp5BhdtP0Jx5lzqFSNs66UM4N2oSefZ+OeAObsuXH5uYGrvMrUWo5Z+fstSsnf6r9P7M+6zTmK72AzVebkCw9B3gBtewjgmfeF7K2PykOGDd5G+LnqmIwWmNI8CBa3IkY0OVtyIXIXlKOiNsdYQLX2rQFHFl266+PP9uV+cEsgIPXQ== 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=YmtvY3NQ8T8KYEC+iwpe/E5LqmjyPen/J8TytaQ/++U=; b=Feob1fAS109ZrN4R+ORhyaXfIhX2P2IamNvhzSJ3EHOhIA+Mx0ebgP4ybCCo96/mz2PjkxW7hqcYblOcuI5vsR7KrN73Jru/n5JNVOxhjHHKI7jvqOA2k9zhJ7YklfSvFRVm6PJvfCR/bt7hJ0k5xavDEdVOzMmzFNDSX2k+dIR6n2WKzzmXM2P8oQFY6KNRgyb4cYGgInLwWGiernRGi9m1WGRBd1DgGkePdKJdSXorJHi5ez+iGwxzRMHDopZwQJM5ZyT9sS444th+q4Iff6Y+7rBvYV3IzpEEUj1IB7iNOvOW+rkvwLcBetqQDeaA0OV4xgOSGMEGXs6KRj/Rjw== 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=YmtvY3NQ8T8KYEC+iwpe/E5LqmjyPen/J8TytaQ/++U=; b=YVnDJeJ7toCrm/WVDld5K8XdRiAtDVxLY6a1K6lOI7MSbA41aU5v5Eee50cvMABCt4b0Lgrq3OitOIuOU5g+UPc83Qh5bQC4ouPkiiRVgP8s7TTOaMrgqmRON41JW+JNXUwWfU81qceQwVrJMmp9AlItygAUhyk+9wTOvCJ5++Q= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by DM6PR10MB3020.namprd10.prod.outlook.com (2603:10b6:5:67::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.18; Thu, 19 May 2022 00:35:29 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b%3]) with mapi id 15.20.5250.018; Thu, 19 May 2022 00:35:29 +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 V2 07/13] scsi: iscsi: Run recv path from workqueue Date: Wed, 18 May 2022 19:35:12 -0500 Message-Id: <20220519003518.34187-8-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220519003518.34187-1-michael.christie@oracle.com> References: <20220519003518.34187-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR17CA0015.namprd17.prod.outlook.com (2603:10b6:5:1b3::28) 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: fde9a266-1860-44fb-fbcb-08da392f7960 X-MS-TrafficTypeDiagnostic: DM6PR10MB3020: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: wSpvXSF7zz5CvX9zfKSNaoE8ZWyPPOi0Py5lIdLgHiJccTCdqaAxE+kO50hWDzmN9zHHz61SQ2UYfCY5kAiCV/BA/9dvIWVSFrIPhTlmiKD2ZkiidZX+WfIanNExYkcpAt6P/kNrwHe7BwmFdzlZcRWdlXxcoBk0wXGczqKMZtyAdy7y/AQJ/REb24WCPLZRzvUTSPgtfdIjVZCGyKQKDLv8Tk67Z+XehYMb5KfpG/htK4Fm6q/63bpMfQV/fV82MsLCa4miiV3dSYIXYX4Q7HnqZNQNU2cDS5ELCxjvjmBe4a3wjS0DTCQfXpZoRNTKPQ7ZZhWBIliejVTxOC5fUuAmDl6TwOJE2AtT3u0zqqD+rfRH5e2SZNImo0LTrXhE7fZB+4TcpXM+bIh0cQVaHhmilG3d5xnAjmPdVIsqsT7XW+/5YjcX4wR94VaR1gZNJ9wxp1g2xGsdS5+PDzex/AVMsokTLf0/OHSA7LIW4DvAyILqC+TiWiSielnohp6NXqaq6zc5+ZJiDmy4gewR090N/Tmg2C254CqTheb7B6bp4rAiMVPPlQLKrFjg0YpfNxggoXmNsxt/jUrC+IGDJq0Se8ZWr+NTN9ku8CP+rRDmf/IOuEG+wQcB3FkPcVRCS0n3ALIaacnUwxd0B2MJ5xe1rK/miPm5JTHWky2e1+7cJRCxNo0lc+nRZ4WUzUc2JzEKN4RTkFz2ohXEqInUog== 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)(316002)(83380400001)(186003)(66556008)(1076003)(52116002)(2616005)(2906002)(6512007)(36756003)(26005)(107886003)(8936002)(66476007)(38100700002)(86362001)(66946007)(5660300002)(8676002)(6666004)(38350700002)(4326008)(508600001)(6506007)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: PXnBA49HTzfEaFVDz26q95JSv1FArUa2NZtLSYcprmWKnnFbCu5URxd02fBdpt0S3z58PxPLZmvQhpLMwHxZv3y76SViVTbbzPWlZPvIrcdjqd4XsKt4rDsMDa5iwrzolrHYk50N7nz4vRvSXc8824LPMK5ol7vrNUPPjaE3FF42Dq5TonSSNpvan26Vo3pawr/J0hpmKRx4Dk7hOYWr/G5xI9cAM9N8/orDrWKh0Xff8aGmE0IOSwCTCAbrY2py3vstYSwxoaZDqfOYB7rsW7iSmGKh7pzJgR1F364cHWRV2ZaZdFDDp5UwvsvrO8UvpXI7HktvD8PWF8fFyY3BX77irWso1SQ46chdySvmvylgcCN4US/b8f4Qn6vfHrOBJIKp8YCgZ6Vyr74Q+7FavaPS7mw0JEtL6LA01C9BfTV/itZPcc0w7GCL+l8t+90scw/MsZFK9mfyPEMpDLJNS6E3ElFUT5rjYq6RUgeDzu1VP7aFq3VqGFpkxMxFpMRDfnuXMy6bMun+dui/Q/0szfveGxXXnLc0plp/yN0fwmqMbUwHzzv5oCv17EQRQhxOfHonrbw7VthlhcjKtMzS4/8bI5FXXnBUIKYksOVs8Q8p7pnq4FCQSrzaQEnDCgbxa/gC9PxkcvQ40ll7SJKyVIhbf6ZrG/Vjecd+B2AOxWD3Dsi7vbxwcczNWf0o94BBNPairdqMT/5KDhtAoHRsbVZ5izXed2gfYXdVvVp0+dJF/2NPk01GvzXWRRn0ckgSoyZDlToVocMmlUxJrdm6FiPnrz2OEmJ6BgZcGimMLXIGNXjgxg/nncBrb4YCEqWy8sAoBg+NOYYJW3dlCM5pBxUoMPv0KikmyrLSqr8oQRI2Y6wYfE1P/ep5W3rbCZk/5iqDBoRMvZRGp40Rx2GQiP6sWwvC7e9jUBZwLZBRL2ZrfbXzZ92baaFgrebgDNPTExdezIjbmp25+DJcSjgCvUh/vnWOqXa7wbvT9xHhNTufSuZVeoZAUWZLhBaOivrvz8R6VEXFkONznMDK8QET95PSAiF7k7aKpS5jYORBMtkPyterR64gNUhSJSBHSLcdr0bWNGOubWGuTS/rzVBTAWZcrYT9yXbjH8GkiCM77Rv6XOq3Aq99//IL8nTxzyJAXT8Z3wVCTpkjm1q2aKOqcv6y2N3wq/WlPdJngmkXoxqBa8OUqKRXJGI7s+ani8CIs/C1F7lsvCj2kj4j2bHguUxCrrrLFzvVwt40Avp7eVYsAeX+DczduP0CvwoMULN1B2Ii+gXA/2flrzvSpXIBmIwNwXtOW/NovaXMWHMDi2I7Ej15iWjDfLHmUgSkiGK/2jQYLL32QOU9emzg3ct40Fz3Ai1b/r/yhtqJkmn53TUTZzsMGE7gGbjcgyL2jKSKYhaUmnQLZyznSZ9tlxph+RGVfkZrw/VjyEwR4SVfKx84qwK46ilLfEyUs6n9GZO0dORIRtLoKJ0SHgBkBOu0rMAVT5hQoL1zZZ8zpL4kR6NBIHiTcUFKQJwHB0/XHtwlveBAuxm1IuK6BNPX3y0sQ6scgg9PcAMOGQw644yPvcwJdZ3TSQDdjBEXMq0aQBXBm4KIR9gi85RU0YUVW7BW4HG26vQVQ1ngOY1yd1xq/yjvEwfiUGDNR747UTPK6hmfigchwFfMpqfDK7ISZ72j4UdrQ23AjC9b6JvNUScSfKKCD2A07K4pjk/wxXkCg/M2SKUbGSB4lrYz5i35JxTRVXsMLi5Qk7wjTx5JgSELxoY= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: fde9a266-1860-44fb-fbcb-08da392f7960 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2022 00:35:29.0241 (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: upZPGZvGgJPAujqRQ0KFraY21fdZU1G/orOsSbDPk+5CnxbqtZgdQLxHbT49d0gWX5toSQxK3UQU6nTAxEMEyrCbeKncU0zCsAIKmYgnGMo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3020 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.486, 18.0.874 definitions=2022-05-18_06:2022-05-17, 2022-05-18 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 adultscore=0 phishscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205190002 X-Proofpoint-GUID: UF5_A3FAmgMClRRfv_uadKm7MWwIqXhS X-Proofpoint-ORIG-GUID: UF5_A3FAmgMClRRfv_uadKm7MWwIqXhS Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org We don't always want to run the recv path from the network softirq because when we have to have multiple sessions sharing the same CPUs some sessions can eat up the napi softirq budget and affect other sessions or users. This patch allows us to queue the recv handling to the iscsi workqueue so we can have the scheduler/wq code try to balance the work and CPU use across all sessions's worker threads. Note: It wasn't the original intent of the patch but a nice side effect is that for some workloads/configs we get a nice perf boost. For a simple read heavy test: fio --direct=1 --filename=/dev/dm-0 --rw=randread --bs=256K --ioengine=libaio --iodepth=128 --numjobs=4 where the iscsi threads, fio jobs and rps_cpus share CPUs we see a 32% throughput boost. We also see increases for small IO IOPs tests but it's not as high. Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/iscsi_tcp.c | 65 ++++++++++++++++++++++++++++++++-------- drivers/scsi/iscsi_tcp.h | 2 ++ 2 files changed, 54 insertions(+), 13 deletions(-) diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index da1dc345b873..10d7f2b7dd0e 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -52,6 +52,10 @@ static struct iscsi_transport iscsi_sw_tcp_transport; static unsigned int iscsi_max_lun = ~0; module_param_named(max_lun, iscsi_max_lun, uint, S_IRUGO); +static bool iscsi_recv_from_iscsi_q; +module_param_named(recv_from_iscsi_q, iscsi_recv_from_iscsi_q, bool, 0644); +MODULE_PARM_DESC(recv_from_iscsi_q, "Set to true to read iSCSI data/headers from the iscsi_q workqueue. The default is false which will perform reads from the network softirq context."); + static int iscsi_sw_tcp_dbg; module_param_named(debug_iscsi_tcp, iscsi_sw_tcp_dbg, int, S_IRUGO | S_IWUSR); @@ -122,20 +126,13 @@ static inline int iscsi_sw_sk_state_check(struct sock *sk) return 0; } -static void iscsi_sw_tcp_data_ready(struct sock *sk) +static void iscsi_sw_tcp_recv_data(struct iscsi_conn *conn) { - struct iscsi_conn *conn; - struct iscsi_tcp_conn *tcp_conn; + struct iscsi_tcp_conn *tcp_conn = conn->dd_data; + struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data; + struct sock *sk = tcp_sw_conn->sock->sk; read_descriptor_t rd_desc; - read_lock_bh(&sk->sk_callback_lock); - conn = sk->sk_user_data; - if (!conn) { - read_unlock_bh(&sk->sk_callback_lock); - return; - } - tcp_conn = conn->dd_data; - /* * Use rd_desc to pass 'conn' to iscsi_tcp_recv. * We set count to 1 because we want the network layer to @@ -144,13 +141,48 @@ static void iscsi_sw_tcp_data_ready(struct sock *sk) */ rd_desc.arg.data = conn; rd_desc.count = 1; - tcp_read_sock(sk, &rd_desc, iscsi_sw_tcp_recv); - iscsi_sw_sk_state_check(sk); + tcp_read_sock(sk, &rd_desc, iscsi_sw_tcp_recv); /* If we had to (atomically) map a highmem page, * unmap it now. */ iscsi_tcp_segment_unmap(&tcp_conn->in.segment); + + iscsi_sw_sk_state_check(sk); +} + +static void iscsi_sw_tcp_recv_data_work(struct work_struct *work) +{ + struct iscsi_conn *conn = container_of(work, struct iscsi_conn, + recvwork); + struct iscsi_tcp_conn *tcp_conn = conn->dd_data; + struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data; + struct sock *sk = tcp_sw_conn->sock->sk; + + lock_sock(sk); + iscsi_sw_tcp_recv_data(conn); + release_sock(sk); +} + +static void iscsi_sw_tcp_data_ready(struct sock *sk) +{ + struct iscsi_sw_tcp_conn *tcp_sw_conn; + struct iscsi_tcp_conn *tcp_conn; + struct iscsi_conn *conn; + + read_lock_bh(&sk->sk_callback_lock); + conn = sk->sk_user_data; + if (!conn) { + read_unlock_bh(&sk->sk_callback_lock); + return; + } + tcp_conn = conn->dd_data; + tcp_sw_conn = tcp_conn->dd_data; + + if (tcp_sw_conn->queue_recv) + iscsi_conn_queue_recv(conn); + else + iscsi_sw_tcp_recv_data(conn); read_unlock_bh(&sk->sk_callback_lock); } @@ -276,6 +308,9 @@ static int iscsi_sw_tcp_xmit_segment(struct iscsi_tcp_conn *tcp_conn, if (segment->total_copied + segment->size < segment->total_size) flags |= MSG_MORE; + if (tcp_sw_conn->queue_recv) + flags |= MSG_DONTWAIT; + /* Use sendpage if we can; else fall back to sendmsg */ if (!segment->data) { sg = segment->sg; @@ -557,6 +592,8 @@ iscsi_sw_tcp_conn_create(struct iscsi_cls_session *cls_session, conn = cls_conn->dd_data; tcp_conn = conn->dd_data; tcp_sw_conn = tcp_conn->dd_data; + INIT_WORK(&conn->recvwork, iscsi_sw_tcp_recv_data_work); + tcp_sw_conn->queue_recv = iscsi_recv_from_iscsi_q; tfm = crypto_alloc_ahash("crc32c", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(tfm)) @@ -610,6 +647,8 @@ static void iscsi_sw_tcp_release_conn(struct iscsi_conn *conn) iscsi_sw_tcp_conn_restore_callbacks(conn); sock_put(sock->sk); + iscsi_suspend_rx(conn); + spin_lock_bh(&session->frwd_lock); tcp_sw_conn->sock = NULL; spin_unlock_bh(&session->frwd_lock); diff --git a/drivers/scsi/iscsi_tcp.h b/drivers/scsi/iscsi_tcp.h index 791453195099..850a018aefb9 100644 --- a/drivers/scsi/iscsi_tcp.h +++ b/drivers/scsi/iscsi_tcp.h @@ -28,6 +28,8 @@ struct iscsi_sw_tcp_send { struct iscsi_sw_tcp_conn { struct socket *sock; + struct work_struct recvwork; + bool queue_recv; struct iscsi_sw_tcp_send out; /* old values for socket callbacks */ From patchwork Thu May 19 00:35: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: 574483 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 5B85DC433F5 for ; Thu, 19 May 2022 00:36:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232200AbiESAgP (ORCPT ); Wed, 18 May 2022 20:36:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232043AbiESAfk (ORCPT ); Wed, 18 May 2022 20:35:40 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69FFAB0423 for ; Wed, 18 May 2022 17:35:39 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24IMIpmn027442; Thu, 19 May 2022 00:35:32 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=K10sKvF1Z2pT+NmvyTDNczHpstHlMiLonlmnWg0odeU=; b=OV1OBp2F/FOpjjm/dyw1CpUANjwu419pWXmhq1p3TZOO6tzJb+hmwScLdniAoTKlWtW7 ueGtJEP3fiNgr3/J5bNlCzPRjHob0yZrjusEnTQx6Edqyhjzqwg5s2Qd0afjz5T/Romq R0z9W3IHLka60nkiQVDZIvMIKLyOe/8e/GdExlqvXLHVA6OAvDRVBfwcvbQ/pSdfcavW rxC2g9XBPTT8kMeuJkbS6AfRQ8nrGn20ewkxz5jEFBSS36y0tI8z4c7YENuiJ6RzL88b ejhu8gGWQOEQU3dQWuJy/UMrmueYRs7+Bhh63rZUt38Ec9pKFiZBPkB2x7Q+BlKO/KB4 lA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3g241sautg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 May 2022 00:35:32 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 24J0V4VE015306; Thu, 19 May 2022 00:35:31 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2176.outbound.protection.outlook.com [104.47.55.176]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3g22v4s0u2-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 May 2022 00:35:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GZ/33HznaSZD2/VJPsw+LAMn/a5/TdXE7bozugwtWYXJ4mJw/5vwh3zwrRmG+ZSz+v+a2mYDMcvjjTEUHAKvqLGC6gQUMYSmLuTpbrg6BWKJeMYqNikl4A+9iyxAPB6dL4Ze03gScn2ucJhNKR98oDQImO8VPnkJEIdmqLE25GK35SiIRFQga1/PEcSPZ4UuZ34vsU3LSJNmkiOnZC7BLvDZbVeoqgTVzBvp6UVTTH9G45R7tjaQ6lvXzxyrIe3+3AGWErFhBCrJUuPBk0MMfwbRTb/+gKJndu89lbKtH9IHW8yZPa8c2T+9iEqzsZI/n0q7dy97Zib8TbC9YfyLWQ== 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=K10sKvF1Z2pT+NmvyTDNczHpstHlMiLonlmnWg0odeU=; b=lXxR7euOdXlBiYN74AXuYHXVGVcCbF8Xkk9iMHgKtcPmts1aEPlv/uJW5G/wsMc6VJLjsoYaGwzsd/2ZnqZGcfgBFQCkuvP1UmXTSUlMBPWhZVr59SFLJevFb4HjJH8XJaan0JIovs545v/en2TB61i0NhQwN39S8P6EDYXI3fng5LZWUyoSIUnsOdDS85MSkwKaxRNe7lmIr0mSzytsKroAyo0OKE07szr250fcVYXp3Mq1dS3d3vMj2mZ7po0PFVZP6ZYy5ddPtiQnQFYNkkSxTnxycfPIEljW62iCfMpVZr7zripOFEpnsG0h0p75rLcsu+p5xO3Dd79eQf9uZg== 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=K10sKvF1Z2pT+NmvyTDNczHpstHlMiLonlmnWg0odeU=; b=IE2t3hJqbJ4dFTJGL9EkgxJiADtsvBRyNLH72kWgNFrpn7TgR5JKSJoPY7H2Ld0XfGmPvS8LhPaiHlZJ7r829Sk5Cn/yVWM1YkGdUxHxXSSLzjFMpCQXNB+I3ecL0vQbOknTwSIonRt+TZ0ZG/Pr7EwXG2ct2GRrNSPjKh3W6Hk= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by DM6PR10MB3020.namprd10.prod.outlook.com (2603:10b6:5:67::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.18; Thu, 19 May 2022 00:35:30 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b%3]) with mapi id 15.20.5250.018; Thu, 19 May 2022 00:35:30 +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 V2 08/13] scsi: iscsi_tcp: Tell net when there's more data Date: Wed, 18 May 2022 19:35:13 -0500 Message-Id: <20220519003518.34187-9-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220519003518.34187-1-michael.christie@oracle.com> References: <20220519003518.34187-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR17CA0015.namprd17.prod.outlook.com (2603:10b6:5:1b3::28) 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: 94085280-89d0-43df-1e8f-08da392f79a6 X-MS-TrafficTypeDiagnostic: DM6PR10MB3020: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: zfOL/rq88PcG+kV+HB7gj1BhRpS++T0CuQBY3djXZCodVsEChhts6KfrW+NXULu+VGxjH4nFmc8OlqLMzWaDvk0y2XOQqYZluaRpxh98PUK2sHO8X5PdxJYw3V+P/Y0VU7neMzlj3adIe9dZU7upuvunKYUzYnaoeE9EHqfLcON5w/lfKj9hEgm7acs85wazINpvkcj6tMArFNniqQ78ryYVk8l3VHns6FuUsquGoTtO0Yyn3VulI2G76j9HbCc7zYHPG0y0ZX134bLjZLvXM4QAic3/6uy1MPqFFA1hTq+grSexPJfdi7y0fIkm/sChjQIKl3ZSdMTdPKQO9jFaAeaZmXifZtLGeuvywxHR3VDlRCvX3WtOIkfB34p2sjq81LgarOgDgxtGwQAATyxa49mUiI0UntFINQ6mWr+7xas9F0COtZmkLjukM5GG97Akxc+iJLjnzmCOoBXBhUQymf2IIJkgaZzKlN+fu4BYXMWr9khLRHd3CmAkXi5jU6baBagZ+V+GW/k1yK++ZX07ydTBRIRz49mt8N6XeuTkhebEB1urCfDK5pOJhQLBYvBFPj2RnudM1juYjLltpV4UjKxtqsyhBPXePCMLBTk0BxiqoSqMhxkGYtg3h/5iviEB+nBCuG04EwLDaTdH+0SbxZdAquDdEbCIQzBSiB77uK/Zh3YA7ZpX8CH/Na1Nnq30RNhNF2lLRKBnM/h6gOwA1Q== 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)(316002)(83380400001)(186003)(66556008)(1076003)(4744005)(52116002)(2616005)(2906002)(6512007)(36756003)(26005)(107886003)(8936002)(66476007)(38100700002)(86362001)(66946007)(5660300002)(8676002)(6666004)(38350700002)(4326008)(508600001)(6506007)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kxjEYldn9rw30XLXSMyljb5sYZeuOGDM0uUKzYnglkksZsdLvA+cvf468z67P2BdpJs/aMuuEFUj38QQlQ4563zrnF4rEzjDu3F/73J1h8aMjMMVVo5l+dAVjZVFGwAKBSe0rh6OgQThpRgmo8oqlhTDU2gqNQ+W8gOi5EA9oVRdBbZZHF18t9bY7cfxJFqu+WLb4oFs4v7c+6jVG8fESOypaQ6dnTIQM4ukKw9RKUKZqz4TAovJUTFNWhEkqABdfLogelpG+liB9xrc8plEJhrS2uFL/zy/HBl5e3AMXf/0i6MGJh9bLsDYJbegvKq22H1JHNTpIlMrlPSrc7k1KsL3T1vq9dmCF6zYsOSuWQp04PtJ9KWGf0jrCSipVb2h4anLaPf7+Q5lOoVME5eFeuS5Owvl2Bw98C/HlzbNveuQKJD1jojzt+YZb5OO/Eus6hxvH2mGwehyzjaw3XwX2UwYPqymQoWlHABkhs0rU7S8bRjDlUgWGjg6OyrXJ8mxtMbiTHHEf7Hmuj9OjQI385Ql3hieDnG7t5hUD0n8YlohRr55/jkYxaSBv5dDAAMFUaTQieDd+/3uHG4wa+K4grgmW0DAdE4WEQmkBkZETlRJhmfOGlQ/6Np22KMwY4f/tCMjsa1T0O3lvNGudHstF67HEWzzVw0l4FlvJuJfEgsRMW18I/OYb8cu2hupKZWbbuuoIDcbNefMy9hK0waqIKir8iHTZa1fAvLCCaW8/Dt9HPPcYl0aMfOUQiqvX91DebWx/u/w9zzlpmh29EGlnUgt/3NRcoz6elZQts5ZYC2xCOJHVQ8+4xY2M/8eKE4LxpClE6rumiLoLviEtWgD3THhQjGR3JlyK0iqdahEQYRuOanZ38fNDki3KSVIDdnjnTJFru+zqSDhaNvPGSw14y21efVsvplBkx7Vu2H0Yb7lGyaDwFges4W96rR9Cc8KNqRQvWmo15dO3M7sC4a73IPQ3fQN+gai2lteSlSD+edr2gBm2duKSRyFa2nXuQsVRwZBSLLnGGJvP5t3nnQcaRg9f4cOUOsRpUoN11E8ELAmcc0bxhsOOoyOvXYEpFhZP4+sfdlrbQiMmUKJNKTawTdfbjeqh30OHLGT1teb+gPIJI1/vsUyHU3T/XcCXrLlEV4P5wZB55PIEICoMweCocFy1xuK03VJlkLAo3jf3IqZkqQ17H87j+koAPQ/j0KpXrb6EXipDlkijAF/KqngpKybXnYg2d/BweOPmOGKatOHwSEb9Ec3UATVPnawTmMMtgWAHW6676I4m4vwCAkpBD/8I29uaNO1hEo1vv7S78pfHkcEH62XCclSO014IrK/KxB9tyv1mUYr85FQzpiCf7dwGWmxthsbzmigDduZJjMVGIigaz3wqTCU/sIGLa+4Gsg4mT+nBFMaL6vzreTrvcR76gIJm8iZljSgJ1INmt5tl+zyKCIXORf778TvQZapk1q71UpRukTvaWRl29jbH5NXJKprLYBYb7aItkdffkGyI0Qb5Ks2GOBJuy2GDQXohSCNkycPg78ulgvOVl04q/lVHC2U2tRhWfASu7nylHdeRJ5XxtRv2rnVqejAIIhTll2neQ5Ja3s+NsHu+yy+MT3Vdryr1IKD5I2iolAuEg1el1OhqbpGAZvaUXLqRTkTVuUMUvsvSWMkHQ+mlVYAcrPWzirH9w0Eifhy0lSWU0ycLb3DBYUCY5bbdXzVgLdF9DQbB6UAnd/Ekv3LO/NXBsF2iqBXwkoy2uK0U81/7BE= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 94085280-89d0-43df-1e8f-08da392f79a6 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2022 00:35:29.4928 (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: FRGi3XaYbHPKV6qd74lb0bioiZLWKGOvumgq0AktZ6n00fFR9OuId2bYChF+yPdMmU7uE7ewTv00ydBEpvC8M2xG+7iTLjh9VfZWbA5NQKk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3020 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.486, 18.0.874 definitions=2022-05-18_06:2022-05-17, 2022-05-18 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 adultscore=0 phishscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205190002 X-Proofpoint-GUID: -pDUnigbKU1eJo4vA-jYnc-DzuzcRb4- X-Proofpoint-ORIG-GUID: -pDUnigbKU1eJo4vA-jYnc-DzuzcRb4- Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If we have more data set the MSG_SENDPAGE_NOTLAST in case we go down the sendpage path. Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/iscsi_tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 10d7f2b7dd0e..5e3b59ecf5b0 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -306,7 +306,7 @@ static int iscsi_sw_tcp_xmit_segment(struct iscsi_tcp_conn *tcp_conn, copy = segment->size - offset; if (segment->total_copied + segment->size < segment->total_size) - flags |= MSG_MORE; + flags |= MSG_MORE | MSG_SENDPAGE_NOTLAST; if (tcp_sw_conn->queue_recv) flags |= MSG_DONTWAIT; From patchwork Thu May 19 00:35: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: 574479 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 766A1C433EF for ; Thu, 19 May 2022 00:36:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232136AbiESAgi (ORCPT ); Wed, 18 May 2022 20:36:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232262AbiESAgE (ORCPT ); Wed, 18 May 2022 20:36:04 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75D13261E for ; Wed, 18 May 2022 17:35:43 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24IMIq1o027463; Thu, 19 May 2022 00:35:32 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=zNDMzd3ozPBbhQxOijWZaIue71pL6z1s07tA7W3XdYc=; b=Q4KNT12uSlXQaLCYo0IPTZ5Wj6Ipbcg4epKgTiHVdqGoYasCHkxV9cqLIAIQMRZznc9K H2tzi/3BM1LotiFEKiBUjDNDvPa/K/kv/EMO1XvMfWoIqKs4q6c4GIxwVI3yFh6kpU6W Pen9bbIY095D6gGF2w9XRC11CgZpzw22YQS6Y+6Mk4atEx6eLk6U40vzNBMUf6VX9UM5 8qreiDj7bMUayZE2hOJiPwO5ScnwK7E59Bw8TS15BppTCG3F6O6Xj/v4kGFsL8Pmjlrr h2p0HjvNeJwXimzqogGYJGLypgN0N+D5+eXXt0+h0lLuAAH8Li7hmpxlB0+HT25Dk/9I aA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3g241sauth-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 May 2022 00:35:32 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 24J0V4VF015306; Thu, 19 May 2022 00:35:31 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2176.outbound.protection.outlook.com [104.47.55.176]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3g22v4s0u2-7 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 May 2022 00:35:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Mntbmh1fhX3sXGhWWf4De2ZtWivcM1xWgl5no9dX9g7aLFNBKSM5B82xN1/MInfPsqcmLyeDUXb7rrEllIP0HxYnTGfQM82JnbOTfu28DtKHsjONgFB1XHYu8dpH5wBmBw2FOmampSSInvl0oXoTCgjX9phfpxgo23GCtq+qnV1Vo0HMEZpvasaSFqZTI456NfEiglscSBT/08NArnhDJzWEacHgV50jXAxAx9FA241RpQDvPB5gKTLE719C1cRUzuDluBpQY3xlxzEv3ClDjwPDxLey8xwPvGBhparlSES8PRFv40GML+tm/SlG0UZ+AEuaKp715lvov1TftVdSnA== 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=zNDMzd3ozPBbhQxOijWZaIue71pL6z1s07tA7W3XdYc=; b=Ye+VmEznL+e+eiLgwGmxtQsb1texlJKO7/j0MFP/VuPicAuY/hR+XmTrJ3gt4XctvqvF2vueceBvHdSt0TrdkmBCNaeJ79lYCGVHowLZMcgR+rJy2EbGOaf4upuvOTJnBHSn3zQZjsLpIMlUOBp8uQmg5r8eFihS05OF8k389oxS3Dx+um9Liix8IZvK1DOwb+VMaJtnqZCh/LKNT9AXGn8T6Vy/HLfxu0deUZV72NAARXe6f3LTviZMZaZyqcDalyZpZTk+1R+Kv2SKpDYkGfgTl0NgSVEM7Rj4er0g5e6GJHeg8qohVTOmKphU2xnqS3scfs8KWzEhIIsi4uujtQ== 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=zNDMzd3ozPBbhQxOijWZaIue71pL6z1s07tA7W3XdYc=; b=egAnVGSQantVEoz5gggdf7qsL1jJk2lLAH9wgQHhPIBqIP9Kig6uciCig0X8ykBmcGWlW+Xnqq3lXj9KdoRNO2KQGVAp6ylSaT3qB3RqNykWvNH4Dhg8A/rxUnW6y/RSq2jpuyz74P7MdeHZ21iCPK4X2LUPx9EOrxOzHgre99g= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by DM6PR10MB3020.namprd10.prod.outlook.com (2603:10b6:5:67::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.18; Thu, 19 May 2022 00:35:30 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b%3]) with mapi id 15.20.5250.018; Thu, 19 May 2022 00:35:30 +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 V2 09/13] scsi: iscsi_tcp: Drop target_alloc use Date: Wed, 18 May 2022 19:35:14 -0500 Message-Id: <20220519003518.34187-10-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220519003518.34187-1-michael.christie@oracle.com> References: <20220519003518.34187-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR17CA0015.namprd17.prod.outlook.com (2603:10b6:5:1b3::28) 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: 24a9fcdb-1f9d-4be5-ca80-08da392f79f4 X-MS-TrafficTypeDiagnostic: DM6PR10MB3020: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: 5O3242N5RphIIk5G9ipb6gdJxaelFmMPX8ST4Ib/S/YES//ARIccyUT8j5XLPy91GUsnk77TiKjv0tyDHAW62UdmhJpOtH7IuXcI8pjkk7B/uUM/ZuLQ/ktje3FFN253udnFfCsZFTSP2mUvs47p/dGfk96109KcqVC3QKZwMohD88P2qgq+glqFrGIw0fZGBfuIRD7q6W/rtP8w17Rpz9YvwQyw9ULc0I5ZkialxTid2YsbJVnyAolL1hNU6M+63HAspJPSsH9Z7Sd9CVSCG75NLYcBaEnQh0Lm9SGsiZkOTcJHRxGo7qMJmVVrsCXEa31JbBREcvdteL5az5yGH8vq8kEWzaJN/x7zgLLkfgKdsnsSfnHnXCTJtW5CUiNSktnykGMWP6FZz55KSrzIaFJ3HKVuBZmjIf6Qzpj6DYHuAA8hnmyhLaOoc2ehFFz3AMzBK61KMZzKEjN+LwDyjgLGBmKp8RVruQTtsBwjENq0S+n1r/uf1VWMqe6zxRuXdkzFM4jXLPW5XQ8/GvL+IHT14YF+CkArIfys/Vq2YoP0O5P3NgGMAngdaVO1TjY5wf98ip8qqsho0Of1N7R9KpiwqfVkoLQgBpx4ehCEwO7VK5KNhgakrDpIaw3OjpnZkntC93jkzYbkq8TwLwbrNmSDmTRT4zDjVbg4yNxZLfgfgjqUDHRD5nejd+hJUxDhL2B1LkW+KgMgfa2+D1Ikng== 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)(316002)(83380400001)(54906003)(186003)(66556008)(1076003)(4744005)(52116002)(2616005)(2906002)(6512007)(36756003)(26005)(8936002)(66476007)(38100700002)(86362001)(66946007)(5660300002)(8676002)(6666004)(38350700002)(4326008)(508600001)(6506007)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: EDi2bkxx79Vtg+yZ34zM3ZW4V6ON3zyUwUJW/VDRzaiP3PudoKkf9pqZfROyBFApwl4ZFOz3iJCely2lOITd9dG/80IIXrPZxbW7B3WUP+3O/huI3gN8ZG9f4PZ/Nh89WVXdUdERZbTln+nhv31zPe5EuSNUJpJ76oJeE0NlxLK0jZ+P2atyQ6MSCznmJg4pmcP97Jm7aDYpX/eDvYx82z5si6lYjH3ChNGW3iuQgXZ4pNRq22Ra1gtGfi8WRiSGW6WsnHiIBjGYOQBezNG5BZw9ED7E4iCcQjE3wzeEiPhtcQYp+sBo9T4MisYzdrLncKiVt+7ZCR4iJUSZT86lmcvS4lK6pRtQpcT8ZUClbnmLNPL56pLyx6B7jkdw/ccRe85dwP9XSR+V1/XQmnXb7dGs2fc+KfJZae08mKFfPojyVNGIf2MjzxfTNCplMXFflkhOK0wUVo7zxiOO7qei+utqBurX0MoSI1OLpZqEyavA8Bejd+Iz+8XTbfNVIEj0gj7hAHyTbMv1k3gAQRD9Di2OGnE5G4aVP/vvtWyNxiOxJPYsZSCzxi1tiHm3zacyaIGQREjVl1XdOrC61CawZk7xyDfcMJnf/Bg5uvx5w//CJdRdGhZNf4iK/uXfJWWrnGIZj3uyj8FoUIFhO3OLasljMpmHtbLoMUWLs48u+23OagYQC61UZCDdDln0ml4k0C409PsxomKep2rqcpoQu9BRH84oBROtDFFsMJ9w2FXhoclc5J3n0suqF4bf5jUTe19URcJ7o5pZhWxY9mDzDX2NWdk6ngHVyo9wKGJTwbsihjI1jEgoXZkCNQM3C9WjECOvokjxDtddRdooq1gjVF+RNkbZMZEAYar97COdPTUMUkSVINz6I7t+mXK0SZXQKdDg1i7yzwtf1+J1j4sBBLMwpLX/ewHsiUx6RBPeLB//DRm4b3iOtsYMSrAYYCSIW07S8J1dSC6K0z/Pi3O10FmGYXf540x2BKc5b2A8/szusijbEcAGQWwlZaBKNCXHmUgkZX/52yuk6JZA84doDWqV7jQh9nixzFuaYlvQuPHB1jLrRHjK6MRxN7/HDmRNvWkkDOWQJpyLSn5dbHIrjFjqd04n8WT8XWpYxyhSAm5N+M1WgIZJy9YjNn0jLlMKqFvIJI5U0yO6eBkAZ7QL19/jbXoTVYViOm2e43fkqhNcjZzyCzxUY9rASLbB2qzqnzIIrg7vvxfq3uGVaAe3jjJn+MegQlFRgoDt63joQ233deQd6fyHgrfjmJYSmFYfcL9dt2jVOb9MuRPd6BXSYX1tMRpos1RGqKjL9T+JvPl75s8t9eK6DvLV/8n7zYDEBxIzaxU6m35kZ5v6IL6sfyo/gduf3DKqNjqeXcmRUkyrkr0O2hYoexXCGz6YJZzljiIz4RfHi3g4s9gmSa6yw8UMYLMNqDAfhDz8kb0+4dnCiaNFgBbvFFE653cRwvES5pWw98WBqlsSOCvS4/+p/AfqgxnRHOI6wh66qaucRwfumQyLG/PFDD26t8JFmIanipLKgSWApNzI+EdhCZwu4XnC3+rim+t6XxzOSjj+6Tv7g5coa0+Qhwf3/STNB/GsH8EUIHwYYxIi3qYS2TRAqv0lvVdRjlxGb0MEcrC7ofSBOx9FSBNDYCnsOwOtQ1jZzg9zSSMQW0rFG4Y7GUWsXQkc/ssNuqx60E9EljOv6cUart7avhwkXT7l+68ISrD3YGAdse2R12+RANX+EwLHALvrxYR4k0HBI1iDUtyuDSk= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 24a9fcdb-1f9d-4be5-ca80-08da392f79f4 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2022 00:35:29.9615 (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: d9cOekIlcvY2flEpR8U8QrG2gKvFk2oYXv3OiuVeXXmTDuRhYW0Fr7Oy8to/HfeJT98hn0ef5q8ySQnss5y34AnLrOFRwlYbuHsfIQf7zX8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3020 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.486, 18.0.874 definitions=2022-05-18_06:2022-05-17, 2022-05-18 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 adultscore=0 phishscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205190002 X-Proofpoint-GUID: ZeQ09PensEfcdP9eV861g-qm-G8mX6Ry X-Proofpoint-ORIG-GUID: ZeQ09PensEfcdP9eV861g-qm-G8mX6Ry 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 5e3b59ecf5b0..29b1bd755afe 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -1042,7 +1042,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 Thu May 19 00:35:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 574481 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 CC91CC433F5 for ; Thu, 19 May 2022 00:36:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232250AbiESAgY (ORCPT ); Wed, 18 May 2022 20:36:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232263AbiESAgE (ORCPT ); Wed, 18 May 2022 20:36:04 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFB78114C for ; Wed, 18 May 2022 17:35:42 -0700 (PDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24IMIm7j007814; Thu, 19 May 2022 00:35:33 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=zoLRFYwtfYXgqM94q+LtOcUNb1/hmHA3AWS5gnAarlU=; b=N+JDVqxxOD/8Mn4GZj9iOxD0PhFfZsSptJKhgxE0/6vxjS+bjaBlsbCI+r27MtuqCqhk CotK0IOptqbngIur581OEzJ/GKcyqdN+9TRIDAKvfPjqwWwmr8CiDYz8RinKioymnuel FR+XKdIz+kjg4M2rZDAk78hZnXmoIOHD+Nr7Ib2bH9nsNO1GJcI7Euwgp1F5P0jlb0N6 SD1pNLg7bSStrVz5XogLstIpMRoIHW4rIdVq1GB2qkpa6z93qDnv7/LxT7VXQTQfSdkt twwaL2N99lCRgH0qZ82TI44lwPIyZYn4LkKXfAHLpxbsAkNAYo9nhHeDl5tvL9acsPTu rA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3g22ucajja-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 May 2022 00:35:33 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 24J0V4VG015306; Thu, 19 May 2022 00:35:32 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2176.outbound.protection.outlook.com [104.47.55.176]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3g22v4s0u2-8 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 May 2022 00:35:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cEnFvq9dnkjdNN1+cEvhqupMRgrTymaXv3bsk1OLNNDnwtD3W+E33JBgJnUyotkfYyVKkFAV7JUmo+PS9VQLehfwzOgZdDQNvkisTNacq1IYIpwVR3uSXeyfjHqEMs6Udz8MaiV+YSPLgGeqo+/B9OrYd5TGnThaFuHtGwTvJI4k7kiOVB8czd6Vqc7japSF0jjzJTR3e8JVF7nXMvl/GoTZstQVdJ1ycDSe0n6YRzrC8l+yrIyhnkmugf8x6ztWjgnLdXjxwvFWDCsCfi6vDXCN0ffmgo+toraDkFYYJZ4B3METSSRokUA5ErcMzd96PoY8QwAgSjjQONG2pprLkA== 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=zoLRFYwtfYXgqM94q+LtOcUNb1/hmHA3AWS5gnAarlU=; b=EOJTtZtevOvn6HdeVQbb6Sl66vB14Oe+6R1mMe0x0kU4z5kVCvXH/plDKiHKtT03O4OrUwhcHzrxMRxhF9jlMyukfvDd8xAXMbm5ZBTHt3u9BNUdL4bXI3EV8DEVMyJc647f6GlQHCqEukcXZkzQ69JMP2QS5WmfVQnGUSiaK42RBKLzhQuvJlcX6eMueKyGZyJZqOaAK2PDOAVQiULD1c0BjxZv4ugzyokvoroFnabAprFe7DxRspTt7qGDq/xxcFntJ/MNwzH+JGeM2mVya4a6pmAxiMGsfIhc+joBauK37ZG3ZfIcDX4+6Rs+6B2qvT0n2issbNW9/bvH+zx7LQ== 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=zoLRFYwtfYXgqM94q+LtOcUNb1/hmHA3AWS5gnAarlU=; b=GNqDNfBsMD4CdIqn+/ZOK3X7/hORoxAd0iYRVT+7XXgEmRNaXNPs2sswJNMEeGqMSUVKbgV/tzRG9ZpGwjOVcLKpha9ZjN+EH61ye4KTOSTP1mg9Skoauu5NDIt+M9SnlaM5Orjd12QatvkxLl3AXE/bY4jsJqFqMqkOxJGMdQA= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by DM6PR10MB3020.namprd10.prod.outlook.com (2603:10b6:5:67::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.18; Thu, 19 May 2022 00:35:30 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b%3]) with mapi id 15.20.5250.018; Thu, 19 May 2022 00:35:30 +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 V2 10/13] scsi: iscsi: remove unneeded task state check Date: Wed, 18 May 2022 19:35:15 -0500 Message-Id: <20220519003518.34187-11-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220519003518.34187-1-michael.christie@oracle.com> References: <20220519003518.34187-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR17CA0015.namprd17.prod.outlook.com (2603:10b6:5:1b3::28) 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: 19c9adfa-5de6-45b8-142b-08da392f7a41 X-MS-TrafficTypeDiagnostic: DM6PR10MB3020: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: 4mrUmrGOB8+jeT8xTV3FG+Thpb5b/Sf6KuNtDdmxlWvsPW35PW0wypmiZfyrtxP9Xvt5zpOqfupb0kyD8F1slVg53HcX3XkVi9fp5OBWqScT8rwmJbmk0LW+wNgU53rQBAAypHl/junzKziYQ2j41HbyfVs/YAt9GYH08klM4AFq/nxX2ShTaWPtA3yS/Ah6jbRLo0jM+PKe6oZfrGNev2nWS00/Om0u/ypA/WfRoD7p+DQVQdcMhZp3cfXiaHZUia+q25EoYZ1EwNUl3yS3QMlXCE6FRj9PJCXtqNTnX5kIN/cu3ZmwUV9I3p/zYW0cunnoYSZiKpL6A6aLyQUWbOUYV61e5Pz5Xf0tGfolNMvxbE2OzaVmTIOURMXaclj89K+56m16QO4xLVH255JbmNVmht1vQEO6AA4sCDXySC8kcGCRXVTnt1aS2QZiL91VY58NEEQD32DvPKlU1paQGsYH0PQMQv5dtkJvB7WTClpwjnubaLosm15n/5IKTgF1cYiCeEitQRiZmBYD6B2Puj9VVa/vuFQpSI/6r4OErcoioHFPdmp4nX6GVwqncCXMnexoB32tr8wQqIDsHxkNwgTFeJWah9zLOVkV41EWfQr8y3CuJAx4+Zghx0As/eaUuUi2rvngAEMRdpvlBbbZS55CiBiqb8LccP8KVs/C9Hs6/9XIBADGOm2ONdlVbMokR0HBBMONo2O2a1xfMC1RwA== 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)(316002)(83380400001)(54906003)(186003)(66556008)(1076003)(52116002)(2616005)(2906002)(6512007)(36756003)(26005)(8936002)(66476007)(38100700002)(86362001)(66946007)(5660300002)(8676002)(6666004)(38350700002)(4326008)(508600001)(6506007)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xmtmUxW2yOm3k7WbFReztTVbmtQQcbBYHRW9KzVxvp5zZHlcUWKF0WLbRcGIvdJHgaTsK0qB2EFfIEDqY4DntgjF7Vs4ryfOL4zlODZN1JCrtzsxxmTzhp+iez8bOTu23FBw5t1/elTWYnRIBmJQrWPF0pzRAgkYVRjQBqdSJbt+5MYkbk3WbGTjYCs55PUj8CFABWqxPIAniHrlqWt8KCeW6PMfJ7Vk9Y08jG8SwDzp1RO927i7+b7bmUHlZLwAWH7S7EocMHma9KFpb9ROf9IHOZU7vOHPh7FYTGm8uLQjhG34qYuKx0rMMVTQi7E0hv17Ic4T0aWLyDvAhoz0+dB3KytNtzmVQhyLEoTzffCJAHmJMooBUOYakYYWR7D5VBcmIfipjXAkOu8kTMfcJ0KXgfUcVuUVA141dBASD0QVF4ShdL6IBMGWWLMyYuN9oHtpiwERKaq47y+jkkqprPV871liUMX86GHp4jdQSnK/Rojt4t+FCe9etVefIgXk68L0Q/VfaHEJwwW4cum/5stbMDHANpr/nkKj8a5LEsrDt8NDkOLocPRG3TJczFvksz+FzWsmqf7863hpTnAMcd2VRBQQKrA0JyQcV9AGtk6Z6TqoF3GvdxAzU6/lEGtzMxlOLPDU32dhtF0UUOINxuas7C1X6CJFr6LGdV5C8wmc44d0l/IyNK6hzp3HiTXhkduZlP2g+r01e9+kAt0NJ/kqvKY4mFYY9IKZylGtinu4Iifzh9LCESo5s59bGXc61NvByBGZNV7FpDr0tVte/1sJKKuDHP5Aog4SFQqQK4BxadoMYr+3fTPa5hCWXwZ2Q5cC+/iO7dntMQaI9SDxYESw2T7HsPz1ywKmGjXYHXXILn6GrgKGtXOtYeyP9gAhC94q1mBjLvST/V/bfE2xGSWH8MOeKU6mXHR/enMaRW9/wk5Z5LtahHI7fAinjxmy1kuLCtVFdt2O1j8AW8Icqn44TmD/6RhHLdQ+bgq8YYv5rRaDDWBqcSP8ka5YkJNY5d8uUWOLhipYXCIgVBG9unH92Ep+6Zm4DRHOq9s4HGa4rHAhupH6TVxQwQlG0IZ4mRuJwZTvfFE2IuDwmZzGzR2EvKBHrYYbgd/GKJYmtITgmNNkzzzKgshxZCsFZvTDvzXz+8ANEte2QBy6DY2/Nvp6ApvGiJqmHHz1NEiiAAMcDf2Np0g7qRdtwDKAErSZ5EmWt7sRVQ+5F4sbUKr4ZDFeXXbRMtH4SUKeXoM9Ty6I7Zb0tNS1sIguZIeuIvpd2Ng7QJ4WJzRbJyS4qiPxYTxKUwmVnBXw4J48lgWL/yEL1mwKGmkbsKBlz6D8YuP9YEdkeomJZ0nl62Hon59qsIxXQFwK3JjOsKq4WcFWMhAdjzFDuI/QGVTtdLP/6dxhLXintn+sa2Jrxv7gi1IIshEMyOOsnx5EXAm51/hbGxjCydxPDGFpgcelvepSSFG3v8DtDkCgVRS6Iicp2+vHHTTqRlyYcpiGCc0cV3xNAQVfbh/XAKbHmUgiFKzUivOOWOEgAlEeoNxbg3vLjrDGRrOvvpUXkR/7GSKy64rfKyr98fZpgf6uEjAoIjIKa7gRZsqyIj3ZeZeZbf6MCRKRJHqxQUhxPWxQRox8kToBmMvmYpJkibxwu8Y1mPNdleVKkGeCdYOcLM37TsWqhMKDhgULsz/R5uTXT09WGn6dABRweJYP0jXLZKVUhllkJyBKU1jx6DOuTAnTwJ6paeKHvHOsRbBihWpeqjk6XCfIAJs= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 19c9adfa-5de6-45b8-142b-08da392f7a41 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2022 00:35:30.5084 (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: BG8gnvLGrSPlhemK/whwWt3Pspbpjq5OWFt735WMZ0fnmpeCETkR6ac0HlF03D9ZPgkGhHkhM7uDx8CjyZPkDsRaJD+lOST+DZGvWu7lK3c= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3020 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.486, 18.0.874 definitions=2022-05-18_06:2022-05-17, 2022-05-18 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 adultscore=0 phishscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205190002 X-Proofpoint-GUID: cr7Y1PD83pcRUM-MDyiMM2uS9FbndTos X-Proofpoint-ORIG-GUID: cr7Y1PD83pcRUM-MDyiMM2uS9FbndTos Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The patch: commit 5923d64b7ab6 ("scsi: libiscsi: Drop taskqueuelock") added an extra task->state because for commit 6f8830f5bbab ("scsi: libiscsi: add lock around task lists to fix list corruption regression") we didn't know why we ended up with cmds on the list and thought it might have been a bad target sending a response while we were still sending the cmd. We were never able to get a target to send us a response early, because it turns out the bug was just a race in libiscsi/ libiscsi_tcp where 1. iscsi_tcp_r2t_rsp queues a r2t to tcp_task->r2tqueue. 2. iscsi_tcp_task_xmit runs iscsi_tcp_get_curr_r2t and sees we have a r2t. It dequeues it and iscsi_tcp_task_xmit starts to process it. 3. iscsi_tcp_r2t_rsp runs iscsi_requeue_task and puts the task on the requeue list. 4. iscsi_tcp_task_xmit sends the data for r2t. This is the final chunk of data, so the cmd is done. 5. target sends the response. 6. On a different CPU from #3, iscsi_complete_task processes the response. Since there was no common lock for the list, the lists/tasks pointers are not fully in sync, so could end up with list corruption. Since it was just a race on our side, this patch removes the extra check and fixes up the comments. Reviewed-by: Wu Bo Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/libiscsi.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 8f73c8d6ef22..72ed303184cc 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -567,16 +567,19 @@ static bool cleanup_queued_task(struct iscsi_task *task) struct iscsi_conn *conn = task->conn; bool early_complete = false; - /* Bad target might have completed task while it was still running */ + /* + * We might have raced where we handled a R2T early and got a response + * but have not yet taken the task off the requeue list, then a TMF or + * recovery happened and so we can still see it here. + */ if (task->state == ISCSI_TASK_COMPLETED) early_complete = true; if (!list_empty(&task->running)) { list_del_init(&task->running); /* - * If it's on a list but still running, this could be from - * a bad target sending a rsp early, cleanup from a TMF, or - * session recovery. + * If it's on a list but still running this could be cleanup + * from a TMF or session recovery. */ if (task->state == ISCSI_TASK_RUNNING || task->state == ISCSI_TASK_COMPLETED) @@ -1485,7 +1488,7 @@ static int iscsi_xmit_task(struct iscsi_conn *conn, struct iscsi_task *task, } /* regular RX path uses back_lock */ spin_lock(&conn->session->back_lock); - if (rc && task->state == ISCSI_TASK_RUNNING) { + if (rc) { /* * get an extra ref that is released next time we access it * as conn->task above. From patchwork Thu May 19 00:35:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 574859 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 83FE5C433EF for ; Thu, 19 May 2022 00:36:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232257AbiESAg0 (ORCPT ); Wed, 18 May 2022 20:36:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232180AbiESAgC (ORCPT ); Wed, 18 May 2022 20:36:02 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B6C0EE21 for ; Wed, 18 May 2022 17:35:40 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24IMIl9s005304; Thu, 19 May 2022 00:35:33 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=3i4+9y7IW+DoD39ITDlWkaCbxM3nYoEfbu4eyizCAFQ=; b=q+lqmoMbfjn3N3X/dcPPS36k5oghaqQ4cNh0KNJB9a/Nneyj3fb+bK8mr5tIVY13sIc/ qKnmyNBAt3EDu5gDoY2mpHwnMqJ8SqFiErbDGmKn/v0omAQwgTaKZBKOzbTBjO+Vn1I/ u04lfzlRrx34zhE0Mv4PDOi/fee8Vyzlgp+F+7xXLz0dsAu3OFnrCPs8/swlzsunWBZo 0djHPKlus4mYt9HqHQdfyAfrOKiiaenhHSWN8UcFkp4pc3F1sDVR6fZ2WvDnuP8T/pwW AfgETLrfIrIcGdnmOTnnzmOu23E4jk/Iy0a9akHBtpI0j1zYPWo7L+iBH0kiynNNsoCM Dw== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3g23723167-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 May 2022 00:35:33 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 24J0V4VH015306; Thu, 19 May 2022 00:35:32 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2176.outbound.protection.outlook.com [104.47.55.176]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3g22v4s0u2-9 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 May 2022 00:35:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ITrzMsG3m5PLRBHwkZHrQOAU/6/jzp/fX4JrMKscbEgnWzzZYJkuQCTofgb3wuunQocPpd0lI8P0v4RDRz7+MbIYbSM9DQ9iZy7GzWgsbY+LJfCh06WfWPMir+KSuMnx/XTpA71N57Y7H3umUDub8N7g9ZPoZ+cPM+K1vmZkrSsvplZR4bRWNNoDDRAuuj7prlmgcM6tE3iC6AgxpdgYMTx9Vj/mWRXExqjk8VLi+OhhK2jPN8lD8LTrp56tRcnaiD21ySaosq/9qsD6MASqe2vT1TS6QFt36ELZKR7nOKI9hiouyyccuclGXfieiLukTqIeM7kXhwhZzyrhqX9rYw== 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=3i4+9y7IW+DoD39ITDlWkaCbxM3nYoEfbu4eyizCAFQ=; b=WtRGad0K9KvbBnizbuv8kwlv7+GMiECAhe8qSYtChTGZDpf1p2aUx5wYy6IMvYEJL53u7a4AuWdl24L2Bx1yQopuJTQKtjdOKNH5SCMZHmqAGaNQtl2MSXyqYrco81UniN6EXKHuJS5pMxpLat+oo8NgqBL+3Ac6ieXWVp99ASfqd3sfcJ8zGzeOl/A32r8G0v6s2xmP31B+hlxtZzZ2Hi3UbEXO0uzljnDBx2qFfSBB5tP9bmQqK+/PwGR0glP3jNKfOHEoIfOIokRmiJUqgafbODliYUePXeXcjNP9OsZ6aBAzxG/WcvjygzT/cM3ij1vibt+6Ah4ZDR76JYKyiw== 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=3i4+9y7IW+DoD39ITDlWkaCbxM3nYoEfbu4eyizCAFQ=; b=MrZ9TT2WDjGBNIYAvfzoddmo1QFaXW+x+wEPnYCXx6KP23+1Bhts5uQ7828z087bKy0sLLUuEFBJc4XLRvmxCRAzKPgG8rb0KLxwL3Kv9zvltnYYpY20R+KDTOuD0NHW998f4FRp6W2zvK4vg84UbvGa8xT98xnAxYSmNcnG5Ek= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by DM6PR10MB3020.namprd10.prod.outlook.com (2603:10b6:5:67::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.18; Thu, 19 May 2022 00:35:31 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b%3]) with mapi id 15.20.5250.018; Thu, 19 May 2022 00:35:31 +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 V2 11/13] scsi: iscsi: Remove iscsi_get_task back_lock requirement Date: Wed, 18 May 2022 19:35:16 -0500 Message-Id: <20220519003518.34187-12-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220519003518.34187-1-michael.christie@oracle.com> References: <20220519003518.34187-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR17CA0015.namprd17.prod.outlook.com (2603:10b6:5:1b3::28) 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: ebb10beb-5fd5-4f66-0df5-08da392f7a9e X-MS-TrafficTypeDiagnostic: DM6PR10MB3020: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: 4ukLrxpuor1mKGNH6S8mBQXSDTn6TQlFXu7tigXhsla9pnwAPfXxQm/u/PL4qMDLp0jR1tGZOWoBoqw7rZW7IXWogJkqySrlWCDt5fwl7GC1Z/0HVUQZq0N1EAqhD00M2aW6DaKuMA73ilY0HsFc+Pwxqlqw6st7psUyKcnM2KFvIWN9KIednAVIIBw35mUA5zs26fuwukXxF//7SDB1OsOoCgxpLDl2Pq30O/QW3WF1mJRtfK8uA2K1p/dmnrRkH9uOI2GNlk3NCbIp/Z8RaOOTtAIANWcbQX5hFSHxwyqyUJ5n3g12oT/TuL8xy1kgIDmJfpwMUeaQvlOSz/pNYb2ZEjYIDzt2i3UlOtxo6RgqqZFNy8u8DieGcBk/oIG/+Z9gzzs9B/JA5A7c4CVsq+P4ex9WhFLqXPLC0VB6SlR/btqu4CSeSNqxs7Zd6A4Pr0DAVS+GF9TReN10ZDD8HomWalwn02s/VmdqR30x7/XrUd5B49ZSvuf5ljpTPB8aDfT9cdqNBdn9IJOAM6BdMuH4hAGzTb/IbqfzzGZanNkFK9Fvx5u0HbZF6j1rkEf8gdk1a17uXaAASwDSh4IulIqpYxUFM+svQvmS+hgPoBCrIQ5TqQwa5haN5ZHOzLeKPrf0P2qjY+RXKVuNXITVZrSF6iA+LPM0e1NUpGvJLSqSxxgSGB/a99ZV1quXKBqn3boRV/Au5u5fWhNYRGgkDA== 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)(316002)(83380400001)(186003)(66556008)(1076003)(52116002)(2616005)(2906002)(6512007)(36756003)(26005)(107886003)(8936002)(66476007)(38100700002)(86362001)(66946007)(5660300002)(8676002)(6666004)(38350700002)(4326008)(508600001)(6506007)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UignjSxdWGRrf2iWmdwTTF4KPn8ShitxN+QNEkcoef8Ns7dvJeSiHq6VI1Uk04M3dW4ADJiNpzp/MiIs0tvYKuQhqS7HXUEsiUuuGSKKEVrHvk82uwZ94LdMt8Kq4jEETrFtjPybrHs20iSf5TU/p20HEEvQseERn3rKEIlDj/gl9U2W55LzhDo7am51So68x3SQX92zVMnjohJ7Nr3ssuH1Xx3h18tnOylBGy4+LoVulfdU2VqY304fq0dA2J9j69NBSaz+3erQ4WntDzUJL3pXN97/+YjCtPfPPETkLJdOq8z2+l8NrnJKi4yOvLEDQIrnyN1ka7sDzpuEeodtnNcDWh42PRzWqxCkry2yL2PSohFCJhUVvB/bPhZpa3bW6eQ1CUtcmL1Kf6j2khVzHBaHAenlj3U2XDVe9UVBK4yin8/yb3c6Y7h0aKT5R78/fFRkNwjZusp39RvhF+XZEUXdKVkAZKcIv6tB/WmqmoTy2hIzw/lzSaH5E2ioXRthW/jEURHZ3y91F314/Zq4qJ5gG9GNJ+cuNUqq+L9bz9fGj6gmxgVFotFFt0yYjdu379sIrTeMwF6MwpOLQzTOK30Y3qrYaWvFQmAi2U8PPFX5NYwyVCsJ2aeqQb2M69aP8CLH4WFNTMoix0x8ryHpRuiX/SacDaw7Zcn6CUIizFM6H+jyXny7XJ7k3Ppw8YEz/e8c8W8OpjX7j8mx7i70yquLIXdpmhQNvIQEZfWzGhAnJXpIQubIlO9t7CwyWK7yAFqoKA43QS0OCiBz8NA7VGsoak3lGIhOm+YI+5qxVHtHQN0ONAbI4k2EGsYX5y84ZzfSmQfWTdA3Ey7K+owNrDpANeQXY4zgUVNP+nSC1fpfarODHEWDi75qQ0urodQhs3oA+D8Ktpi0DnpOf80pnOqTcemY3RW/x6OtdA8Wa8OKiZuUicOpeoh88gcxL2zLksJe3iCwia/HGM/xwLHF+O/z+C2x/cyUHk89q/H8AZ61d1Jc84Dm6VkPv7GzH2TqgX3+a0lJG+q8Wu7zMK5BPV+uHfVUKH5VOnbZg/VE/OOeWMxRSZaR3kfr2NVKOnuoqv8S3fJ87koxCC4JXFtKdVbzMOCr0jtrAscazH4BzCvsaD1opZmdwWMzLapmjSlNFwnL4iHg8rYW5MrL6l8a2bz8s0xGPGOaNL46cl7A4NiRmt0FiI3VrpSvAkjHu/Wr3+goJTJmPvgTe7xidh25Cfx7+gDchfutvnTDg2ZR8BxjyTSOXEgia53vVucF1LClnhsiwHKj6SjMjEVpAvvbZO9r5/V7y57xp5xH4+T7mqXSUXzMJn22fBivI1iX8RtxRXyIYewCkP/1FCgVMnASvRjOLH4lfpsHBEcl1FyyZJJJ65opQr4VWmJ3lLTze+yrHXav8BlpmGVPwDW6KaKwLqaD8+ea8f64fxlKih4n8oyYKTSXoB85I3sqkTIUNVqXL4M2RLL13u9pZTlpKZ6r43IUGGjAYE/qdcjzEoYOfm63KWOCfwbenL9pvEzKNMJArerhDA3zNDiP/2jvZB+kFr2NBKX3PML7u5/jZwPj4iEu5alCnel9dZndZQC7Z5XfFBFcvheOOZUTOpppGFJya8iOGCDq3PgcHy1BpayKj5ww3sd1/AnA5er1Xlto58vGrOLuQiNrFDqoFW8Mp/e8muQBQE3W2XSyDUS63GAtiH6YNQZrI5TXPd2CZ8Bx+ffqS9+1XKRb+Zi627J+bIMZmkyw0plALVzgWl58aN75+gU= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ebb10beb-5fd5-4f66-0df5-08da392f7a9e X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2022 00:35:31.1177 (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: v7qA5bFYqEZ0em8fMNILKs6WQWIJC0GbahPBiLgWNXd/ogmR9dVF7oc7LuTDCWwzhYB3H58w943/z9DRATY3Zlzke7+XJTnylGHWAv199fg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3020 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.486, 18.0.874 definitions=2022-05-18_06:2022-05-17, 2022-05-18 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 adultscore=0 phishscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205190002 X-Proofpoint-GUID: uSGd1BpRsxSBnIUD3leOPaWlM5rIHtGK X-Proofpoint-ORIG-GUID: uSGd1BpRsxSBnIUD3leOPaWlM5rIHtGK 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 02026476c39c..50a577ac3bb4 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 72ed303184cc..dee6e2d5c86e 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 1e7c5c7f19ac..7baffeac279f 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 Thu May 19 00:35: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: 574860 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 19C22C433EF for ; Thu, 19 May 2022 00:36:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232240AbiESAgV (ORCPT ); Wed, 18 May 2022 20:36:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232183AbiESAgC (ORCPT ); Wed, 18 May 2022 20:36:02 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B4511EADD for ; Wed, 18 May 2022 17:35:41 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24IMIl2m005301; Thu, 19 May 2022 00:35:34 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=TBeg8CCS7OgIHpdG+6/WUDHhCxTLd3NX0pzcz02Iwco=; b=QDo/JWbfq+OX9GrZYx4Y2+wG4QYGx0u8iijVeDScJvyjE2CIbwLXw597wum1nNv7PFgk LkgX1KApBM2YN6F8mEYqHTZFRIX1VNJVgVY99ZhYfTzxcrHfOplmsjK+TTTljFWqcBUJ R+JRSypOUOARqeUNxjgu4iMs2yHD81KMJHggDwcNAQ9RN2k7jJFBJpDZfQ3v+NydgiT0 tjv1+BWacnQNFOqEADD5Oa7kZjsZfYYiqp2f/yZwzu92aqsMxXM7duVLJm14f+sfKhep fRYSGpXnj6vQhkpYJQyB0a43ZDOSRXzoKsFeDBS/FeaWFKWUbGXwWmY0+jGDW7CZyoWd wA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3g23723168-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 May 2022 00:35:33 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 24J0V4VI015306; Thu, 19 May 2022 00:35:33 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2176.outbound.protection.outlook.com [104.47.55.176]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3g22v4s0u2-10 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 May 2022 00:35:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X6w3TEEpH2waPKAcx+Ks844w+TEMTDE5a4EYeHcafX7zRuwPUZyRt1vV2lt1PXENngiG39uIqmjpTTH1RAEpOwZRThCNgp/JLolPMmu7HVO+B+eoLN1QaJq6A4MPkfsGZoBmy1uB8ycwYFm5fI8MZjmjshbNyRJZf5M5vokdMnhL0K4fXPUrFzutd2MsWAJtbkm3Ne4jhSMc3qteKICTIEVCNmZB5gZZ20Yex722SXVf1b42MPZnpG5YFVdjrzjTfuMBn/P7LiDHWGsXSHmg+IWTD/BVoEjEEMQ+sEUbS3+59cRKL8mbhnBcvImF34MLNxaCTRoM2KztaaeEz9iCWw== 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=TBeg8CCS7OgIHpdG+6/WUDHhCxTLd3NX0pzcz02Iwco=; b=UrpueBhpkjh9FuEbjJN2Qqa/XG2igjghRsqhs2VNzsbxUoKFUZUb6YJSOmi0Zasb0N6B6raKo/CHN454cmyzPjDs+HqPM1vR/EfWyg41Z5sZ45n0UoPWlJ4UHxAyXN7le2FE809Edu1EX4/9XXl26YEKNdycyhOtXPD/g1+c6K5D8OM0fXZM7K3W79AYPLZNas04ukA6veOm/+NvgKYaDudqm6sjsV0yMulHltp3g1RbYGOGD7KEi82t/03jaL5oH8iRDfQnx3T72kF1TncLEEl02Hn9WcUw5hXJEn7wI67b/KMgxwl8HITjgmrJEaqmDsPF5rGcvRI8px2L7iEuQQ== 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=TBeg8CCS7OgIHpdG+6/WUDHhCxTLd3NX0pzcz02Iwco=; b=Z5BahZ1sQvDBE3qM9PfTB9n8rwVE7vOIw/nPZqYfgoUPBYIpxfGKyWTXmr4MoO+5ctsqw7EqX5AAevFBncDVZBcBoQYChmhM8TqumeeZAykE/9L9MToEYIrtNH88RrtzNN9RLcX2+1t0NCvGjJTkZJB1TAE9m9PMvKVDpjZLIyI= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by DM6PR10MB3020.namprd10.prod.outlook.com (2603:10b6:5:67::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.18; Thu, 19 May 2022 00:35:31 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b%3]) with mapi id 15.20.5250.018; Thu, 19 May 2022 00:35:31 +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 V2 12/13] scsi: iscsi: Try to avoid taking back_lock in xmit path Date: Wed, 18 May 2022 19:35:17 -0500 Message-Id: <20220519003518.34187-13-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220519003518.34187-1-michael.christie@oracle.com> References: <20220519003518.34187-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR17CA0015.namprd17.prod.outlook.com (2603:10b6:5:1b3::28) 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: 01ff1379-6cf9-4d7d-7e7f-08da392f7af1 X-MS-TrafficTypeDiagnostic: DM6PR10MB3020: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: jz5h0r+xmKSiLBS9bpIk89Xs+HIu8rNRPNf3DjpO1OKMR0I03WqBw3eJmfbBe8KVx4oSKxQQvfJV1/Jra0dpwwNTRtx/So8j/jp8uXa4+u18w8D5qv2wEZ6gQ9uH5/ktr2BDuqV+k3zxzj4Cv85RSeaFy8HPC9RTB2MyBic8/wktttN/iF6jvsQF64obP2fqd7A6nrhVFNA5OeHCt4V8EG71xCdYaLY9+L4c2kiOILvFmXwAF6+C9duK29QfUsuJMrOEVn7bn+ggGjY+vJAoIIh/sOMZzRKd4D6W6Wnp/aPIrg9FSy1ahEqGF5voweL2I6QF2uVMeu7c9x/VNHbDcZWW+XKizw9mxu7v/e2IxTG8oBbFJVsrmMQpU09iEcTv3K/2bf0vwQLLzxeLCfubxjH7ShzpVagnFNvbxlATuJeqe8Ct3Y3pXm8z13I/LOwB0gBwbgAY8FSdq9Z35k4IlRIwPyX5KG79u1ROHCuCXJ/y78yXYeHGbXj4M/zdc4yAYvkhMDR+gbEdJ6lYtJ48DKq74wmQR/zpsSPx5IJG5pFi5AdFrGkzobtGuDmSLxa1/oFO6fK8mVhTzS5OKX3bmN+Pp9wJSCkqNWjK3u/1fu/EIL01YEdPRMWkS1f4fZ0sXzr31i6tiNwPe58sGKZS1amCj9TmAtkDOiHXsgyfWpfXHt+ivWS1wKXCbvxU4Xjs6cA0K9/5Chfa9ZigfLxIPg== 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)(316002)(83380400001)(186003)(66556008)(1076003)(52116002)(2616005)(2906002)(6512007)(36756003)(26005)(107886003)(8936002)(66476007)(38100700002)(86362001)(66946007)(5660300002)(8676002)(6666004)(38350700002)(4326008)(508600001)(6506007)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WtAPuG9eap6xYmR1/T+aGNd4SGigQ+jVcMKvJKTYPCBoWTMAC4NikgA56UMChue1Yu5LQek3r3wXDmeLWTaSzqj+HfC/SNSFlHDci0aFYBFrAnlwQZr4Xfq01IFk/NxiH6Ig2aJVBf6slfxRXKIHiovBXPdb7Sk2BZC+egb/7YxhqtgN/JQd5qgjkeotj2yAIKC60M6YmWTKnhHsPHFIJ1PXGUC4OT1XPuhNU9fFUiDUN58UHiYhUE5eHlZKqLRpBE5EQTXpY7oE56tpcIajZDO+BOIxkuzFrK+gwIk9ZHgVJT+4lkvNwRfOsm3YvcVJ46L2OOmaOODb/o9vg2SpHfFDqU3C8TBJx97pIVC/5cYCovHBavJOAjImmIaYdDKx28q89a4lPdvud+7ia6BHB1fkecOS5jwx2M9lSGtgFpZqbEVGRwEeIxavlNwQTGDcwH23TTT4MQuzzKrUcrJChFym3ITXuLoQvv+kIxN1nm5CoF3fdTENsvORLoYTmqItsfka/QLHnXkWWLKOSRWscxZdCAz77qL6JWGmQQgzhsE6zJI/EPbopOzxQvVkS+23a1Z6m7Ua4eq8MQPjM+uUILbjJpVuJODdWeDrVuNLoajBqfzfL3WgAfoZhUCweSCA8HUAm5yn7EO0mtC/nT9EOOtNpomPhNGjeha+B2soaTg0Fr0lpRlKV6xTxS77mlH095jG5V+tHUNzAuABZ31asdTfyWGJ9Ms/KIJpmsER8W2JEyDtWysn6LKz4Sjt6A3cQaLdXb14wBcuBqF8fNsu+0PQqJLMeJtYd6lGg96EHvwlYZW2Jhyu2mLMh0m/rW7iNl6RKuW8timiiz8+YNEvdApHlzB5svCKmzCisjyDikMrZWBBImaUZxjiOdrDiUSMT+tJ5y5Z5CiRFuG6fdE3j0wHheOaMrbBScKqgThdu2UCNuKWT49nAu2b8jZVcqtdN6el7f4oyeTavm7f3ANpnQ+ihw3fD7jep6PkSQbwpdBucJwJC3GiRkoRmYxRhiUwjx2jt66qclevmBI6/hRprfsIOCt4Koqsgimk9/LjcNp0ykbwRkyf6hAfcHHjVdN9ORGK6xgukltdIc0vfofVcFOUg5ONkdiRFLteIIr4MzY2++kLcLO6WEpmn1UWcj0A+1Mo3WwapruL13MiTqJBtdApg46YzD8V4BRXY9nJ8eWPmez6dmExJYqw/3fO1tT8ERIMrCOwk8aLtJlAqnqZl7BKRasUVgo4esh4sg8fBlmr/BzGhhDpvKGm3Pb+GlzkYGiywLXkjX6WpmIYFr/Jia72sYTfND9SL+ZIweLvYlSkYlYyT0uPJQMRjbQECuMtliZr6WpbLI/ptfIrgM6FWIPIv84i9TL/A6heztj8NyNzob+I67UpmtY+lv0YOVBBOqWpvWFv/foy+qXVtQrQotY6UwofVuOCF6K13rdFnje5FkyFbUFJ6OtWMRgp8nSQegqW+c2PUeKDgdhBrMc2WtrsXZ5f4RvIle7Q8HHdwFRmcwkexgu/nYtyTTB4xj4TN/DiZt7aW2lNC9Y6jXpT4kWS4KtXBumRSdFhL64++R3OvJbWVDcopknd4rxFl9H5bip7bYrvTzwozqmQYHdVi4Dgrrh6HdqL+dYLQtr9s7zWUs5Kps5Z5KymQ0ObtKRkP0hcrk+HFkqe4iNiAVoJ13wFQci+KYHzQs/BhLYWiE+BvdfCx3Us/7j0ve2dQ8P/1HQVpuArzg3+lTTVcc19YvCej/W2qjjM3Jh96uEgkgg= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 01ff1379-6cf9-4d7d-7e7f-08da392f7af1 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2022 00:35:31.6176 (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: FZjaxsIrMekN0XbmBQTiP/IxxvyOivGN98cwtxAEIjG8WOpe7Yi/M/pD+tEZWLMZ+OsRyFBH4pifP3EKpH3Smp/fyzIaeURzSHV+I0RL8Ns= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3020 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.486, 18.0.874 definitions=2022-05-18_06:2022-05-17, 2022-05-18 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 adultscore=0 phishscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205190002 X-Proofpoint-GUID: u8UKp_o7riO4wKb82opNdYIMAIyVxWQw X-Proofpoint-ORIG-GUID: u8UKp_o7riO4wKb82opNdYIMAIyVxWQw 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 dee6e2d5c86e..2bba10464cfa 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 Thu May 19 00:35: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: 574482 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 6E3B0C433F5 for ; Thu, 19 May 2022 00:36:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232234AbiESAgT (ORCPT ); Wed, 18 May 2022 20:36:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232203AbiESAgC (ORCPT ); Wed, 18 May 2022 20:36:02 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A45F5DAD for ; Wed, 18 May 2022 17:35:41 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24IMItWD027473; Thu, 19 May 2022 00:35:34 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=6FEjvaY2qCVZWpCHdvZyWzWdPEteg7AlesRGJOl2g5U=; b=OkywGtEctvvjAAW2vSNXYW1hGrwLYw+O5t5/yW2+pX5aybs0eoTSD+Z85gNBstSLkVue rwzvM6405Vi+WRMIrwaP/r36rz6VcFaySCNtlcV3SrQsrT+23pVlV3QiXEaJrqw2MmJA 6u8CNuynsA+x5+xArjCz27qHsufiraZhio7U2I/yM4JECL4R1lBoCMcsJtzvW8/2UJuZ hzmy2O52arXYPzZj/WF2lOneXgr/pNoSfKD44TfbUo045z2iWmS9XuZJ/ZqKzExXSG90 WvKVaZDmPsUoIgmH7TXIuK7NCNSN6wvtiODXh41Am0d3t1ua65O1KG36uwqUtfpHRNV8 tQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3g241sautk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 May 2022 00:35:34 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 24J0V4VJ015306; Thu, 19 May 2022 00:35:33 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2176.outbound.protection.outlook.com [104.47.55.176]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3g22v4s0u2-11 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 May 2022 00:35:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NNel9ilDycjXtXXtN1CQTMMG1YKVMv13+At6zI6hatJOgkm4dA53ZeuHisSYeEGOCMUGsNw/lFXX5EPjzQdzdMlRlegmMm+fHXme13GrXrv+YE5NWO2RYyDpXqni6h66dFSReob1VIPCGDiBUULfqH0f06UiNRPv4iVk9EVaqRHj3ZnK8HpMxbMuGt2tFXwB9BcKfEDmjhHhEWTbNMezgNeH/GjKh82JYcUsxexWXOQ8CXAa3ujXEvl73YtLSQRFSi2sUqOW3WwNY1Om2/LrxsigrsLvj3ybuEkA5ErkkS6daVnbno2WGzY5lRp2x0qpRzQTX7x5XVtmvyHCR76HtA== 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=6FEjvaY2qCVZWpCHdvZyWzWdPEteg7AlesRGJOl2g5U=; b=IBhsTWRnDuub4zFwpeXsA9M2jVi0Secxea0IcNV5zF2bmTpj6ja29JsgS9YNG3aCUfo4k68+SGRRuHbqdha6nvq6k+hpPqbU11DwdKKJVV3etflXeakOykzVv3nf42/wY3Nd2e/Vn6EglETqgJ68ARVtb5kYauxvjts/uXaJusYPCacYptc0fvxU4HsrfzV3BOrJIuYAqyxiUjjcrOYMmzoS50RDJCGBvo7h/iAXRY6WrSq+78fmNfm9xNkhO9EKk72domwv4VT8n5FZMZa6aYsLMPdViM7BMskghCcHP8CenkVmj9ooy93pahyZbPHNjt32FjLHNS16DQ/GUYFtfQ== 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=6FEjvaY2qCVZWpCHdvZyWzWdPEteg7AlesRGJOl2g5U=; b=UsZrBlezuSsohsFSrTQ8L6EkcuixQdp6mlEelztsxpz8BjhW1mtqk00DC/xM7RvHudr/2WtalJ5lQrmjiJRqbjDZ9kLbQBoSx2WgPSQ11xeLhYf6oxJyiFrVB/3oiuIYYUUe/jmoGXvS1Ec1R5D6FdeosK5C7v8IGOt++xl6L6o= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by DM6PR10MB3020.namprd10.prod.outlook.com (2603:10b6:5:67::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.18; Thu, 19 May 2022 00:35:32 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b%3]) with mapi id 15.20.5250.018; Thu, 19 May 2022 00:35:32 +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 V2 13/13] scsi: libiscsi: improve conn_send_pdu API Date: Wed, 18 May 2022 19:35:18 -0500 Message-Id: <20220519003518.34187-14-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220519003518.34187-1-michael.christie@oracle.com> References: <20220519003518.34187-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR17CA0015.namprd17.prod.outlook.com (2603:10b6:5:1b3::28) 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: b4bf5059-e424-4662-a144-08da392f7b36 X-MS-TrafficTypeDiagnostic: DM6PR10MB3020: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: PLRp5MB///kyAtExGYHk5vP6N//9zJsvucD5H9OjSXTeZJUoSbcr1AWMLBFM8BYWSi4ZhuHFFFTvN2VEVdLfG+aOQkdk9dwSOd+ZwtfuP8Hr32wbzjK2vL3XjheNp0xj24ULUfJ14jz7ldIvAbYTndt114h3kUOldlnMuWnW46oum0cyMzStxWZUTLEycN3A0pk9R+6D2uqN/vcGMEN/b2VNRjI/GcSRy78/yWPeZMnZI2OgcfO1GpNip15zYT+VC2E+IrtCvx1MVbe0rDwEZDQZhTMLm++8OEm8Qg4Rz7uW++iGNl3lrZcIf9HHyvoJz3WKysbDY4Jj1xCIBqk6yxxHOdXt+EQdt1I/dEMXO5UpBluUMIHc9uespCpnvGLcI23QfxGVTVgrCvrdVHQbCeNctODNJ5TFipYJZlryJRwAwvnwkhygTqyi4hbt9Bwg0jvySFnj5m2lsXu2HU531LMpTbEuS/356A+0fSVkuQpRyb6kE9Wbj7VvcYSwsiO9WVjgwFHtxx92ep0f0T3LEPBOyVqAJRV/wBMYNrDtPsXXMGmRjzBnjsAwou4X3aDwdYBZ899xqeSM/77mUvaOZkCgenTnTm86334MGIc+ow98QfZzLZi1nA6g9cc7J6x/xjkxFyc77LMqH1su19VpvwOsnnhHT65tGh7jCvmKywBtOD9X575UBjITChiUoEoMg+O3osXXnkF1GOiiqx5Uhg== 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)(316002)(83380400001)(186003)(66556008)(1076003)(52116002)(2616005)(2906002)(6512007)(36756003)(26005)(107886003)(8936002)(66476007)(38100700002)(86362001)(66946007)(5660300002)(8676002)(6666004)(38350700002)(4326008)(508600001)(6506007)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7Q1vO9HuSwfpPtezrGFoNFGPoT7ukT5v7j1zHkDWtBdXIjlmqP1PQWHIpn8zk6X+Hz8+REmAMTrILpm6zu/ayL5itOXt6HxwYsx1p1EgK6qW32Rw2pHykERKS04hGvToH/CjPgbYP9a38DECtvh1NzAHCpazZXwxseHpB8fJJ00nK/7ZTDpYCx62dfsr9Cz9mjGQRin1+5TjTOCAhMv/Xs1FotrW55dA1m+XhfB5gj0gPdhr2ocN2i2XdtDbT8RDX+jilW0sGS+zmakwLUXHOz0C32S4Lpt4Qn3l656w1+ryT2+ci9KgcPO36ADESG78gAJjKH2ou5lli3wTqa+qLm1XyGPPGTSfsAqEOeq2QVDlsFxtdhHf/piXz1Juy2qP7slb0cNTJE9YNsyR6tr44tR3xZ17YlEF7AP3hiFbSWfPJUNybtrfbr4pV2IaJgR1MyAnozB/c34Yl88Lti9ZanOuFUazqo5WmxbauRROIaczzhzanjrWvrPFhxkAMhl7ZrAR2eewuIseHlhIEBV0s030d27kcsMIKViLoAovvDutdIZEGfouZZPvVGw7jsXi34lTamwPY7/gL7fgsnNF+KItsqzi5p4UIQMv/qnbUV7BxAyRa4PhShHxGanYYU8n7/ZnRq6i+/EyoZgXcopX1TIoR3hwySEEJ4l1D85jcBRysjI7sMHcoYnHB9qDRp/9oz320tYyl7zfWaAAt1AGLng9um/kCX+t07PRLAvbDNCUURhZa7vYCwBECWN1afLqxNOpBsAQKpKTZNUAhyWwvoRmkqsIICBFfUkRG3cfj2b/9WnpnAVuMtufJ3donKM+O+DRlXfT8FKb122kmryXIEI0aVgaf4rwTiyjWXvH28SmiDFWFn9WVh9rG5z9ZX3+54HzFTtLCZhETpc52zzfvEHp9CwYfcnhEgy5C4rHjhuqeZwWGw0jVO1vmmicYpIuvYFgOlr8UPrwRBSqZnF1yYeEBYoWsLPEcK82vRSUXYRs/lYq21OMEpaPFmcSPuVskFDmyrti6fCSstLwxZEhCPuNnZHMziQ4z4n//XzWxWeQF2PfG76RYeKicxbQrRtFoVyhjuB36v2kEBPEyxITFgUikxSzTVMYgDSJpfRhSEQHUNPUcPtaE6o09gOjI8GLsw05ayPP0wGenG++n9MYWKl3sgSspFONzKvepj2D5XyHurHSjjj7Ts8A8GHVncZU8GfrW7zxk3Cd6MCSBwk9PEnoVCWO+qNW9Q3B5tVW0a0m6FCnqI/9eEwzOPCORzw5RiJlbOFWlzPW6rGR060Y50s0iKMkdkXihFxSLiHKIDlKc8CtVzBHhBFuHTnR/R2bmo2sIazg/q3Srl30nVfTr/1ef5w7OOXMIIh46hvBEFF4cCNn5VVzSrfvjqR6nybnO/PhA8LoXr+cAsChalyhqPA7N1MDjnPDQZvJ6fa36HTmf/UbS+o8a06SQJH+XOjTkMioZhnfiAa5pNjrloxObKSiUreSM0ZqoR30zre/13LWtvHNb/FGAl94JJuGPcol5VxktKSq8GhQOsmrDyXuDtaOHIdEoaWGmm80l3lp6aDjCgCbQnk/9qEJ5fZ7xqt+U4ef3Ykre4XwuJWcZheHZt6gCM9g0FN/LTMAwDK3by3qppn2uSLeXlSELl+4ydb08Ge1jQFoU5TBlR/TwFfXNTte2NLWQV1kuF286+iBtBOfHStn9pxcc5zGPPILaNEnKX9SqUWMVbCKwlAFK6RAHU3TBmiqVqk1Y8bJA8unayc= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b4bf5059-e424-4662-a144-08da392f7b36 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2022 00:35:32.1020 (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: atO0vUqT87dNhZlv/gD7yhwjvJ3P0uS8QOEcBhYNftOHBsjT377WJJnHcaEccw1vIvkdR7LouNvfnkeL8wK/Zd2blqPUY1bsbXA/F4d05lw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3020 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.486, 18.0.874 definitions=2022-05-18_06:2022-05-17, 2022-05-18 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 adultscore=0 phishscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205190002 X-Proofpoint-GUID: b9bYSe2UKFJpvl-xHKZgfw8CgiEncb2Y X-Proofpoint-ORIG-GUID: b9bYSe2UKFJpvl-xHKZgfw8CgiEncb2Y 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 2bba10464cfa..ea0c67bc54bd 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 7baffeac279f..b3efcd318f47 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;