From patchwork Tue May 17 22:24:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12852985 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 5B90EC433EF for ; Tue, 17 May 2022 22:25:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230525AbiEQWZM (ORCPT ); Tue, 17 May 2022 18:25:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230317AbiEQWZI (ORCPT ); Tue, 17 May 2022 18:25:08 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56D0852E55 for ; Tue, 17 May 2022 15:25:07 -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 24HKSZNC023116; Tue, 17 May 2022 22:25:00 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=r6ZftoAn+JCpElG885086mzsKgInNuIhwMdTV7Q48Cg=; b=QiBJh9TSMEMOSNh4nevtjwPWCYN8hmDfN7DNYcCz4kg54BkbkwdSdK9zIU6WDIH+HOUd a94A8ZObwFYrAGGaXBRwqJO5QQX3yjhoT+Mc/JQ/ElHHBV4LRKuJco+7d+C2CWDutjsB RE7n32ydcQihiqpx1PO9rRiEFMhboO+X73kx9TTT6yyHFs4SDJ51d2WIuzMuL9NOkZJb tCmaLlbJ4/TmXXWDj2MTPex+jfDaNZxJYvhsg7Ll/7hxJSmUUXaN+Eb8twyGN9I/kcrO 4E1WTbYYfS0QO4Mv/8E7IXs3zy8q9ZcNNk9cSlIYk6FfeE10w2cNyFnLW9kzDWC5rrIg 3w== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3g241s7ncu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 May 2022 22:24:59 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 24HMLghw031743; Tue, 17 May 2022 22:24:59 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2177.outbound.protection.outlook.com [104.47.58.177]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com with ESMTP id 3g37cppmnb-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 May 2022 22:24:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m6fceidUmzrxsI+UjlIkG0Zii91hhWlR3eaq7m9+hjz110MM1VR7B5EYv6BG26ncL59MrYzXYhr5vd2VYvnq2ZL4VXWfqH9wpfz28Alwncs/3rXfPw5tmBQxOeqaRCZ4vLdSgObCLTn5l3zVTe6VozvzU9VmcSJrXQp0y7xwzzGoxhbT+8RqpDphhDH+BV5hLoMVbbYL76I8DuIsh3CmlnrQMWOI4AuH09mz3Gdi153j1I5kPJuVe7vpbMxJlSqNJJwHqpUmqWjYhqlg1OkV/P5nVnjVSpMUU1yWmV/H3cvlzgbQRZKPy/R/i2SsSmd1WXXWB244CH5oz4Tu0E08fQ== 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=r6ZftoAn+JCpElG885086mzsKgInNuIhwMdTV7Q48Cg=; b=P2EROlDVkZHSvBXCvaorXA/gw0cjtDehZlcZ4hnPyPWtiMOU+WRtlyDghnJ3WVR4+C1JspRzT2Jw34sQEvZat00he0/rWJEaBDFMI6XEwNK/yjnSD7yebo2s6To9mRnzakWNsuudFAjIBB+UOwe0Ry/VEIOXMP6lzucxTL5R+R/r6iqjuNjk4MYRfWu35/BSbIK5D8o48duRJrjlIxAmWSVeQANfBaMZsQL2zViMjxGmepOy4M/pFGTBebjFUPkuNUa0IDD5FKkdnddwiT3C4c5F5RX5Jm5RwjWJG/2dMCz0One27u9TurJlWC0UnrLBhJkrSnwukVuUxhXsC8b3Bw== 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=r6ZftoAn+JCpElG885086mzsKgInNuIhwMdTV7Q48Cg=; b=Dh2XzMaNItg9FQV8d3/3GwKa4wLduH3e1lDv1bImmEHhTWgjmsupydYuv8qvD2TLmDNskLcMQ0u9K/LD76EySKWz/FPJmoa0RYHiuxywwfYmW8Nc8qR0wxZzqkWnFrp9/v648mTdxg5++GOQ6QD82whzCDEZvkNySzIp569GWKY= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by SJ0PR10MB5517.namprd10.prod.outlook.com (2603:10b6:a03:3e5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.14; Tue, 17 May 2022 22:24:56 +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; Tue, 17 May 2022 22:24:56 +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 01/13] scsi: iscsi: Fix HW conn removal use after free Date: Tue, 17 May 2022 17:24:36 -0500 Message-Id: <20220517222448.25612-2-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220517222448.25612-1-michael.christie@oracle.com> References: <20220517222448.25612-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR02CA0078.namprd02.prod.outlook.com (2603:10b6:5:1f4::19) 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: 25ab3ca2-c54a-4423-1e48-08da38541231 X-MS-TrafficTypeDiagnostic: SJ0PR10MB5517: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: UPsmWaKMfwy3Jv3pcjvAP56leEVNb8jHDd/EtVebTTzUlVPM4+ONvx9jedDm43KSEpMcP3WfRFXBsb7KfXayXzG+QDUH62SW41jnpZaWzG9J++NiGFox6MxNA6avmdws6y3nT4bfpGON87choATuhw6c0K9yLIHx+TdwW8NphVbSBAWnf+KOmvp36meirpR+UISR0y7fHVS+9IOYxRjUv7Ycd5uTDHA5NZJTqgLw1mJ6pD+DhHnVku2MMdFXrSGUsdLTl2WO48YG8y6FzMfHOPVBi5iYjUeanFTJt69Ezwja0EncISBlGoCwILPXtWNAy9Hm+lTIFXcs7IlzQudEJ6uO8mgTdcvGf7ND19g2H8WggHwl37AfQVZwzOM86AZcOEaiY3E3FpnKx7/hRDYZGaCV7FEcostqmuXaTIS8A7rIhn9Jly23YJkGvgnK2BELLu1jQtqHphJ70u1nql+z0XCV+ulyICyaOsXwJQh0dUk0kX2xYLr+U7DJnsZ2T1FzK7Z9qNmDyo38+gEauxBk1uos8kztYoTfs1r4HYkNuobqvhnsTHqNQ/wttI45CyYYLshO2okc6wfef39UkOk73xxsmSmyXRYpAr4a+T7iUsrlq98Dz3Z6N79eBz3jquTdlAACxHXKyS4ngOTO/QHG3DJdNE0ZaHdpLVLbiUmY/0RINVpyBRBebyzHzgo1wzh9mMnjJcuRTMGl++4YB6YmCA== 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)(4326008)(66946007)(66556008)(4744005)(66476007)(2616005)(8676002)(2906002)(26005)(6512007)(6506007)(1076003)(316002)(6486002)(186003)(83380400001)(8936002)(52116002)(38350700002)(6666004)(38100700002)(86362001)(5660300002)(107886003)(36756003)(508600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Ipab2DWjLuUStiIii2fuiFAD2FXME3AqP2zu1nOZRbvlLqn9OPkGHCdUyTOyuo2c5UsIAM52ceiapIZtGZ0Uvjk0XH/hGVekvY9Y3yrh+isyLWuS3KfAbBIDb9eLFNkDTJiS2p+WYM5kMemDnnuPsP2OhwJA/p/p83xYahhBSoEC85eAI/kC1szpzHnW13PaYceX8ZEjGgWi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StGvSyEXy8E3TixPAs0QXC34H5HzSw8Oguk8/dLBGsAmt29tmGqTyi3AzAnqGcvIamHEJdK72glRboHQ7sZ0XCquovshymsqsBEKxZTopHBJB1QStGIfT1+XDAMk8mEy9CeXiydkRAU3bjK/Ual1iljJXG9TCsjU58+TiJoMr+Q7B6GiephCO/pcfRavC0FeXIH1XoXPMb5HRLebone0oSGseHNF/13ya49rS8O4zu/YuylMl1yUHxA57nK0Ftk6Bz0fMux2do1Uti4ndNDLGMaVdjOGoqL5Z7/3Xrpuo+CbuwZ4N6RRmD8yqMVX6oJPyJ//Y54UPPfmGHHjpcy+L/kFlAfSVobBGmlzF5YCti1jxOcb3+1YhTbpZZIgjjjyaFRQcPeHVFo//04i6KBmx1UHvlASyrr7v6fR3NXbBlMe1vl5kVdeGrOCc/nvlusrbAH+GbXuBkOWgnLvs/nTiFDJl+/EcnXS8VWhF6Rrfk= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 25ab3ca2-c54a-4423-1e48-08da38541231 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2022 22:24:56.1526 (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: Sw92QL/85b1WdygHD4MIW6qqSVOo1Uh/TbJNQCsQR4aN63VZuAhFVT1fp/Y8XVwfeIEB+BHjjVzIYt6HXzTY97plHFuMs+NX0lVaOOW1dyY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5517 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.486,18.0.874 definitions=2022-05-17_03:2022-05-17,2022-05-17 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 malwarescore=0 mlxscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205170129 X-Proofpoint-GUID: ao-Avn96Bu7534CgwB8jY6g1JiEmfNaF X-Proofpoint-ORIG-GUID: ao-Avn96Bu7534CgwB8jY6g1JiEmfNaF 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. Signed-off-by: Mike Christie Reviewed-by: Lee Duncan --- 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 Tue May 17 22:24:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12852988 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 EF990C433EF for ; Tue, 17 May 2022 22:25:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231139AbiEQWZS (ORCPT ); Tue, 17 May 2022 18:25:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230167AbiEQWZL (ORCPT ); Tue, 17 May 2022 18:25:11 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A59552E57 for ; Tue, 17 May 2022 15:25:10 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24HKgGle031659; Tue, 17 May 2022 22:25:01 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=nY8RVNTSHmPsi2eTJnAJycvAUOrAD6E5kDu2m1Ajg60=; b=pza9fBmmZsEC0BJBMeOARrSIZHnCvkvR2ntQQ8mYQ0HSo+eqgpjZUvOTCU7fm/x2rayZ 7tgpe+U7GBUo3W8X3MSnKzL4yDwOy+jJOT1LNYlRVFRE4CN3lCnMOsvu90pTkXEfe4yq IShDyUmJFH3U5IGdpoG4/W1HKw/N/xdnnZPBswbIDVWlyooTqBKlMJXVBA5w9cl6lomp 2RdLa7gpKzbatlmaJl5V0jyXgIylawLCWe9LX5w22WhUYNLPZaP214rDeLpeC6jIVFCQ 8sKGNAPEvNRBmw0xr0FUWE7NgUdc+jzK7K3UyrS8wywlAISfWJMHllcZdy0LFKInz4ls xw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3g24aafjgh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 May 2022 22:25:00 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 24HMLghx031743; Tue, 17 May 2022 22:24:59 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2177.outbound.protection.outlook.com [104.47.58.177]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com with ESMTP id 3g37cppmnb-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 May 2022 22:24:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gnhgf0pHxO99wL8jNruOUGxkflIkA7Rc5mRbKjgjgvxe1ozSgXKf4a4XGU9xKXuoXxZt2RCJknE+XIwvwU/n3oflwOtGuI9mn/3Jv02siAzflPKsWxDz754YaiQNNQ/OaReAMOOF/eBeQw1PaWp061P+7sp9QjePKTgQqWkecVE3P10BUEfR1varpKKhhbw96iHU5jOm7I8ccZ/AcLEq/wRrsxYcdHPd3q9z7t5RvEUfHSsCGFTATp3F3zEIliYChSFF7nVeumYS8IxCrpDRxTQQC67aZc5e6FFgPqSClerBOpDaX/i19IPRISnEqFTE8Bv6ZoCl0ZhGyywOCCJXkA== 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=nY8RVNTSHmPsi2eTJnAJycvAUOrAD6E5kDu2m1Ajg60=; b=nTi8yb5KS4vT9tVx09T7ZB+CbA1mmGaYPh/EkBOKhVxrCogLT8OFDMdhwmdBl7px23rlfdq89ZGFzFRG7SNOghuZl7BSRuUJA+QNzXjEZlLaYl97E0T6XdeUvEDhdGP/nODP24n86kGBXrO0fq33ZfO8SskuOdER3+KZUO9yTB1PpJZTCZjYhzMTlkQYKaTuZ8YbbyW2klMSR1ccZHW2fqeAZccrj6954molawf2kNMfkUqWMA/XfGIdRVB8sdIwzWevNFn1Kc9eIvJSnetrGtvPLBIaH3syhnvcI3ipBoT5reQZAQ/OkcdVeLTCSmbjNUHJsB1iKswnqsCEGBLhAg== 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=nY8RVNTSHmPsi2eTJnAJycvAUOrAD6E5kDu2m1Ajg60=; b=uQGDGSvNIKy0foOLKqCzGoT8zSq5BxshGSm/wHLOKKWXNRGJx0y5n1OsOw+cNXDE3QmiMc9Hyrc/mnKk2EtDB1Hxu1TwLJdOYSsXpJrZPyiS5K8+jpt+DNEDxOslK4Do/gCe+6XXZConOj4EXTApU4L3FlGbb/6Vwbmd3bH10gI= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by SJ0PR10MB5517.namprd10.prod.outlook.com (2603:10b6:a03:3e5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.14; Tue, 17 May 2022 22:24:57 +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; Tue, 17 May 2022 22:24:57 +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 02/13] scsi: iscsi: Add helper to remove a session from the kernel Date: Tue, 17 May 2022 17:24:37 -0500 Message-Id: <20220517222448.25612-3-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220517222448.25612-1-michael.christie@oracle.com> References: <20220517222448.25612-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR02CA0078.namprd02.prod.outlook.com (2603:10b6:5:1f4::19) 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: 4d8a101e-94cc-45c9-410d-08da38541276 X-MS-TrafficTypeDiagnostic: SJ0PR10MB5517: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: Bn19kx43J83qwEtpeAmtWDw0l/pI01rFB3Mb3Qbk83JHMdk+kmi3/WMETSVTNBNmNf9z0zmHwc/0pCpsv5uaeyQ3ne4+qG4iG1HxPcG23jEY7do3YTY6vJzH1EdMEBOz9VxNW58rsU+MmYNtgsmjOmNs838vdGrk0M/ovxM2zqflUxsNE6Jow00mqZVbMYiFZFmZw5wQ8riq3kloH4MIwYFR5vW6kFUwcgwzPhsStPkPsHEelFr8eyOPoLDnM6MmKHrcXTOZARA6LAKlmNYmdaUrScYyr7wBmjRS62x07Cwo9/seYvLlDVykkuIDUgW8LhVQNm2Mrc6smfMM2KnhbY2+XuSEDoDhoXLVBARqnJBvjhL/dzHAX4qqVyUUmBa/lASSEDPnaK+8rmpCh/lZDrRzCgCHhpYExCGiYVSFVMyaF9moOarHe7kbHcGpQkc5y16yb3Pp651G4jrycdqhbhTP6MdjLa10lgwdFTBoN6Ni7+wFSkM2ziyaQc7qOUVPNULnt/y5LNu02ODMdrI+UCDTwsIjBszi4hOuOyuO0QrSzQOZATESsNj51wFj7d4/+LdZjZ0XidxEymkHTQdtirEz+7HvoJE8D9EhK8wq4LX8Ts3gCmYqyvkItKoTNfRr/lihfSOIZdzti/5SuQcAATP6MCiZZbjlFsYYOhlT2aYOALyoqtzzMV40gyQnvlsWR8AFfZ7oi0wWZk5XCC7pEA== 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)(4326008)(66946007)(66556008)(66476007)(2616005)(8676002)(2906002)(26005)(6512007)(6506007)(1076003)(316002)(6486002)(186003)(83380400001)(8936002)(52116002)(38350700002)(6666004)(38100700002)(86362001)(5660300002)(107886003)(36756003)(508600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: meTP1zRxXyAak7rdBvABA6sVQ5KuVeEBhpHcaI6D/l+pyfmpI01yOXwzRCnl/a+a0y75qBwdR/em64BJGxTIHpFgmo1tzTY599o0lS5tnSZzGv9uRQZrqLbsWyXbi3hJYxp9NL//Go/JPULvLPUd3TP/6doqgLvlpN8p4qijBqI8estJ5LyAWQx/5oj4gLwORGzEXoFm0LSDfCS5d3gJ63F3XxrEedygPG8fJzsYeuvbkv9fpqX5yBg8W+6DdhiWY9IthynQGomel5mFarBHMR9MgDLlEcmVvI/Qgc7XiQL7nmIDA50li96ca8eLCUY5YCcprmx47Txpwyqw6Gx237CujA+CySWA99lsLZeV4nUWhXIdOqEuMNxV6HUuwYOvQqAGCqge2RzFFrFZAh8dqBslbvy1zowISJEwvu7E3RUiotSo/5yCnlRePdws+Hwo/qh4cor1tZHxKAGnbQnWgNwpJMRK7xFuhP2mdbw/9y2nGWVxoJKhgHziBTTG7pkLA3K0hhlStQaQOyZ7itZGeQLts9RNucKnAd5PK3KLEJkpIsQT1+eRTj/rPzF7sW/JRf24QbYfYEfnh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4WVqryA/GVsMY1JpH0KqNGq3BTv+1/avGBDy62VTt6xE0FRRiutnYKooYaFrjo1s8zuOZNVvoeuTL9RNAYC5gd4mpeTwywQL0aAqu8NHDbRA= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4d8a101e-94cc-45c9-410d-08da38541276 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2022 22:24:56.5902 (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: IxZ/dNgG0YKhRlpneT42TIB54BWa0vMPx4AK+2eeLVE6F9E3KEV+Soc8+kaye52BmlKfqXsK6s7XyMborYkIIGK93C4AFyXFL6huxZbAldU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5517 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.486,18.0.874 definitions=2022-05-17_03:2022-05-17,2022-05-17 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 malwarescore=0 mlxscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205170129 X-Proofpoint-ORIG-GUID: _NuMnZbKLxVju8fAakjBPOjA1Yt2uP3B X-Proofpoint-GUID: _NuMnZbKLxVju8fAakjBPOjA1Yt2uP3B 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. Signed-off-by: Mike Christie Reviewed-by: Lee Duncan --- 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..3b5e07544324 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 Tue May 17 22:24:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12852986 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 6561FC433FE for ; Tue, 17 May 2022 22:25:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231130AbiEQWZO (ORCPT ); Tue, 17 May 2022 18:25:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230505AbiEQWZI (ORCPT ); Tue, 17 May 2022 18:25:08 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F1F152B2F for ; Tue, 17 May 2022 15:25:07 -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 24HKQrO2023081; Tue, 17 May 2022 22:25:01 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=iBH7ZMb4i8Ewugl0DvVdhVMvaiN8vM+9EiRVCqRLlxU=; b=FnDwY2ljStEQ8azltNVY0BgAYHF/0/86+WHmyCh6zk75V/ha9AReWIyUQXx6rqc4rr9H AibpRsq/DeKt712eKF53rO/C1lrOuwvP2F9mdxuf1Mog3BVhoABq3sTbz0vvke9BcpB3 E/fkovko0gk1U848VSLUKkluzMgpCkiGOi8lFnIn5QeOImViKfM7ksg5oZlwzw5Hp9Rs TCNy5Q7yiONq3+6jJLBjuFAChMPxkZE8JOWjBUZs91jJRklH+4serOU4Mryem52XKVeG 6nTgw0VxEQfX2a9A4eDeigQMl+0/ttP79JuLICFtqKLtbrUMdImVpWOmk/ot32iEk23g ag== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3g241s7ncw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 May 2022 22:25:01 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 24HMLgi0031743; Tue, 17 May 2022 22:25:00 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2177.outbound.protection.outlook.com [104.47.58.177]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com with ESMTP id 3g37cppmnb-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 May 2022 22:24:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=REwNfXKQHOeNdgn8ha+SNymUYPz+LEkxXg7LYUxNZjWnbEh6FXK2wdVR4J80or5PMw+F+YbG+6AF/LiVlr+6lxR0SopTxSGmZyvasGi78ol18Q/kmzIHODisXzP39ztOlyx+f68eJv3D6MUpV4+lx/4Rw+poeZQTu1vTxtgtoQJ6oQnKll7KkASe0/act2BzC01pSOzECUJOVqZfqIeem5XLbt5n6sar+jLtqSYBW5fozcJX6lcb+YGp3j47s38ROShSE8cZHI9HlAPXS8LpQmvVz/iRQc/8woj8moQBF+Z9n3NIjYJtp18YS9fhWmvZib+tK0Il7dTdrnJOSMGPtw== 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=iBH7ZMb4i8Ewugl0DvVdhVMvaiN8vM+9EiRVCqRLlxU=; b=oUs7xQYJOrDnDbF9U/ITu+hoj8YPm3lI1t/KhqIoIS7iw//mxnTXvF/ZvElVZFycMVjIcvgWZrvgXWP140DxaWKuOK4PLizDnync17f5fJojrSLsxijw6u/WFyFt1I3mdU0Ah3c8Tj/2VLkRmUI9r3tzAHhCoz2w1vfBQYQcGZDMuMBcqmANURuuSk5dIC1X1CwPr7iBwNX1rx1PYQ7UeNmF3TAtSqCVx7jJDT9mKTS9i+We9KmWE0XmxAHvEpXKx4VFcZwYlrefmkiziQ0MAm72C3nvXpzqIJCOv0zEG77/XdqwnbuUxHIwvUw5LKZrkNZkWApU7xzHTv3TRAKTlA== 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=iBH7ZMb4i8Ewugl0DvVdhVMvaiN8vM+9EiRVCqRLlxU=; b=b5LJhMQ0t6Pyzhp/MvtBmlXfOftvrrmBQWjKAMa9lnRoUfo6hkaNY+bx4qBgIRc992P+qlYqfElk4Zjoo0kyAtePL94r/+2YrkyGIIbxpAVNvdIwi/oHlNK62xK8M5tuvdoowp6ZVvZTSTmMQL/m/UyheMYbXp189lmx1MxNl4M= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by SJ0PR10MB5517.namprd10.prod.outlook.com (2603:10b6:a03:3e5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.14; Tue, 17 May 2022 22:24:57 +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; Tue, 17 May 2022 22:24:57 +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 03/13] scsi: qedi: Use QEDI_MODE_NORMAL for error handling Date: Tue, 17 May 2022 17:24:38 -0500 Message-Id: <20220517222448.25612-4-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220517222448.25612-1-michael.christie@oracle.com> References: <20220517222448.25612-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR02CA0078.namprd02.prod.outlook.com (2603:10b6:5:1f4::19) 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: 149a6315-2d20-441a-c622-08da385412bd X-MS-TrafficTypeDiagnostic: SJ0PR10MB5517: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: WlrBTbhCmj/Ul979peoqQru86fLqiipyJZHEyPNECirU5FVcAn/Ew/3vzODZ5N9Bkv8QxOnatgfbjOhkf3LejG3ZUi+8IYI3dX7OMLBet12kolrO2JZ6Cz1Rc2QMDx1zgjjHz0MFqVFSqrRCKaCaj+TawS6Mwoyevf9fWRmum0ffr1bPQ/S2RuMNH7v0j2u8WIaGFOD5LlTqNeJPs7GEo/fwU3+LcUEpV9e5JVe86S4Cb7LQd12NmC+yx7vb8MBqaysSMjBKmFBdNg9T7K+NrqvonDhDl4mC6ZBN2CLwgahbuxLUEoT/rIXgs0oSnqmMsZUl31HIW6TOX+T5XD2h07DnW/KIah+fxZmeXQE4OWgtzHBl18i/aVM0N3iPDUCAWBZGiSZHexWHpceCm0V9jiCnsurozHybB6wXW086H2l/OLWqEQNPuNGF6FerK0xfbTf4nSs5XyusCKV51DyNPByQcVE+zG68VO8OeL3xAyzkjlqjA9PU/cS6jFgJ7FwIbsP4+4LbswgWW/O8A4IJVfNYSuaxSKzdC5ArnxzwZUCUIKcXZlbHaY/vuHB3FF8ngn6Mn8NG1fR2PFrjCvJpYPfsspbmS6WZMuoWD3M6rJu1rEn9881AQB4Rpr5kVWF/NSLcMPa0YXXEM7ARTjAPoJb59EdHFdry1QMhlWkCWMvsudKxWSfZ93LYcr95+eRWGDSU/dV4DZIHX3gMRXZOYA== 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)(4326008)(66946007)(66556008)(4744005)(66476007)(2616005)(8676002)(2906002)(26005)(6512007)(6506007)(1076003)(316002)(6486002)(186003)(83380400001)(8936002)(52116002)(38350700002)(6666004)(38100700002)(86362001)(5660300002)(107886003)(36756003)(508600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HIgD2y/nvXV4CQjJaSIephR+iIHqtX/k66B55x7st950eGz7rJ0z2ec328+0d/ytWPWjlAVBDhqruREFXAGDQNOPEpo9EGmLadjglcE3232AHek2xZw8BjPqB/oXzITg47D33zOpc82ocnP1rBBnOafInb278iihgcVZ6mzJ2d77S4CSdiCj4LU4Uky4FjkH95A6ZHu0TodD/vIlX9kC3bsV/IDQAD1SfW55rjCCkg/sd+ilRr+5nL9aa6L+OGBKxjj5xv9vIumIGrdRQasgq6EO2gZWdBxm//4IpwiNKa+UQ7yP/JjWdRXiN+gftxZU7mirNbxZYF13Z5mCJYnso2M2g90nhpjKJL9+q6FkFY39zgXjwPOLwBlzIyZ6E9OTrKesK53CmGfPvcvpMOJSLosaui3ctzcLVBMF0wkD5L0oF3DP12ckIfempa1cFGQlP2AiKk2vlh4Pd+Z83GxXnFZeI5nfhigj5aw/KP+kXZgAV8RoEEh6Pf2Fjvn1zmV9Vda6nq4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igPXMFQtV0sg5Au9lLW1xcpkd0xT5Tl4VCPlacA0WPI8VV7z1N0sdW/4IlFDj0Sf4ryeUiqa7cTb7g8Fxv/KYaqYyL33mP4vSxGnZUXjaKByBM3SOGNcN/aCgkT59LymRbjt9pSZGrWGy2vcyZn4mcPxWeOAXcrInfALC0XfAHMNSVx3H8k= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 149a6315-2d20-441a-c622-08da385412bd X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2022 22:24:57.0431 (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: ayxzrifsWSeie7zH+IazqNvh/Vi8XfgUjllZRGI/dXUI81o7fw0tLAJBNEh3KcQ+fCTlWOCpqNAvaTDp4kkzztM3McWawU/dUt4R1+E3rvg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5517 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.486,18.0.874 definitions=2022-05-17_03:2022-05-17,2022-05-17 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 malwarescore=0 mlxscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205170129 X-Proofpoint-GUID: GZ0EFYTmMNTJeLNcLHa_-3B_Yz9fsHP_ X-Proofpoint-ORIG-GUID: GZ0EFYTmMNTJeLNcLHa_-3B_Yz9fsHP_ 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. Signed-off-by: Mike Christie Reviewed-by: Lee Duncan --- 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 Tue May 17 22:24:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12852987 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 B8DF8C433F5 for ; Tue, 17 May 2022 22:25:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231137AbiEQWZQ (ORCPT ); Tue, 17 May 2022 18:25:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229940AbiEQWZK (ORCPT ); Tue, 17 May 2022 18:25:10 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D4AE52E48 for ; Tue, 17 May 2022 15:25:09 -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 24HKQrO3023081; Tue, 17 May 2022 22:25:01 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=BgYo8VqgtVB0QasWFDQDAx8kHRuND+jDkIf1iK3LMXM=; b=a3lMG2V/WCOun55mHhMOaR0UJnIfnJIBC9TLIzATwKJVQpjrGiDWYDinSrmzFafrgXpN YZrQMi1QtWUuLeghMhuKKAH2jKeDw4IaIm8nYe2w9Szu+D5hYxP0fQcf0Nus28j1/sDo 5OvpUj11n6RWqoy93Ju9jADdDtZwWs5FsHlnGZFBVVNUDsHGBj3fOyPmgYR1NpJX/Sdb gESCw+SlSuk6nl0SLPVyvUIGMDXSyHthqgw4u0WII5puqzj4mXhH40PRlovTHfv9H+en jOnNi+cppC1Qga1LbwQwz9ybm3g+e5pn6zAhTX/UGtVxC8owuOtBFXnqVQ5J1rida7JV ZQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3g241s7ncx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 May 2022 22:25:01 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 24HMLgi1031743; Tue, 17 May 2022 22:25:00 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2177.outbound.protection.outlook.com [104.47.58.177]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com with ESMTP id 3g37cppmnb-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 May 2022 22:25:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jfDnOowlptfN2FCOTtcVR2tnpw0Pb6pCa3LRBmGZTtq+9u69Hl5sPH93U1aMVVFk9qg7xaWp0EjdZWwlhuHktZcB7gzogIvK0Re4APD3T95G6DM9cu1G+0Tm8RQPZl3lKiR9wOmg1PttYnr+CYm/VqFm+jSRLDYKjZN3AlEkaFR8MsNu33Kli5fapN5irkGsO1dJ7RObmiFntyL/+oDk1Rr8RkSabi5KZTIhQi5wYFH4h3tHOynnWJus9MtG9aFj1MMxkrprCGJxAXznhHyZnBKTPJD+OEUWqUBE7NKyeke9QciX9Z7DjQUGJbR/56gp8r2lpzhYcGbn1q1h07v5Tw== 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=BgYo8VqgtVB0QasWFDQDAx8kHRuND+jDkIf1iK3LMXM=; b=D8rViJa/UlvP2F39OXz1RHlvpswAFpm/3zuK7mGwqYsUO5dw5HFUOuJo6oQVyQe5QJVBtKelRl21W2dIJfS0Axo0W+6XR9xv6Lj0gjAcK/WcnW67WzARvFU59afbiVqeEt3/x8F0+d7AXpn/HK3sgzC5ZqXouBGnhxqeQng4kWIkrKOaS9iZFRJIFU9QjbpsdXqU13vJPCauTLYnjQA50vw2Tx5ineGtAks1jM+V9FJP8BcSgQuZbKjUvRjVdQ/wvbCHyqqt6uVr91MaGqJswrCT51OdF7IGsxCkC+t78x6kXcayD00XjpIm9GMs1ksuKvJ7hdUQpjFkNiBMRKQS6g== 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=BgYo8VqgtVB0QasWFDQDAx8kHRuND+jDkIf1iK3LMXM=; b=E8P4aC9KPRDDrsZCKK9V2+OzM9euzbqosOZAUkhxhAuQOKNdo3rQtUNAplDDiec6UboksgHHiwN/TnCRnHFNEUpjN0C1yHodPiTdQRShAFAjO9thym0k3tV3I2g3JMcpDkcmkYDuuD8vHNltwEPZ4PnMkP6E250yqFCPnjaCLbk= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by SJ0PR10MB5517.namprd10.prod.outlook.com (2603:10b6:a03:3e5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.14; Tue, 17 May 2022 22:24:58 +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; Tue, 17 May 2022 22:24:58 +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 04/13] scsi: iscsi: Fix session removal on shutdown Date: Tue, 17 May 2022 17:24:39 -0500 Message-Id: <20220517222448.25612-5-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220517222448.25612-1-michael.christie@oracle.com> References: <20220517222448.25612-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR02CA0078.namprd02.prod.outlook.com (2603:10b6:5:1f4::19) 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: a837e70e-9d8f-413b-869a-08da38541300 X-MS-TrafficTypeDiagnostic: SJ0PR10MB5517: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: +v8jBkNzcObNr7CWejJwki8VcLdtA1fN+1x2avrUso/GLCrv/cDp7p+EwxBdhPclZB8/VUS2pOPCQguXZMZk+UQuJDSlJ4tdhW7hXMmmoabjqjSJuGTGeKafhzSCiUVsl/cQMw6CeGqWecjvCvPjFajQuDkf2uxW2pbwL5eJ7ZX5k+RigZ9+XD6he47QZDLOH65WzDa2gSc8TjKJWtV2Oe88x268p7tizYaYHcs0nF8tAqq4f8/sbbLJOlM20MaftFz5AFo+gvInPvbhmj9dSi4bt/MoAU7uuCeuMLq+7fo1BhEHB9ZMo7AnRTkTVTS84hGNzSiHZsrUI17ByHopMXzkI75buwsv4z+izS2FMrFECaedTIInnPyUHAjlH8nXIGVz7QFS7l9NogMAXQc/Gl1jgh/Aq+N/PONllxrb14Etp7Zi0WdYwZ6RYNf+y1O+BWFHSIFnf7I3yBYif1CkXfFaOTqzEDuYhRIF5kNANZ2SszXD79MWiZ8dWBpncHdPW3UHge51Ypdi+AXcYFHETrvsjiK8LKZ2iWBW/GWpQsAJza0qWb08MiWj/2V6QY/DU5sa9EziNCw2iLvCxCJvbF3j5t1kWyZb+k18Gd49Fjwy4LBg0sAWqbKKFBDhndtWFfBYdsl2+ZnKK1ofFL/1HeG1IkNDa2qriHnpFopnMJCEXW89dn4sBiI4S84hwaxAlOuUFV7e7lLiBUL3NsZBIQ== 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)(4326008)(66946007)(66556008)(66476007)(2616005)(8676002)(2906002)(26005)(6512007)(6506007)(1076003)(316002)(6486002)(186003)(83380400001)(8936002)(52116002)(38350700002)(6666004)(38100700002)(86362001)(5660300002)(107886003)(36756003)(508600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BIXdvpYfaQsSfgi1tCPIqv0gfnavC9x7nJu97uuXMxvAVVdEaJbnDr06EHT6IwZRUphMrNv6/5cEL2h8iZacpLrJLLyMLWubE6GtVbbb72WZ09qHZixwc7YerbuPvHIMLFArfEo0L5FkPhfRyVsl2xjPOPQFAfpJO6sJYFQa2apREOH3qfKwFS+7PFbPQy3n+EiknjzUdd2iq4TwPbja4nD6+I+OAKrHivjjmM1ABqIv3PUpBTgULTEEkONcrTTAcli4gqDQpTNoTNIvE1Mu4FWWSuCI8KId79F1yrJ7Z5wCXA/NGeJhqNDnybsk5LLQzQHZWXioI307MX95TffNfuuuPR27FzWQ7L92JZgm4DNoS1Kmi7VKThxch+WrlhTt7XJKRrYl3gixL3zHcrcbFW5dsHDhOCMahUmLbqAJj4WjB2ffSOitOkX5OVuldnFAn9Hy/ombCqlkaMReTw9Wwc1W+Eck+b9m82GxpNLVczcVTJc7A3ZRnpj14hzNgMZr+LEvMWPzhy9F9dzgwxEs3dlXDcg4PY9ATE8xnR4O9Z5+JIf0T3LtCtzMNohnjSFX22GDFwg1kV0x97Xln0SMjmySnuyW3Vctn99zTwPP3o27ESEm9iAQbbjahH8I0xZF+4DDTCQ2dFIq1k1XfATNWnFQECzjpxlk56O+o8iPJuMq8ZUEarq4RyPdh1VVsJgh+NgNN2U6Q8kGX+LQu8vmVWm5o+AfGQ6tzOEuPSUmynA2mPdkJSuz/C68lNjUpxfqGttwF/HMQysJiTyV35nIbdrYg0u1b71zMcLfwTWqajPbmPqJ5/SU+I+m5mQ7wET6r2zEAac2kQDYPF5UGI71Ph2Hh5GSVXo2rvqYFDR5pPcb/GGGxP2/pQBH0JxL75WLbF5mkJ4b0OQpUhrPvcq6p4b06t5pfRuTc4wU3YL1kmD6MOpfsA8C5j54FO1sSYPlz6Pl8xdQPnH8r/fKsIJIgKXiJyJ+7SnzydKVeh4+x1wJ8J3tTO8Sc2bN96GnbEKaU1r8sui4DS1F9t2RaYejnuiQjzv7V+6I31POpSkBCuyF7x2SPQVurjtkyz/TrOfJL1ULy/+R1AKQDB1hFxb5ayw3uhzj3ZNaTyRN4IfQJe7pGSPS+ioQnPxTA8tnlwAg5wkmZJIdVOf5hl1SaI18Eb2nHCH8QrT+d2BP9yyWXMZqTJajAZVI4wc3U7Ky9VN7SEYHZcM8JdmY/RXC8y9xi8h9IcJOel596dQX+oG+HCIDdpvViMBbZqlDQfG7jSeSsOJEM++ySiapmCqrFpt+BQKKnJVkyc67LUm7NEyr4VgdVG7QyDz9JVwCvu7+Lv/eVm3862kEqotBQNa5laV3q9VSHfBYNiJjay8n9FckPg1W05QtOeLazlpWa+x7uXdCGFqy+QWFa2Jf68wK5rM/cVBQtfKwRdaNfgueWfDXQM6gCJPHZ3QhXo7nIKWuChzxBMvQ++a/MOwT7AieTRz5KNB1dkzbZ96MbosXc/fswnL+n0y5SZUvxT58e/BXQqbJzWoFNeUpshx+yB+ZTj/h+57raWrI06RAXd4Az6aI5TTgQw/MXI0+Son/dZw8xu+i13kXOIsFDnz8aEnoAtDVHW6xPkMD0Z42ddnQmbQhYxJGeQ++yqr8J1zU25IOEku8yL6aqaa9Jm66eGk0izi6LDwAXgmw03OehXRJ12bQepuEywiKh/tbpVInb3ihJunDWpKc1EFWtoyWHcHs46zLg4JysmH71mEAIRNPqqPjMhw= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a837e70e-9d8f-413b-869a-08da38541300 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2022 22:24:57.4806 (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: /5UrhnCr/LT1n/5LoMnpY6whHLiGa8oLbZsRoShih8Mv1C16qtCm2Vz4IGo/EI7vPZJIN0G2kpbcnvODSnZO4B351lqv6yA9DSJ2T5zAoDg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5517 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.486,18.0.874 definitions=2022-05-17_03:2022-05-17,2022-05-17 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 malwarescore=0 mlxscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205170129 X-Proofpoint-GUID: i6TPe29KrDZ2axZv0QxJpeDGOsL9L_AQ X-Proofpoint-ORIG-GUID: i6TPe29KrDZ2axZv0QxJpeDGOsL9L_AQ 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") Signed-off-by: Mike Christie Reviewed-by: Lee Duncan --- 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 Tue May 17 22:24:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12852993 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 DB95AC433F5 for ; Tue, 17 May 2022 22:25:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231181AbiEQWZx (ORCPT ); Tue, 17 May 2022 18:25:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231132AbiEQWZP (ORCPT ); Tue, 17 May 2022 18:25:15 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19A6452E56 for ; Tue, 17 May 2022 15:25:15 -0700 (PDT) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24HKYLpD029125; Tue, 17 May 2022 22:25:02 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=CzcS3ZZcS445U8kZaaXoJk8BUekfNaBTA2yF2qi1Qz10ul7HCCnCkiG4EnQLXmPpJanp 1k3Zi8/JdQtRsG/IB9TnsVqJ/9qV4Bfm6msf1JGDnz4UsVGavaqd3Z1A0CEAI5ryPDfC DVfNMAekDRCE3VVjVvvqHlpVVQdn5XKmSJtH7wWWMc9NZThZbgqb3IlWrLjDrtAx8CUs jntERZUPJKtiSPRuy/M/84tIVMkAZGrU94GJShzzMGqbBlPBwCoLdGxL8wJAS2+q8x6S 7baJ+7b8+Kz60ze7WUfTWjAUFoOshus51yRob6J3q7O3SYGUXfp3+CLUcLqamfr9MWNE Dw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3g2310qrmw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 May 2022 22:25:01 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 24HMLgi2031743; Tue, 17 May 2022 22:25:01 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2177.outbound.protection.outlook.com [104.47.58.177]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com with ESMTP id 3g37cppmnb-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 May 2022 22:25:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Hyy4o0aw81cdrQiO+7/3hBCnxY8rtxarfvBDrNQRfJtWjpwnwNVG4NjyTwYT9d6upJSymOI7CvZSFcL/wwKG3X4AjYqH0ZBOkXBeFbviDXCnZvKwFF+bgISJU7WHl7JtXfWQ8or9zwwssLRe7oi2lk3sN6miGcrGi2hNApDweBoKvF5wwonwldp4wpGA42glziVW28GBbxNtHxRO9hn7P5tt7DMkyf1r7hfJkbRHlI6VQAmwFV7RSsXQKFDkjFiTx0aQyHn1R0ySvaI75YaL4uk1xlkiT8XI5YCAzJiCRHjjISDDer2JcjsCX+h5ppUkEJDTYP/iqGGyrJgofW+RtQ== 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=FpyRabprSFTfqodWufwYTEU87g8WsgpZHVlRaYk1+ZYRcZK3dsH5O4p/zUwauVTXibaLc3v1WjR8x9lRwkhykPEAyMjbUw0YOXlDOPKS2W7MzZVMR5Ize2xOUcjpnRP386QYr+vHkoreqJodiOGK8DVoxRPCAsVUe8hCsGsdIjfNq8WUhJnm9NnxoFCNz67AkFGcO2jhnJatZ4j5RSz5F9eTkqXJkVYJuZQfprjte8eTziqNXwtn5PUPuI5wPwPJjJ8cJdzuq3znZ/pLRJiIRMVSy9q1VdZ8QRAw/In4UomVw2VQHwpQBWfmvsllS2duzL+9h+56oW5Og/OSNrMHiA== 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=O6aH8ZlvZXL8q5kWzbjWRsDiUiBy7RnXI3gr2PBOEaKtYDGp2HrJPGNR4Q22lAtQi7gGXctci1hXZov3imSt8bw5RZqv45mZYXza2lgANmv24vUnjpER0r1mlwOwoKs64aGKZrwswlRVUrQpAmMUOpcpN0PGPIStgNCaVTw30Lw= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by SJ0PR10MB5517.namprd10.prod.outlook.com (2603:10b6:a03:3e5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.14; Tue, 17 May 2022 22:24:59 +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; Tue, 17 May 2022 22:24:58 +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 05/13] scsi: iscsi: Rename iscsi_conn_queue_work Date: Tue, 17 May 2022 17:24:40 -0500 Message-Id: <20220517222448.25612-6-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220517222448.25612-1-michael.christie@oracle.com> References: <20220517222448.25612-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR02CA0078.namprd02.prod.outlook.com (2603:10b6:5:1f4::19) 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: c532fdc7-ea0f-4cf3-a961-08da38541345 X-MS-TrafficTypeDiagnostic: SJ0PR10MB5517: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: V986Tr9USjo4IvHq9AYz3QumrsbQrPLYQSQlgr1Wno80bgrYskCUKq32ZinwLpinIiYtkZMR9Xs4LOIszi2Q4lKnwhJ4kXo0V/Kf32QQLnsvWP/aKWtoDHvMngdj+SHQ9ztwLtQtZ0qj4smA65knpgmaiZMVH5t+U7z/EZ8hbJHNKhPdhJTBH2gmg0pbI79r/BMLfd/5Hy8w8/bkqpC0S4MIqWQY1l/pON3OXbLMwPeFanMRvioHx3XPwrB4bZZ83GoWnqGH9ddOBFFtyoytVc2qF3v4ZOVK8euv5rMA/iuuL4KlSntFBERlWQ8azrhY34aYJJlHTNYKDb4yqI7vkG5eDfbo8bGAquOpXEKvn+8YjgOUWX4WB/EQbywovhzLv6B+FRvysAop2icwTkRZ+Es4BupxVMicTLoGWCb1d8j9ku0XXoZcVOC45fErboGVofwCzSB3d8E1JS67lun53DtEgQV13dtKqed5/IDaXJUTNqf6kKw8VSWcLSzStrSgIn/Lz82Ge6ywWTih+ym2SwfARro5iYzFKpXvxEsayS5aXoAR3A8nhA1mS5JGHLydTFb51DutC42vOCyg/zuo0YFV77ndXS5O4u1P4ztYMgBhBwwQ/Auv7WuYubF5SioUtFHmlT1nJbGUafr+ZTryPx2LnUYnrCPihNmRUryyak+S/DdXzZC6l9gL5yLhvLIDTYH+qwJx0A62FMEsaB720A== 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)(4326008)(66946007)(66556008)(66476007)(2616005)(8676002)(2906002)(26005)(6512007)(6506007)(54906003)(1076003)(316002)(6486002)(186003)(83380400001)(8936002)(52116002)(38350700002)(6666004)(38100700002)(86362001)(5660300002)(36756003)(508600001);DIR:OUT;SFP:1101; X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ifYr4QLR3ct640c8eCuqEV+/ALO3HBJ+w92rjijppbJ/JTvwCX13f04EybZbFBAZbK5s/SK2uFEnWJHqS8HLWphvVsi9Vvu7RLlJdGrP6T2oiSsZRvMuoGQ1ZxbIiGcj+utUXEX3cfIyJ5oqB0l0uB/v83aXFE3FI+U5e8oblCzWiwVa37pVPjE6i2uUUfx77oSGBk7S/F/wkIZ9fFJVhgbfOYVp2ozjfISeqSJAmTc74KSfKPm3Y6K5u9QY7i7XdT7xqS99IjBxtW056uH0ui7Ry/5PHlt5NEfWhodaq6vsBOajebTnpbOYNPQLJ1TqD3bY+3bZfiU8L6XwF7TkrvruaDtZr8gFqqVV6at7Z8ANyPHKPRFWdEMynMBLhbWsK3/AiCtwJ5V+JLW+w+oTSVB/kGuRw1TeX2hNyS24gLLfDYbrFXwOPCqCee3+4o1WRBSIM4PlKYtrJpw9YeTvI8fcEm7PVyU3QbqyjaIpA/mtgRmeWC/9rAgXCDJOJogGtDiQbYvZ1GYX8kIoI0kQWH9ARcDQvKNCHKA0xDf5T+5/JxkCBImK1aiSLzwn2WraEfllGKXFjViUJnoGzIOm6jfBKJLpzwGBlpAtahCljqD00QqFxXj9Zf3I4pfLqWiymEQ5J2a+EXYi7UxieFdoLKt5Kh+TV/UKosmPx6BwKgg7uW8toY666rL0xO7w77JVfwo6iR0OlbqVitBflJxZLgapB4bfw0URfYXRu8o+V7BrqB4wC7bUU8= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c532fdc7-ea0f-4cf3-a961-08da38541345 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2022 22:24:57.9805 (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: FrYrloQPNb+5spUH9pTHPkEanNpedjzwLzDNmKoyt4x5I19XNh528FkWj3NBedCSSer2hO5EGqLjKeFHPXDE0ns/PiLxIKi3wE9S2DQso6g= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5517 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.486,18.0.874 definitions=2022-05-17_03:2022-05-17,2022-05-17 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 malwarescore=0 mlxscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205170129 X-Proofpoint-ORIG-GUID: YToFj1dsKVIGRCMxtXsBnMVpK6aSFDdm X-Proofpoint-GUID: YToFj1dsKVIGRCMxtXsBnMVpK6aSFDdm 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 Tue May 17 22:24:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12852989 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 14A4DC433EF for ; Tue, 17 May 2022 22:25:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231140AbiEQWZU (ORCPT ); Tue, 17 May 2022 18:25:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230522AbiEQWZL (ORCPT ); Tue, 17 May 2022 18:25:11 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F04BA52E4F for ; Tue, 17 May 2022 15:25:10 -0700 (PDT) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24HKTuFr012482; Tue, 17 May 2022 22:25:02 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=GVLsvinOUsHJWN9CRSWNmM1fzsJ2ukmYhtXJwuQA572taFwU6EjGFHplyqKHYE13kG06 Yp1+Niqyjk+KT/Lj4Gb6iGBdSBDPqfLFWebtzHhqYcvFp5dsXUQnDDrejdjg9YiHbW8z O9Y9jtR0rrGaW6iPABF9QnjD+PVXXy9pD+NYeLBMxkDAkExtleHQrrhhlcAyWsfJLF7x 6D4d5n3cB5OYTJs8LpCatnDiz91HnHbfD4blvBSdxdydnmXCT/rNviOoXsdP8U3t4AiV zd2w6ayKZhThntyux518CFTU8ComPJWzk06fasqijkD5IZkR/mVgb6tK+gBfLGjsTgWb tg== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3g24ytqqv6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 May 2022 22:25:02 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 24HMLgi3031743; Tue, 17 May 2022 22:25:01 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2177.outbound.protection.outlook.com [104.47.58.177]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com with ESMTP id 3g37cppmnb-7 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 May 2022 22:25:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OVzFdOJUlJC93oz1deDK4Swym20Kh/swswnJNkM4OT8p6yChO5PaI4mt1xYRrpbHgamMuDSikQrDZNTQIyJTc/8735tr3KbISEKXCytnhX1iu5I4NIl3Dmp4/bqzJl7TOqfdguD/jYe96g5IYQ31CemDgcr1YoetNf08cDSDjpfiP55NITNBRIbu26W87aTkIQBgE4DPFaagN0dS7e+U7FkUnZSrs9aoA/VDASNKaShXVdz8wz8W8P9T0LLSYdC4rEepJXXP11MboqxF0BnwVygSk2QLuhnclS9d3QFsnm9gLU4/lQHU3BVFmzOVG23EHMqCB3ToOZwCHM1bBScu3g== 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=FICWNzTIGoxoPde1b1B54xg0iOw5qK6Fq6XrShz2YxA7Aya4nTGAXGkbJ6x70F/+bw8I4/0ary5yhC8f+gQrRDPYWWta3FiYnKbHmnsncMGHgx3qoGM8ZNylMvh6Tkiv55DUyGanihAScpwetdWE8Pr18URRzqkWRsQOMnhkqKGCVQYCs9JZ26ePwXFu9rT/bIcbeuonZga6L6V+sdkwT+B2DdXaYQ3Km9muUkn6s/Trzsu73vykBAtv2PVHEezRRcWuMRBabHMBZ/HV4/IsGnZqZscEmtLyahCt6njL4pf4R+xbx5lLBhTLC/PO75JLPY3fvWcMQQIKN99FbSwhdw== 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=VNCA2ciB280KAfwHl14tJjhk7zRLqsCOyo9kMLOMkUGPqnBrL/icC0DLpNwEnbuaxgmXbUTTmoKJ1bRODPMg54/9Uljf+mDeZZEeAIVKdb6Y5oxOxMRSYX2GYOMEOS3qwgaimrNdzV8rW96ny5o2h15bDFq+z24poIoOeuPJnGA= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by SJ0PR10MB5517.namprd10.prod.outlook.com (2603:10b6:a03:3e5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.14; Tue, 17 May 2022 22:24:59 +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; Tue, 17 May 2022 22:24:59 +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 06/13] scsi: iscsi: Add recv workqueue helpers Date: Tue, 17 May 2022 17:24:41 -0500 Message-Id: <20220517222448.25612-7-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220517222448.25612-1-michael.christie@oracle.com> References: <20220517222448.25612-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR02CA0078.namprd02.prod.outlook.com (2603:10b6:5:1f4::19) 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: e248aafc-a2b0-4cc0-90c6-08da3854138f X-MS-TrafficTypeDiagnostic: SJ0PR10MB5517: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: wQiqJ5sNzEhnbGE2JUzW6SdnREHn+eHRdJK3edrt7fFXVXCN443H04AQiPQVCsGBGF8DbTPQUN3smcj8HPUlT8shA5Jc+amfzzmimNLGhHTbdmGObG9JUQsNWZTan18q0XZtrcE//JYlVKUsOLSE0XsItJPh0HOjKK/H83+3tl3uEta2MkSkFC2BwfCZiyAk1MVMbSSD0LpAPm1v4GVVjzvtcCPdr9+7O8lCGcuq2cLf5XTnhAYf2twh5/o61jwfgrUExcMAjCoSuXNLuDFrsk5Ii6AmeqW2HmtL0ox6EN6j95VJRopavWF/QVGfFpp3FsfiA8mHW53Z3c0ACn/FfDwlofLkzM26n5qZkm7yXDbthF8kfOl8VlYzvDvKf7SoQ2xbmWP7DJX57llFh44PPRm2FPimgKeo9e/MLeM/+Oq7392DFOauzrCrX5m55N+cpnj1T8s6nCzohe7GFnhZvj6GJSYnQCDq/VcqjWpoUvYp25ltTWEP7ohCEYABcgS56PPlSvOvahWjg99+IrxJoqBp36rZyxJmV3dJsZF4P1W7Xkk0CXGh9h7Hd8T9hIRoLGCjNbcX+dgu+TtrOWA9JOh1ckMvuB0vbFNe56d8mimRMTsAvxR2x5YI3HyMoN3Xmm0K3FkjL0VqEFnkrHLUF2Pxtm2flse0Y5+I/bm5d+2f2tVsFETowsWmeR7EDkZuOAk/QOAIzPdb3dNlv0bcxg== 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)(4326008)(66946007)(66556008)(66476007)(2616005)(8676002)(2906002)(26005)(6512007)(6506007)(1076003)(316002)(6486002)(186003)(83380400001)(8936002)(52116002)(38350700002)(6666004)(38100700002)(86362001)(5660300002)(107886003)(36756003)(508600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: eIQzz2xjBdj73PWKXhdigutRGZdRPZiu8lHb73+9t246lSPRyG+hQ4N7R2UWcbUZuSlsoK7OhlMkByd+Ia97XOO3pqwwyxUeWlb9GYnscvbQN4dJs9t8DI2taKJDBjVRfhrbYifZBHGUgyc1umTLWDeh16u2b4ghVHZ5RNbHA4FmVTluX1uukKB+cborSjWb2fHQUagpKb256IBAUfvhOMzPvKYoSSY6raCb0h6VpIuCaIzqdjXNF5R+r8NWK7UyLZS9JJkHKJPqh4PopRpiuvJolzV9uEJJr1TeVoAVxMMEj2gEMIyA67H1dtnywM18maYegnEbLDwEnicXIF1q7oBK/YqY50xHPS066hwhKG3L8EMtjXdL2ZNU2fcpVw6e1LztnRcT8ytbZW6kzTc400WiOf5GRvZQUbIVEgW48Rbj6qdzdK37+SFLtc9R7mI5LTOJ5ot1nV4qs/JgY6qYAP6ciAgZU+Ef+X18+fuyMuqnksTWju/j6SVcTvb+AP/+GSS1wiXYmnwWk8HUsDvRfngG/g1o8UIw7csZLmc64U3BMlCsmoyhhqc4HCdsuyO6/eGmZn4u1nYCWr9/Hs4w24OtS967AXQnF0+GhNcKoHZmb4tsCyCCyaTHnBYlDz1VAk79IVIPJQ8a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VaximLd8Ap+/JGFCm7sd5by3a5lFG913Gmv64= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e248aafc-a2b0-4cc0-90c6-08da3854138f X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2022 22:24:58.4493 (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: G6PiMst32tSxqoeRJnUm6bO6xALmZRTPWjdW20NVVU+fOH7QHCIRJeOqugsHfs3nKXNh2Xcn315+1W9zKi/4LSAJnQIxMeu2kqOxOlcN8us= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5517 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.486,18.0.874 definitions=2022-05-17_03:2022-05-17,2022-05-17 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 malwarescore=0 mlxscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205170129 X-Proofpoint-GUID: s3hbz07wBP_7FLCLFDYhW30RhKSC0992 X-Proofpoint-ORIG-GUID: s3hbz07wBP_7FLCLFDYhW30RhKSC0992 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 Tue May 17 22:24:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12852991 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 316C6C433EF for ; Tue, 17 May 2022 22:25:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231152AbiEQWZr (ORCPT ); Tue, 17 May 2022 18:25:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230527AbiEQWZO (ORCPT ); Tue, 17 May 2022 18:25:14 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8ED8852E4F for ; Tue, 17 May 2022 15:25:13 -0700 (PDT) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24HKTWN3029120; Tue, 17 May 2022 22:25:05 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=g0azgRdxPRVcc8vPcXkG3DW/ei+0kTWAvIldOUePtr+OhP1t6Jja4UTSV4kXbehgSRsI T6DO8mEnQARZiFLafZUy4ZHimx7/jhsdLgV/60oklc21PpSMWg3Kv3U6SPf/GwKv6x6l KCTvLU+NuyVkbOeHM8u1kEPrkarRtqifn+zNfr4r18fst1kU/Hn+r/86L2L7jOerZEtU cesOXfgIwjN35ik69YdO3X/SR8RdaNvuL2T8PmXK+jX2iX+EsF/qVYiZNk9PBZRlTPSn DVPJZhFDq+ozfJgQ1vKAF6zcdVjz500K720cvc/869AoZw8GCRxLAR+QyAqqbfn7FEe9 9A== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3g2310qrmy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 May 2022 22:25:05 +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 24HMP12G008394; Tue, 17 May 2022 22:25:04 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3g22v3m138-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 May 2022 22:25:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mt6rcUFsOLObvha0KOK5tt2BtG4QnL2LY9G2i3zBitnlujKb9cKAwdVcKXBxO1mxFFsOaL6U2Jikms95KaFWMroyva9mvT9gJwMHO1H7cvoLpp2ak+OlLFocj4Uvh0DlMgEKu9MmZvKmQKzeHVHz61UtZlyOqFvHa4kaAqRbb/FcX389N+69ZkVOd74HdfRaXaeugYbh2XqN/vqGISGVU4A1oAsORP0XpNg96Ef4NoijdBLEcNxnEYyj3d0Ojf0BPB/bOM1y5FbxSYbwP8tRlD11R6zaCAEcyApW69OXpC49wl3PRSeFSQcnX34FUP0xm5LLvOHvOBn1JlAiFX5oRQ== 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=Ifkv+HXLzOIzLFYRmDR9r8+nJ6bX7LKvhxO9yoB7nM81qZEFSBT4rvy857PUmTn/zNTfZeWxkHL+ollsOzVr7dIi8BXG/XolYXSupJeAkcOvwP1GbRnRDp1VIMZ1dkjqj99wjm48Wkw5ETW5poHyxZaCNHQd4+5wxQ+N+ckUdUnhP4g++82PGMta1ULqTdG5M0EOyQzshpq+nWsoFcRfpWrEZKqR+xAsQGWSPWJiYXyZSfTafQAJ7dS2dMa2BfWeh3kLLpKXlKeF3ZyJrZ+JLGrNnbGkarx1l7NOTaJwtEuHJ3T8FZI7sCt6UdBxGAvSLHqunkyT02Tlz7OVemNajQ== 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=ZqpSqhf22tTlzyi9DWYgAMT0h4uCqgc4bixqjymo32WCu3fPXYNLKcgXHg74DSOn7AwiPI4e5Ae2jA4FN+1dA8XFX7xgVkt4BdfTUImJ3h1MMlqa8uLgoAxq8beb3M73VRvUFngu6vR4aqEY5yXs50pPYJ+fu2ovpjiW+RwGRZA= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by SJ0PR10MB5517.namprd10.prod.outlook.com (2603:10b6:a03:3e5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.14; Tue, 17 May 2022 22:25:00 +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; Tue, 17 May 2022 22:25:00 +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 07/13] scsi: iscsi: Run recv path from workqueue Date: Tue, 17 May 2022 17:24:42 -0500 Message-Id: <20220517222448.25612-8-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220517222448.25612-1-michael.christie@oracle.com> References: <20220517222448.25612-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR02CA0078.namprd02.prod.outlook.com (2603:10b6:5:1f4::19) 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: 751b0ea1-b339-4dda-9f0c-08da385413e0 X-MS-TrafficTypeDiagnostic: SJ0PR10MB5517: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: /oc3LkcqjZUbKs7eV9CNTUFvRxwYP3QV+GidNnlNWKHmpI5I0DvgSCZ4deXST/prGdNa60ZFMbSikuEy1318v+wOCtePHUHKHQt8vdzg1ujKx8RE4YonpOUZRAvLisXhNfAJyw7nJB0WOjSaytw388ttzotGJSgdV7S30lvt7TyKrRAR7k7t58uA1ikGHrsw6Gzbdq8V16bzUFPin9Cuw0wjZ2wA3K5IybLMhlO54Gfr0u+CpcAmJJzBwHKBqW8o4ie/guMiascQ//6NUgwNrrWI4MbsoK329O36fiFXapZe62orftRrFncqn5pfE+GniCieXkewdEh1JAqlKBEaaMuxk6AfO1zKv8cMTPpHLmoKpnukAmZAQh7oCA6d+ng7BwzPQt9PI+WOzAUpKlQC6T9Dmb29DyTfyhc6nErIqSbVlejCBSDIPZnvSEs31WwitudxHhjgUxhK0ij1nBkUgN1IgOH8ailSLPKIshGO/5lRNUmmnpllIAJ9BQYDenLbNTk9wrOO8EHEAAVOCVbZ4FZXU0GVhuuQ628yoBRF9d+YxuQzNqGtWjz4+KOHUKs4kybVfuki3q655NYLuzQ2Z73eNsGC0DnTNdUleRGrVYG72iFeF221CSUJ0UnvEa43wXczRNCKnyNV5kbi3BdnrNg3DeK7/dNqh3+cP1TMviv9262Mjt98zEyA6rigI+UPAm94u541iiFiEFgXix/AUA== 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)(4326008)(66946007)(66556008)(66476007)(2616005)(8676002)(2906002)(26005)(6512007)(6506007)(1076003)(316002)(6486002)(186003)(83380400001)(8936002)(52116002)(38350700002)(6666004)(38100700002)(86362001)(5660300002)(107886003)(36756003)(508600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rzl7MAruzvWt+VFn5wesUuSItIrk9kLoyq+DYQDk3ib8P2CYHI6VwKhcXAb7lwrDtY31EEtyrX/3IJVIkiSXyaLudXt1XGhA5qSzSf/cAs9JfPxG0mdVKOk3VoevnaMRZYX/9S/hSzMwZYdYi+mWy9xAp/jcI28BN31S/rMox3tsa044+9dvfW5oYcTJaNO4lkBnwtgwD6/+YweYS7DFSlajJqtzUJ3QAXR/qaxPD7YsqKk7DqqUTn1aFEJLrGY2tZC/DLYwQjnFQuRz6IFdPgqIZeAJnXq4oioUSilVjIaBlucLNIWeor8i2ZYys18AXlzE+aImk1IKGs/nRec6MF4w9t1dKYvymj31fLMMfNB78AQGAa8l/XaU3UntfRSPZODEE+CQY+D0bNgHbCNpWOAYNPUTMAl5KpdUklm9c9Tv8HB0OUrz0G8ykhb+0ds4CopyTEGy9zhC81Kk4uZ5sPGD0buxGuf9BZ5rH03WYCRpqSXyCWCmWjTyVPRwljpZC3xe9nKmIk/y7sM0dmFsCH7ftBSFGsU1J1SHe5wzCkgZJoLGiXW9xYjt+K7BPTAZJAIpSBwY1s/0xkaz7dbbeImALuF0lek41WFJ5qJD+rXChOLiOHrqKfkNFjKnfzpFLEYdjiBXUV37JCZ++Lmkq3wmcHgM7fxbXqCKCrsq3GVAsPN3F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k= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 751b0ea1-b339-4dda-9f0c-08da385413e0 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2022 22:24:59.1523 (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: m4Tv+jijKi74nAYpxt7EKR2Hxwe+OSvru6TGtzBlW4Z5w3dZgZfw7PS6FoP8LYYF3Svg3uRBb5dlHB7/nsiGWCY6BGFXY9UoSiJESwUYVNE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5517 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.486,18.0.874 definitions=2022-05-17_03:2022-05-17,2022-05-17 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-2205170130 X-Proofpoint-ORIG-GUID: VT5zhrjgF0DixOew_YPPxtLkNSdgJJ5D X-Proofpoint-GUID: VT5zhrjgF0DixOew_YPPxtLkNSdgJJ5D 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 Tue May 17 22:24:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12852990 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 7FED6C433F5 for ; Tue, 17 May 2022 22:25:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231144AbiEQWZ1 (ORCPT ); Tue, 17 May 2022 18:25:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229595AbiEQWZM (ORCPT ); Tue, 17 May 2022 18:25:12 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EF0552B2F for ; Tue, 17 May 2022 15:25:11 -0700 (PDT) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24HKTuFt012482; Tue, 17 May 2022 22:25:04 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=DoLpqql0Sqq7fx4A+hFtjKhhOzpT7eU1bjcnxPkIgsaxWVcT87CQotRRF/byUIl+Zw5y qtQ3ftIEKiVomZV2IVjv7eyrGSv48AwU26ZVK0JlPlc8Gb3u+gVK5GhT9ZQ/oToBosz4 FPEd/lrrmG2Aag8n7XyM3kLHa3pi84S/wP09WHxaWH0WSTZKeoTUvGLGHx6QHiaVSJIY i5ogj44stcAnmUiGCZEgp/0C6ofY3Ae89Q2BG1H19leGCYhe/Xahima70yA5YHsP0WEk XAgIiQVKQscqNG/9Ahvmc8T2HmXkzAYBn0yWVPtU2nTnvn7bPpyXdwNBXVtOcjhm08ym og== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3g24ytqqv8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 May 2022 22:25:04 +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 24HMP12E008394; Tue, 17 May 2022 22:25:02 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3g22v3m138-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 May 2022 22:25:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TBPIhJ1tPngpb+8QmRJerDHcSJy/bG1BiHE9VXqLk/u5iVnti9Hc4J3v5pn/UPu1e1kLwKoVy8iSMs9XdkHfdDoMbQTNDrRm+YmAaUz0y3bo4S/bp7TGbmwV6tJRatBTpCgndiiQelS1WF3NPiHt5DT+YDDXwVZpPAuQH9rBMNHYu0JhWrORpya11v7pbDnD8sB4oIkzL+B/98drvBO2Degrop+xeKcOVRWzpIKhr0gncsd+HoLfhZMW6KzoZFqgxV7zYOTFRd362yrM6nq10oPftPUoGK/lfPK5zcMqpcNRjPpWDQfNc/dT6Jmz7mWUZyaG7vnnbXx6/bDJxS92iQ== 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=gSSyMpNixWlyn2xdNcb9p3WgyXwa1TuD90JzNvlGH/j0iD8BXezpw9YQBoeJfy0NaoDb9Ck6oet+GJe3+xDARPj9wgMXdspn76lYTOGimH/r4eZSMX6cjtc+D4h0oPm5yCdfwYSrn5qXAHUaK3qJV6F4Wz5ZOASP7DbB+k/9Apkq1icO83XcVUq+9SVaAqTeuoxkCEEkc5NxdzsGL+a37H/YaaXK13v8dfd5d089BUEwwrW8P2x4B17RqvvYDmJIdWpSdnqMWPQX2rIIphmiQRSeyTuvQI8GeTcn3ek4+8+4puGGP/+wqW5DAsIYuifmxrgCHBcNzlNbkLstIu34/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=K10sKvF1Z2pT+NmvyTDNczHpstHlMiLonlmnWg0odeU=; b=BZicvJyHlxbKItW7uFG9J33DG5aUpQTLxShavPpoHGuckYNaNvIAvrByU6kpU8xIQtZUlACSRsd3UKYMb8QqdakjAWV4SjwOACPLXNY6LknVvIA5YGX741x2GBiEGli/Tvrs03qWQ7DDunf3yuHpCv7VGW5sLMDa+Z/f3oeMhqQ= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by SJ0PR10MB5517.namprd10.prod.outlook.com (2603:10b6:a03:3e5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.14; Tue, 17 May 2022 22:25:00 +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; Tue, 17 May 2022 22:25:00 +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 08/13] scsi: iscsi_tcp: Tell net when there's more data Date: Tue, 17 May 2022 17:24:43 -0500 Message-Id: <20220517222448.25612-9-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220517222448.25612-1-michael.christie@oracle.com> References: <20220517222448.25612-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR02CA0078.namprd02.prod.outlook.com (2603:10b6:5:1f4::19) 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: 0ed48b78-7359-4360-bfc9-08da38541444 X-MS-TrafficTypeDiagnostic: SJ0PR10MB5517: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: jb53UUjQDwjmZ3BHnq1J6Htz+haQ8AVdOPpML5ydlbAyZSe1yy6ql9hNpqprxGQw7cbxJbUzrzDtgzyaeVAVtcUafBJz7T6WQz8fxyTBxLztWUJH18GyFNG0LWuTIEJ0Y2LXkn0ZPEA7aY8UU+12Y7Wef6//3EiE6YCs4vVoUmOvd4S4vzaqsf9cw9mbPH0Qv7J6VuQ8cvRDMSlrcHeSPUStEOPLVXy5D/spHhH0iwVX0TUL59Fnek4cpvRacg7Ebo51XSg8EZZ2v3tIUu4aXTln5MhYbtif0+/U2mqm5oF60kyI2cIKOmWUV8cjax04PF7Ur5zvy3pNsBJPg9AgrKJ9e6w+Bl/DKNq19oZUc2K3xG2MdsOM5M8Wc71uzgQsHwTlrFLdBitbH1v5UqmN0wzfJjuiaEi5H7wSzO73AZ8mM9h11t+zu86GdKA7MaXH2ALqOvnVOV/cWPXDb3HQurv7Ov90MrSmmXW2w8k8z2DS3pZiuiBvhE/TGfkB1nWnGIxy9400c0bgh2rjRpqui0yacCHoPj33kvX/X4HNgFJ3U5LpYQ8edmdVHGq/Sgfo89eaKNiZCiN78plqOGpjTSb14VJlA6UdH99gRJqs6lAYPdxn5dHcAtTF9NcTN8STBy2kQMRhXIowt3ysi3EMyqjh/b2+Qj3/jal+sjMg/0Q2vqX+Y8AmltRNuyVwN6oMyPulCvUYYUF4vyVsxO9DBA== 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)(4326008)(66946007)(66556008)(4744005)(66476007)(2616005)(8676002)(2906002)(26005)(6512007)(6506007)(1076003)(316002)(6486002)(186003)(83380400001)(8936002)(52116002)(38350700002)(6666004)(38100700002)(86362001)(5660300002)(107886003)(36756003)(508600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: d8FpGnqlZq6Ua3k17HpPkTZh1mJAHeDYRsUQQr0uTn7W6y6NvbOxSB1GB9mQfnir7rQ/jlkh2/oBos/brYan/5jKqrwHHYqzwYoigC5xzBCdGXHsGyBg5/bUKB6B5I+AkirVFYMQWqzm83+qRXSrWW8RN6Mxwn0REmmMHIANOzr89Jxz0e88m7NfAgH7Qo+xWijl4exfUu9srRYqGRdgl10S5P7hUWBU+h8KTZoQ2AxK4YcgHwJyCTgX25Gb6xkVt8We/7JuTS4dIy7s/5fbh9vifyVBtt0IrOZiC8lbrxCBDsO4qR2gN7XR4+Qm8s8wb/0CqraLN0bAxYnVyPa++UZJ+ErJRnSoIKn8zKKk2CnionfqsfM3lfV5njUpqwYf9gZL9Kflz8IroGVujiT7Ak0CNcTmNTmKBTzt5ApgHZT/ydD4SNVjCYsIHAwyjqO9PZxsj5t6iKMiy/OsumWhJ/GnDFKjVWfbb5MRLsLkHGiciymtpU82aozlZyzWQ83AuI19txtVuNyOF+sSPwSDdqPPP5hwooeIsT2dZaPPushuZhIy7pHRaTKtQVBJ4punaYWioIb5LlORvz6cCRQ289EDc4ilgB6pUXePOPNX7BmBo961bh69pL2Yg2EXsI0GtERzr4l046uBrAEcRkH44PHjtf12X1zOCNnvGFFP+RvXA44xCgZT6jMWZDBFIi8xgz2Qv6E7tdEDHnTp3p9tmvNXO4nJ8yuU243Gn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359-4360-bfc9-08da38541444 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2022 22:24:59.6210 (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: 9fVHBtR9CenWFTAXbODPJMIevi/Zm1jQ3XgB1R6ACsViIE9LdaVC4gb70PJ448baEne3udDdhTjp61Dko0+EJ1XY2Ea9wzq3YTc47OzHlKE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5517 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.486,18.0.874 definitions=2022-05-17_03:2022-05-17,2022-05-17 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-2205170130 X-Proofpoint-GUID: JW1xU-bVxi3Nz8lLzmdr3BO0zjbp9Voa X-Proofpoint-ORIG-GUID: JW1xU-bVxi3Nz8lLzmdr3BO0zjbp9Voa 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 Tue May 17 22:24:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12852995 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 9E76BC433F5 for ; Tue, 17 May 2022 22:26:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230522AbiEQW0a (ORCPT ); Tue, 17 May 2022 18:26:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231150AbiEQWZr (ORCPT ); Tue, 17 May 2022 18:25:47 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52BD552E58 for ; Tue, 17 May 2022 15:25:17 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24HKiI9n031641; Tue, 17 May 2022 22:25:05 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=biO2GVIpwJuXtO+0fHwXwKiGZkyGoz1jEL6wXUNu0mwZyqjia3m2ky/b4nTlW1RS/Qj4 99QQ8Zava00dYr0jw2Dcm7KzcEgg01OygnXn7u1M512+DsmdM2QamT5VMLKnyQXe8f9T 34g+pJceWM6J/p9cz14kL6Q+XMgSkKt+CZR53tIbdWaabxeUJH+S39+lCfga5A+wlnjD LyeXBidRmklq98XXhUz6046Lj8qks7dNvtZ8SQK6fuGIlulmSf91w5TbDE/n4YBH/qoC M6wuLRbOZ1TjunCg+jevbAZBW4G8x+4zT3URk7leU65gQWJJYGpEx/Ultl4v/M5fkQrK SQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3g24aafjgp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 May 2022 22:25:04 +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 24HMP12F008394; Tue, 17 May 2022 22:25:03 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3g22v3m138-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 May 2022 22:25:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YDPcNjS54UGk0LUN0JREE38TP39yn4F7fjBY2kxHW95/OLe07PTyXOF3XOsX46VuLHXZjx3Ah1MdM03y7TPGfAL1XvuhwAvjlVjzc0qS6BzTf0Aa/Kn4QS8JLy+vwP/cVS9FVxusDEYK92JrXOipM1Zjg9z4/xtBX+/WCux7JNAr+mk9UJkXw7Wq1cl98/X6KJ5l0lxFiiSnIqru7VmW3pR3+RbE2Ts/Sw1kZrbo1w3tnmTpCEAzHupbJlHSrleEOiwvIPCnTW+xGhZ8ddw2iI2eLI4KpcTCAcpeMApN2SZD/3s11gBmG8mwu1Q8l1lYezXl/C/uZ4L8RN7PGRbl9Q== 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=HjURH2VLmRbtRz/an6/VpN/usm038wZJ2FJx55uWGrabEf0nTomOJa7j52RS5NgUxwsrMl8ugtXl/rrbHYU7+c0HuF0Wgxa1xa+41YuviPpe3n1aHr7rTD3JBhnEAG8Q1L84jIr0+9JYVI7/pITjpSC4lCxestCdGy1pz9HsxWeJjauF2ph+8yHTwd0NyQT2kkhR2SZflOILKc+zqj1e/hyfjRREZx5sIX88P3SuIfj4E+dKmkVgTmkcjHKC8TuBCh46JXzB07CF/J+qoKzZTiGVMlfqjPDidyHdS4AZTh7zv+T9hcz1zsZZsW42IMaRldo7puvoNZ7RoGqhz/FS8w== 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=TDDPDKsq/0QytIqJaE+EzlqEMyLD/BLUi2LKDrrW8dDGsak7FZvzyPPB5Tu9kEL7/xj80t5h021yQq5Bg7onjObXkHGmqbxrYGalULRnNhZaohSD+EYaIkFhFZJWaGxGYEK/eFshFiTM82cPf9CdV0n6MHMCAIAuNPIrtmwNAWc= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by SJ0PR10MB5517.namprd10.prod.outlook.com (2603:10b6:a03:3e5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.14; Tue, 17 May 2022 22:25:01 +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; Tue, 17 May 2022 22:25:01 +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 09/13] scsi: iscsi_tcp: Drop target_alloc use Date: Tue, 17 May 2022 17:24:44 -0500 Message-Id: <20220517222448.25612-10-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220517222448.25612-1-michael.christie@oracle.com> References: <20220517222448.25612-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR02CA0078.namprd02.prod.outlook.com (2603:10b6:5:1f4::19) 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: 8c4fdd90-3fb1-4bd0-ce0e-08da38541495 X-MS-TrafficTypeDiagnostic: SJ0PR10MB5517: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: pfPAXcu/4wmVBdqYfM8Ux/b2De+fI0im7Cja9H67xy2RLnzA36OxwMMMgWnR7lw7y8SCMeKWvsPEo+7t1JfWdidFYPcYHP7T3GqIwSBWTN9w0Sb4UdSQUuXbVByxKhU12TT59Xx5/Te16HX10PXC8vwrQRry6J3QXVUgb+4DlGtOaitlhpzCWVv931NxKfXqJhQpX5dwuVenQbY5GwUQpvmVP6ueZqd1CBK60i0WXKthuTZw1oUd4d2epbG6M2qV7lZKSSkNC25JJ/2VXL49FsntRlG+PuJRElGp2nLSQXSbMr/pTkgjrDqD5kBkyFazdTXO8HfLxRVXUA5LIexksPQVV5W9K1ABqHAfFru0OgJMc9J4KgMbqFSWuxqeMhejpFt9yeg7EaMGpMuNzVr60TTOhBbaRn4dC9k0ch7fBWy7RTmgsHZOgN5nJJHuHvS1yHIBZG0LaZ+fkbDVC0Z9ZNE5PX0KOB0h1GmI+RiSzyhAu+4F+SN1PBxfnHjqvWllAU0wnlYspBnDantRHjS6wfAbFZtL6H402GnfclPctynzw9ju/x2ah67Jfs6CWnmGoC6H2TM6LFwwae9sBgMbdkA0D1kd7SBDDCT1gzXn7KLdXbcPb3JtXqj707/5wpxbQyEeQTvNyvJuWA4nKf97kN3gzIDWPephDjneatgStxTkdjMpHHjTmsSQheS0wHKQqHyx3ZNzKbdLR6FozV7OSw== 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)(4326008)(66946007)(66556008)(4744005)(66476007)(2616005)(8676002)(2906002)(26005)(6512007)(6506007)(54906003)(1076003)(316002)(6486002)(186003)(83380400001)(8936002)(52116002)(38350700002)(6666004)(38100700002)(86362001)(5660300002)(36756003)(508600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: raRJZZ2J7xvyqjcKz/4E2hnTPp46k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pDPJrQ62UieNGJuuzO8wOtQb4u+xLJL6hgOer5/gAUCWjoc9mUN65xWfImyCREIp4Vh0DQxmwT0rcxSKwDa16+rbpXaeZDge0MnMOcALXJr9UUoAFtC5tCy/KHOo7ne4kll1t3nAjBkiERY4mLT0lwsEzw+IbMaXNLK+ARwLCtjfUvXNocdeyU+d5eYigIb4Sc6HC0Z8nuDF+G5o3bmymlmJKOlK+HLzzzgej2VF55FnOuxhsuJab+P3ZFHnMD7EHgZ/O+3jz5QfbEYYuU6lxHUTXMjGIt4rq/Ju1ytXFTO6AoCKXkCXTeaVZKFH3lH6QBb3uxNhsxJ0Juqc5FPUSX5QRn67AVmSjx/kmmFO+qqbM/V/ciBtfMe3J7ZIu+O7FLLmORY8Mhkpr9rqWX4UKtimos4h/falG6a7eFzpnCDgasFIi7eJfoFsTmdBc4s2dEpK/X1+qB2/vK3tc70BBrFxIlU/p/nCyjrh6jslAkGhsKI60JYJgZEMiM5pZiO2emfhskDg9BoBniShGzrHhZXSiB9pJd9jj4ErkvfV++PL+7GvZ3uQ8L6bxJd5HwbVMaLr3Uq0Sgv2qr7jM1BU8hePDT6I3Jvzz/CrbBQ2i7L2oFNnv5PDNcj+2yMHjs20p1ODKRG5S/AMOuY= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8c4fdd90-3fb1-4bd0-ce0e-08da38541495 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2022 22:25:00.1679 (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: wvF9Ixc5yos5jLE1q1WxMfIXnP2MvqmYsKgAUceZ8xYzuxxRvb5zLqPh5O1qVSngdoIvh44fxOQ2Ncin7A3tZ+jgjZvRw71hqsKDghCDqqs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5517 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.486,18.0.874 definitions=2022-05-17_03:2022-05-17,2022-05-17 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-2205170130 X-Proofpoint-ORIG-GUID: cOXDFbC7hjMx4S38-MfLMyjZV1wGiou8 X-Proofpoint-GUID: cOXDFbC7hjMx4S38-MfLMyjZV1wGiou8 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 Tue May 17 22:24:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12852996 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 4A44AC433F5 for ; Tue, 17 May 2022 22:27:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231132AbiEQW17 (ORCPT ); Tue, 17 May 2022 18:27:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231151AbiEQWZr (ORCPT ); Tue, 17 May 2022 18:25:47 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89C2E52E62 for ; Tue, 17 May 2022 15:25:17 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24HKgGlf031659; Tue, 17 May 2022 22:25:06 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=bIl+4Wq75rY/Em5/uUCCh6NrLgWtE/wtqF3HEG5a2dbW2pPPDPUlPaNcSVkBMCpE/MSn ecAZv5h9Z763yb6CBZBZPGOOGCySzpq9S4444Kw87Pk2KcGo3EnelRteepPR84GR2Gj0 gKIqlse5dJCF9Yph2k3B7su3Ftr7Ji0mhfP0h/S3vJghx3LOO1WXtj3oao9gei0u0K0E carrjeyCcxAYD2VSDNdB5cH3665NjRbWVNQoibkEZRcUZ1LRLbkucMIDH8CjMLM/uwTE M+1droIzQSBIk9vgPIOYH0fA/g/qkaukIAV2izC4a1vbjh2a83xmUuKhAuJodz3yppx/ ig== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3g24aafjgq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 May 2022 22:25:05 +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 24HMP12H008394; Tue, 17 May 2022 22:25:04 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3g22v3m138-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 May 2022 22:25:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KCOmXuivM4cGWATO/V+n9fSH2qaKeW68hF+Xw62i/r+eYiS/BvW/ASmWb2b+gxf3P+jO5c1b6/7eZHlnZhLhwGGy7Eo+3GvByl8VF+X8eY4dT1i2am+zXb7b25KxaNb8shXln8IpcKlnGw2twUZZMxS+iitilWiZdEWDiH6/JHyYuhfv4rQ3kXdtAKkOd3BVTwmt7xJk2UlMNogbuRodo4GsckP6TBplI3/itaBf/7BQfZoyY5eIqPYOpGix26J9mdPZri3pTAa5JZ/K3iCbxv2PL/x66h0Xav7zbBkDFpXYwcWs0eNVivumne/yR4pDBh/IKTT9AeSDlIi8F9uAkg== 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=GIWs0SO8RsyYFSVTKx6m6GELe/i7zjLRWIDlwiRoB5WQu4L/yJu6f0912xA1E+DNVIKQGbTLh/kTeKkdHV2fTEf4FsLsAXViGKM05cBpnDo/NGVT/QedKqzPwvu4In+495mjLyrD8RFBprxPAGygNdr6DYSB4mruxgWQgyNljHixvpzW21L+qpDclW1UOMNXem9YshiVFmlXJ1pHwz9NOP9oOWy6UEfqqBjqubQZ6GdRPyYtrrMv0rHd7lf7syaJgiucIie9KaYf3pHimCKYfKFWqySIddPHhofmbVCt2/ikMQ2zK7IfM4zYiHLNvZBweQuHYMIMkacQMQ/IQu9vdg== 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=WqQ+M5Dwcb69KYqTLoRkgk2mfnm/zXW23RNHuhHeZ39HjPD3r1k5epD8Vxkd02unU0LvHcK2OaGVQ9bRx6hKOAoaZz67qajRiePNZnOR3pI46e7KmGcKrUWjeqmxkOWaS3PLETtzWqLkP+Xc+54ezg/YXx6r/nD/+glpAzXgT0M= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by SJ0PR10MB5517.namprd10.prod.outlook.com (2603:10b6:a03:3e5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.14; Tue, 17 May 2022 22:25:01 +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; Tue, 17 May 2022 22:25:01 +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 10/13] scsi: iscsi: remove unneeded task state check Date: Tue, 17 May 2022 17:24:45 -0500 Message-Id: <20220517222448.25612-11-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220517222448.25612-1-michael.christie@oracle.com> References: <20220517222448.25612-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR02CA0078.namprd02.prod.outlook.com (2603:10b6:5:1f4::19) 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: 4715473e-76cd-40b2-dc5a-08da385414e6 X-MS-TrafficTypeDiagnostic: SJ0PR10MB5517: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: qFDWte99rw8rqha4e17b8CSFedM0Sn9l+rQnE20i32nvSgKwT/WZxGKtTWsuI4LXU8RNzPPZTecwhQnk/3JW1b7N0egRKBXFLQ/L/SmmnvMM+EDR83EKTkf5REP8OZrMH9Gkp3+gPJz27PyKLiwV3KNnEoZvINw3Qasas5KvSfXrDW0R28JZOWnzxvF/9AbziHwmv6b6E4uWzh48ejS7mw2xjyO6yerR6tekPQsy8FfGszLkNp6P+cVfngKhdV+CyA4eEexkOByxUnBZ8k1j5P+Kj72TjOLtFFG/eZfONny4avqw92g3PaHwBZGkZbHHCqH2IKU4asQytcHyTFq2g7T5nRUvc/jUbubJxAOdRd6BTdKp9qi13O+2IBzDC5XK/BcIaMTyckwk+RbrXZuqCpxhc6H0Ym+6jhMd/82irwueAR3mrb/ar3uYl00ImzVNGfAd68Ffo2SnvdKZgRkv5dKw2pTuS7eIaiJ9Jjm71uZg3G+2TTIZ3xFlKvdiEjyVDJ0lBmun/Af71beSrFSQepOMXHVa0cJwQws48+5F379ndtHNIwknuhe8z8lPfzOpWGJbR/+WvSuPVa9PAiqNon6FqVop4MXOB/Bcv46oRUoiTcQ+s7jC7f6iYkd0RBSXt+ND+tcpzdj4UjdKUSqtZ74xt7GXv7dh+ie1w3efvkasJI1LmEK51bQRv6ifIzeM2ZKDc3gMPro4cmAr7/Fn5g== 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)(4326008)(66946007)(66556008)(66476007)(2616005)(8676002)(2906002)(26005)(6512007)(6506007)(54906003)(1076003)(316002)(6486002)(186003)(83380400001)(8936002)(52116002)(38350700002)(6666004)(38100700002)(86362001)(5660300002)(36756003)(508600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: q3gWYiIltPuV0eFHAs0yrJuAieB+wbVitXnwzA1UHpxRSv4l/iCbkKLDe42YIXzZR8xWUTYyRsc+4R3MOOawf+qw7ewLUgKUjzX/Yr/mX2ht5kze3Vz+LSp5eD8BzunppQ9k97TM7vvf4zutdGz5E59fJNJp+1xevhOH2T8NkJ/YUazsz06LsKz+SLgIudUf+u+BnnrmcuIgvL3YnfgSVEVzICYyvYiy3mLqUhbiRpfj+MA6ldIuPGQ08eHn84FK531Ato468etIBIs3siWkTaBN2VEML8YFK7UUG9BwAzqSK/ZZ/BUIfZZ38jLAunHCJsgneyxxJMB5jKS/k5uxt5oEUOHpZbqzDqXpBIjNijRFpklD5ml65Q6Vsmg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Xnxj66xnPdHF48/xFBqA4xMFSo8YibHjMtp6mpvHetXYJxdz26LxpkZ1VntmvTLltcIa5SAeNrkchd4UPlXg91Hqd8c/VtUKAgcr2lMuIKJFNOk/7qg6aJ7dGVoDz/QLK6ZuMEcJ5f67xvekfQeLqtivIoCY6bZTCggdKIu8gl9fk1IWs6p/7E6JgZzotXQOhLDMI+zk2EscJdvVrQ929CJnSf/pYmbPWWEW6MSd/BIJskmsxKIG2v9SEei0MidrYTe5m0aCfNaGyw09JX6NEe8CQ44bA3aS4xG45v+YN6kucNvRiH3oNOxrf+32rQzX8= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4715473e-76cd-40b2-dc5a-08da385414e6 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2022 22:25:00.7303 (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: hSvwyW5VS1+Yf3AX6yhdmU303w8zwYGaEAugOX1TQTwat2cbx4npQbfW2UxlQsz3gV1BCaxazqzhrLH1SAzPzR01YImi25I9uWYcrxa6gKw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5517 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.486,18.0.874 definitions=2022-05-17_03:2022-05-17,2022-05-17 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-2205170130 X-Proofpoint-ORIG-GUID: 7MnJb9d0jkH4OB6j7YhpGopCRwv7oJEc X-Proofpoint-GUID: 7MnJb9d0jkH4OB6j7YhpGopCRwv7oJEc 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 Tue May 17 22:24:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12852992 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 D3932C433EF for ; Tue, 17 May 2022 22:25:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231163AbiEQWZu (ORCPT ); Tue, 17 May 2022 18:25:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230505AbiEQWZP (ORCPT ); Tue, 17 May 2022 18:25:15 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0747652E48 for ; Tue, 17 May 2022 15:25:14 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24HKgGli031659; Tue, 17 May 2022 22:25:07 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=IDaAwX+tMVZ3fURZztmqoTC9QcQ5XcqkqLa0ntXVYM3bN/1r1ANH6Scah4hXwIA+s6Xe GuzzQ2PNnQLBUQyt1gXGPrJ688EjJaYa8mrtJbF4TOuuC+9N4y20oVtC8SLYBglnEzmT d7NOrGDy8ncfhi/QXWFYJ3thZTsfHWqTKPk+GzyvGcR6PHUKjh1/72jysG7643i3jKu7 p5DUQbW00OTeomRlm8bWwC1OFV8+vlXDz/e4VrIcXLgODICjJna8DScXQTyQW1yen3eD 0LQkc74aRMICFcXWtmkOO48u5RzJcA9onPcqnP4yjwfKoGmgH70CGfbGg2i5whzXwWMY qQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3g24aafjgs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 May 2022 22:25:06 +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 24HMP12J008394; Tue, 17 May 2022 22:25:05 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3g22v3m138-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 May 2022 22:25:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KiCAZMkXMBO5GVS3ArfSm9udG4FKXdf5XaBHda1A+N/BelN+E6YxvYRhj2WJdBa62zURXPqFR9F/PJlvrD+urCZne0ycmzKXagtDXoe8fEDJoU5GRoPS7xoLbKzU0IHqP1Y+O603MC1PW6FPWNfA7DIl5aIrc48djwvk7fEZEkOd3n+puzElR+FHXlsk+ZrTaV/UXNkHRplijpQ9LOg4JqC+ZC0ePXv3RycyLlj6VEfnLEedVK2FCSjXROoUgrYL/AY0EMRMdmdPQr8/E1/O5tKhp+Arcos5HpRXJ6niGcng0hlKDT45Y/5WlH+XdIYGkAigKGH8ex3lMwyKKXeSEA== 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=fvKhqFjM+mtYbCy9I6aSTi898QpCC7wYBKXRQRYp+m+wn9l30ZE5p6zJnxYEfpw0KqoucBivOTIy+4JSSWsI6O3fy3SzUt3CgAcuyJxiEkUXSkVbPJpihs1bP65y+eAch5swvcXEyFDq57zZ38euJENbf36Yq9IJulxF+z976JI2Kzmf5J5tLPSsyIfSENnq8RK4jrWgiqTCEtldkJ/27wvqJj/RBptwTU3/kvhgy2VKa3t/udNA9A0iMX9aTxTNt8K9/i26PTawAhcDsexr3DXFArnrpP4aiRcVDCEs5xvdinxyLyeNtwhtltvx4AYonXOg8nJiUEvtWZaU3EwmgA== 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=fnjJiKoVM7fXVxbTlvF1Ljb1SFeR/wrH5xTxQo9lVzr3VJ3myJ5CT/3wIf5uV8M8ct959bbmoytEwrI5y0ldpcsAIpTtJzF0d6gfvJfNw3mNAQrXhqX0j/b2Ysst4aOkZg/EJxC/KO06Vy9WNwtrKhN4p9v5luTwuYptPptxmPA= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by SJ0PR10MB5517.namprd10.prod.outlook.com (2603:10b6:a03:3e5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.14; Tue, 17 May 2022 22:25:02 +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; Tue, 17 May 2022 22:25:02 +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 11/13] scsi: iscsi: Remove iscsi_get_task back_lock requirement Date: Tue, 17 May 2022 17:24:46 -0500 Message-Id: <20220517222448.25612-12-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220517222448.25612-1-michael.christie@oracle.com> References: <20220517222448.25612-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR02CA0078.namprd02.prod.outlook.com (2603:10b6:5:1f4::19) 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: bb5946f7-d374-46f0-8856-08da38541535 X-MS-TrafficTypeDiagnostic: SJ0PR10MB5517: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: NG1tZzvbsOZkinnQ3/7oev11NkeCAoIaJUct7zABVeOcte/eNfgBKhlRiBLFzna3Fn5PpZq3AsU4tP6M4xJMw620ErO7cTpNFyiFfDQzNlNnvsELIOgef2hvqL8vgxJmv5AhkXXiRaB0rUoueLiz7sf3XvP76rP5b8xL08qd8WnecC+WZ49+7gRFUz12UavMmVblcE+rAMs2DEw8/ZUgmOwp4uFBM17qpra2xw0mvOKmjyGVyKVOEIdLqQJoUolSZmFX/f+oldZWYqdItGGdT7BL3/MfLim0sF0cXkVV4YRJAmk9A6F93QjhzyrUIlKz3yB0BtCFlUUd10ju6SO3h/QgAA+4HxDhvQ9cIrWF0EF8Od1LZawST2bfEN7KCKoEGg2cRLjLE8Rf5HdcuVRZntAHXobZjONmihIkSXDoujRk1em8cNWrwbjJK8FkNwGPGKt9j4Q60+aNyd4CZp0mGwSNgFjMMpU7Yzra67KSXoidh3iIgHKF3yt1nrWwfsKUE3h77Ee0s7rU8yVueFjvBtAfFN05cUf/akabP9n9HXl/GOCZNYT7rh76SQcbkt2rklGA5+a0q5kmJjADuPu1xhEctTXjcRYcu1u9ZtlacxIiCRMiLAMd/7LmlFqAYmUKetqHSkh1mV5/1+K98FZf//1KSI8ayovUYz/Vr1IcLbn+Seq2o5BAtK++Nkyd/0xflUxEY+hqCllA1EiMVGDjug== 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)(4326008)(66946007)(66556008)(66476007)(2616005)(8676002)(2906002)(26005)(6512007)(6506007)(1076003)(316002)(6486002)(186003)(83380400001)(8936002)(52116002)(38350700002)(6666004)(38100700002)(86362001)(5660300002)(107886003)(36756003)(508600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-Mess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NtMo/maC1qrKAGUTviOCgA4ijI2TRvArH45bpCYLOUZknI1gv1kEOtPRxrg2bXKy3wVNSvgX242d1dfJmCCow3nlVAtanjAN+WskqJPd88jgH6h879+p9zhmWc53M0o56alKdUK89oCy/6V3Y/FDY/ywLhK6DdZQR8/ku46Oc8F9e9JDDbUnbSJvcrRuqajhJ89aHPEqzHG/+5bfVw3dVid6ygPmdXBE7RW28JoKpFrzO4PjPXMlAPs4TBLQwCNGS2eaKUpny3hyl0ZWwY1GnFbtTDL27cerk/rtehgcgKfvTCfDxAiWFbZd6BfVIFuJ0hsCqXSJvYw1f3iHHjQelndqzWRbphYrNX3Tn3E0ItX3LMgHC8m/0JxVK162O2jOjdv1oo02kRAmJGlu25mQ4VWyG9CpCFc+lHgWdrs2PCBez+ymIZHL+4t0uHskXHAqKQq13qXk+2UKdSLmtDumSvrWLN4uiAUZQPvCf4baXDOIoCIFvWgCcvv9iX1vx8W7orlkvNX0JQLPTtOKfMJ8+DgS4GZivD2oNtMJge7uQXMpSTdBb+KUz5GR0oVDC0dggdPiu6VQKtKbsBxBvGVJaETGPbHoQY74y1/b9nZ4v9+uRTKuPS8I5Y5oxJEBjre39gAg8jIhEphGdQuswkYI3pchcjACa7bRXyoWd39lu0Nqofj2f4rywP1luE6c5bo7b8ZtwUJ8lQPY4kFVNaSMrnlEocE= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: bb5946f7-d374-46f0-8856-08da38541535 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2022 22:25:01.1834 (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: oGklpm/1iefrNf1eMvU9gdz32M28LoxduAMZFGhERLkZ0Ga2ofSMT5GuSRxzjkdj7m8YUnaTWuX13owUZg5sMaU29Jdjk3FTv4KIiDNKWGY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5517 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.486,18.0.874 definitions=2022-05-17_03:2022-05-17,2022-05-17 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-2205170130 X-Proofpoint-ORIG-GUID: KMgcPteQfFzyD_oh9iphMT2qb_fODH4V X-Proofpoint-GUID: KMgcPteQfFzyD_oh9iphMT2qb_fODH4V 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 Tue May 17 22:24:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12852994 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 83979C433F5 for ; Tue, 17 May 2022 22:26:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230366AbiEQW03 (ORCPT ); Tue, 17 May 2022 18:26:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231142AbiEQWZ0 (ORCPT ); Tue, 17 May 2022 18:25:26 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 527EB52E57 for ; Tue, 17 May 2022 15:25:15 -0700 (PDT) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24HKTjSk012903; Tue, 17 May 2022 22:25:08 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=bfdb4syXDPs0ky55XH1AmS4EryLv9b24n8Aim5KjpBd7MkLSfpyoMwiD92iEv5kxl4S8 lhqJoHGN6qldF4NGSbfvBW3Hli7E3OHpDPHQQVv/BVCiGRjBAO70Nj4ck7NJOwZo7AU+ fSR+AAA850IlTA1fTuyFE93SPUyyCJ5D9lVseZMoMdyFLXP55KTFZEEtZaMSI24z7R3/ CooF+NzG4xzGamGAK9dIAtgga7LwtH5LnrPqljhpChnwUgklbufVri611MzvbAHaTcQb RhIxToQ/ML1jtWFka4FM9a0a7r1euife7fiuzB6TIXvc7NAAXl0kOubep1XOYFY9/Xcq dQ== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3g24ytqqvc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 May 2022 22:25:07 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 24HMLnwM019398; Tue, 17 May 2022 22:25:06 GMT Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam08lp2047.outbound.protection.outlook.com [104.47.74.47]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3g22v3c0cq-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 May 2022 22:25:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MF/raYfb6d9Uufyxd5kSu+OEz3BIkRnQL4TPLDZZ4CYAzp5eH8ue6mVHhwVS75egGVwMMrVV6sm2ylcXCs07zUZd6ERGmptY3/9HV3vqG+ctlhMQCyvqaWTu3b17nqhA0PjubUsHc7MaQ5FlJ3azSPeLMDVv2fQbaMpONXtODgq1UB8CSqoC2/YTOc5EobvhsKnqj/GCTuJ52PDs85tO4XkKpGYv/5vnTr2VOo/plYhF2oKlXJZZD6KZDEPOnMkrJQjVfFSlKgT55kn9/0/Qa5vpHexj8Wwo+TUW0L7scbaUADmgtUcXZNKWYC/P4XMwI+b9sCFcI2wY+4L62OTLDg== 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=ORbY539SswQidItSNc9zGcdvkX24QBb8govjqBSVm+yZBXNsZVE01qJIMmG4sgc5c9vp2Y+y2C9UWVv4h3arnFzNmCjhcqQi5M/os4eoix/WXs2xRSBVIAmH9Mw4cK6+kG/vFUoftoF5HCV0ZTO6yGMpN1jOdpoaaQZ8IAXPysnl3zcof10+mCZeeHUrsMhQmm6MWnyndtBldhNeokpboIgU3sD0PORysUBiJQuG5motTJbLhv+4YBdofoRjmBBdR2SNUx1aGFkN2B7QiwdjJegZXPY/ty+BWOrGgTpEDQDqCZJ3NFACUW9VRY6SXR3P8eyugX+yUQkVMjJEA2Yb2g== 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=OE3CA2xLVUs+gpJ2FRR09UMTvMLWNW97a215cOuTZaSCPswsGr1xDcxayZ5UIq/SPWKPzaPhGB1OK/+LNhFA2c4MrqO7s1KyHzeyUNsycohWxEKyitl4b1RRFG/j3TurYWkSQ7ss3c2qrc0Zld+ozEWFsy8Cw0yRFVjhFKTN6aY= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by SJ0PR10MB5517.namprd10.prod.outlook.com (2603:10b6:a03:3e5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.14; Tue, 17 May 2022 22:25:02 +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; Tue, 17 May 2022 22:25:02 +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 12/13] scsi: iscsi: Try to avoid taking back_lock in xmit path Date: Tue, 17 May 2022 17:24:47 -0500 Message-Id: <20220517222448.25612-13-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220517222448.25612-1-michael.christie@oracle.com> References: <20220517222448.25612-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR02CA0078.namprd02.prod.outlook.com (2603:10b6:5:1f4::19) 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: 660e0bd2-5acb-42cb-ab1a-08da3854157a X-MS-TrafficTypeDiagnostic: SJ0PR10MB5517: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: giZXdTpDFlpvRzWOQSCZXEDPYFDchZbBadW+n7I00R3Cqr1T50/Qx2syyGZG9Slo69vRuqLk+OxdcD80xnLUKX+hZZijWXSSto73brdsDcfTp+s62mV3HIokqDwIeM4xiOlbwLYMZ5ID8R9Hi442Ag9iFvPocJlSg8JjYYygQiV4XqWzeCFAfWMWmHDG4Nv54PJqzqCPcZFF5OLWampig/GRGZxfA00zEtzD3hej/yTcRkMq0RZxvx/rrclwMr4+HLp/JNL3pbg4LBgB98olSopJ5ITxfxGHHIAm5fLlBBarCW94j9LpX8q6VYQh/yyFMNYXgTv5kS/O6VfNKHK7JPgdOYFs6Rm+TkAMpYsZw0V1NTF0dDHBZa7y97peEW+3kUTvDMhSeRS6dzDwqE/fqWPK+AI06pAl8a9BCkoAuByJe9nsbCjiX3sJdI9eD4EVdQcYQa3eImLjU8OhzUSi3JbJYan43dNbnaALlTHgpu8T0OoPoavP55shyA42e+TlpU4ZMLuJgxc0DMRKPhTVPMIp8FHjuEi68Zyam8lbKli+V1AOnBqILM5kY4OuzUw/IP1cOcUT1HaaMV1WHtrLqMPVs3IC2WCn9PevJgmo7lzvfQDFWsuhindkQUEKl4OoDd3II8j+GtQHaGDDW/idms/oe4NHWpjS/JEGE3qXDj/yCXlRbhd22IjlGRR35rEm+d3kbX1pycIB7+YJsP1Khg== 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)(4326008)(66946007)(66556008)(66476007)(2616005)(8676002)(2906002)(26005)(6512007)(6506007)(1076003)(316002)(6486002)(186003)(83380400001)(8936002)(52116002)(38350700002)(6666004)(38100700002)(86362001)(5660300002)(107886003)(36756003)(508600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QrmDtt/jNdyFiEnVvO8Fe9a7tZg7jJivMHf2RRN3iBV/iXJjAo+d0kG2YzQtYbQv1EJt0GH7uL6oHszBIgPzXV0m7BMiSg64lDjnR1OgAihzqP5Zj1WGYoaZ0HEMykJpn+Pb9WBZxD9U0WfziD7wYgMY6iX5POylq9/BRJ4ZYd5hSeYf5zdYyInnVkpRKDpN/Y4kOl4+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g9u+IXLDQixBh9zrsqk3tgYhD6Oh/HfWui77+a7F0YFOT7/8o/S3Qm8hqhVTGUlba4gJGuH3hRZxVG+G86cnPp7/PPsp4qjVFBaV8xv7goeyqpIBqT7w04Ww4a01jp9bFlfSe1ssLfGOu+IFGf41CBQKPTYedRxto22tg+kOBdnAV5h61VbmYWErcG0umJWFaBl7mpA5/RuCcY0hWWUHXD1tLrGDGeCZ/fdIhpK5ahSy3B9Avd6FpO7dZ5gVu68ky2PRvz06/BbsOyxD5FRletFF+aTFEXPR9LKv8VjVxStHQvo0fTuvfykTqNhE+2znpGljLxYsQ1aoGOEqtFlTriw6I839jB8ukkxAvXqkxt0RoefYi4Sd8O8vXIk+XenqO6DcXRUchb90rG0/qH5bB/DpB5x8vaW5GrxDmyUbnr/cfqr/xgerkr3y9tImo3JdDwCV8Z0gXe3MPaoMNclgzniuoxOe/zhxANX7odd4iiLwTGKm0= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 660e0bd2-5acb-42cb-ab1a-08da3854157a X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2022 22:25:01.6365 (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: HqZ7ZaLjFWq6Vwp9jMqBJ2YtEwS1ny36pybXdEKXJt/rbqqhht64qeDNu29abISnqyUAkmdkYj/tGVb9zj+hIuAEpGv6LRi/6uZD22tYCh8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5517 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.486,18.0.874 definitions=2022-05-17_03:2022-05-17,2022-05-17 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 suspectscore=0 phishscore=0 bulkscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205170129 X-Proofpoint-GUID: ysYuK2AVmwGopKavaKq6WfNJsOW2Dky_ X-Proofpoint-ORIG-GUID: ysYuK2AVmwGopKavaKq6WfNJsOW2Dky_ 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 Tue May 17 22:24:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 12852997 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 891EDC433F5 for ; Tue, 17 May 2022 22:28:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231184AbiEQW2A (ORCPT ); Tue, 17 May 2022 18:28:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230172AbiEQWZp (ORCPT ); Tue, 17 May 2022 18:25:45 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCADB52E6B for ; Tue, 17 May 2022 15:25:15 -0700 (PDT) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24HKXoE4029115; Tue, 17 May 2022 22:25:07 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=Gh/r/bwxYxIrQ5qjj1dW4g7DkduB6Q43mvYlnp7LwYvHDymdkAkd4h6DUkE6grXIyI2/ gEHKAkSk6gXtWNzZlbt++Cq5nf+yL+XguTSGzXkawZREauq92HapZ/RzY/GDY/4NDOwO xPUNR1qBToejgTY4MLeLel7nCR4GOB28Dgtg5Cnq8Wp3w8bkraWyb3T3D+oFmqao6k+v ralItdehYOMnC0TDPgoJ3GV3JXunTZR7aYuQByUKWgxKNQWHfc1R17B06wGqOkczBMCS BWBiouQyQ/xAGefct8AxE/grRdmIU8qFnTJeT2fMdNnlwhGpHHpI1Fje/7erubgNv0ns +g== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3g2310qrn2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 May 2022 22:25:07 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 24HMLnwL019398; Tue, 17 May 2022 22:25:06 GMT Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam08lp2047.outbound.protection.outlook.com [104.47.74.47]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3g22v3c0cq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 May 2022 22:25:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KVNrNqHfALB80+WTtmEACG1M2eC0tdYXY5ZITfgyrUzvSEwVdhkz9OTcEAuDWB9sgzHEgEem23bOwzRmzLa+TQ83+flA4KFIlgY+yrnG6qzw4K6x4TOkg43nQtYTdZvWgTLONrclAaFzVV/jxpT/GzAHMBQAuhmVAFl5twxYwLSglzmxeh+6jYebnsZstnwELoLnWVicOXGuNzFW4F8FQZsUUpNn6pb+j7jtWqWzKOMQRqAd2TXy3MwfmQ4SE2x4r9v83bBwv0U0iroQZNWSwHRRZLIgXhf4XH08ah+o0YJs4ngrCC+gs7xRCaD36NRFLC2XppRRTlzaQBckSzAIfw== 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=DC0+BtcDciGBN6b8/IB2RST0CqOekzA4+7Q6XHS8aU73xaArfiBmHAyEwDbQsH7XbntBkirFiiKH9GoHknWF7d4p8vAprU5gDtBTjfdYFKWtyJ+8xxVWghAQAPAjOPq2thxr+C9wTstcFL+pDxfh1Y5dmJQcrefhy4g58F3SaqeoheuXzPZP60yFzFOoXB6n1x3nUk6k1iyFwQD+nU6MwShZkvP7WQmYCpM4DPHSTamQy1e13nsdBFcL/XXbfZ/8/iwNB5BCD0MAJz7cYOLfw/ozRPeAYFICkYSU88KAc4z4vJWrnv/3u6gYXOHL4N15T41cVFiqAW6tsspNW0/Veg== 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=MRm8UHBaU0oKqzbQ9GgRuTgbZxkBnd+0awBkFas7WZ9s+aH6ljQDqYOiS06laxRkni96U//QOdfgdLfeb8vxC/0laPq2NX5Zm5hyJvH0Vg7NSZyD/kUDb4MuThX24WvhnUmXzcidUYtAsePbPks7rTxVCjGVGFoSqYzctfK69Cs= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by SJ0PR10MB5517.namprd10.prod.outlook.com (2603:10b6:a03:3e5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.14; Tue, 17 May 2022 22:25:03 +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; Tue, 17 May 2022 22:25:03 +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 13/13] scsi: libiscsi: improve conn_send_pdu API Date: Tue, 17 May 2022 17:24:48 -0500 Message-Id: <20220517222448.25612-14-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220517222448.25612-1-michael.christie@oracle.com> References: <20220517222448.25612-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR02CA0078.namprd02.prod.outlook.com (2603:10b6:5:1f4::19) 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: 46765a18-801e-4247-927b-08da385415c4 X-MS-TrafficTypeDiagnostic: SJ0PR10MB5517: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: ok0AM3rBFgtFZwlP3tlqFpXlU8Bsu6fwEFdnRaDnmaxzptK9uJ11vsHDaFwrVXiFv9h6YxlBYBi3JOO/23IPGz5LYPNx1VQLP34nPHuxCyjNxHkwh02PXtVrRET2I1H26EBk4c8eqcFojtRU68QlMQLG+V5QW+UqC8uufB0lKQjOPuJCgwEHk33uWnPFGtTNERyU8TPO90CvuDHEh8ZhkYgUJxgc3hLZIXLFCzdOlifXTs/OJxAvUp7ibaQv/10cu47I1VwW89OdQEQMeysmUDoGHgIhbVUMlPWCnTlgLCQFkKKTwKHKc5SthFZ+Nj9lvTD5Dt/fkpL4TqiUoE5a0U8YLmESNY8va9QphTHmjfthxDQKrGdk5brs5Pjo9PONxcCSJC80saRQs7HpMuLSaty4aGLdSWdCcDOkaTlHf0/T+jQR0McNu3LDvxazEfvy4xL55z3lcMcRORe4w8We9FNRwTIXcePmjHJ3ZlavK4OvlKGEfc+21eT3IkIHcSEe3B+35zc5H+42bm6tY2sbppMWpzwrFkuRqKZvl6Xh12r3QcXEGzK7gMCRAq0Q0Y+XQbUfT2o2C2ug/hhhxa/muyUP+QSfPJbpz/8QiKgVIw0Gd1D35oNX9AcLRVJZJTwswC5Tzq/D5c0rpXe6/hTU/ITJEGZWcYBPjEEYHYj7G1R5M1rXRV5rLAetORiONpMRVcL4vy2/Pp/bPpfFQMoOCg== 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)(4326008)(66946007)(66556008)(66476007)(2616005)(8676002)(2906002)(26005)(6512007)(6506007)(1076003)(316002)(6486002)(186003)(83380400001)(8936002)(52116002)(38350700002)(6666004)(38100700002)(86362001)(5660300002)(107886003)(36756003)(508600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wDdFZATeg95M1nSDYedLzc6qFJczN7S4X30YRuPmM6N7RNH/geDkBQav46nfk2VsM6T44eggjU8lXU+0pdVr4ll58ZmNTL30VUD/K5CdrCK6UidYmlvmex65hNPRZLVZUilQwZ+lOJ7dghPyVOt9V6RjKiN272dR0SlLOcn06iOKNwlGomFvHwC6sPYuwcV4a/TomtynynFCxbpuaRfRZ08bxfRA9qYsgko41cykg6SsG5Pw7YHiElJAKAz+7d3je7tP2MJ8YWQlrWojne9Um7O/iHPZdBr2Vt8DmgyxIAQOyZJqn+iq5a3svAw6VOViZBdUrTiEnquKZ3CU7q0zHAzrG9h8yQJr+oC1UEa8Qcu93dqymRHgJkmqyntmUhsExBA+JQc2nWyNbeXb4+qnvTGK8TIiDwbwOt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ArcytTljw5EY9psJtdSP6y7CjeoFquYkLlguJ8nLY99Ux6T5c64URUXaKLGlpZ43xXosS1dazasT1bm454Em7T1rHMe4yF1arP6Te+iBD6tTGEPjfZK1IEuHKkWIGhP0c7Y2dPBpArCsViCLKPB7AI+Kr2gbfNClsD0K5T9KxmEYc+uCJpFQhz7rm0N9LVQe+oETF9HO6Dq9QIi8KSjxDHN9lVQk1CcQy0cC8+QQ3ZjJwiTM0wN0D+DXgtnYFSi6RfySJiYyebgviArSU= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 46765a18-801e-4247-927b-08da385415c4 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 May 2022 22:25:02.1365 (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: VywpLlfEttqBV4CftggFVcCukIhUu3Sk4YEmlG2GweVh+QFBWM2eRvLB60oOAeyOfaKHVegCyRIXqoY1WMHl2WdYoqWtWCMqxowFrRMR0OU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5517 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.486,18.0.874 definitions=2022-05-17_03:2022-05-17,2022-05-17 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 suspectscore=0 phishscore=0 bulkscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205170129 X-Proofpoint-ORIG-GUID: -NlO-u8Ay7Fu_UVXaD2DwrQ8tuXN9KHm X-Proofpoint-GUID: -NlO-u8Ay7Fu_UVXaD2DwrQ8tuXN9KHm 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;