From patchwork Thu Jun 16 22:27:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 582529 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 2248EC43334 for ; Thu, 16 Jun 2022 22:28:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378992AbiFPW2I (ORCPT ); Thu, 16 Jun 2022 18:28:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378861AbiFPW16 (ORCPT ); Thu, 16 Jun 2022 18:27:58 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA37C5677E for ; Thu, 16 Jun 2022 15:27:57 -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 25GJQ3qD029767; Thu, 16 Jun 2022 22:27:51 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=3tlXitOn0SHB1N4sd5qAJGjpI4oLsW3jh6GfhMv2Gas=; b=SejoFfnUBe2HVM5evqDgOgNV5WzVedH879eKo+AA33JH38yISOoR4OGjLK2KVx92DsnN hFzlCy+FMGkoDg6k9wLyR/zUazWJUZwQE/nCDSqumMup6xPdTlbCAH/nohffipWmUL1t FCnpa1Y5Z4KtMh8rHNNXGIdK4j6UUuVgw2j1kyYoJdQjIGRsc1Ba7br9TtKl6UQ0q1xY wAC0i3Bt2+ZsgPXJgh94NSlIrfT0Twfp13bfpTOeGvbOwr3KZ75pkjfiolCS/zFyHzL/ nJRaqKnZ7rsCytm82IWy7GRbObnZ/zKySrvzOXfAg/r6oX9JJX/vhV4e7NrOBNKeo6vj eA== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3gmjx9m7s6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Jun 2022 22:27:50 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 25GMG1fJ013371; Thu, 16 Jun 2022 22:27:50 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2042.outbound.protection.outlook.com [104.47.51.42]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com with ESMTP id 3gpr7qjfvd-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Jun 2022 22:27:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cFY54kzlr4NxQZU1L7Ypk7ZtkS2H3k67vfhNw1MLj0SSV7INN1Wf85e4Wqhoh68HJbtMdU0s8JqohFtOtlZmTFGkQaI87Q3EdL1X5btHGjdCpEFv5Tp1cHWCPMqXWe3BKSvJhjyOxFIPI8XlrKzrwS2LdIFnUO6uHRWpu7/cR2j7AMjV3IN48sZebhvDxRKSsTU+qrfEDv87ogpy4tflSX0++NE5jy/iLj+FTQQqxa0KCk8/TkQqS1YLqQFygJEiC09AD6rNVO0e+ZYHat0//i08HCoEos/8BRzSoH6BgidMuRc67QleihvoC86tQ2kX0AH09UnrWu0c/AhayYx5oA== 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=3tlXitOn0SHB1N4sd5qAJGjpI4oLsW3jh6GfhMv2Gas=; b=A9Cu2yTohf3u2dM7jFKsPlmKbPQ6yCkmSfJRA7hKbkPbPwx5dz+zQ0MLgfOpfIzTNGPCKemptoBVqotTav5Tq1EZibnM/14q1bZmzY5eqIlPnQmZrr7+MG+4as9DXMbQ3DocQZBhfkyJdyiG64vPom0vxm2WuN3RCmjsnKgIBBK14MtM5d5q521iETY0OsuKqOKmsc1wi6HkdS3E9aHLPJTzQGzmUC01Is/Sfhu6mna9EXNEU0o3iPwgUQ62ygZBAanSBuGEgV7SbwdDCKKDoDzvVOdL+psXiOA4iJG3Gx3tFxU0PvxiCUQaSpytyXC0eSNzDLI4P4ox9CfIqSuxdA== 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=3tlXitOn0SHB1N4sd5qAJGjpI4oLsW3jh6GfhMv2Gas=; b=sDJfPq0qwQpaKVMNOv6vtqu7H8Ahq3LLZSpWi7ML+VF5/sAZoxC31dz0YAdjpjAc+NcoDSvX0CcEnhTdQjFEYl1CIfypcBSCufiN1ZMc648BT2YN9gLZWKdv4ouqGnOLOuESmMhA7n7EXF/QIp4AXyzC+2fOZSl/lsf6oTNitUM= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by BN6PR10MB1267.namprd10.prod.outlook.com (2603:10b6:405:e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.14; Thu, 16 Jun 2022 22:27:48 +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.5332.016; Thu, 16 Jun 2022 22:27:48 +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 1/6] scsi: iscsi: Fix HW conn removal use after free Date: Thu, 16 Jun 2022 17:27:33 -0500 Message-Id: <20220616222738.5722-2-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220616222738.5722-1-michael.christie@oracle.com> References: <20220616222738.5722-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR18CA0070.namprd18.prod.outlook.com (2603:10b6:3:22::32) 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: 24ebd1f7-46d9-44e7-510e-08da4fe7710c X-MS-TrafficTypeDiagnostic: BN6PR10MB1267: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: e2RlKB0uhzeDQVEQ0zrABfAjWGCR9owKMThS3U/FQcCOru+0IaW+pq71YzfECbhp+LWDDx+vlF+KD9ilCKF0IxaLxgSArAMfZJJefAQK2Fk6y44qm+WZZblbE16CgHdu0MvhPPkdm+TCqHwTnOlzkpAiMHDo7yPlXFIjv2QOubP2DbLjIzyeiLvsMAXNPbJnJoagOTe4RUx//5LpuN6UTV7uJWqgLM7wGbAljv5vz3mHiG0sYrslNoM32SQePtcc5fvK7aiVI1YOmu1TRkRhEyCrHwg9BbjHgXgCQcyWbWZgCRNVJePRt7jhcYhY+auJGIR9gSO2XqkAscajOHlv8hYe7/wbyexQffT0Z3qm2ZU8tUl+yd5SZ2AfrR+Xwt8oYA9GwGxKHZYBKH7+2ZpVhuqJF219vd0bwSXrc81p5urG+fES0i4pxgVeYcj+ArA1udZ4T++ypBmsI+bgf2TpkEk2QBEUoL3Yr1o9kh5ZBwOU2qJXhg8q/vl1WXDngjOajuW5c1eJnjCX7p9ZCkgJNWjuwQbBmJ+kQF5UA8m4pR2maikW4FM9fM/jUJt2nMxXQquIzBg1petNLgXkrjfskl7pnreD7k37NjVfnCslds44Oj4bXnpCvtmt49ZLC2cScT0AEvNT5nQu54X/8EODM3nbgC1Z4mpPp7np8fjPIFcLW1tL/MTVQ5sp9ErJdPrH37X04+oc5kbCLxx304DCwQ== 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:(13230016)(366004)(4744005)(5660300002)(83380400001)(107886003)(36756003)(2906002)(86362001)(38100700002)(6506007)(38350700002)(26005)(6512007)(6486002)(1076003)(2616005)(508600001)(6666004)(66476007)(8676002)(186003)(66946007)(66556008)(316002)(8936002)(52116002)(4326008); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: otyWUHuLaUUg57I8vbtFA7s9QJEFWicYrxMfDrAyOQHcyQjbzzVXZeDb6NKaWLUej68zNqpbYGmN2ahfvLX3oodg6WkrsjSmmlqKzqbzJLA6kjE/m24Tzhwl1Y7/WqaHvqvvOdMmVPGJkul2+929X2CS/i537sk7lcjrLr14re9LhKhtIQQ1XiELhkXTQM42/qkqgmRy1ov/x3rcbwYBVRdrBEu2H1clLHyOzkTKb+Lmn493GlVbRg7mJ7Ishzh//KxeOy/GrNG0N0m4YXZ1pDrQCG/48GBITWszjICsElhsu4wV9Z2/kyKtfeduQue33Ds1szBdexfFoFiDuzA47BhmoL1CRTIPeCCLpQbWOmWPF+sRRqUoe/Td9aM0u82wfvB4Kuttta870n+QAQwmFNYBNoezmGY+Hw0tmlAhjSeez2aqzDrTp2XhyqHiRBVnXJlt3lcb0N+rWWUBXXpWABG0pB0MoRpWQVoRG0/Zd2YsKeqcUS6t8Hwd4gPq/bggImVYxLHn0N9nfXX0kmC+N4aKl4y19gnTj8wLyiCMnmbiGxwABP+WtaheQSN8L5oQFaLh0tjJeQVbxMTPDZALuTXpqegVOn/y7RMKHvyi5zqh54/kD3ZEWfjCc6SIygDbvPNk3dYgq2/rkZeKTIQ/mn7tY5NgoGfRPLOJLXgEg7kJ2bliGH/HDHykWxPyd+xWI01/Au4HaAENqwnuuO0ziEqnIjw9Pots0iLPUJyCeyy+LfrsooNuJJGtPUy4GbLP57MHF11XqG/L6jEk5rIMwH6PI6Xyd+2eUJFPGBhPWJ1czpRiukL0raJpNJtweFQE30QuYaebLiOPGqvgq0F2qkMrzk7Oo5rMmuHXTOqWJbbA1wpjamNGG1xPv6ISo8hVDKBeZBUcmWo9oH0Sk0+tCxN2fR4AsEVbFlMvKFj6agPCYRMChQH8ygYvGyB6zo6rwA1qaqK5CiOvjMZhnJALgkSKfTpWBHfSpfi/2cHyNxmpckSW2+sEvR6TDRalmDrarTwNIEcEefBS6rGGLMu2JmiCf8d7CL8WGheGOeUu6CrX+To3k7yTnO20VntIN2d3zqF4ATXHwecPxvXcK1tcpWukPkSKOtbAemalQndNoscR6h5PVGTc/vfyMWDvhwIA3k2CzREik4yvwTxsUK8P/X5W/8r7+7aOnGlcievEeGnI5vApayHhIDIfycZRlWMAEhB834w0hv2YKv6f8/hj3E97UWnYLxUpSpVpOiXFXoL/PZSUBO8Z5XQcPaWuBa5JWOg7w3m2662IQjCdNwZPzv1Z+bFTRoWaBtKCCqQ8xu/oNP58Y2JXQPJ/K4arxVRv5ZDzZs7n7MB08018IDtn5NKdanPfBczzztlbtq1TKiDZ4UL9pEqlYkPZYtfy5Kyyu2khOjXThcn24S+GaUYYJyEXwUI+U5WrGw+5WkMPM16WNn8D7UPsxzAi/O753R9cLVIFjNkUikixBx4fd2pxIrQq72SIdZl7o0HiizQ1LScTA+YlUPYVjvM45lUuP+4SDgJM1b2WVdm+rQbcTIuLuxSFczNaHG4Mx1X9qZXDmdDp0lznJNeyVEUflhfOLoaUmQEj/9hC+Bjf33YCSGs3+TsDsXnaoxK5/v4xJrGiG7+WS/ZFCwZ2qDpgD69LO1MHBukTz26CGcj0G3+W3hXRcHFhWvW0Dhns4VIcmRxNwSlDKCibAPujnmaUb7NKxe4utMxIGRt/VEdcKAmBLmyc1n0bitvtKrYQ6JYLXiCnBt8= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 24ebd1f7-46d9-44e7-510e-08da4fe7710c X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2022 22:27:48.1049 (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: ThaVml9r38ZlBrPuYoPllkVy4gYEArVZyKiM1L3trm8KvmfJnP1h1nkewsHJAw29ILqMG6mD8//hzvFrMY6adLlEI4BChzkg5dZ+vIZjp4w= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR10MB1267 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.883 definitions=2022-06-16_16:2022-06-16, 2022-06-16 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0 mlxscore=0 adultscore=0 suspectscore=0 mlxlogscore=999 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206160090 X-Proofpoint-ORIG-GUID: g7cUX37zFGft-BsfU755rVm9dESjZfkE X-Proofpoint-GUID: g7cUX37zFGft-BsfU755rVm9dESjZfkE Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If qla4xxx doesn't remove the connection before the session, the iSCSI class tries to remove the connection for it. We were doing a iscsi_put_conn() in the iter function which is not needed and will result in a use after free because iscsi_remove_conn() will free the connection. Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/scsi_transport_iscsi.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 2c0dd64159b0..e6084e158cc0 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -2138,8 +2138,6 @@ static int iscsi_iter_destroy_conn_fn(struct device *dev, void *data) return 0; iscsi_remove_conn(iscsi_dev_to_conn(dev)); - iscsi_put_conn(iscsi_dev_to_conn(dev)); - return 0; } From patchwork Thu Jun 16 22:27:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 582528 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 D2470C43334 for ; Thu, 16 Jun 2022 22:28:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378861AbiFPW2O (ORCPT ); Thu, 16 Jun 2022 18:28:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378901AbiFPW2C (ORCPT ); Thu, 16 Jun 2022 18:28:02 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AC4F6006C for ; Thu, 16 Jun 2022 15:27:59 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25GIm6B8032726; Thu, 16 Jun 2022 22:27:51 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=5AwKPawvQRHSsq/HBa7KjRtPfopY83jlMfxNQtOmFUs=; b=aXPgzwWOPVlR3qeQfLLwngo4K8/hInjQ2PemDnXXq2wtO2bhUIEJRZAZnfUQAVWjZZIT PzYqngK2BtnGMB7BGc4yFYPztZp/pkPDW1LeHIYtybSjW/1RSLe6vCVXo2xBOHajfj2e YIb8ti56Xd6ju6LXNEa8WBOLVD4S5EIq6Sg91VjZUIXzCwecIrm5uks+MQym650Ksbuv nU1PY60gpqQVEU3EDmXoBX2VnrFWNmZlP4/TN3VqFz3PjO8UvNzbkbB1MtdRXn0ndlHx IhrbGEIEl0yoPcPzYaPDdmi0t9DyIwzi14mOGI9MBXgSPZ2FCE7scMObx2YJJ1FsrAOS /w== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3gmhu2vm10-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Jun 2022 22:27:51 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 25GMG1fK013371; Thu, 16 Jun 2022 22:27:50 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2042.outbound.protection.outlook.com [104.47.51.42]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com with ESMTP id 3gpr7qjfvd-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Jun 2022 22:27:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oShbt0SI8COAuhWAg4Ps0Tb3w+LSMYBlll9pZj6BipFDO3kPBu6RWyRyTJn/WmrlAkE9QqgE8DrZNyRMNPIDnF28/GpEaKgSUTBQwRGj7rXoPz98Gf8VrlDNOEj6yLoIX3Nuinli8Xdy/1R4Gz2ZCSpnDIW1tmeKGFxz55IdMZSjmVzPN6hRUtfFr17BUHVBwfLj1hIRxCUGYvFF6wluyY/ynRVRT/x+LYx4bEz/hwLaDyn3nalrGMyZJ6bvBhognnHoLBcPTsFrZ/Zpz6NOvv1dMupKOXFsn4SU5coHewBRHAlx06WLvbaWBrYkNU9TK8a4w1VLtjCAdjwTWFu+1g== 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=5AwKPawvQRHSsq/HBa7KjRtPfopY83jlMfxNQtOmFUs=; b=R6n+QFy5p9klyR++SRfJFPPSVnHJ03ABtwhKRclQoXm5tGWiXxmhGTk+GykUBVVDe9VOJ7NGAV+qvlIm0xfkzhqygaOtr7uCtWnXBWHcExN/aABGKMOMpCog+mT4ZMdDXYt9qnEewnvIZv1SBprvxVS3xDqkeD/8ustgKXTPE2IP6HeB1IT6hhnIWCPLyVU7Om6aczdwpJUFK+IglEnFHNbU6Jzm7qmoOuI+b0N9qR9HJxnyvBACmza3rREnsfthBl1qjwFGiqoQdZ5vAQ5F1lViy1cdZWJlTCx4kZUQTgm72E1wtYIxSndwYtM9qjXHG1cy7fsSoUhrDh+nbXr+rQ== 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=5AwKPawvQRHSsq/HBa7KjRtPfopY83jlMfxNQtOmFUs=; b=jNOOWw0U2yFEkt1cv5EkVx8dGh0aPTyzMuXHiLWXswmKzeEVkczYrBqOE329MYnJ6HGMx0qWgpiP2Bx4n45RUePkKPdeq1VAoXuq8yStLmijKPcxWL0tgJuZs0oQ96jiTQgaQPZSOuqhDx06228QksMfPMHndwBrgZ8O0ZcFLfM= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by BN6PR10MB1267.namprd10.prod.outlook.com (2603:10b6:405:e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.14; Thu, 16 Jun 2022 22:27:49 +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.5332.016; Thu, 16 Jun 2022 22:27:49 +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 2/6] scsi: iscsi: Allow iscsi_if_stop_conn to be called from kernel Date: Thu, 16 Jun 2022 17:27:34 -0500 Message-Id: <20220616222738.5722-3-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220616222738.5722-1-michael.christie@oracle.com> References: <20220616222738.5722-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR18CA0070.namprd18.prod.outlook.com (2603:10b6:3:22::32) 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: b383d9d4-b5bf-4ef5-0d53-08da4fe7718d X-MS-TrafficTypeDiagnostic: BN6PR10MB1267: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: nEi0VGSQxYlSEVWDoPSqJYxa+3YMO00XAQF4QWpq5nYIbvL46wMKIYf0YW9kn7bTNno5t6epcZbXdU8m1DcqvQqerOTnsZXTLq32Htal1ZcM7Xn5/m6S99XDoat26ys+nFsAINo4+/RHu3VV81XTVaFVpUznccg+2yeyBoOIB1SoUTH3fN72O6Qwbn7JGIo1w+7hg1+kcNcsA44no4Qz7k49jLPIiexCWbP7i8K07Lq+V3g+JLaayeqe1SWRn8kBksmBo8fG4I9fW3/VGoMPcZJFLMzuroEYfAkY3oSC4k81UJ4AzUg2GvdycsU5OknmnFypJutLoQz3uhKstbCfXa9kO+H+2ctOn78Q1oWD4ZNaaYykjLNa0UmX8mpM41FQUEjAy+Iq8mCg0W4KTPu0OL8feY6i0x8LAXyLSBVY8tIhYodGdrn4JDdK+IWb4IGiY8wCixPJqjzqmQUhwDTfrtmpEtpJG1mNO5iBLXYP33GNqkalYPVlQ+n0QZdou6BlNwtafX9uuKGrc0jXvDCnwbEegGAk666THcFs19Yu/ZEH+LUwjDJuEi9Y+FqJsTnpz3PuiWbyPN0g+AE/iDnBuhHTQsV8NOgPDbYVfI0NnWXsTqdZhZa1HHv2oIMT2PuQAhdo+ZgtRlcwX7/OWQyM0X6a3by9LK18xBydalAOmG8G2yxa7SiQ+c14sdHAxrquNp2IC6rILKi+ugKfo/SA4Q== 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:(13230016)(366004)(5660300002)(83380400001)(107886003)(36756003)(2906002)(86362001)(38100700002)(6506007)(38350700002)(26005)(6512007)(6486002)(1076003)(2616005)(508600001)(6666004)(66476007)(8676002)(186003)(66946007)(66556008)(316002)(8936002)(52116002)(4326008); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VFQps9em4cDfsu+5GohDLRlax5/k7aghSkmZy3icoyHePOzcSdj44E+UCusK2gYWZyaDt0ncEXWUJTzeKNcOYtjlU8KXtV0dLICJTKrlwrwYQqdz8dJtN8rsF12p03hKXQ318NncS0+tGoTvUAVyyZ0yuaPlyLFRCN+7pdmwo1BnXbkjdrgAjm9dw7KzxjiqhycuTjsBHfDCNDlaRrc89PMCZ/uKooqwIIdf9v7I/3WBbqNAdpBX+zJDagDAb1EH66sQf+PvC/zZysqXRP8Lc1meLvbp81+wNpveeUuO6CH/O4obFobmAj2cIM2lHiRpN/9CbMLDYtUXjAHSjlYVX7YykkgJ6PD2sOMsOoTDUrHRRRLvzhF7xRAeyBV1Ebi1qYqYdXchLPMzJj+InsKdr9qx1k2164R/a2t4ChNzNze7+xEl6AgeeKZxzgIjahqrlPYDMm/Uwux9mJiLxM1mwS2woQ3LAyDWT2FSWw6k2k5dOiAb2jz4PkcK1AWiia7VMJe2dSZDPpoPC29n4JJ5GladXG1MMRxwoWKrkDwjbnELAyaIwCZW+dWbWcFTRiRg0XMjihXZtm7pJ73o0iTAGzDK0+TzRJF2RlT3fnwX1NIv81azI9Xo5h1Im3BIIabGRy+eN5e5qaqaJX5iSQLolQFJnCVXUZi6su+9g5vQLKWL7R++PFEyohpndWolc+ewOvFZn7LuAWRIYYPWu5cswAM+FB+pnXQ0XoIL25p5XNw5Zp3r/nLsaxKkdUGX2a7f/WZ/DgubBFWpXczZsxUlXtf1Hi4l8TLDpWQ0fPWnle+VD0QBqxWM2v7qrhUV1aE9QiEdvZxHI/AT5OpGYAPOGmbn3bSNIVDHMkXgykkKVptdhDZru3UR2XB2gqJ8nxXG905379EyAuQ3v5ALRk3tMg+YP3nOQ+pj6JbwnxhMue7r6NkpgkMpOIj+kIQ1xKvMCKQSFhSfEKYH4oZGCeMTIMEYoxy4gVJ78jnWI5Q9evc6hmI9aqy/tU21o5EaJhrdSQmV/qWtM3lSiJs4L/1cGeoPamK8jCIdOW+4f1/LJSPKI5yUTYx9tcCd6oZlwqaJFXi0gEIAa/FWrfNl3u99dra2L6ULwoN0XI3xmMTRkGX1I60oVa+ukp8kQzmH30syXN5LAPdJcBZPJd2V4vl/vTrLWGbww194P4NQ11u1dCZQS5oxumw/Ewjgdta6G0QYOmbbZWA7zJ18b4F3d/qZoQFCNofoxAiYfuxxCncmA0LcFISR5vMf8kb/M5Rx+M9pChCbzuCk+VU0dG+udKDZr3/wk9aPlJenckkeK5lM4dET+aPUHE172VPqYSLr2jf15Un/+TOGd5Fj7RcibAw1WQOVsJO+hLgBzuegsbTKQnk0sfpgRh6XHB8To6pMmZrPhmTIJ1vIfHNQNVtCr/pydXI1gbeGkfHMOJPna1QEwRvBxKba4Wub6wUXnT/rMp3Xu0kifDJ2kz8PPFSC/mY6U5p1cjUqpflbEOtuB37It0Y8LEAIzwXVXIBYyhuKcItAahzD4z3BxsAuY9CJb+nuEl+HtY63GQ1esH6sf/JfUeePbElnXegox0D0L6JsALX+UtJimXMW0gdMIvKYqAGgrIE9EjxIDOF+cWn8N01Pxcs5ZJWehaQD6voilxr6gFfq3HioiKYxwYbPWOEcED2e9ORebro6XurDMuG+AohoSr1cmWmf9Z/ulNl3CGdStt+7HQJjz0jokB261npv8+7IE8MkjU3mhaF/iEabw0WnKA4= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b383d9d4-b5bf-4ef5-0d53-08da4fe7718d X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2022 22:27:48.9486 (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: m46sNNMyc4/bo1Pc6SAQkne2Z7l09eRyrMHljo1E9Qjz4vvSZEH/J1iaiajfX/OYqtr3G86JWwk8cjZmy5QIKqUsNc9TYxr/TaYKRTGbf6M= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR10MB1267 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.883 definitions=2022-06-16_16:2022-06-16, 2022-06-16 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0 mlxscore=0 adultscore=0 suspectscore=0 mlxlogscore=999 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206160090 X-Proofpoint-GUID: zpLe0UJGHPS9pt7y-oCyDPXm82jzufmo X-Proofpoint-ORIG-GUID: zpLe0UJGHPS9pt7y-oCyDPXm82jzufmo Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org iscsi_if_stop_conn is only called from the userspace interface but in the next patch we will want to call it from the kernel interface to allow drivers like qedi to remove sessions from inside the kernel during shutdown. This removes the iscsi_uevent code from iscsi_if_stop_conn so we can call it in a new helper in the next patch. Signed-off-by: Mike Christie --- drivers/scsi/scsi_transport_iscsi.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index e6084e158cc0..0d83b6360b8a 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 @@ -3713,7 +3705,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); } /* From patchwork Thu Jun 16 22:27:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 582726 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 49CF2C433EF for ; Thu, 16 Jun 2022 22:28:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378817AbiFPW2P (ORCPT ); Thu, 16 Jun 2022 18:28:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378918AbiFPW2C (ORCPT ); Thu, 16 Jun 2022 18:28:02 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AC96606E1 for ; Thu, 16 Jun 2022 15:27:59 -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 25GJ44FG005248; Thu, 16 Jun 2022 22:27:52 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=tbP9HBuIDCVNYRj0G1nwWkoLkQ8X/eC/NBiQrmkzEUc=; b=lt2tt/pEcg2clTzGn2nWMqspyhSJ3uJL843ifFfNyJFdLLZQZ1eFkdweshNMM5bhQ1tf Z/6Si3yudkJi7RPojt81uM/EkPejlBl6t6AK/PuyjNc2wD1fTC6GRs7a9t52R/uvjsFv iE2InNYIe7x0aO2D4AmbC6nTRh1UrgsvhOkltQfYZFgTonYwvLxmP+tf06/3cetq937V NJD3XwdMu9/prJT8WjWoBsx8qAIx33TISs3sdjr4dfDfGXZw8PQYFFUvyHfSKLMD8qXZ Tdjq1M+TYiiI3wqMnPSkRl4Y9Yey83LdGjbdJzvQAwHpRRzICknXIm0EsI7oMWjQMSWQ Rg== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3gmjnscfnb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Jun 2022 22:27:52 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 25GMG1fL013371; Thu, 16 Jun 2022 22:27:51 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2042.outbound.protection.outlook.com [104.47.51.42]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com with ESMTP id 3gpr7qjfvd-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Jun 2022 22:27:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c8Sp3xaPL7i9fc//r/jWBVbujudndfrJup8674d3HOTlg2C/AZ9rL3fLdOiutI7RjP9QsxMp5QMmw1z3AUAzPSS55FpM4L6lTQu0x8n2A63JYuUgMyigiexI6QLJluvqCJULKsvlkfh6dargkiNSxQW0IJ9MzfXzCNg4N5Mhipx/efmbcMKi09tT5LgPcfK6rU5SDjfKBVJFpclEBsBEoTiHrF9N/bPs6QQcYKHcawWAwOj2rkZxPt5bW+16Hg6gIwE9qN/0VCdNpIozCI1Zufh62H0copHmwyIqhr7wI3XDbM29hoAsRPL7hHrtutO4bjOMYYKrX2KNu1s6KsdHiQ== 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=tbP9HBuIDCVNYRj0G1nwWkoLkQ8X/eC/NBiQrmkzEUc=; b=HhQjKNlO0iSWrob0PwpKgIM+ZSdKoz7szZ1jFY2nPi7UIj3AdANGRHAY7S87v5fXv9m3b2S8uUPvITS12GhfC6bhwiYcRH7F776mEK82MeUUIIxOyiA1jMW0sECSTXBVMD3EXB5ONZ2UevUgQQVm1GsSL+oJUolOxG85O2wt7UfuyNFVBB1sqw6ILJW3BkZVFIF5ebH3W8peWSO1BXfAERyVaXUK085RbYbERGCPJPlVm5ugotM8O8PW+d8hQu/K2IMlbM2xAQbthGJBVLrwBmgexDGgVDQbH72Da/R0E99WxD33lBDr0x2xF4mntN4nD4TkzrDD3cmFzFf2DrvtNw== 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=tbP9HBuIDCVNYRj0G1nwWkoLkQ8X/eC/NBiQrmkzEUc=; b=In+k2V7l1gKgiiMAro4gKNI2gkaMinRzzBjeSJr3LHWVHBPL8/xMIKDwMjuR9UO4Go1g3PooRMf7fBZmRVZBtg1iit4t3hR4bjcBeMbWD2MS/HhqsDsw44kkVGNdJe4+/CORPLhE/8suYeahWv2r8Mnh2F7NjC7oL9OFcjnZM6w= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by BN6PR10MB1267.namprd10.prod.outlook.com (2603:10b6:405:e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.14; Thu, 16 Jun 2022 22:27:49 +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.5332.016; Thu, 16 Jun 2022 22:27:49 +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 3/6] scsi: iscsi: Cleanup bound endpoints during shutdown. Date: Thu, 16 Jun 2022 17:27:35 -0500 Message-Id: <20220616222738.5722-4-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220616222738.5722-1-michael.christie@oracle.com> References: <20220616222738.5722-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR18CA0070.namprd18.prod.outlook.com (2603:10b6:3:22::32) 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: 94c5a2cb-4c0e-4ce1-52ca-08da4fe77217 X-MS-TrafficTypeDiagnostic: BN6PR10MB1267: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: yVGrQbKtmhq00ZNuyV/Oi2OT2Nod+PZbm1/4HQspKAd00ddSUv4UyCLg+nxlj2P+5M9Jxcm0GpvHd7Gd8IaUMF/PqSHVrFWtHYvxobiHGuMMmUpi0XExQWAZGNagdn5zKe7KCltQ6t8qr/jzwuo1MB62dRLGawg43cP9i7Kd0ewRrkhkSarSIJKrOzc7vrFAGLQCtL2rtR8HohBYyHt1DA4Wirt70tBZjziRMaFF+2j/nL1I16GgWbP3oFYTMdFS/318XKLvwx5tntAawBVqcS9qW63sT8O3Sb1mzma9onXxHPcG1/mj7lxwOuAlJ4zQO1lIoQYNY5jaIQRQdxbTRPQX9TitW2VN5+DEyYXOSyL0dznSeu97HGRsTZaoWeSb/4zw6WZz5DrYiGqiZ+R5c3XJpPqAAvQdWl04/NHjXIXiJd3oZhbnvXhsaJACSHceytuUdcdHHtzDlXq4JG9pF3sZjhdeT1ghQG1/OHk9QGJlIKM3YkEC4atNOLvA3enq4vte1l0FGlaegRJJpeoF2mAKCPBoB3wo/w4mYtRJEGB7QNcOdPObLb7AptO4jNcVlYxrytbEa6ZLpAeAeoVtQROBN4wEiTBZ/tgeV2KVuhnK5ns0uZMi2b7rq/S8UbSRPF93IbtuxsFZi3LH+tFXN8dm01/3r5rqjPgEdY7JONCtLAGSyBhMplYt0zAoh73p9gd3hWT7Ujq9BfO3eZJqcA== 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:(13230016)(366004)(5660300002)(83380400001)(107886003)(36756003)(2906002)(86362001)(38100700002)(6506007)(38350700002)(26005)(6512007)(6486002)(1076003)(2616005)(508600001)(6666004)(66476007)(8676002)(186003)(66946007)(66556008)(316002)(8936002)(52116002)(4326008); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7V6MRrgkJA3gIlTH97LcnZn0IKLbCDrI1G4wIMqA36eWNcxwB2l8UFoXAwfPVemnI8YdEF/JTxzOzZMGOmDh5FZoCzaHU1plEC8MUIqZap1bmcSlfkwiHfGrFKy4tyDlXRPXgAwDr9oygt5aX1VIRYEfpTWy4I/vk5XQ4EjG8Vpp9iem1GozKjNbeqzVOy01iUMrR3NgsBHucC02P4HaGcijvUUClv13EO+iGOOTTKfdj2991Qu+a6hFRyuoiHeAG1G+B2e0nAS0HNousSjD+sJCGo/XXke78FqTtuiqHigTKN3jtxmsemdctO13rlrzpCKvvatWWbyq7QrTbBD+7fYK8DlSuYprCFF1samkkrgCtzyz/2BOwywp3rYBebxJi8rsGWL1XDSVcohTRBTQVB0zpK8MygueNsZJwGMowUioIEH2lkfwInbh9A/sN739RGxH0EbO8gt1w53+jfe50C80xB04WjqgIJsoOPBvdGL20SFMPKqT1xJu+xNbRmXfq5f1wbR6PRPEzTT62/8IOXhHNnyOh9O1SGUCNcGHGlo1H+8dzFlN38ZZB3UDC9chkxYUF8lklbsOEzpb3ql/kVP5YoQwaMybsC0CyeaIaTHuaRKdlEOf1ceh3k47c5G65MgwjdHz7BvoI62xOHUC/vYCtXyovQYvfvQkzQvbqCu+THn8adi3cV7CH6vLPBL9SEofTQkQit6eYwORvMoFfAoOYTvX8C04SIou1l+CqH3KlrEPCsWMKYhM/k504i9dt5ulazg8vpVDMc/aOy9F6FBBg2fruFnpTTBLvCMEdOBn4pnbeWqLUr9ZAdouz/7XSMKSccn3M1yWiTtBCRUdtZvY9+Q/daQhAyhEgX4TXXirkLkaURNSSGSEbzMHhgC4sGsq5NDddVFW4s287+OH8pWXKumW9+MRGINsM+mgVdz1lHPKpnm1XHtiGZ9c7qfgPujysmLnyvjqFYjUadGDkidrjC1bl/9TbaR5SUWB5eg3sa6Ej3u/RxGfbDWDa4TdK3jwEi+Nbmbl0UGuSRwbz4yd6qB+YFbQRZ9v8EbisUhM53atwmoPXQi1HplYi5twlToLXlUP2ntcVdTL+q0dgn6p+1LEUgFMgqHyAO7wLP8/F6AjzY6tnVJSXsR+wN05db0J/qXFqQVtrhGd1PirsVMQ28q4+6Ry75PMSEQDI4sIqMBWkmF1209C9uKHOkZPJE+wR3JQkwpoTEMDmz8kIQUrP8eFwZro9bMjQ+6BrkxOqubCpNH8/s8HApPwi3uPcFWBNPAe5qLjNLoFQrabBPNtoAdkOOBAAS5XvIQylajffvGlRBhBBL3P1fgf/FW5Azcx6KR8cLnqmM3Kri7oKS90osikE0wYglZ3f0IrMZhVLYc7BI6YVPq492hPAlSab0uwUUuiAxm18FH92TqGotS24J7kfzfIrqhxN9Dkk5Bz7je/TwHjNQvXngf9XwLJnJjcsH1f+pIc8FKrmROn+ScCZW8igKU5mBtttKVBNNMA8EoA9poDiOhRadGreSOEVHOdUrbx/W5tUwrRUzVEyC8V8uiaJCI3h46ZxMi9rpd/vPMYJ75Vw8KeK6fFwp77/3ULpyA7ldL7855AZfB92mEu/B87O6xA4C8zhxGIvzUiFkUJwKCTeS8lncQoRMKKg34dWTaytKxL5nswc4puFfCN9moe8ZzAG47qoNwjznZBAF0bBB5KLOPlnOOd5y8qmd6qkKW8Rle10Dokayysu0UnBrC33uZExwPCYK1e9V0= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 94c5a2cb-4c0e-4ce1-52ca-08da4fe77217 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2022 22:27:49.8079 (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: ZG+XlHjcEvhitlSIvdFmgYQPgPk7QZPrcHPc9Y+Vcd+H8x46m7/pwffG2TGYlugwcrt4fRlTpx8UOZ3XgHyN1eMfZ47KFMAnevwqkzupfEY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR10MB1267 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.883 definitions=2022-06-16_16:2022-06-16, 2022-06-16 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0 mlxscore=0 adultscore=0 suspectscore=0 mlxlogscore=999 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206160090 X-Proofpoint-GUID: INWCaJMmhLvbBkIVn2gl3Zhgd3DOCiD5 X-Proofpoint-ORIG-GUID: INWCaJMmhLvbBkIVn2gl3Zhgd3DOCiD5 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org In the next patch we allow drivers to drive session removal during shutdown. In this case iscsid will not be running, so we need to detect bound endpoints and disconnect them. This moves the bound ep check so we now always check. Signed-off-by: Mike Christie --- drivers/scsi/scsi_transport_iscsi.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 0d83b6360b8a..e4614dede7e9 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -2260,6 +2260,16 @@ static void iscsi_if_disconnect_bound_ep(struct iscsi_cls_conn *conn, static int iscsi_if_stop_conn(struct iscsi_cls_conn *conn, int flag) { ISCSI_DBG_TRANS_CONN(conn, "iscsi if conn stop.\n"); + /* + * For offload, iscsid may not know about the ep like when iscsid is + * restarted or for kernel based session shutdown iscsid is not even + * up. For these cases, we do the disconnect now. + */ + mutex_lock(&conn->ep_mutex); + if (conn->ep) + iscsi_if_disconnect_bound_ep(conn, conn->ep, true); + mutex_unlock(&conn->ep_mutex); + /* * If this is a termination we have to call stop_conn with that flag * so the correct states get set. If we haven't run the work yet try to @@ -2269,16 +2279,6 @@ static int iscsi_if_stop_conn(struct iscsi_cls_conn *conn, int flag) cancel_work_sync(&conn->cleanup_work); iscsi_stop_conn(conn, flag); } else { - /* - * For offload, when iscsid is restarted it won't know about - * existing endpoints so it can't do a ep_disconnect. We clean - * it up here for userspace. - */ - mutex_lock(&conn->ep_mutex); - if (conn->ep) - iscsi_if_disconnect_bound_ep(conn, conn->ep, true); - mutex_unlock(&conn->ep_mutex); - /* * Figure out if it was the kernel or userspace initiating this. */ From patchwork Thu Jun 16 22:27: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: 582725 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 5EF3BC433EF for ; Thu, 16 Jun 2022 22:28:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378996AbiFPW2S (ORCPT ); Thu, 16 Jun 2022 18:28:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378942AbiFPW2C (ORCPT ); Thu, 16 Jun 2022 18:28:02 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4ADA860AA3 for ; Thu, 16 Jun 2022 15:27:59 -0700 (PDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25GJUUPI022342; Thu, 16 Jun 2022 22:27:53 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=CjxGqZ0LS7xcZ2OHrdlfG05eBe9cT4ePABl0eVU2p2E=; b=XGNL+XpHY4hd84qtW3j8qOQqNwAOsP1YNT8n0xa/eo0mvATNAcspAuXtK8DDHc9dg5pv 4DU6VOOPGYOyzPsL5RD2VSaw1TRnmu0MAj+qoLhBOVA0V90bcyDo9U5Leax0Ex2Kne7r Sbixj3T8j+nI8R61mqHA2kgd3ODc5fTPOC48LESte4co77pWuPkT6tH2hSc4wSxkdsNt bqHQfLbxc6MrOElYtfO+AqpdUl3uh9E4Cusjs5lRuryfGsqMDaRTRBI9YcRHJfIxG/tw 0KrlxbR2CU9MdaZ9B945LDUtlP/YnfBpZ3v+fiR7BFelELd1qrQtAUzcTQeWyLaWIgAP IA== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3gmhfcvbur-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Jun 2022 22:27:52 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 25GMGH0c034591; Thu, 16 Jun 2022 22:27:52 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2040.outbound.protection.outlook.com [104.47.51.40]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3gpr2brek6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Jun 2022 22:27:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M8IYLBt+byo1U7B14NuH+J7bCP6SHVf4Wchod2hJuqTyrKQbXe88Jig2S2tauafNcDho2gnrDNNCyHsIn2ef/cD4XD5DPB36M6p/EUAhNOcU7A5a+fO875kYCG1niBFYusST5aA37qtuetmi+UnjqlKs31EYkWpWbpxavDPiJEBp0BupHfxOF9QRaR3ZkBDOr5+ytB6TBLloNvKg/cvpFSI781jRzrqE1R20xui92pz5BUZTr+zIMHpK0KMB2CxYsCHKlIA/NC1MtWr+1IDFaZSi54/5+eGfop/rGg1PK36bSJul+e1afgK4/jHmhTjdWea1dIzwvQqnhB7An97NZA== 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=CjxGqZ0LS7xcZ2OHrdlfG05eBe9cT4ePABl0eVU2p2E=; b=byqiIwWKWHnkuIB699GmOOLH3lhV3XHEPrxdhBD0eUjRiUB6FG6DTfx3IhL6Aev3drLncvHulp2607WRzLJlhKDKMQRgkWayxpvdam00XvSUW7A82pbqxa3qLe/gWqpB6i2bKBTAp2FmcWcPuV2DnNdvJpFMeEOSFFFnHJU+gd5Wc/ENeyEhEwIdLqRyIy6EWSWVSQnnusCi7Nk662/GCb/GFl0TNOgORYdQwRwt9aXm4CgYUTvCZ1lslZ9QqP19Y0hYFRgSKRTxSw6PV9VOFT1K5b+UVtgNatUMY1eZkJYDm5PsmxqFmiT4Z2p4jCDILYRUOmszv3XBdRoX+xwL2Q== 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=CjxGqZ0LS7xcZ2OHrdlfG05eBe9cT4ePABl0eVU2p2E=; b=Eoz1Ytw176UuFvje0a7iNAJQ+tSh854K/MiWWBehU9AwRaRH6Jz4SNrY8r6ev9D40qt3B7b4puhg9O5jaxbEQHNSbxgVmgjZyt9qSLoAUf2RsYJaMgSbpN0Ep0uAazVHtww2B6xGP0smwAAqkOutem2vGWAHw3zd8APW/yt5q0w= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by BN6PR10MB1267.namprd10.prod.outlook.com (2603:10b6:405:e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.14; Thu, 16 Jun 2022 22:27:50 +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.5332.016; Thu, 16 Jun 2022 22:27:50 +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 4/6] scsi: iscsi: Add helper to remove a session from the kernel Date: Thu, 16 Jun 2022 17:27:36 -0500 Message-Id: <20220616222738.5722-5-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220616222738.5722-1-michael.christie@oracle.com> References: <20220616222738.5722-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR18CA0070.namprd18.prod.outlook.com (2603:10b6:3:22::32) 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: 71fafef5-23fd-468a-0f13-08da4fe77298 X-MS-TrafficTypeDiagnostic: BN6PR10MB1267: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: 3D9QAf2R54QZVIGFMxwq5hzI5yQlzyOiC8z/KwtosAuYtFt4Jqk+AD0Pu4RrMfPD3UzzPhip5M8+9fEQR9fSzxw90Dmn8snqohnJBoQIkuebZUQoudyaF7W+LYs2b8Y+/1Sf6NzGw08B4x8h5wBYnlgTDGrfcjS/Qo1+JbqClPT3bNP7SeLLcxrx5L5LLbBsgrX0SnN0vaBPbZrC65ws3NkvLXsSQNTxTo4gWjXdhVSnUhZBusPC4+W/40VW3/XidN0wZ5FV41A9J0IiPzAbhs/Nd1OmwK3STy89mqgICsV27wVbwnsGuDvyJ27xa2sROXzjo6KTKFVNJseHeVMLxdEbqTMIdo0Q0XVu3snE/jPZCC9TsvGlO0isLzO2kbeplXRWNc6UJjqbcToUrt0g0twJ/4dLcQImC3WnJd/0OrkIJeozwDPUKUCm+76RCmjuU/UpNUSBSEDigxa5DnoE80U4ial2uKz/sH4GRA+d0tQOGzgYwqRHOdqpUIKaTmUQ+1kypaUyWG3+6QG5FC3qSBWKYyIKmOMVu9PP8mG3g30ICIgdpEz2X0gzbLZTN80kw+3wnwyOE2Gg7YVvTVjm+VzAc4xGAMcp/szEid8i2COrjAbKyINqMwK1LrDZn4WhbBSbmvjm7eQTLQ9I8ikLQOAEGhDLivjs25gC0QzwTELfHyIXyjTRyZkvAicgUuyahPX0arxjaVLeMal0P4WxBA== 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:(13230016)(366004)(5660300002)(83380400001)(107886003)(36756003)(2906002)(86362001)(38100700002)(6506007)(38350700002)(26005)(6512007)(6486002)(1076003)(2616005)(508600001)(6666004)(66476007)(8676002)(186003)(66946007)(66556008)(316002)(8936002)(52116002)(4326008); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Mz4hufDYKC/oxzL+wm+6YzT720ozl4qYkpCHgpNDmLPQRR8su6EnHF2zxxe8ZG96Xqg7N1ILE09yuLerp/gh0LZAJJkOJNP7S5+ZxnZBDiFUybZRyN/hWYJ2zdkha6oLG7x91ao5F3bPjxl7akuOVr2RRnGJsw+tsrZAcc0zOGfIMRaEUawhf2hDTwAeUz8PJEj19e8rA6V77HBjsdr0KydZ8gNw6HNBi+neTDltTZ1lhGA00oL0Q6s7oA5aM/VzGgMv0zhfZk4kHCqT5jb81EfM5O7guM1RJ+J45gO/aUAxm5ONfmqHYZvHOKiGL6JPeFPLBojQQjry+mEWVUsWIrg69NPySxAr2Y7bvQUP6geQ0tGzB4UffdkNpvI6eHRJkxtmqQyyoSfsJHB+Duj7niFovkTtdff5omXFpcfpLZK1FjO8LIaOsdurfFIZOF+I3+W7/hmDVsEFbmpZZ/VxOOwd97QUZii+1LXaWSv6wBK8G7+ubcQpQSSxNgoBFReM1G4H544HzLDPzIsU4c8HxQl7sQtaiWVzSQr/whEwXEA0KAo2w1h4yy6wJWklHwbwwIw9RRGSd0XD6Bj0YpzF6kVXSlQpL6KNvOMC6BumYDOBmJqtGYek02XnwJms6mIgq+XZrITWdWI0cHcUFPdf0xfG3XRFDv2F+qrxcLV/Xho6hMBiyliGXLYP4b3UTrsn9aotTzuLHzlVBVyjIJ4dXV0soGQ/0jKea1p+sSdoBCeysS2Zki9DleZytH0OvVEY5zltAKdYppy44q19+0KsktcR4cvFEvRFaKrmBOctYLOTgxJYBdSfHuOrzMymPrIM1YeWEHA4GkuUb9q3VF6tStn5M8YRxJR+rA+34YsfSvlGp3HUb5N0XX+ahShRVcGYGjiO8eJr9X4s7aw3hn+BevddIc/uJijs7hzCglrnmdwAxlJswhP+Klz/nQoBuaXfhuz1sSnayhMIyhzxwsYYqmO5Yk6faesLn3eYxRa5F2EdLPvKCYYzZAw2KO2lOZHjeo3McswIxkbTPMt0QJUrrnOyvQ9o2xVP5tWuQEaGHnN74zdaPKz6/sxdWsMp4o7BF+hwo3cqsUKlTYcZX6H1ZtvbSqDOMQso6MjxloATqr76cZxybTyUWvsBemoeYL9uFTeicpABdI2kgfdjFPyAY8GQqsQb0nQAyTSMkpv4tioGVylYgoF9AoBnWajXWXo5QDS5tsLQkool0dmNXcgHZqkrQ/GFyiF/oMHSerYtWhFYnfqnBu50PJ6Nl2IWrGD1mDzY5t4FpMb0x6+lxL/gTKAM1A6pq/soRmjCZzsTzXf1A6gB03SKyZSgZfhdk/UuT99sKWcFqASvkrI2C0oYWlBlu8eskNFz7Lf9mxRSj7ya+QgNFE/ML/J8xlZlCPbFmfhJ+szjUFoa/kx6NtIFsrPjkS8FaRpEmcypLs5gtEhAoMOwwDSszfCymFSTOUEKr9R+HO/L98BRKyrH3Imuuu+43FGiQkqj6SRiP6fGC+/t8o0e9ms4grw59MWXqkGC8rd9r/qxAU3L3JHMjec9OwJgqO0ZNOsGXWU5FZq3plQrD2ya5/kv6JLxNYYDBXKl/IcHGGc4pa5DJpTBNAZIGwsB/cKW1WB9EEmVE7GsquAIYIyWxrG9fWk+MqAIRjfRQlq0bgsaKN6+La0kfPJghyDfIbG0oEbPLEJIItfb342qf/M5LKOZjj0EuVM5E5FaagxPDRRtcC4MQyaJy0/kWZVsfb0B1uK30pGvSJPLXXg= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 71fafef5-23fd-468a-0f13-08da4fe77298 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2022 22:27:50.6828 (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: qUV6boUHuTXXtk6fVq3vDDNa50FUxf1K/dg146P6E5UQidBlb5XerCUi9TTxeU2HQ7dNX0XM2fsF74DmU1jJfUE2HDHqKKBGQduBkExH6XE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR10MB1267 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.883 definitions=2022-06-16_16:2022-06-16, 2022-06-16 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 spamscore=0 adultscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206160090 X-Proofpoint-ORIG-GUID: I4Gtu1_de4ZjYBfsDSXYE01URRDv-YkG X-Proofpoint-GUID: I4Gtu1_de4ZjYBfsDSXYE01URRDv-YkG Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org During qedi shutdown we need to stop the iSCSI layer from sending new nops as pings and from responding to target ones and make sure there is no running connection cleanups. Commit d1f2ce77638d ("scsi: qedi: Fix host removal with running sessions") converted the driver to use the libicsi helper to drive session removal, so the above issues could be handled. The problem is that during system shutdown iscsid will not be running so when we try to remove the root session we will hang waiting 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 --- drivers/scsi/scsi_transport_iscsi.c | 49 +++++++++++++++++++++++++++++ include/scsi/scsi_transport_iscsi.h | 1 + 2 files changed, 50 insertions(+) diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index e4614dede7e9..b67a4a938cd1 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -2334,6 +2334,55 @@ 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; + unsigned long flags; + + WARN_ON_ONCE(system_state == SYSTEM_RUNNING); + + spin_lock_irqsave(&sesslock, flags); + if (list_empty(&session->sess_list)) { + spin_unlock_irqrestore(&sesslock, flags); + /* + * Conn/ep is already freed. Session is being torn down via + * async path. For shutdown we don't care about it so return. + */ + return; + } + spin_unlock_irqrestore(&sesslock, flags); + + 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"); diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h index 9acb8422f680..d6eab7cb221a 100644 --- a/include/scsi/scsi_transport_iscsi.h +++ b/include/scsi/scsi_transport_iscsi.h @@ -442,6 +442,7 @@ extern struct iscsi_cls_session *iscsi_create_session(struct Scsi_Host *shost, struct iscsi_transport *t, int dd_size, unsigned int target_id); +extern void iscsi_force_destroy_session(struct iscsi_cls_session *session); extern void iscsi_remove_session(struct iscsi_cls_session *session); extern void iscsi_free_session(struct iscsi_cls_session *session); extern struct iscsi_cls_conn *iscsi_alloc_conn(struct iscsi_cls_session *sess, From patchwork Thu Jun 16 22:27: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: 582527 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 724D8C43334 for ; Thu, 16 Jun 2022 22:28:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378918AbiFPW2R (ORCPT ); Thu, 16 Jun 2022 18:28:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378969AbiFPW2E (ORCPT ); Thu, 16 Jun 2022 18:28:04 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAD2460AAA for ; Thu, 16 Jun 2022 15:28:01 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25GIhsMi032716; Thu, 16 Jun 2022 22:27:53 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=trbdtpi7IGaB5tQBaBng4RxSIopEbsyt0fLuRy6kkMU=; b=h7X0tCv7TVA5J3IHg1/xXsidCEpKsF3jorinc0/4XGuxO34CsDlVyaX1prYtqe8Ko7OI vzm52E93flfxaleRnHSAXK0xCVQ+Ou6AxMO1bWZQpJRKuS6k2g54F4DfxqLJRVsEfv62 TLn+8xy41yRCvW3int+uZ1/oGt1LKEjwAlnnEVEjsm8GyrgOO9uBdPNqQH3Kt1AfxvXr 7K5gEJ8fu6hCchD1Yr2h2Sf+Ak/NQ8vvA1MvCXmWEmUPoVKOck+DpQhxJoChlC3F58vk rj2MGfK1WKcs35vrjTWmiIuA1rY7RXiS3uc1fOyoxCjyB+oDiAZrt+vNxeH+fgqGKs+p zA== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3gmhu2vm13-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Jun 2022 22:27:53 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 25GMGH0d034591; Thu, 16 Jun 2022 22:27:52 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2040.outbound.protection.outlook.com [104.47.51.40]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3gpr2brek6-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Jun 2022 22:27:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PKer2/lK0bfVBOWP6NMQwhXIE/RePP6XnGuv8Nnvst86pA+ghA+pfgWFkecka11f7hu5p2xV7II0OQwYUNr012xQom8re9dQ/E7ZQibXsPQbRinPq+VrJVsKiQEp2VqwoKxV/0Ddl0C63ix44IQv+UD++P72dVfXs2LhEmTRyeKlt5/e2/VrYPyMhoDXFQYA9M3lTRcOrbkQEpAIn6C8VCYOltcAt49J7Hj6YVCq4fFz4t0pWaSNgUXzRwfQ5QHzurvvBPHrUDuzZ4ml5wBY3cV2sYPFdPe0Mnxq2f6yvlhGI1Zx5pj7O33qRzKTl+QYBu16VHXXlxta0gIwFcWeoA== 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=trbdtpi7IGaB5tQBaBng4RxSIopEbsyt0fLuRy6kkMU=; b=jgv3DntUE2DgluaAVAGTF628u5ZL3HjNttrkzq/kHGd9DN+OGPjem2BvQQ2BPu3DEfC9Qh4OnfEXfO+5ixjC6AQa5zIID+qZlOMeuVFPMMW2/HR6f4dyCD7W11Wx52y0SVNAavNWvYa8r9EZnv5vOfhLOhdk+on4o3MW34W5fus3jUQ1uvytXgoxFJfQFBnuKMmg9nnnDXYIHPe/b98a6pvoTDrOb+Yh0NDBE3BsDB1hQvoeT+10KMAG5DRVgcs7Kjhg3Ygr6ZHtHw5pyHYy99flNkl9D4ZbpJMFqrHyK6J8pLtnvOXVNcVTKBLNspNTcS/JBiaeetuhKMszOIShGA== 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=trbdtpi7IGaB5tQBaBng4RxSIopEbsyt0fLuRy6kkMU=; b=AugcZ421EPjiId4oVDPP7FeaCishQV2R8nV9iiun1MYtCQjDBFzWDBdhfdHKhapaXwhXKjs6yMe69Zs7gD9OVaa6wATJqfkDOp2Xw+jr7Q1Y46dyvHQCtCW2MewG/K9gz3LKLD9dJ4/BEs5/5nn0Sln1/17WdgWz/pNX/zPXIbQ= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by BN6PR10MB1267.namprd10.prod.outlook.com (2603:10b6:405:e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.14; Thu, 16 Jun 2022 22:27:51 +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.5332.016; Thu, 16 Jun 2022 22:27:51 +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 5/6] scsi: qedi: Use QEDI_MODE_NORMAL for error handling Date: Thu, 16 Jun 2022 17:27:37 -0500 Message-Id: <20220616222738.5722-6-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220616222738.5722-1-michael.christie@oracle.com> References: <20220616222738.5722-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR18CA0070.namprd18.prod.outlook.com (2603:10b6:3:22::32) 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: 23a6785a-8419-4e41-690b-08da4fe77316 X-MS-TrafficTypeDiagnostic: BN6PR10MB1267: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: tMvC+69IqrUFs74kxfcYOl9iQ8qbtHPFIEgvH+bq/Fb1eitDsJ4R7J/z6rxjFHsMe5pGcyAEWFusZC1ircx+PRYrnhucJyLLLU8W+/rNPG/oWwVjpyAgD+dQnVtnXs4LOVTplsV5AOxRkWYJaItPsYXyWNJhxpH90e27xdyPTFO/nZ3rt5sYWpSk3Aoi2FY/W+cIq29EE5PN5QvagU8UY6kzQFwLC/G6B/CTFH6v9XhVlohOFhvu1eRFeUNylV00GYGnMYT0lCQsZBqjdd0/1LvYFTK1buGc7P2NTmfduLzlN99+lfUoAxRuPv4grYz/5sZEKo2RvyjOFN6VfVIZm2z7E2ETRUxLE10lx+2GJWizI9v46ngvjGsoTyYRnQ75GF2p+9okYkfX2t26RSCJGERBCeSYqtXyrzkdTXIIUwCx+R0oCDmMDUnJtwgHCMbhBT5HRqqFGf1s0yMps3i+8mDKATZvT/nT7ZagbmC5v109t2pm9kmJUeipwec2jbgY5EW0MjzN7Q4fTpmAeUJrQ3mPP/t9AKOWx6wLWgPwai8DqQ5TU/eUPjrUTibHxSdcBYnbJOkxv8kIu0a3jBbb6jPuTSyDtUkGkh+SEhYagqpLazS8cxs6c1940eDKCLXbEOIxxbkr/EEkVo5dWzqkdhNQOl0qjazU8Zb6gW6kf6dHNxif2EkLhTdGnMQXClsGsrlKQUS6mL2J18Du7IoPTQ== 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:(13230016)(366004)(4744005)(5660300002)(83380400001)(107886003)(36756003)(2906002)(86362001)(38100700002)(6506007)(38350700002)(26005)(6512007)(6486002)(1076003)(2616005)(508600001)(6666004)(66476007)(8676002)(186003)(66946007)(66556008)(316002)(8936002)(52116002)(4326008); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: aIPZaoxkVp7YWIPReGMPTRsNV24t6i7b6PwuPjYfCk55A3gUqxZTwz/2qbZ3l/G6L3l3iqF7zgSy+vvm3Q4mESCUtgwU81UuOU2G0/DG485gkRDB1PX9+cYRQ9VubOLuHsUwCtErs2QZD47X8Og9xr6wzl+YkWiB5logI7h9+dzGmuD/5YivoCCp//nyMXDCwoC+ZaBQyj0dghFOiDqiWs/GEjMiN7Vn92L/Bpb6YfDSNJsZTj0P8CDp1SUZ591EQsKVb0mzNTuWoV1SEFc447TSCT92VR+O++pinfOfkadSYDBi597qDSvHfeHHybgDfjHFTZ78ycf0TNEtxRlkmT4RfMrNEGKQEViyH1tRQfcMZ7lbU799CdcfgPXeOqA4+NVVChDFlowdxGkKmGNglyuN3qvJ0iWtgX0ZCIO6ttBo6g68IYF4iCfjapSM80JhYP1LGC5Hlkmdv1scTMzHuYYt3be7xRY3XHecdi0pXX63SvCPfLPUeYSUVSTVljcBFto8sbqkZwn4FjPixusNU8P7bXydfAa0fmzEg00lQ8eUkmYVO6hbkvZQ9b1mKVVvMeDkMR3fKVZIpRMXWNP63ikbDWeSHrjHj+SnT+wiLH4lPx0oLPSrFCcxNSoTqDbB04pWkEoBOhEx8M1UDWB4BnJdxgeIMrI/niSoMekGPQam7uBHYsscZeouadqvERlyys9TXW/oYY7vivAjrlVqupxTk5Q5fp4+9/OiMu/WbExblTI3KFlQGQGZzWvRdkK6SLylZrA+6kv6UEVhYJhfqhlm94c5c9pT69fMEEchV19mHplgJRVKyU/xU206AFHv8FOvddSLvqmf8zoHBSizT3Ki6TlMn74DgoiN7cqgI6paopaExG6mTn2CXmPXk1ghvzjx7ip7Xs4QGaX2s3JLTgTWH3YNJH7I3lhvm61Xop0Uwm7RQ8gT4XzGbxdnnDgJN1DQ2b98U0rAP+we5Gv0ZuwgmVs9WVIkhs8+2t2Ci+0g2qxCdnyJPSA8+GJuz7XV0P6Wj3udkM4o5HnDYRcSWV9E0eVn+1IOQSeykaMrXTdVUjFUFa+fwwinOosOZ2+pYwfediM79rvQYo/9uXZdG2+simfeYOadoZtxwUkq/XNnCBimzyqZsLaqzcqaraag5Jlbc/c6nVNDVyAoxm5tmBXU2DtG9WnP3U69mQA5UwJA18m6PbtPbnj+ENutuC+8UoOY0LLAW4DfXfnmhz5xga5XUrY4SDEIKa0bPXxED9GH/rsw0ZmD6FsSXAUlO19xnQP0onKBZsZgxHkrDomHy/FZJMq5J6yn/bAfm8Vtum3wLFL5O//ZUij7XWcdkb3TEG1Ud59GxYF75eIfrI8WHXR1DsLOlTq4yvOq4lto2Vej/OHVviwN3iO+gykxXQNtmO8LWhRwx87iVSi9RZelfLcdlbuxVT4RJZw919i2OnRAvEjzh7Pf20oAkGaUXVTTo/2AYMWRfwQRfJZhkq2j0I+vL4oLVIg1+c8Hau/4GcIvrK6mtn06T5J0nCqm6US3H46/Ehbff+Fy21NMqdhfFiL7MFe8buLLhiu9Cyv36HVavb0MTf1El2NloPYes6L7ksVoAIMC1ry4cFCrNW8pGPsQ0ckpRdGAZvKTYTU9paL8qeP3wP8d8Q5/iVZ70jAEV8iCALSYI02/5NGV1WdU3AP6rsCJ0FGNBetUjkEIOcX45MsV33zOR5E26RPkv0xQUjsr1By7j/Ai61gDgf7gVTZNoCoPuUvflphk9QB+9lY= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 23a6785a-8419-4e41-690b-08da4fe77316 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2022 22:27:51.5109 (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: 2QlCpxERZmUc6Wwk+9cmJQIVr56YlJhLYGwsRtYozjc5tmULE2yOgFG28MqoJOesvdNnNJAwwMUZcqBqFbpu3SLktU6L+avTJYB0br9IY2o= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR10MB1267 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.883 definitions=2022-06-16_16:2022-06-16, 2022-06-16 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 spamscore=0 adultscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206160090 X-Proofpoint-GUID: 9A8rD5jSPQ5DQVnlAg-Ot4xnPIFghpnF X-Proofpoint-ORIG-GUID: 9A8rD5jSPQ5DQVnlAg-Ot4xnPIFghpnF 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 a subsequent commit we will want to know when we are called from the pci_driver shutdown callout vs remove/err_handler so we know when userspace is up. Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/qedi/qedi_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c index 83ffba7f51da..deebe62e2b41 100644 --- a/drivers/scsi/qedi/qedi_main.c +++ b/drivers/scsi/qedi/qedi_main.c @@ -2491,7 +2491,7 @@ static void qedi_board_disable_work(struct work_struct *work) if (test_and_set_bit(QEDI_IN_SHUTDOWN, &qedi->flags)) return; - __qedi_remove(qedi->pdev, QEDI_MODE_SHUTDOWN); + __qedi_remove(qedi->pdev, QEDI_MODE_NORMAL); } static void qedi_shutdown(struct pci_dev *pdev) From patchwork Thu Jun 16 22:27: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: 582526 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 C211FC433EF for ; Thu, 16 Jun 2022 22:28:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379006AbiFPW2U (ORCPT ); Thu, 16 Jun 2022 18:28:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378980AbiFPW2G (ORCPT ); Thu, 16 Jun 2022 18:28:06 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39E6D5A5A0 for ; Thu, 16 Jun 2022 15:28:01 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25GIjK5T032718; Thu, 16 Jun 2022 22:27:54 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=+IsWFV1Ki6G1SeIPLtn/Zqj7H16z+suOYZP/ctlhx6I=; b=uQTnVRPES14areKRiCDa5hMjKPl9ypFcsTtDrTOTTFCijUh929lFsrV/dvfB/Wfbc+z9 Al2SIVkuik7PSiIkoCZPtDy3SZLFkznjtptJLxmIJmzuEfqM3jsuVfcxmexC9mYHk/Ar R6pCo98awchyUcVdwRnPagEl/+fyp83RBqY1CdH6sA5LuN5LvvXbs+sk+uBrAomxaa2y wnRC4BlD0I27NKN22IPhEGK86Nn1GbQ1qYaDiu/2cMDkyb2yCnbnAGUtp7Cv1vi1X/jA Nfd+VZQ2F6TIXSZkYZ6JbvFl9EshKpDzMPxtbfp9a1+KgT8cZBydk3UNaeiRrjb8dNIQ 2w== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3gmhu2vm14-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Jun 2022 22:27:54 +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 25GMGQsu002680; Thu, 16 Jun 2022 22:27:54 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2046.outbound.protection.outlook.com [104.47.51.46]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3gprbtah99-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Jun 2022 22:27:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XosRfn4sl/MKm2cjCwnGhEykHCifbzvFma+QdVinz8EBVnCuQ0KoRdoL8eLwjgBT6RFXu4molyAeNRpZ6SczA5nhaEAbwdwj5HPs9KpN3KEkksd6QxjlfsdMGXbnZxpcwFyrf6VBRYldOYd8StceL4yw+lu193iRSJdL/yljuE1cnS+S7FgJN8ZKkSleyzG6M8G1B0ewaM0/kjifojymFI80oXTNSKTXJCLGeX64iNk5pfW+U98/aaX2IisWcN8AOZtCiTIDS6JczvvNoROGofVxYb8YF0AC9mG6bOdi/NaoG5C8Yv1anFgrsTuPCuNWT2Vch66iXIBaRNc+O9d1Mw== 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=+IsWFV1Ki6G1SeIPLtn/Zqj7H16z+suOYZP/ctlhx6I=; b=QwTV+Jap3+GwReyEuH2IEI+cN1XyUSkQwfMkAGsQlmvm4e8ejp7s5LpL4hwaxVTJ9msJf+VvQ7rm+PCxL9B1P7ajZjpF3jaWyw0aM1aUN+4L/9lneuaa8VENmkN7hB0NKoyUB32+jcy45G4qgRts6S81TPnE9twm9RBQLtW3cezYd9U52EXw0G2zTWcvt7MDZtxSrpvghumAnWQrk3WcD8lpju1iYtpTpW1wHyxVgILhvKq9BNUSEGljNe7KcgHYfhc5uirSS0snJV6lNvLRrn9ACKWvYUjcPXGZUdnp0vnRXUN3UfnCjthy5dxeU1K3MoAoWwMxF0BYxDfZR31gkw== 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=+IsWFV1Ki6G1SeIPLtn/Zqj7H16z+suOYZP/ctlhx6I=; b=qVH6Nx7/UyNwqvEuTDKzwi9SqdXFnsfibycbgaclzScCoXIZDzdJNN/ue7QoJWOVyIHI2iQmzlFDPQT6DoDgjJXWhaOa5hxd7wPXKMBU90NoHcSktyfxeQTkkUJ/eo/33qJZoxNQfbXEr0I/Fgd6LE5e3K6RgBvNrPrRlAnP8z4= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by BN6PR10MB1267.namprd10.prod.outlook.com (2603:10b6:405:e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.14; Thu, 16 Jun 2022 22:27:52 +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.5332.016; Thu, 16 Jun 2022 22:27:52 +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 6/6] scsi: iscsi: Fix session removal on shutdown Date: Thu, 16 Jun 2022 17:27:38 -0500 Message-Id: <20220616222738.5722-7-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220616222738.5722-1-michael.christie@oracle.com> References: <20220616222738.5722-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR18CA0070.namprd18.prod.outlook.com (2603:10b6:3:22::32) 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: 121932c9-0417-4e13-c304-08da4fe77394 X-MS-TrafficTypeDiagnostic: BN6PR10MB1267: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: 0FzjvlnAG6VLJ3Tu6cptBXQlSX0FWYKeBMIQulsXJ4ildPwSeV9vN0vFA56vQxhWBWlv4fv/p4X1jPD1D24ca9Al9xJn4PiI6wNahHxl1uere0+Ym3KSsfoV7h+SGXLIEB9TGKb6QmQ4xz639e64dJELOxGO/vdwfzY34r6kZVqjk94HgYHagVTXD/JlXZl+aDJJtDBy6yDU3J36eST/Qzi1XV06PRX+Rcc214sBbCyCpPdR5zd28rJomAPpz+nQBTOahRP3/Aacna+IxJQ2ogf/MQ2EjzL43iPqTvyHTIILuFFuWJtwr4vzr6Ns2mytk2+/ELFdAP0/UI6Wmzi3PO0QJSZoygsBW50aTnudDISn+5BPLJr+6m99U5KAwA898JzcUCuvBGDhnEKlV9I1K2Mdivh02BHDi+evDWqDsmRhbc6EcG/4fkRM0i4aVCVeyeHJzmeXD64are18eKCij/dcDoZub0tA/Za02zSYzX0+2ADH3y/PmIajGk1JASJ2QmKNBXqwwGYWqAqNh/EJPrgLwTmh5zIR4x0TyzkB9+w8CGNyIhSPLCFiNMdlgi9Hp1xsp0ylZaGsRBBuOdF3TSMnb5VLWNNXNHniwiJZVa/V3XyAy5SkN8fo4EraoEDVLVee1vxI0rYLkukI59siExQLkJWWjbl4qxvX7Shet+L2dl/y5S1jhH0WtclQI457qoknHu/gnw5G6aUKxWGuww== 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:(13230016)(366004)(5660300002)(83380400001)(107886003)(36756003)(2906002)(86362001)(38100700002)(6506007)(38350700002)(26005)(6512007)(6486002)(1076003)(2616005)(508600001)(6666004)(66476007)(8676002)(186003)(66946007)(66556008)(316002)(8936002)(52116002)(4326008); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Uzpnup0qrz249Rt28UxUGgAGa2SFZthNNsMn6LmKbMkj1iVawh7F8MRIuvRLghurM5apodtABcqGQYceUnIX2/wPjFPhatRTISVCs13kkxVNTcCXxikNncC0ssTsUuRlEtN1ucTqbD3jfI/tPzG3WI2asW+3X7F9wXI4BtXepYgfZKgo0cPd4wxwSP8Rv+Rv8yZgrA87FlZzv8XST7aoV9JQdeOKykU7B5lz5Hy3dj7hF90A98C5jR0kvSY8sjWz1UV7+ja+zhI/5uvZ1LhQ6iJcxdbi3zIhaPK1PAMZXWzjrCB/a2OQgZC9IlTguQKpMu4Lx9iSdWkI9zJ8e8Axj2BP4rY9gN2kSj+yOH3wjdlGYwQdpAcvHjlBucxIwFwq7zjFgA2haEVP0q67mI+txHW6ooi1jYTy9A6y3RdVC6KDfOIhdwXoGkhXlCaFZ5qNcGpqL63LHdceOi+cs6Z47lUNQm0aHisnRSdj9cIh5HmKtWc4cAn36fTGKSJX7Do51ljIAQpFRCFB9bpUmhLL80/r29BkEgjUJGUJpFTYopeMvdrMEcnKx/p44wTczQP5GoBDdrsBj5stdgWytjFzzeDLw14hluL9WCVqSifjyAEh38ZAr8oR+ile1o5RTHAGGPiWI7Zwa2pNQL+xvnRlbZBGhghD4IP7w3mdnloTFRIe16sFph3EdJPgBF7YglDD8sq9MrtUum6CoapPPkrx3YKKDGM4zK8JAYIw+BeOEA4hJBgIyy/o0prprTeGB6R6XOwThHmAcNwpOrfR15UQSO0XqHIaH0+3XYM8Mre1M44QALVQ6/xI6JnHGmgZtNdanddqhzpYOJgdMboj/Pt4RLSc9zj/xNyuYpdigNGKzPVxQEgj5GUV/w30m0yXhiA3QerIbo7lav9Xno5hakvQnaVhNALav09sgE9VKx/1tWQyx7sRapcVJAkWn3hTcheA2H60w4qbu9L8CrEJW4bbDLNrhRDIfZ8jhq3OWis2As8bcdxpkgkDAoYq411GizTpsu3SlRkuLJm2bLhsM7UU0hYUbeFCObWywwa+wJy3JnBxr7XWXzwYG88IOQNXDflIuGknBRvyvFojyNHMP9J4YaVyJJJY6Xaz2/QLz6Qq97ONIrWe4jF9Kqs0+6DzDWt+hyMSDpDM1m65IRLmXzl3SO9miTjLUge8oCbzshh4hK58PELNjyl9cCimckEsDpaI7Hl5LLK2eqVbmqMDo68NJphP31LHuxDMSuemCNe29dZEiW/JKu57Mdtai+U5IzGy9wXsM7vRenVt7kQAnsN7yWaZQIhVLdxakbbgprbu6blQdo3Vf1ZNiJLIl9DZpi7eHOTAtEkOCNl2jczXwaeXs4mMN/sXQfzXQTBZJtiFk9kd6xTckE6bB9zzCqdtGefhlK1zK/MdQRmqD8qKi8UTCvCRg1CdxPVkhbxg+yxH7JngCYwfm9sKhBcUcrjQbfK/REPnB8Ty8h+athCdyXtEdvyavP+MdFC4fWmrmlq9SYNxHl8IDTsDkcmJUxW4MUOql0PUR9yxPuI22YF10fHomZMzPWe2yGTIYDnuXo9n6UeI3yUwbK4U8oA/JDGDa4ilPPhMP1NqF1mXESYZj/keNMpaLNA0ZpJDsuVZ5dLEaLVBrmls2ZeQEUb6+LUosuklhLgD9qZnD7ErbOrjuf1Jy1v2UcyBBifPigNSa2t7ogZR+9ZBdC3Joja1L+K+V5fDvkhKLr1vcg1iYJs95BySX2GHAxvnRfQNULbruQi0X3U= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 121932c9-0417-4e13-c304-08da4fe77394 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2022 22:27:52.3390 (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: nxONKX2Qr6BTigbHhwkWdbLAwRBNMZ3qTfJ1e9lA/ga1Fn+GxX5NOPcT5jFmGMAWAhuLZkkjZjB9vPqjpbfFjMWRS1/SdbwG3P0XEPHqstQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR10MB1267 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.883 definitions=2022-06-16_16:2022-06-16, 2022-06-16 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 mlxlogscore=999 spamscore=0 phishscore=0 suspectscore=0 adultscore=0 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206160090 X-Proofpoint-GUID: uV71Ya3ZPIPyUvT9Au3gIR1b0xrob4d5 X-Proofpoint-ORIG-GUID: uV71Ya3ZPIPyUvT9Au3gIR1b0xrob4d5 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 commit d1f2ce77638d ("scsi: qedi: Fix host removal with running sessions") which made qedi use the common session removal function that waits on userspace instead of rolling its own kernel based removal. Fixes: d1f2ce77638d ("scsi: qedi: Fix host removal with running sessions") Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/infiniband/ulp/iser/iscsi_iser.c | 4 ++-- drivers/scsi/be2iscsi/be_main.c | 2 +- drivers/scsi/bnx2i/bnx2i_iscsi.c | 2 +- drivers/scsi/cxgbi/libcxgbi.c | 2 +- drivers/scsi/iscsi_tcp.c | 4 ++-- drivers/scsi/libiscsi.c | 9 +++++++-- drivers/scsi/qedi/qedi_main.c | 9 ++++++--- include/scsi/libiscsi.h | 2 +- 8 files changed, 21 insertions(+), 13 deletions(-) diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c index 321949a570ed..620ae5b2d80d 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 c0703cd20a99..9758a4a9923f 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,