From patchwork Sat Feb 26 23:04:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 546387 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 1D593C433F5 for ; Sat, 26 Feb 2022 23:04:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229949AbiBZXFa (ORCPT ); Sat, 26 Feb 2022 18:05:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229942AbiBZXF3 (ORCPT ); Sat, 26 Feb 2022 18:05:29 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D137015DB0C for ; Sat, 26 Feb 2022 15:04:53 -0800 (PST) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21QIHOfD008190; Sat, 26 Feb 2022 23:04:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=nusCi8CcKQzZCFWYcongskSEqa8GkYjQvs0VkSC2rC8=; b=K5C+0DGGcEIjnme0WLVdXKuRYuHrVRajDnfLXoYpAxov56QNlx04ENeVEYH2JnaTDzCY EHuTw5D+/85Ohcq3C1T0kKKkBwQnpWgVz9IBtYBDrJ0AnvuxYKy/JEKYKfDh8l2h/gmt nktLUJyogc8M3Wv5x+I1+OXcHCz3007+uJjZ9zB/EyZFkmwSZt8QTEZq83+uhqaY8hAL jRZU+zhVci19unfIHLmubPmkt3uEMsE8IxJkPTTgFvoDy7iwnsaDI4iiv40yaXWc2kPE 9Ee9EKedQcFcs6oex5YlsHgz8wruaCJHNxsJyb3TU56kcowC88WZA6f6UENyw47R/mhb yg== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by mx0b-00069f02.pphosted.com with ESMTP id 3efb02hbcc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 26 Feb 2022 23:04:47 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 21QMtKAK179769; Sat, 26 Feb 2022 23:04:46 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2107.outbound.protection.outlook.com [104.47.70.107]) by aserp3030.oracle.com with ESMTP id 3efa8awbct-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 26 Feb 2022 23:04:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cr9F0D9VxnZFcfdQCmSSLB5qXd47cEIQk2tut3NjKX3QaRTfhKUwDOJWH+ToIMyoWrDkwk2KfLXJPogJKtrqIBEckJv21yARKcfzw7+EYPRn128EzegyE2Vozwuldq0tJDYmDpMs8pCXInA5VwVf167Ev+laUREVSxBReafvFDD7bJlKc+unXbUO56hBnEPVzwiMdBb4lXDiCiRrkBN4kHnMkJgUySmudsNmVbA/Kmug6sdUdxXw/MoPlmUu725BqQOQLd8X9HmHwPAa1lYvhJhd+9lYWJkeg9VtK0q78LBhWhebZs7f7dykean78yX23DMZJYBb9ht9zJam+IcjIg== 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=nusCi8CcKQzZCFWYcongskSEqa8GkYjQvs0VkSC2rC8=; b=lKvzhcYVWEnyw+atjzgbIhdu/txbmYtzH7OKtRVUhwQZSyRuSUolMa0JEBgEMl7ljaWNG69b4F5G/VUFxI3rLraE0YrW2Bv1W1/Nku9D5HTOKRZmzi8oGKOrc45A2iQ1+3MmeXNUnYI+s258nxlUy4ER0hVYng20TqGAimzRLNdxAJf0CRpLLS0N9faOUMJsxaZqqgVZ2I8eWMqgaHvHMArwX97w2Yxu/8NsQYoRUC4jeP6O3IAbhgkzGqa8y9qsqEqamgqrQ+IWmboMS1gi/2QJWKV9U2/w9ywU4RrM3fBDI63JnPIe3OU36pCsKr6OczojMonwxn+7B7GTqlRM6A== 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=nusCi8CcKQzZCFWYcongskSEqa8GkYjQvs0VkSC2rC8=; b=0J7N0s9H30ZPQpCS8uGZfv+u35NZeq/LfVTffp+gfH5h5gFmK6NQUqSpnIFITlA6S+XhZhOeTcsxDdUHmJojOHq4g0Wa7N7vpEmEgtVgir8pqtODImOHt13//3BQzk+JblpMBtvFQ0PWLBTiVgZKk5iDjyfjMKoeOUUb+4RJ1wY= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by MW4PR10MB5750.namprd10.prod.outlook.com (2603:10b6:303:18e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.22; Sat, 26 Feb 2022 23:04:44 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::3dd8:6b8:e2e6:c3a2]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::3dd8:6b8:e2e6:c3a2%12]) with mapi id 15.20.5017.026; Sat, 26 Feb 2022 23:04:44 +0000 From: Mike Christie To: martin.petersen@oracle.com, linux-scsi@vger.kernel.org, mrangankar@marvell.com, njavali@marvell.com, GR-QLogic-Storage-Upstream@marvell.com, lduncan@suse.com, cleech@redhat.com, liuzhengyuang521@gmail.com Cc: Mike Christie Subject: [PATCH 1/6] scsi: iscsi: Fix recovery and ublocking race. Date: Sat, 26 Feb 2022 17:04:30 -0600 Message-Id: <20220226230435.38733-2-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220226230435.38733-1-michael.christie@oracle.com> References: <20220226230435.38733-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR08CA0048.namprd08.prod.outlook.com (2603:10b6:5:1e0::22) 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: bb59eb19-b6d1-4df4-376b-08d9f97c6055 X-MS-TrafficTypeDiagnostic: MW4PR10MB5750: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: LuaJS5XvQocFOkKLfJS/ytB8mB02/NjbSTfJVv3WQpVfgrfK+1xdyj5cdqQtyOB57YYxPiH9eIWxWyTBvG9bxVCv0SmYE1YK3q+X1hhtgE6vhBv59YZuBY8tgcOSLfhFd2ZyPvG1iXfbUmRNYKRJzDoPfn7DeYne2Sy/bhtmkO8RZDfaqCDLh16wUz0SuOyq3h79HUHHgLo24ewl7f5+jTjRpBmTbp9mukbRPs7SxKEd/ryfRL/S8C72/3IlHw/YDmRigjogqhhMReguDX2ffoRlYuN6Fc5VOHwuYJYyTsn/0URAe74jEtGD0c02+4TkJep1ypsxwbcSbbZW1rP51MEPjPhbvjlQaBPSjo0TzGHge3HIEzPYGIMGY7Lp/MTcnVKJX9R/2wPL0ba0GVi7gixL843SLAvTtgQxkmRLt21K6xlx1ZskmXyMFw1BOyBWNfxXUi1BH3av7xYrHZ3Igxun8cXLRnju4GUA/BtegEi/EYuoW2L+WzSf2gXaTqRAkdg7AskwriJUol6E0pQkelDrquM8kFgn35vFVJ7MnGXYICzA2lV9ES++QEnMrWrxkAs9SAcC8CHyuvA52RQ9Cgh8xEzQ+Zaoc85yIAfWMFa0pQnZUb1zil/yaeoKBYbNrlCF5jPVC99fZguw8i4tObN2zq9czwHXgWSlgW7oivMU2FLd+zW4qXwKLUWg2x8bMTDH9QurIDkNjmyNEdMPuw== 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)(1076003)(107886003)(2906002)(5660300002)(66946007)(4326008)(8676002)(36756003)(186003)(26005)(38350700002)(38100700002)(2616005)(66556008)(66476007)(6666004)(8936002)(6512007)(6486002)(52116002)(6506007)(83380400001)(86362001)(508600001)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: CwqmjJrk8X2L8vVdHOKzYDhrAVYGfVE4ko+h46Vwq10NUIQNPOfx9gHa1EszpFtR88YWFBT5Lx90afz0O4fNSCT15uisd25LjrnbdW6LLFlh1xpYZF3jK0lZiG6w1m93f7r+pOT8N7P1PSgzh3HwMp60sndNlvUZHu3v9gopicxdfmziyzoq7CvvGIScsVr4td3+qu7o4VLCFPF1K6TUPzksd6wJ0z65Sw35G81jA5ao5tdBaQ+03VOk2WdJpChzJ3fg8NW8Sj1Qd/+eSsqrd8jwPyNZMGHQiSONBRV/XD8Qxy7vLQtbFNkDZy811Md/BmVIgEmK8OXcufnwgvjhueu2Rb1+tFCa0OyuQgWu9NZCMM+at85LG3TUO/m7TTh4TNV/z8Dlzz/KFYvzDvB1Unyk0gW/sMcmxSdLidWuhgSvse/widUQLEpIr+P+iA4eKHSejLZrT3YyVbxiiis3ApoBqMifrKCHXkG7HWJvl/gaJf7x/bR0xX1ImtEXW9J65IAHSUsiK0cKrSJnP1yEEdH4goiR8S3TnkNFRUQXL95KdJu211nnbCKmEiLQUcpCZZwprgTemAWVjs1h2AJ95TZojJHLE+h4USolf7GG3L7Lv6l6YwtQ6mBy6/iv8awzk76h1un7VNlWTXiDEfMM0V/+Ai+FwjSc5qcKaBiAgJdzMI4J2Y+YTbui33vMt2CzjBMvFFoh28cxk1Ksc7iSrdfVaWuB9l6Zwu12krPLLI1rwapkROsGgF1zGumsojKXOv0oZYMbjU6jCVC0jRsYNahCxiIYRGTD50PbdM+vQbg9nyBkUrVkX+Im9VOAIKklWp142ShuOAsRm7TNgz/SJk30ryP1L+mzTRV+k1lpJf+I7O1ut2tNrgjBgPFxjH1qiK4ZPs5lNbFLVQUWJO6eVhNIN3+WDnFFC58utph22AIgQR7xLHB9/ByAJEbYd0YEI50gc7hiXaI/ZItxCx9qH5PGr/hvjYZufOSkylInhAiYBsz0AwaA3pLGyL4byOKrqtlxRQIUSmP+uug/k473nhVvFuky1d06Q7X/j50fkHzkrheNWsH7KTBG+rMR1d2Ad+n0pqay+Bp3eZqXVZlLl6G/+PkG+I/ADSAOajHuKctFqcL/3lYrF4EA6tbFbkF1TIp4xbP1GM3XXgKztNWsHToq1KbT4lFjlNR4VAcmK0P/PgFsO8427QbV7JWrJOwcc3RFrlqx9V9j9AvnsCmWeMKAP8PKdnOobyAE376+k6S24vyziPr9JtrgKMijznesiU5Pt/PwbTYmFrLIL2NM/RqhNPLq1TIDPXS7HClBGHMQRuFdO9hy32ES/ZxJprKSSm8lvPYPN/++t2ucgzfwvZkzbiDpouZRf345EXEDXq1TyJRnZ9Y3OOrMzTjB4BNFWmwvnuAsh8It8U8IEqLU6Gwtz6B8MvWrOLtWTR7ue83BOqhpn+EH4dQsx0rsP72AoRrulS1fcDLpRxI5aTSP7afIN+QDCFG2WvRrSGL6VDAC07YxdX+ITuNTIa7Pbpfi94hgW+JPeva4vGzMd92QVRIsQQCV+I2QwwcmWZKjNDDLs9GtfIYH6kEHIe/wHeggMRBDI03vjB1XZtaijIpUTO3/anQLmQ5wLo8dksgRBobJ3Mkw1e+OvMYlmcrbH2eC+aqXJV3y8CFWG9/8iO451A== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: bb59eb19-b6d1-4df4-376b-08d9f97c6055 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Feb 2022 23:04:43.8969 (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: UQmEIZ5ojwIWtvFKxPVOvh8faGh0rtVqL1EJgQ8AhbLJqVWTxGEfZTds0EUPI/3ci3qG4ZEFAl1rAb42xsQFSeaWvajUNVh5EoLRMPQlHto= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR10MB5750 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10270 signatures=684655 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 bulkscore=0 phishscore=0 malwarescore=0 mlxscore=0 suspectscore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202260163 X-Proofpoint-GUID: c6u_Dz9OOND7dAeRcKaH1q1i2uVRWUsP X-Proofpoint-ORIG-GUID: c6u_Dz9OOND7dAeRcKaH1q1i2uVRWUsP Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If the user sets the iscsi_eh_timer_workq/iscsi_eh workqueue's max_active to greater than 1, the recovery_work could be running when __iscsi_unblock_session runs. The cancel_delayed_work will then not wait for the running work and we can race where we end up with the wrong session state and scsi_device state set. This replaces the cancel_delayed_work with the sync version. Signed-off-by: Mike Christie Reviewed-by: Lee Duncan Reviewed-by: Chris Leech --- drivers/scsi/scsi_transport_iscsi.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 554b6f784223..c58126e8cd88 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -1917,11 +1917,8 @@ static void __iscsi_unblock_session(struct work_struct *work) unsigned long flags; ISCSI_DBG_TRANS_SESSION(session, "Unblocking session\n"); - /* - * The recovery and unblock work get run from the same workqueue, - * so try to cancel it if it was going to run after this unblock. - */ - cancel_delayed_work(&session->recovery_work); + + cancel_delayed_work_sync(&session->recovery_work); spin_lock_irqsave(&session->lock, flags); session->state = ISCSI_SESSION_LOGGED_IN; spin_unlock_irqrestore(&session->lock, flags); From patchwork Sat Feb 26 23:04:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 546385 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 D393CC433FE for ; Sat, 26 Feb 2022 23:05:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229968AbiBZXFl (ORCPT ); Sat, 26 Feb 2022 18:05:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229940AbiBZXFe (ORCPT ); Sat, 26 Feb 2022 18:05:34 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA6E615F095 for ; Sat, 26 Feb 2022 15:04:58 -0800 (PST) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21QIHcjH008247; Sat, 26 Feb 2022 23:04: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=5F0qSuMBwmIbqhAryziuZ9Y+O/vouc9QyeVTtvk2zK0=; b=IZHJqMjNxm5HxenYLv56B5AmQqgEDEhorCJ6j17WY2xk6kuBsG3pcgO/Bi2VLZh02ipF dj/kI5jyVOrDOpQMKksNSb1x0kdIU5DXXYDOb7vdiqRjkY94aLtUSGCqiNrkty6zS9sU AA//liB+nZwztOmifystzpjI7QxSvv20vwxoorGPQxT6SZJoTB5mvZXDurtbn/cITpjl Gd5HtAQJ4xpQLDu5l4AMZlZ2Fn663ty/djaUZS9rG1JjTrzuWdD0HATSX4ve4tVsHbnD 9nkd2KUv8vze1k7aHMgVpiVggomq+mHOBCFF9yTsojLyRNYEgRMuEMl+qjYBRzbcYoA6 dQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 3efb02hbce-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 26 Feb 2022 23:04:51 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 21QMtm5L027402; Sat, 26 Feb 2022 23:04:50 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2109.outbound.protection.outlook.com [104.47.70.109]) by userp3030.oracle.com with ESMTP id 3ef9at5krx-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 26 Feb 2022 23:04:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d0vvt5AZVWLYxodchKah2uzvdFaJOJY63S6GvMZs5j2ftutE2B1LzxLyrYb7qnyb1rvPFCCy3Lfj/QkwOQSXMJ9u4K0iX/ap/IqVqxaMdJK2TXHt4Tyc37xbj1ddotxny0Tx0Z9bCOSS1bbfQz+dhNhOkMdzEnt2hafJv1+ATWQ+kN5Oim2MA0r70FcGCd9oKXYJzW1aZhaRsQmUcsxMeMVTmNJXkJz1Vhi+AowA9UBMr2cCY//RbpQMbPcc5ZtEi2T5PUnx4A9Si3Nyjghysy5Sorud9nynvruX6SnqpLeqkhqyb/N2afVocmDsMLvnQCovh/795dGs9ObcqXWWcg== 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=5F0qSuMBwmIbqhAryziuZ9Y+O/vouc9QyeVTtvk2zK0=; b=WCot17czoMYyjGNrXlWiQ/9t0EWh0Ek562NkQU980JntOL0gyo6FLn08J1TXlTzlr9XJD1sVIayXm5I/A58Zk5EkdzZHC4TGr8hGns2wXAMD72y+eTgo692F1hhlGMkKK+rmMq0Smlwr6Qg+XETLbAGBAueMqBqBjWsmec4blKQtP8on4N7/JvMPWSt4nrhzB2wGEgt6aYa0pBwKaKIeb28dnrndhDOFpGdi/DH1+mxK0mB384E2wO6ml7Nt+c8tX4of/P1UJ3BsvP+5aqPwUJlrrIu1+lCm13I4Zbnrb+eIVTDDh0J5zjYnIY5fJblKsaXsasErFb6mWZ6u1NhKlA== 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=5F0qSuMBwmIbqhAryziuZ9Y+O/vouc9QyeVTtvk2zK0=; b=rs4octH0GI6YTZ9nXr6t+UTh3cEGzaL3kgc0k2WFgFVM+Bogjng9IUMUzvdctdUEMKN9ONliyQ37Id5kDWKLDgt8yEvoihX8JvAl9MhyV2dnr5Cexj77lKko1gUk5Dz5TKygQxYWsSQVkJ3pNl/q/QNTD+DC6oPCG6Fu+hC2br0= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by MW4PR10MB5750.namprd10.prod.outlook.com (2603:10b6:303:18e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.22; Sat, 26 Feb 2022 23:04:44 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::3dd8:6b8:e2e6:c3a2]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::3dd8:6b8:e2e6:c3a2%12]) with mapi id 15.20.5017.026; Sat, 26 Feb 2022 23:04:44 +0000 From: Mike Christie To: martin.petersen@oracle.com, linux-scsi@vger.kernel.org, mrangankar@marvell.com, njavali@marvell.com, GR-QLogic-Storage-Upstream@marvell.com, lduncan@suse.com, cleech@redhat.com, liuzhengyuang521@gmail.com Cc: Mike Christie Subject: [PATCH 2/6] scsi: iscsi: Speed up session unblocking and removal. Date: Sat, 26 Feb 2022 17:04:31 -0600 Message-Id: <20220226230435.38733-3-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220226230435.38733-1-michael.christie@oracle.com> References: <20220226230435.38733-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR08CA0048.namprd08.prod.outlook.com (2603:10b6:5:1e0::22) 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: 8cb2080d-aa3a-401c-a9b3-08d9f97c60a8 X-MS-TrafficTypeDiagnostic: MW4PR10MB5750: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: QPvi3tEvGaXcY5qHZbz4Atm65XDEnJMTDi12KDwMWmVOeERgzSr1IoUHiYb0f4v0EZ97LYK8GlXPg5TEIIJtOU7CeI00aMYurhsYHHVj9lV1AjQZiwqrEjYmgFf6uqUB0WnsRk3szoU1lDMYn9kpAhOCv0sGkrpd8FEoOMQ6vyRpPqe/DF0qQsOWno74aFrPODBFf/uyO3bLCLNAzdAgDR+zBNxFL5LLNBokHcXnQsbrofAPPnG4R7P4qJJ6XL3uDnGnNkJioc4RlACXkBBcWAC0l2Za0qbhadJclf0FvLRoFRdCuAaBcdooTiVOaqY9fNWOycUHLi4k2Fu12nkISvELBO+B/20aPfYUy/c4QNKZN6xtJH/cMxhKuYrqS/dPzE2LWwt23pBxSfipROo2TeMJiDC+dTXGZhTYGU7sxZKgpfn1dzrBJbVwjMEAoxeXtVKh0ppF5L2xbcMiy5V2aNNlEMxRJFXtwKFpRgfwGh0y7XbmEW/9O4LHjS2ry5xeFR90/ezLbQkvfOpD/Iqf0Ot8B3Xchl0jq+tBxnD9GRuGUJ+jV2Aaksy+AywI6DVb7O4oYzt71Ctq1yd6uBjefnp1rqf4yo1LawoR32lnZVP4GGyBr1S+4afuD+F7BG+XqJgNkZbGGVzEuBYJ/kacUpY2LaZzgakmwBb86P5qGZhG2JafH3MYg6fRl9sf7Q9FFwbIskinOtme1wZh6pO99A== 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)(1076003)(107886003)(2906002)(5660300002)(66946007)(4326008)(8676002)(36756003)(186003)(26005)(38350700002)(38100700002)(2616005)(66556008)(66476007)(6666004)(8936002)(6512007)(6486002)(52116002)(6506007)(83380400001)(86362001)(508600001)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Q3ftetsw9zXAIy1Ac8k0hCzjKUMyRrTBq1Oarizcl556p16MzV/ne1f7HtYL1Q8PQRQx1jG9eQd9CfCYd4w2sBtPKHnoGN7sRDkO8xlTlInx1L3GLJ7wGmn5ctbPPIJhdAdqQ589oNAI9KPfdByiMQ0kS8Vxob7/64s49+rrl53EH3tWEzqJc2s/wwUY5Bs2/CW7msVwFqOJ9GqBnryT+898A9sCWlSCOnCvtAnIJvME3iKxuzJLdGRYvkYidyAqAGs91Nwd9/g/LmE5zeastfIwQ7wfcSDF+plYzChMCDu9s325Ea2gfPU5MeJAyVfcPJISGENBG/hGXdIvaOEg3dX0V81BFnca49UgUwOn0n1XYr9L+6Kt5SaYnmY6PajY7soX5Db9r3vzmY+rKdjsFJxyfspRoWUp5RAb1PylIdDgO/MNhiI2jqzXDfi3xD6yWEQME7PKx56Y6m+o2YbKDy7rlD0ML6/iuNOAeHZr/HYRCdQwDBPBreftl3N3CKpISCIUQGX1sF7/1/xSAb/Z2TL5lhulGkNRAaztL8SDnEo5rbXiD5F98aJV/L9kVavAuYXB8v/k9IJedcj4M2zEyGZM/eoJ122mR/MVVMIYr7DqCA/S+GGEWGr9TL8X48PsdJYgt3lhuJWkxMb/G9eKbs0IFWdIpXA7JmdFGxpiEZJAZFIbzSBODpTh3xEzRODkq1orhLJwV04/lVu4Qc62uhj9Vf0SnV3wsOOS1H/aG53G7Jv70Tv0bKltqEWxycjG3GmES4MQHX//OTHpybMXgKTgzfdYN6KKEl9lcvgFjspXwnykvUWM55rw9vTkPDD1o4WUSCpwR6nQ4R40SHohasE5Fv1Xlrihw+4xXceeYJ38YM9r1Z9fX6RPQ9TMIFdbrTUfCmp/mqUTfrzjoxwKUZGn5FGEctR5+ApZKIvsvnnG8lN3kQLc+apyCE/zG/p9uB/EZjeab0RDbo8Js7bXzjIeljInHVv2mSpNAd8SFnA3bSpqt8t7e2YwUD5DKveAPnGZehWBC7E6twwE77pqdChJBiKrTQ5J9aqagdzRVHON3K4fjpxZtYwerjHW6FRdIrG6pF6vMxduXoyV3//WuvgvNjMCL2lqT0jOvdmBAUBgp/OagkRJNX8de1WGqdh4nGcHI90v2RgkuHh0Loy8dJjexBnoEueSIIgzZPICsFW53RJ8rOinZBgdmfNedp+VhyLKVfeJ6LnYmnlAX00BPdWOn0GSzpFsuFETYWDvJtWB7gKyBXpyTOibp+bUF6LQjv1FZWSwx5cHosltvu4Gss96P3PD9ig81GcbYNh9S2hOFnJP6+WMYlIejie4hzkZDZe4J4krKf2hwDzz9Nt3ncxcVKGcqqm8x/gMIsKwHT97NpxQFhpqORTVvHmYmphjBHi7Eio5WCMDLzSwGH2+ZKYfxqjAj+FpkZ2N8qjVwy66nAqi76v8rWKusS8lj/KBVv64ZEAxhY5KMTzfwhtDl9+Kex7GhjnK365Y3IyPmjp42jVe788oxUKO6FgWIc2od4aByT2P94Oaj2VoF/bg9x9tYV4Q91Olq69Bh4vIvlZNXDda4DYK7L2TfQt3XoTA5W1FMfmSPXmbw06E8bZk/ZqmA3Ubw0a1daQh5LFVn6QVUxS93Ip603SnHdx79LJrLCqFE/9/3WZ+7yHy50Qcyg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8cb2080d-aa3a-401c-a9b3-08d9f97c60a8 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Feb 2022 23:04:44.3812 (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: 4qiD4M6x7yTqct1CVsA86YCA4PLvqvStMj2LGD+WMmWAVv8lckOoPQ8gAfmVawCMOp8UmcdSRq9AHUuC8LCTCaNaAxbp7RIFk1pJpYYT0vg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR10MB5750 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10270 signatures=684655 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 malwarescore=0 mlxscore=0 phishscore=0 suspectscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202260163 X-Proofpoint-GUID: EgPRQ_svQCt6Uw6ajZ-K13yC76kHMp3G X-Proofpoint-ORIG-GUID: EgPRQ_svQCt6Uw6ajZ-K13yC76kHMp3G Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org When the iscsi class was added upstream blocking a queue was fast because it just set some flag bits and didn't handle IO that was in the process of being sent to the driver. That's no longer the case so blocking a queue is expensive and we can end up with a backlog of blocks by the time we have relogged in and are trying to start the queues. For the session unblock case, this has try to cancel the block and recovery work in case they are still queued so we can avoid unneeded queue manipulations. For removal we also now try to cancel all the recovery related works since a couple lines down we will set the session and device state so running those functions are not necessary. Signed-off-by: Mike Christie Reviewed-by: Lee Duncan Reviewed-by: Chris Leech --- drivers/scsi/scsi_transport_iscsi.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index c58126e8cd88..732938f5436b 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -1944,7 +1944,8 @@ static void __iscsi_unblock_session(struct work_struct *work) */ void iscsi_unblock_session(struct iscsi_cls_session *session) { - flush_work(&session->block_work); + if (!cancel_work_sync(&session->block_work)) + cancel_delayed_work_sync(&session->recovery_work); queue_work(iscsi_eh_timer_workq, &session->unblock_work); /* @@ -2177,9 +2178,9 @@ void iscsi_remove_session(struct iscsi_cls_session *session) list_del(&session->sess_list); spin_unlock_irqrestore(&sesslock, flags); - flush_work(&session->block_work); - flush_work(&session->unblock_work); - cancel_delayed_work_sync(&session->recovery_work); + if (!cancel_work_sync(&session->block_work)) + cancel_delayed_work_sync(&session->recovery_work); + cancel_work_sync(&session->unblock_work); /* * If we are blocked let commands flow again. The lld or iscsi * layer should set up the queuecommand to fail commands. From patchwork Sat Feb 26 23:04:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 546386 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 59823C433F5 for ; Sat, 26 Feb 2022 23:05:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229960AbiBZXFi (ORCPT ); Sat, 26 Feb 2022 18:05:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229955AbiBZXFb (ORCPT ); Sat, 26 Feb 2022 18:05:31 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2E3115C66C for ; Sat, 26 Feb 2022 15:04:56 -0800 (PST) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21QI88mc008207; Sat, 26 Feb 2022 23:04:50 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=w36kmbvE03CotuJo4e7VJsDHPTfoezEt666a0noBitw=; b=lEjyR86ou8skMLnaxcjzKrgraF8YHeF3iqTPZ2wy9eweLvbTRnmfaziwMs88y3oWuHXj MjBS5dCT601/O3/UEGAeQW1B9cCILMVYYPREfS6RZ6sHiFQdf98dRvwXrg01MXrjkWI9 XOdh3+CrETKsIePM1h55V+Q8iSM08DtsFw2jN2HfOETu1ZikylqCHX6KBZi7vglzpLqG 0/IWfhm2mtJjKrgOrEeCvHD5p2LLX+c9e5ZEQirOVD65E8biXEp5DlWQqc4OciSqDvzX xcwokJErkFSvkOJU6H+efCi1gU/C5/L0qFLv9DSVV8XFr6qTnbDkvMqtB1Pv6OusTGvA /w== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 3efb02hbcd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 26 Feb 2022 23:04:49 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 21QMtm5I027402; Sat, 26 Feb 2022 23:04:49 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2109.outbound.protection.outlook.com [104.47.70.109]) by userp3030.oracle.com with ESMTP id 3ef9at5krx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 26 Feb 2022 23:04:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z0BStM58Y/QrorzE/JvegkJKDiP3QbUUS0pAoZjEvPQJiSUFHboijsQ2itZRnbNk0U2uz1uGlfSFC8ryUcDvIHIZSJnZ+avXH3e3j+afRxDpki8qlsyuvk/DaGYwhSLoThxuiE10vMbffJDDPoZQWk7P71cVsJR0Ig6ldYLlqOF1aaFBl1BMcDHTAFMSNLl9bJMrLMt9D54XWo9cW2vk9g4uLVVtTsj0lYhOXWTCZdm8AU87TGu80jruNeVK8OzF3ZaxR11FQpb3IID0ju1ti7OPGNg7eEZQGeW/uAkfUn+EVm+oqjy1/g9RF9Ri49xXI79uJD44ArWkpD9f0LFPFg== 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=w36kmbvE03CotuJo4e7VJsDHPTfoezEt666a0noBitw=; b=QdrdQBONXVZCH/PoZvhKbUY4BxYOGHNy/PbBkYUaUCIGY1b4meAJ1gbCa8q4jE+3l5OEG7JptNuAetjNlkEGhXs9TDvlnnihn2sJA4XM2fHamUVx9Yo+l+U+wM/qmAvg0JTrVPTF211ZZx3AsZ1bvmnNtVuUqgxL6irFdMoCx1KcB7R3xPLcSJVvU1wjZIudjFWd6gOOplfK1GyOV9GB4jmykLXmmSXNU5/SWi4+rjqsgOVdQsZ3HUqOZNL+fXPIaT9J7O7T5Q0VSmOy3scFEK7Uyee8B+Ws755bM7rRqQLQrSGa4AyZLZRYET58LMmCRMhv8sm3/yCANJEazY1cHg== 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=w36kmbvE03CotuJo4e7VJsDHPTfoezEt666a0noBitw=; b=XjqmmkrTipB6Nr7OxTtuf/yshjhIBRXdMoqfzajZVyvtvcZVYT4uv95+P8SlCqLSwLoQo8XT1z5xl2544m3Po6F5Jo9N3YdJHq5lLe/KPGWe5gMaFtXRN788XoXlXcdcn+6UR2Fox0nJiTnyaDIN8vTHdGKYT13LxyIs3rQq7QU= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by MW4PR10MB5750.namprd10.prod.outlook.com (2603:10b6:303:18e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.22; Sat, 26 Feb 2022 23:04:45 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::3dd8:6b8:e2e6:c3a2]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::3dd8:6b8:e2e6:c3a2%12]) with mapi id 15.20.5017.026; Sat, 26 Feb 2022 23:04:45 +0000 From: Mike Christie To: martin.petersen@oracle.com, linux-scsi@vger.kernel.org, mrangankar@marvell.com, njavali@marvell.com, GR-QLogic-Storage-Upstream@marvell.com, lduncan@suse.com, cleech@redhat.com, liuzhengyuang521@gmail.com Cc: Mike Christie Subject: [PATCH 3/6] scsi: iscsi: Remove iscsi_scan_finished. Date: Sat, 26 Feb 2022 17:04:32 -0600 Message-Id: <20220226230435.38733-4-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220226230435.38733-1-michael.christie@oracle.com> References: <20220226230435.38733-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR08CA0048.namprd08.prod.outlook.com (2603:10b6:5:1e0::22) 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: 58517632-d96a-4cf2-f4f8-08d9f97c60f4 X-MS-TrafficTypeDiagnostic: MW4PR10MB5750: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: zlPn/YNyNTkHMOu8+4SGCtAt/PbsZsavgS0dDKrr5gm0c09wf+lBPqEhsdS69mpSERZm63K3VkxP6IbARFQGEVgQ40lTO5E7slZZAZoMb2f+a/rIluyHnu5d8T9YwP5SnsjHra4Nbc4X40vGwHIFSpqpx87gMDvmEo1sv135gAD3iylTykiGg5O1z8ItHh7ZxpodkE8YI7MAGoAgOGGarZJ+Rm4oirf/q+wTRKxLa1E/TnW0tcm0AaxLHWg5s2QH1PR9jIcNRlGURmoSXp4tkSGjKgNMhE1rzAGEsuVFA0KzNV/gbgxhEZ+9GPr1oVDvRi/xfwzUi4cjyBP8rpFQO6U2Wg0tfmtyO76Ih9ieLzYZia1uAnaORXsPMijsmOWXahXTrk10otBbREJE8a0Imf7Zas/ubjqgg8khlOBwrdozVdKlE1ru5v9cYTIhvh7FF3vnOlAQIU6OgoEAvUKXJUFqhxFKqSlKb/woEB1RPF4LOEJ5saVtnoIs8RipMRegn8VjeqGuwUxr3Mwzte4AkdyYDxLXoB5AIN59gnSuxpYhg3ia6JTPe+gsRf9R9lC56hYPZTAA24J5M3jHq7wIKl4bxQGIwTc9pvTXAeBzJzsFMP71s2DEA6MYFdfbegHwNfRPh6/cJGRzSWpz7A87XHvPMBCY5UbchZDE4V1EfjYfCX9TwPylDIW964LN756NL+K9tsI+DjLP3hr4DaTyAQ== 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)(1076003)(107886003)(2906002)(5660300002)(66946007)(4326008)(8676002)(36756003)(186003)(26005)(38350700002)(38100700002)(2616005)(66556008)(66476007)(6666004)(8936002)(6512007)(6486002)(52116002)(6506007)(83380400001)(86362001)(508600001)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fx3/pkPw4BPVfciLZLtwxwA7dCCq9OQSEDzE+GmLYxWYwvv5Iyt6uqozY7O1cNsDimDbFQxzNuTLvNiYy8twxVqDaGQj64Q9r/7bb0OUcwhDECNWSKg+jkCKhAOQTzEdxOvXmR7UahI0Vy55i65OGzQIW75/qRk5pgzhjcp3a6olhdHNLJWtQO0DJj1JLk0xhSSXfd7DJ230bRZNq4RirQo/c3IgiHoqD4dDj6oVDrVQ/oqhk77AeM/a65q9GWCtjljfJEIRGkxulSpgPrqVWr55m8S6/Mb44AfHKjm3ZAzZuhkLde1iPNIs7EQRjpjshmUJTTheibQc66pYxpv3DtnHd4TeMD+/ErAIy3JPcAIV4Gqs8iFqIXG6lXDNcd9eUFtgYPSaTEXme38X9aq8fRr5vbQsy2x6c5UBDFiH60a2VPk+tMtNjeIUg8IzmQnL3iicChAueep29qdut1Vs7FfVAeDA9mbamyW1bD4fJNLxz8/UtUii/2fmzqQxboEKZ9Rzw+BLg+ZFRR/x6xWlfpzLatdMfM0n/Dinzo54wJOibV1byXIiz7vOgNeyjzejQ9F3IceBV8zeZjMvmd9n38uED0mhC19DTsdEzqpn6aM0fTr1b8eZPwnJKyTaoqNBy90TE0pN/uz75s0evTdq3EDRw31c/bWUm4jgp77y9LV5KlTo1/aHWvdo/JyQEg3mwsSghw3CXVBdYmtcTf5fTajDeTn8emGzdFxwSAu+wsslcEU7AKF0owtXp8lD51t96HLifX5RUTBfpCwxap56E21oYCEttzkRo5/FeT9mKurKhi9Xo7SgwIfxaEjNN4rEwE6cGc8CI6YL7c6FOQlZU5huxCpClmyceu7XhbL9FNoZ33qqro+5DNeCX00IMCdWTWxD+DQaqYhoyGeRk1ug6ybTOS0qiQDtjaB+yWiEv3HrWcfH9HL64YIZmtRVIcvLs5Qc3g8hHbx9lanJB+msKjbQneixRmVBf7PFqJpiF8NVH91DjULWZtSYzU2L0+9n28MroxkRnPWwrSSshga+HqzOC74yjg8538CqVckoBJ+BiZE4iW4elPiHR+ZauPfAKMG/UUB7/V3qTEoKezZaYhHQRAT2XJ+dUseU9jy8z9fxXKbSd7wNSv2PvQu7j2BXwd/agFAaMBlRBRosxsyP3hAn5Z3TOXVlKiJy7O/8hDgd01QAkcG+H5esulzceJ8RVFnvES603GdIerUd4xClvMdtzLr9H0AA3Was8VRRd8+zW4XGZu/QE8ssxpvpKb2G9AEpX4x7KOYrdqBhXgXMZA7/nCNdpMXuDFW7PC3XXb08UoDl0o/7KwcHJQROmXwdngqTruD4QDGujuEPmyiZKm1JgU783Q4nf34CL8PF4I464vomt6yZArzK+cKhFpS7vwU98QMGgtL2DP/ByzruEZumHGDIjE9AN24PhUbxEC4tRWMKBf2NyQCfirwNrtGImhvGpsC/ZF0NgWyjAPFojQ/ITbifbCN34+9Vvke7TNZhjtEmAN28jzYiyG4GpblMxELVpc0Ls9Mkr+xHw5f+bM54kSc0jxKQFGgvvvcYVlW/LS4HlDoXCk1yAUSqiicfNF3adAROuOOU4vwEuowVck2V3imbtVKeV5IAYap013PHYrHX4STrm80jfFSCBd/zrbWN02FnGvgAf60p7em7IA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 58517632-d96a-4cf2-f4f8-08d9f97c60f4 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Feb 2022 23:04:44.9281 (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: ifAXL9dSWLzD5ZdY2h5QAtbyFUWL5RL2gwpJO1gF171BKhjuzc/Q3vzSzLfjfUWx3UpS2QrXY0Wv5beIKPADaz4t7yJTBB6AiObTDP+UnbQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR10MB5750 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10270 signatures=684655 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 malwarescore=0 mlxscore=0 phishscore=0 suspectscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202260163 X-Proofpoint-GUID: -VpFJys-r6rs9P_mTJ7voRHpthEoD_fR X-Proofpoint-ORIG-GUID: -VpFJys-r6rs9P_mTJ7voRHpthEoD_fR Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org qla4xxx does not use iscsi_scan_finished anymore so remove it. Signed-off-by: Mike Christie Reviewed-by: Lee Duncan Reviewed-by: Chris Leech --- drivers/scsi/scsi_transport_iscsi.c | 39 +++-------------------------- include/scsi/scsi_transport_iscsi.h | 2 -- 2 files changed, 4 insertions(+), 37 deletions(-) diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 732938f5436b..05cd4bca979e 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -1557,7 +1557,6 @@ static int iscsi_setup_host(struct transport_container *tc, struct device *dev, struct iscsi_cls_host *ihost = shost->shost_data; memset(ihost, 0, sizeof(*ihost)); - atomic_set(&ihost->nr_scans, 0); mutex_init(&ihost->mutex); iscsi_bsg_host_add(shost, ihost); @@ -1744,25 +1743,6 @@ void iscsi_host_for_each_session(struct Scsi_Host *shost, } EXPORT_SYMBOL_GPL(iscsi_host_for_each_session); -/** - * iscsi_scan_finished - helper to report when running scans are done - * @shost: scsi host - * @time: scan run time - * - * This function can be used by drives like qla4xxx to report to the scsi - * layer when the scans it kicked off at module load time are done. - */ -int iscsi_scan_finished(struct Scsi_Host *shost, unsigned long time) -{ - struct iscsi_cls_host *ihost = shost->shost_data; - /* - * qla4xxx will have kicked off some session unblocks before calling - * scsi_scan_host, so just wait for them to complete. - */ - return !atomic_read(&ihost->nr_scans); -} -EXPORT_SYMBOL_GPL(iscsi_scan_finished); - struct iscsi_scan_data { unsigned int channel; unsigned int id; @@ -1831,8 +1811,6 @@ static void iscsi_scan_session(struct work_struct *work) { struct iscsi_cls_session *session = container_of(work, struct iscsi_cls_session, scan_work); - struct Scsi_Host *shost = iscsi_session_to_shost(session); - struct iscsi_cls_host *ihost = shost->shost_data; struct iscsi_scan_data scan_data; scan_data.channel = 0; @@ -1841,7 +1819,6 @@ static void iscsi_scan_session(struct work_struct *work) scan_data.rescan = SCSI_SCAN_RESCAN; iscsi_user_scan_session(&session->dev, &scan_data); - atomic_dec(&ihost->nr_scans); } /** @@ -1912,8 +1889,6 @@ static void __iscsi_unblock_session(struct work_struct *work) struct iscsi_cls_session *session = container_of(work, struct iscsi_cls_session, unblock_work); - struct Scsi_Host *shost = iscsi_session_to_shost(session); - struct iscsi_cls_host *ihost = shost->shost_data; unsigned long flags; ISCSI_DBG_TRANS_SESSION(session, "Unblocking session\n"); @@ -1924,15 +1899,6 @@ static void __iscsi_unblock_session(struct work_struct *work) spin_unlock_irqrestore(&session->lock, flags); /* start IO */ scsi_target_unblock(&session->dev, SDEV_RUNNING); - /* - * Only do kernel scanning if the driver is properly hooked into - * the async scanning code (drivers like iscsi_tcp do login and - * scanning from userspace). - */ - if (shost->hostt->scan_finished) { - if (scsi_queue_work(shost, &session->scan_work)) - atomic_inc(&ihost->nr_scans); - } ISCSI_DBG_TRANS_SESSION(session, "Completed unblocking session\n"); } @@ -2192,7 +2158,10 @@ void iscsi_remove_session(struct iscsi_cls_session *session) spin_unlock_irqrestore(&session->lock, flags); scsi_target_unblock(&session->dev, SDEV_TRANSPORT_OFFLINE); - /* flush running scans then delete devices */ + /* + * qla4xxx can perform it's own scans when it runs in kernel only + * mode. Make sure to flush those scans. + */ flush_work(&session->scan_work); /* flush running unbind operations */ flush_work(&session->unbind_work); diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h index c5d7810fd792..90b55db46d7c 100644 --- a/include/scsi/scsi_transport_iscsi.h +++ b/include/scsi/scsi_transport_iscsi.h @@ -278,7 +278,6 @@ struct iscsi_cls_session { iscsi_dev_to_session(_stgt->dev.parent) struct iscsi_cls_host { - atomic_t nr_scans; struct mutex mutex; struct request_queue *bsg_q; uint32_t port_speed; @@ -448,7 +447,6 @@ extern void iscsi_get_conn(struct iscsi_cls_conn *conn); extern int iscsi_destroy_conn(struct iscsi_cls_conn *conn); extern void iscsi_unblock_session(struct iscsi_cls_session *session); extern void iscsi_block_session(struct iscsi_cls_session *session); -extern int iscsi_scan_finished(struct Scsi_Host *shost, unsigned long time); extern struct iscsi_endpoint *iscsi_create_endpoint(int dd_size); extern void iscsi_destroy_endpoint(struct iscsi_endpoint *ep); extern struct iscsi_endpoint *iscsi_lookup_endpoint(u64 handle); From patchwork Sat Feb 26 23:04: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: 546581 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 96784C433EF for ; Sat, 26 Feb 2022 23:05:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229964AbiBZXFj (ORCPT ); Sat, 26 Feb 2022 18:05:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229958AbiBZXFc (ORCPT ); Sat, 26 Feb 2022 18:05:32 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2D1015DDF4 for ; Sat, 26 Feb 2022 15:04:57 -0800 (PST) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21QIIqVx030109; Sat, 26 Feb 2022 23:04:50 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=wYq8uOP3/EwabJNpr1OmCzpMvDmk4s1gK0zncuI5ls0=; b=v7EYjkGdDHrSNNawgfnPDGaiJ4kVTi3+5Aab5D8KqT0H4vmKkkciinPl+l1vTOjzqcoz HyTrZgruTSFM/A3eZYVWxM3+vWEEawFcw7oNrtVs1DmNZZ9unxTNaLSiBizKz/OFNh82 umjRqYatc3fYfvsdS5gqacvCBF4cwvuy4HYnTjEPqjtkYJV3tppJxhfUOSFzTORxuLPn GiUVyyv1qg1NC7tA4FJeAI3XVREccC+YnNBuVS1aBmchMruo+9zuMqo+FeDLGdJBcGQf pJQJ/r4oA7D+Q/Je48lqBXAfCKodDgvALsl6Nin3cOcJ2JEsMw/7VZ8NRBVhPkgwg+hQ cQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 3efamc9bkb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 26 Feb 2022 23:04:50 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 21QMtm5J027402; Sat, 26 Feb 2022 23:04:49 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2109.outbound.protection.outlook.com [104.47.70.109]) by userp3030.oracle.com with ESMTP id 3ef9at5krx-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 26 Feb 2022 23:04:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Hcf+cW/1gTPZ1xIZlzheDexqjsRw//f72zrIg8IcS5moLxlaVGc9R9toS3e0vClE7wlbtuAQ+sUFN0FXe27M1yyjdar66NcRz6Xrh6B6FYmKiPNiUUbEq61A77z0tPiGU0C5FwLzkdZFD/ae44y2npGTVVy2kbLunA3d7PpNa+gthK1uRdqKgy3+n3FR1n8jPuwYOPMqX6endWO9jnj81Ht6VLyiUw56f1/hvEHffpTYvAvV4V1pQAsASHIPIWIMwByKb+mXUiBKBP0MY/UwWuqNY9jd0demZHncvSMRsQciSp0/M7gX/BDnpzVvdK75f27tYBIeQJr88U83OlOLAg== 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=wYq8uOP3/EwabJNpr1OmCzpMvDmk4s1gK0zncuI5ls0=; b=W0cf7F+y9vAI0W+ZbCQq5ukON8kp50pE9V6nHQaWX87hsbwK7OAajJ6o2oASlIzA3Gk1VkHrk6EkkT59uaPhcTK6zxQ8/YTsbWIigYv+qdOXBsoWjOirKtpbKmd5+50QR1oy8ztPc2w/lNp1wt+qx/LhQ7A2vzhUZcHE58setPUSRcw59+6Em4tgf11CzsqQL+xdSbrdmTXD5xA9mlUjQWNJdSrdiEJGIphCGvaHLLy38CxwKcZP/ANxlPsN4cFO7phnyA3w2iJwkKKUlWhUdMoQPntSwVFj4r6kG5W4i/2/tb3BpH/yDkeFXt3jat7bLRmIVQb3W1dT8VvCQMI2uQ== 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=wYq8uOP3/EwabJNpr1OmCzpMvDmk4s1gK0zncuI5ls0=; b=RrNJz8NP5iwtbLKaLf32qE0S+sMHBknhwM3M+p3UXEIaqc+wQh4gE04EpnMi47cwNo+Kbr4O3/G0Cg9vig7pBbk65k0VfAHXCTGGnnN+r+AnbyAYFe5KzKnSoKQGKhF889dzRiU4GB53wcWK72exf+Cs+t2qgHdW41b2+AwOwj4= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by MW4PR10MB5750.namprd10.prod.outlook.com (2603:10b6:303:18e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.22; Sat, 26 Feb 2022 23:04:45 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::3dd8:6b8:e2e6:c3a2]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::3dd8:6b8:e2e6:c3a2%12]) with mapi id 15.20.5017.026; Sat, 26 Feb 2022 23:04:45 +0000 From: Mike Christie To: martin.petersen@oracle.com, linux-scsi@vger.kernel.org, mrangankar@marvell.com, njavali@marvell.com, GR-QLogic-Storage-Upstream@marvell.com, lduncan@suse.com, cleech@redhat.com, liuzhengyuang521@gmail.com Cc: Mike Christie Subject: [PATCH 4/6] scsi: iscsi, ql4: Use per session workqueue for unbinding. Date: Sat, 26 Feb 2022 17:04:33 -0600 Message-Id: <20220226230435.38733-5-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220226230435.38733-1-michael.christie@oracle.com> References: <20220226230435.38733-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR08CA0048.namprd08.prod.outlook.com (2603:10b6:5:1e0::22) 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: c015a4bf-4d8c-47e6-8e39-08d9f97c614f X-MS-TrafficTypeDiagnostic: MW4PR10MB5750: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: PvRmWMWhj0mbhGp1JakgSJ4+T2QJoUpBgTbMFQT0oPyKx6XtKiwTT+zCQ9aj10gezNKWjqmbnGoAMs2VGHHjNMw+/ApZ3ovWgbV2brlvVYclnmbdb2z7emu/WysA/UUsILZDBqlJMg7hppwZLo/GQezGw5W2fC//VY0i9BhezM0WDIUlaxzA0BMzyxs5xf/oDMagN4DSoAjgWqZH6OgI+saS/2HXBo6qMTTLfvu/I5KHWg/B81uqrqvIw3CIAVb8oWasMYuu2o22QdpaNhDdY6N3jypmYzyMsj/VAdH0A78ay+0U+dWkKfly6zlnBkAoE3qt7FDhtWP/obVWHtREtqw7Bk8lgsAf2bh3kBnjgdBZMG7DRaJpuz9FpztXqXiWRGUGD5x0cWLHDz8nBuUZieMykG3OcD6LB1/AS/Iyz2Ivd5d2N6uL2GyPhNYY9EwWhL0t2mVpQCZnL7qMXGVnjq4g9hNMKKVsV5n+dmn3Yi4DTkKo0NynkcUYPb0J70ShmhVwZL2niDRogtcQXVdz9T7VpjRgN13mx0mu0A9zOKFWMMyfittY8nNutyhxE2Y8wKTd0xFiu0N33JyC+ErQVIfHfyeYIF3lgh0daePrmLVlaFwAy6PBm4BW8abDpD4iu15oNkcyadAWB7fQAnXgO0PUdBmdrhwbt/jDDmNx0T7eP3A2JqzF/vEOX0wAR08RGWfWNyfx5gOyZgwzeHVuVQ== 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)(1076003)(107886003)(2906002)(5660300002)(66946007)(4326008)(8676002)(36756003)(186003)(26005)(38350700002)(38100700002)(2616005)(66556008)(66476007)(6666004)(8936002)(6512007)(6486002)(52116002)(6506007)(83380400001)(86362001)(508600001)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 99qZaRDBsWR4rJm+QPfGeJ8Ioa/lBeWBwpgiBWsMdaZ1T9qAJcEz38m/5+ugM0PiPQMOgVCaolqBdEIWe6dKDiNyMGmr9TpY+AB4bsEmOTuoG66nf9Lkpr5mkdQsGhyW7OW5UJExSfyCO+h+Z0JInOuBexcqLnEKur4NTMM4yrNoFeneYjBtBuDbIwWh53IB2eKRSpqQJQNJpE6j4h7/zq+XigJTvBVUgWnbhjrp3Tw9rzKJFjeCvnindsiCA8B7fabXQP+TKAidfQtySDTmh1WBGaG/DWgZxlNeQaMk6h1LNAbwU6G15vq1F8ZCHW6P3gP32cwE9t//vUT1l74sZfRJnbHWQ/m9d4uPUBVLJbTyooGgByoIl0Poiq50bCoGb60FUFx/j9F2FJJUhtsxVQnZuLh1GMaGst63HAXEDKL/dz9Q6Ota1SWelyfhZPPKz1rCF6nrwQICRX9yzdm+Y2lxiTr5+02QelyoFDXIhoX/4YtWNvMzw5A0kWt/JuwhvnQQpuQEfYpnMN+7pG+68oAIqRXmpoZDRuiGo6FjEp7l2r6r0bvn9n2OvxcE7KQE+8dXgtBfgdtTnZ0LzIqgNx2JKp2N1AgaZpVlTZ9mogqP5rFQ0jr7nQlwzVQY1rrHrNOUcnndjeSEh8bJJ1KCfLi2tc6nbL6jatKIhqIrBSZfUGxEwPMUc/DFnnlaVvPliOebq5j+ewRuvFM2c6iuUQ6gsm86EU7TDP8ZRXqMU9UWt4pNYW/LpPdfX4V5EQVZLcM/rLxKw1V4fccufSMbEVqOgmVAI7l07dsIcnEj/udbniNjddCIYKXfl9bYwrCl6ETPA/d4ORlJ+Uz0JOBXXwVaZHW9JE7M03siqRXqihEjVJMtNHS5DlF+ithMdw+HYWmLCAi0f1zzeP5yr/da0OxY7Dlgn2rsFOrhr3Yk/KOvTuJvgnSkDhRHz/D1mkPEvyJghDnezO8sS2JVilMIMfai0nAB1Z/HK07CH/DOoA7UogJFa+7DEVS3fZXWO2f/BrwLeOdA67BuMO2IfIEWI2pVTY+JS2eMCKD9Y9xgaAoQEBXAekZlPVNo1CenLUBg3VjGGPXxux/pZ2224LBoK01aPJFneUubx82TQQYdRGh5bnxYTSu3Ul/04J4wSbs0/6o954VSD+pceVSkQTfbFDGSvJGQJYM1PM2szIxA43ubkYRLYb6nWYvy2jBx766QqSrod/eiIgyB0FOfmK66B1zfFmPYmyozPAtE8rY7hWSwQRxMR32/GfptlQ2vbT4aec9cACsFZmdsnzK+KHJbNTLaXup0qKsePbwFVlFjMLp7cFmKPmIWH+1DTm/ak7be1PNyFJQafqKVz3TS5CUsQMDOu0MdbGFuDdiyWjLjErMRDmhLUvfunrPmMOoTab+/yd2vWl5utFJzxF5ke34iUtTHZOjve5OV59mcDp9/22rReLF6QcnxibNqDrRpNNpChlzn/pLHKABmCm6wrVuCLctFC9amGB1t87LcZN1xXvTjr4n8DDAj+u53SEN0XM44fXVcwm8GuqxbzCqe4EKnB1CbOX5hmamVadlRjEPLlJK1JDSgAKBO0ik2sbyLwA65cYZ8yULxGoCkGAPGERyhqrD6FUJ47EYSxg9GD89Lyq6qKHrftNMJdUyiLEBy/ONYIOhjVjet13Z8ehQYq6txnw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c015a4bf-4d8c-47e6-8e39-08d9f97c614f X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Feb 2022 23:04:45.4750 (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: 2xcXMrIsZdqzvaphJ3gBSxp4ywJzg+SjuxCFLT9q5d/dmhNTKZ4DGmVDVSzsNcH+l10pl3X+EBg2Di8iCc41TSItxWAro6BVAW+Rd/DgoK8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR10MB5750 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10270 signatures=684655 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 malwarescore=0 mlxscore=0 phishscore=0 suspectscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202260163 X-Proofpoint-ORIG-GUID: f0QiO9GEokEzMYJLEuRNOa_NwhHCE-oz X-Proofpoint-GUID: f0QiO9GEokEzMYJLEuRNOa_NwhHCE-oz Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org We currently allocate a workqueue per host and only use it for removing the target. For the session per host case we could be using this workqueue to be able to do recoveries (block, unblock, timeout handling) in parallel. To also allow offload drivers to do their session recoveries in parallel, this drops the per host workqueue and replaces it with a per session one. Signed-off-by: Mike Christie Reviewed-by: Lee Duncan Reviewed-by: Chris Leech --- drivers/scsi/qla4xxx/ql4_os.c | 2 +- drivers/scsi/scsi_transport_iscsi.c | 19 ++++++++++++++----- include/scsi/scsi_transport_iscsi.h | 2 ++ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index 0ae936d839f1..955d8cb675f1 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c @@ -5096,7 +5096,7 @@ int qla4xxx_unblock_flash_ddb(struct iscsi_cls_session *cls_session) ql4_printk(KERN_INFO, ha, "scsi%ld: %s: ddb[%d]" " start scan\n", ha->host_no, __func__, ddb_entry->fw_ddb_index); - scsi_queue_work(ha->host, &ddb_entry->sess->scan_work); + queue_work(ddb_entry->sess->workq, &ddb_entry->sess->scan_work); } return QLA_SUCCESS; } diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 05cd4bca979e..ecb592a70e03 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -2032,19 +2032,27 @@ EXPORT_SYMBOL_GPL(iscsi_alloc_session); int iscsi_add_session(struct iscsi_cls_session *session, unsigned int target_id) { + struct Scsi_Host *shost = iscsi_session_to_shost(session); unsigned long flags; int id = 0; int err; session->sid = atomic_add_return(1, &iscsi_session_nr); + session->workq = alloc_workqueue("iscsi_ctrl_%d:%d", + WQ_SYSFS | WQ_MEM_RECLAIM | WQ_UNBOUND, 0, + shost->host_no, session->sid); + if (!session->workq) + return -ENOMEM; + if (target_id == ISCSI_MAX_TARGET) { id = ida_simple_get(&iscsi_sess_ida, 0, 0, GFP_KERNEL); if (id < 0) { iscsi_cls_session_printk(KERN_ERR, session, "Failure in Target ID Allocation\n"); - return id; + err = id; + goto destroy_wq; } session->target_id = (unsigned int)id; session->ida_used = true; @@ -2078,7 +2086,8 @@ int iscsi_add_session(struct iscsi_cls_session *session, unsigned int target_id) release_ida: if (session->ida_used) ida_simple_remove(&iscsi_sess_ida, session->target_id); - +destroy_wq: + destroy_workqueue(session->workq); return err; } EXPORT_SYMBOL_GPL(iscsi_add_session); @@ -2177,6 +2186,8 @@ void iscsi_remove_session(struct iscsi_cls_session *session) transport_unregister_device(&session->dev); + destroy_workqueue(session->workq); + ISCSI_DBG_TRANS_SESSION(session, "Completing session removal\n"); device_del(&session->dev); } @@ -3833,8 +3844,7 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group) case ISCSI_UEVENT_UNBIND_SESSION: session = iscsi_session_lookup(ev->u.d_session.sid); if (session) - scsi_queue_work(iscsi_session_to_shost(session), - &session->unbind_work); + queue_work(session->workq, &session->unbind_work); else err = -EINVAL; break; @@ -4707,7 +4717,6 @@ iscsi_register_transport(struct iscsi_transport *tt) INIT_LIST_HEAD(&priv->list); priv->iscsi_transport = tt; priv->t.user_scan = iscsi_user_scan; - priv->t.create_work_queue = 1; priv->dev.class = &iscsi_transport_class; dev_set_name(&priv->dev, "%s", tt->name); diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h index 90b55db46d7c..7a0d24d3b916 100644 --- a/include/scsi/scsi_transport_iscsi.h +++ b/include/scsi/scsi_transport_iscsi.h @@ -251,6 +251,8 @@ struct iscsi_cls_session { bool recovery_tmo_sysfs_override; struct delayed_work recovery_work; + struct workqueue_struct *workq; + unsigned int target_id; bool ida_used; From patchwork Sat Feb 26 23:04: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: 546384 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 EF377C433EF for ; Sat, 26 Feb 2022 23:05:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229972AbiBZXFo (ORCPT ); Sat, 26 Feb 2022 18:05:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229961AbiBZXFh (ORCPT ); Sat, 26 Feb 2022 18:05:37 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D221815DB0C for ; Sat, 26 Feb 2022 15:04:59 -0800 (PST) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21QHuqjS026177; Sat, 26 Feb 2022 23:04: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=HZQNF9m1cdzLDsIH2rCN+/mnizBfexNnMob8OyzYExw=; b=lW+PVV6ryb0Am6FI81plCt+rV9GCawv8l/Cvk0St3SbmtBdMv9jaiB5ce//hUiksgC8O DgAsUvmNChKakRrx4Qk52ZfhooAH3Qhvw9VJiKUMuXrBNfRb+LSV9eG/TnwIP2cUj/Kh sYsYfIGB64WIi5e3sV3ei60C6vod1NQnqOnoy7stI8dU+lYeDdvz84ulP9bp7gKeT5j6 irMtBeYEacjRKD729JvYDWtmUX00uvgoTz1zM8/hsk0w0sA2qgETaiD6rocn1LHGt5hj tgu15XZ0C1iLyWzuJsjRBeeiKJ/8gkPMxUcNGFZnf3F0nydOW9I8Mlx7uxosKZfb/T0Y Lw== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 3efc3a9938-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 26 Feb 2022 23:04:51 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 21QMtm5K027402; Sat, 26 Feb 2022 23:04:50 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2109.outbound.protection.outlook.com [104.47.70.109]) by userp3030.oracle.com with ESMTP id 3ef9at5krx-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 26 Feb 2022 23:04:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QvBRKCbjnDAUYdvSTDmd563+dcIPwsneGyejAInjqyIIjCw9cs7rPCF3JDtxiIsOc2k3VGZAsFXhZNobNSE/9lKkwNr4A9lId+ObYFSe83pn/PaXZC5/7TlgvPbDsxGfQhS6FPbJR4mhdtwjWMVbeQbcacmp5DU8sXuS8tVEiaoDyjLPMc4wexrwelFTjNlat5zlyEwgvclocZ+JnNfk8o/7Iu8ePo+FkZGNoxCZkoThhFfH+NkqfLWGUNWqc5VmIdo4jc5BtVQyitLpa/AjXh4gsmr745GOkqxjiQjzsDHwlQKn+QdPulfX4+545eJ5vl2tu2cPwWFnnksc52dSnw== 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=HZQNF9m1cdzLDsIH2rCN+/mnizBfexNnMob8OyzYExw=; b=C0pSz2znQNxzwkQUMy8UKCKK1Pocr2oZ6QNc8g7FvHyjW+nZBqrGCsGPZ+FKe4mhzB9F3MMgEDPygAddNZ0xXh+2QvORmct1THQiI+GGSzNJmFAfjUhCdbXitPr19qSHrhYClgsqGJ896hBzWTSEEPKGhe/Sp8ogoSwHqV8iEvEN9FVx2ZpsczeCroWkP/dCSHQjwlyhj/Sq3QjbefkwzZbSdkfxcTslpfnHHOCHgyJja1CT76j228uyhK0Sq9ZMP44eu2Gt6icARBapsjgZxN+P6CYRKBOIUZQ4iQPW7lasA9zYhZFsdbEzj80PSCpewahhS5IHnAbervSnLGJP8g== 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=HZQNF9m1cdzLDsIH2rCN+/mnizBfexNnMob8OyzYExw=; b=a7WRkgxQmrOXv/eNxeNhDBZ8m+iQqtcy0AXL35o0QlnL6z6LcIeoHUmMDEJZS5j/HfgnAQdeJ2iTnN3Ahhgb11JuhLWY2jeAHOKi6SeZG9ANSvzjNh+/DnP27bwWmuD9Irb92s8+Nu6DgZJfWWGqGnwfApOy+B2b60ooRyXUNPw= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by MW4PR10MB5750.namprd10.prod.outlook.com (2603:10b6:303:18e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.22; Sat, 26 Feb 2022 23:04:46 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::3dd8:6b8:e2e6:c3a2]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::3dd8:6b8:e2e6:c3a2%12]) with mapi id 15.20.5017.026; Sat, 26 Feb 2022 23:04:46 +0000 From: Mike Christie To: martin.petersen@oracle.com, linux-scsi@vger.kernel.org, mrangankar@marvell.com, njavali@marvell.com, GR-QLogic-Storage-Upstream@marvell.com, lduncan@suse.com, cleech@redhat.com, liuzhengyuang521@gmail.com Cc: Mike Christie Subject: [PATCH 5/6] scsi: iscsi: Use the session workqueue for recovery. Date: Sat, 26 Feb 2022 17:04:34 -0600 Message-Id: <20220226230435.38733-6-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220226230435.38733-1-michael.christie@oracle.com> References: <20220226230435.38733-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR08CA0048.namprd08.prod.outlook.com (2603:10b6:5:1e0::22) 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: 6476693b-6031-47da-14cf-08d9f97c6197 X-MS-TrafficTypeDiagnostic: MW4PR10MB5750: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: 7l0Svt6qYk55y5mmhT4xWfKgQ/XUP3LTFTbPQf2Yfo3jCPEHAvMIjE4yYLVCwemni1Y424el8Jn47MimQil8GIzoTsKaSeWzSqHVn4VFSL4UxWAzzAsRDmrs968LOAwKQO3fxgK9VwQmHacUP2eXUi7/NIFlUiShsF/1PZ68ufLxicyqAL9KUkgsPvt21yUNuF088Pepi19WNpm1yalT6US/JACiwkGdEFk6nmaiJe+T86bMzGFSXOc+ZC6hVLI5GC2M8mmSyzYiHXEGyMdje+7BHUxwpX7dF08Trn9DpTaIQRh5tYUjnggvWa6sRCOsP1SOayYhF9rWU+OJ0QGrBqNUKoxjLEb+hIHy4075z94qkT6h/9FlzpK3hVDpnpBZwD+/PSN3KEFbKfOEPoXracjrD5EoQd+vHKT1FGJ/LXq9xJihrEnhkNqd5RZ1If4D+eX1NfREQQ4It13IYP15CgIu7KXODkRY9qp+96SGpu2VnXa2AvGeiqduJeiEKe/mxx55q+v7qCORkcqqhpF0IQdejtGjnogGhqUlyYnHMV/6mVQf+n1JUIQBqtApbSoByECcbxkpdQmyumRBRSNZ0x9vwIBpX5mVwOV/cZ36sWITT8/DKJjqZvpSxY4l5MTdxo+Ix1zgoYdRLb9t21wLwoUwid0fUmNgHynWXc1GJGzi+w+3/sjC6Ea9hZHED4pvlDLFLJaA4duDXMaxkF4Tdw== 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)(1076003)(107886003)(2906002)(5660300002)(66946007)(4326008)(8676002)(36756003)(186003)(26005)(38350700002)(38100700002)(2616005)(66556008)(66476007)(6666004)(8936002)(6512007)(6486002)(52116002)(6506007)(83380400001)(86362001)(508600001)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: N5w8w5//VlzvZrqFyK+xQwQlTbjj7IBYgGO4yF7a7BWEb36zv/BJwEtZU8zfT2rkwjLTBzrh56y6tTeuJSyhY86/RiObteKRcSzGsNCvk8q95PII/5z3S5psjlytqUV52XrHCpc269fD1VKW7imwsGYm/Mho1AMxPnypAu31csu7tmpZCiGd2QCzlwiFBa1lpFjmz0u8OevZgQ9MeXWUqVcwqhIUmFduFJVmvGx5S8WuMOCO5TkOpfrPQGHZvN+zeiZ5ek0SotqMkQWRY/wmXtcZh8jgreIvHuv9Ekc1TTr8vSFcTApIxQXL0cgZrFDLrxaHY0T21Dv5DLbxp1Ad2z4X2xbsvfMf19XM9dJoV5d4mnZ6A9//JE99dOMxY9YlSVRE2qMvsVqmLscZtpGFpqcr3tIXoa0jWElO3O/Krlrzo4KrR62FhnmcePx+LrgFDrw6TDnEbNGqi+QYvIlUtdGKfTB+QemxDPZc4Rb9pmdaqZJZ9XQelMnHA8DE7MXvYspMfyS5b7IwnTuCBgDgQaisCJyENzG80MLB2bayyR77alLi1vCEM24hmSj7gy3Xl+VhzNpOIqjepYYiKjhaW/raGV8vV8LMeNdU2Vy+v17VDnzEZX3OhbUmRqnRirIv2JfpGuF1Kcc2YpBrARUpW86hmhB5zZT+u1wW9Pbe3WLgQ05A5d+4L14C9tSaupU9RUHZm1JmShpVgCondBSfACUf/EgWZLEJM9RE6Ich7tb/r/xJDJI+t/Hf6Lw227biqVy8MSYONsAlHrcvPxjM7E5aUOy7S2UjAZLRwG56dYZDwP2r+wNPhHi/EuxitVpCWVxdcaT5tX2C03nijFTY0Q1lXKQGYXgjlo6yi05z45rMIrOwKlNCs78HYhpOWb0oXVU63Zpdzhk3LNVAhWdrHxVrrHzpTebs2F2aE3yNih4jE8Hd/MEWv0XgGX/Lg2M3A/RSLb5OKsn1guJV3ka1RQeA5crQtc75eD7gdftAUP4IOFr+60LIahY3CtLI+IPy8IiYyxDhV5akysnjhe1wFRhRVM+rU28A8DvpQH0aiCy4YbIsd23V2l9sQO3EtDUt5s8TWyggfsldvQwBt0SmF1yJToz4YQcSCeufHPYHKFnRgZqPOx9ItEi2hkzpGkatx4Bbv9VOg7hsjmIMbW4wLA/DTzdLjj4BPbfmbtkqngtf7hhkNdvXTPVg4RzSZ7L2MoNuwTLpXQWRsi180/+Vn42rZh7YhDaObaX3Gw54Ta0IvSz6jvN1cAYFHLhZsHEgZywPt7VYw3zCLSwKczzCMg1UROdISk2ZS6TrCeFFESgdAPfktkS+MsxNpMP3qtd3hLIlH8yMHjZWtzQj/kjLwfXdg/ODVDzD3Pgp24pqfGv2aEzZrli4oWfwCtoHwAoct+HKGRQBZ+xJO+ur7VRYxvKAWW2QTNHsgLx+wvhO71OyDNdkPEYKBX+wut1eWUxqHJuGUTzijO6AhAL0yZsHQRrpX7VDR/P3Yr6Xybzbz6qkTfW3ZLafW0f25ORXwLQlJuteEPYLgV2mjAADtuvGbmIXoS4PbIRmJ1L/+MN9g+uuX4ygFDJkJGzoK+V4RqTRlTKka0Hs6ujeA5AEAjLRDpkVFUuJRBnVvdOCt4JV2NCHQMHM1Z/e6qukCXGW1wYreoXTazEP2lKyzIVuY5rjEw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6476693b-6031-47da-14cf-08d9f97c6197 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Feb 2022 23:04:45.9437 (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: vthgRkBAVZmT2DYp4Ku5tQc4GvCqPPuqxi/nBeIsv5t0QIGPG5lKfXAsy3UkCerNQZY9VthuSPGnSGcZ1F6MnwFFO97y97bJ1MGn68/uFC4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR10MB5750 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10270 signatures=684655 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 malwarescore=0 mlxscore=0 phishscore=0 suspectscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202260163 X-Proofpoint-GUID: 8pN_aMXIvVQOlB2izDAyWVxxdELyp6Bm X-Proofpoint-ORIG-GUID: 8pN_aMXIvVQOlB2izDAyWVxxdELyp6Bm Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Use the session workqueue for recovery and unbinding. If there are delays during device blocking/cleanup then it will no longer affect other sessions. Signed-off-by: Mike Christie Reviewed-by: Chris Leech Reviewed-by: Lee Duncan --- drivers/scsi/scsi_transport_iscsi.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index ecb592a70e03..754277bec63a 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -87,7 +87,6 @@ struct iscsi_internal { }; static atomic_t iscsi_session_nr; /* sysfs session id for next new session */ -static struct workqueue_struct *iscsi_eh_timer_workq; static struct workqueue_struct *iscsi_conn_cleanup_workq; @@ -1913,7 +1912,7 @@ void iscsi_unblock_session(struct iscsi_cls_session *session) if (!cancel_work_sync(&session->block_work)) cancel_delayed_work_sync(&session->recovery_work); - queue_work(iscsi_eh_timer_workq, &session->unblock_work); + queue_work(session->workq, &session->unblock_work); /* * Blocking the session can be done from any context so we only * queue the block work. Make sure the unblock work has completed @@ -1937,14 +1936,14 @@ static void __iscsi_block_session(struct work_struct *work) scsi_target_block(&session->dev); ISCSI_DBG_TRANS_SESSION(session, "Completed SCSI target blocking\n"); if (session->recovery_tmo >= 0) - queue_delayed_work(iscsi_eh_timer_workq, + queue_delayed_work(session->workq, &session->recovery_work, session->recovery_tmo * HZ); } void iscsi_block_session(struct iscsi_cls_session *session) { - queue_work(iscsi_eh_timer_workq, &session->block_work); + queue_work(session->workq, &session->block_work); } EXPORT_SYMBOL_GPL(iscsi_block_session); @@ -4851,26 +4850,16 @@ static __init int iscsi_transport_init(void) goto unregister_flashnode_bus; } - iscsi_eh_timer_workq = alloc_workqueue("%s", - WQ_SYSFS | __WQ_LEGACY | WQ_MEM_RECLAIM | WQ_UNBOUND, - 1, "iscsi_eh"); - if (!iscsi_eh_timer_workq) { - err = -ENOMEM; - goto release_nls; - } - iscsi_conn_cleanup_workq = alloc_workqueue("%s", WQ_SYSFS | WQ_MEM_RECLAIM | WQ_UNBOUND, 0, "iscsi_conn_cleanup"); if (!iscsi_conn_cleanup_workq) { err = -ENOMEM; - goto destroy_wq; + goto release_nls; } return 0; -destroy_wq: - destroy_workqueue(iscsi_eh_timer_workq); release_nls: netlink_kernel_release(nls); unregister_flashnode_bus: @@ -4893,7 +4882,6 @@ static __init int iscsi_transport_init(void) static void __exit iscsi_transport_exit(void) { destroy_workqueue(iscsi_conn_cleanup_workq); - destroy_workqueue(iscsi_eh_timer_workq); netlink_kernel_release(nls); bus_unregister(&iscsi_flashnode_bus); transport_class_unregister(&iscsi_connection_class); From patchwork Sat Feb 26 23:04: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: 546580 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 CE6C8C433F5 for ; Sat, 26 Feb 2022 23:05:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229971AbiBZXFm (ORCPT ); Sat, 26 Feb 2022 18:05:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229962AbiBZXFh (ORCPT ); Sat, 26 Feb 2022 18:05:37 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7800F15F0A1 for ; Sat, 26 Feb 2022 15:05:00 -0800 (PST) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21QHrURx021519; Sat, 26 Feb 2022 23:04: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=6DJdEhmGgVWMFbvFw6y6fIGFzS1UCjX6gqTb0diTeVE=; b=Q0wdoXE2KzTSFCKIBx0n5U4Gw5eNYy6Vr+GGbSbwGQbSFWFwr6TVmUI5hEw83TSBKgqh Q3fEzJP57rn8GlYF89FtS6c4szgJw61d0pckWRLmom7L/WgkH+uszVdYxqsCognIy7D6 ZC+mC64hKLzrqPXcCdjh++qE/LyWyQlwhTmbBd3T2YVaP+RiFyLvJgZ6j4REMSfRd9KY Fh1gWKVMCqPN/5654TybTc5Ab/oFWzM0wZO22AMndKXOfMOd0mge+U9Krzx52Nk6+Ue+ V8HfyszgmM835gnAJAwIL4Cykdprg8S7PRV1r+bH5TmhiThICnS1uUoNgm4haksKPyOZ pw== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 3efat1scnh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 26 Feb 2022 23:04:52 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 21QMtm5N027402; Sat, 26 Feb 2022 23:04:51 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2109.outbound.protection.outlook.com [104.47.70.109]) by userp3030.oracle.com with ESMTP id 3ef9at5krx-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 26 Feb 2022 23:04:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SuY28xhMTSOK0c3n8f0QfuEvUh+X5Xtcn36OVPwhbUmCPlrDnHOhqxzGqJRKjGqPsDts5plLzhl7MYzh5Nf59P63lrChhirtP4WF/GUtOJruPLRPSbPDjyoyaSo6jNbURX7L+F53zuAkinRC1YGqO57CQWCkpTuMfxdzn21tyMbSvxQ7BL0/oRyRUYOr4Cuky8Qn//sxOXJBOoYB3RxW8tOPomjqnFOP2sn5qseHKcsDYe4lvmeVyKtbwfk1U9QLeqpb+9acfaRd77QhqkHg41KhjcNwAgt8W/lCh3fJT0WVELqlukHP3rchcxlDNNKJGFKtCqT6ROi109UGZbFaYQ== 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=6DJdEhmGgVWMFbvFw6y6fIGFzS1UCjX6gqTb0diTeVE=; b=P1gu7EhmTCoAHxpeYic9fW00nyC0zWqXRqs8MKEgHIs4l3gk6e7hd5mqgorlT1acm0cq1/aNn2JOuH1DcecbCXARev7WBSHEqHl4EUiSgHSkQIOKVLfh68p8n/7ST7L1dWWy4gtBEbVaQsahTGqqgJhAFTGFk3EnGFjKDbw/If+yn67rZDcH58GJQFgCwkpJ500W+yFay/QDiitCVJzHjuCajZty/k3sxPNB3wwwAzvYQB86lhHeCntWTdXaaISx8gzil9TldOfeKmutzWnkVJjj7OTCGAokaZosW1VmAvVEdi2dzDDBOdTwxjaI1NT41tTn/Q9FrZx4ICdHSwdayQ== 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=6DJdEhmGgVWMFbvFw6y6fIGFzS1UCjX6gqTb0diTeVE=; b=ihBr2BdD/17g5ugNibQAaU9v4cj8Vpb9tAFi1YN4JYPW7qHA74ES2kQn1r4ikPQABEjmOhdtqKL59bQDo/pxJnD1HRyB4Bum0zlqYZFTqtDIq3aaUlmQzo0rMtwirIT79Baas1NoG/pOGoynmjHzheikMDgsWwlkg+MI9ay4nts= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by MW4PR10MB5750.namprd10.prod.outlook.com (2603:10b6:303:18e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.22; Sat, 26 Feb 2022 23:04:46 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::3dd8:6b8:e2e6:c3a2]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::3dd8:6b8:e2e6:c3a2%12]) with mapi id 15.20.5017.026; Sat, 26 Feb 2022 23:04:46 +0000 From: Mike Christie To: martin.petersen@oracle.com, linux-scsi@vger.kernel.org, mrangankar@marvell.com, njavali@marvell.com, GR-QLogic-Storage-Upstream@marvell.com, lduncan@suse.com, cleech@redhat.com, liuzhengyuang521@gmail.com Cc: Mike Christie Subject: [PATCH 6/6] scsi: iscsi: Drop temp workq_name. Date: Sat, 26 Feb 2022 17:04:35 -0600 Message-Id: <20220226230435.38733-7-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220226230435.38733-1-michael.christie@oracle.com> References: <20220226230435.38733-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR08CA0048.namprd08.prod.outlook.com (2603:10b6:5:1e0::22) 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: 9129a874-5dc6-447d-8718-08d9f97c61ea X-MS-TrafficTypeDiagnostic: MW4PR10MB5750: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: FITltsYC1npAHWFsuAVLEZb6GazBmEkqKoFSCcj72A9LClcupE2ju6nylray/usxdvalgMZLGz4kO1It2j2EYrXE15hKarmFyb7Ujo2VaV7I7X0c8sa7LewWkteYZAN5nVgHYK4ZXlBcoeSYtzN33W/mFjIB/tGuIO8/EOUsUanGrQgs2dox4+kJq3m2TfeXmfNTrB+4pY3aRmbhgm5pNnLNuIUt/xYAfDvxgFNVL5DqiKlEuRUpL32ObqCDN4xLUAUItKtWagxYrnQGu6245Vn8OjQrRKdvIF75ykNv1cwVlKJlXoI0XlLx4ygwxXBb3OgfGHHNs8TSYD6l/hNTcssS4BZ0F9cPGE/t0NqfuA31HUNeOSQWQcvwPJ74lIiF92Lx48U/kkRiJjbcT3RAv3gUeqYhyIrZaGCKlFoKoBvIkp6fFOjrDE5g51nD58ene7HwMKZcO8VCrvrHzzCKZwsBltragR+i6FslcsPI7oNkU8ZaOxJMfrtxs8IcSZ6n9I8L7Hft3QJwHHHop6a0WTn08ehHOyIAtsq1sQkkhxEBKWnKRBadN5sC38AtRFaoVtZER3l4jcn6Pz4lXaruwuLlLtOjQuyy7Qf5UpBabsMdReMUZRL1KRNxqeg7awGVJGJ9jNEnL4w7W+xri9H0BRwJi7ADTc+x+MwrAJDcic/rtBiwWs3eRy6w1yi22240qGOtMrE/ckQGV7B8pMiolg== 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)(1076003)(107886003)(2906002)(5660300002)(66946007)(4326008)(8676002)(36756003)(186003)(26005)(38350700002)(38100700002)(2616005)(66556008)(66476007)(6666004)(8936002)(6512007)(6486002)(52116002)(6506007)(83380400001)(86362001)(508600001)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QwTiUheFTWJiDG2YJvHCKcvCK6CwFE10DXiNFouAuJ8B/MAKzk1/HXKU+mzz9F4U8EPKBMe+nTs7j5vIq/wZgRCAW06JCJd7WzVOyagRFiUPm2CTUFPfN8At0L9uv/epvSSY+cFqiEqw6UAQ6t53dgfYFjxWGNDRVDN6tbxp5cQGc/O3bK6AkwrkyZjfNXJ+OYlXodYWfzCgViw3GGP4lnOWlOPStITTuQh9UxZBIDHha2Kr8B5Ccu+vedHEKQmBiQpDP3q5q0+NK6b/1dppA7sUJ6evC8U+fPUIx/OTazsiGTboGlujtF91z2wMFN/cw5oCE00Z+ggBwjLrs0pflfLyY51NtztgfVGc8Gb/6FaiJrLjAxWzrjQ8tRCqBD1DwuvJkseD8adlithj8qjqIJ0RP89sYzxqGuavudeR5T5QoiyCX54ZX99I/L+gjfUAPVKnNvhNSSKQdR2GOqxPlygd+nOl5Zh4VzmIzzc2wqQ80thTTt3RjYbQQaFA69OyiUy7bVGVzPrL5FrlW7Pv7WTKTwK/ZUxOCfjOl89txyeEhIwqYyIUolzJWz2gJ4o5ocio7DZxaxYFRHLD0dn2HwI9Sbu3LpltqRbTqg5R49qZQZfxHIrb8x+cv3KPPpTG/U370nL/dYCIlDez9Z3rYZ6D4/RklOeXMco54XiWZ1tzLLgGe1McTXQb1b3TgxyyPnUOYjDR+b9+bHakf13Msj3HPzymhOG0DKt9aqr8UxQ8vOC4DvRouz3Vy8+OubZgDayWtn1PuZAsLgVJWs7zBKYaU+Cw9TBG+pKyZju9WeKtaX7wuJ64K8CDHBNc3hdJrs7IXbMhuCmiR0+xD1l6KU+ckWFZBitcW/0CbiZ4msqOa527S9IMX08lZOU734AJrZ1HcQE9tkzrrUGsgHSzbsbnIR+Z60wSTM9Jo+gFrG0WKUGgoriDUSf6xBRhUl8bTYfIRKHx+bMjmqI8wszWHMTvVltyMBh86kEibK3MWVcb7Uvx1aYuOhU3tns6LfgtpLimNBrCWHMlnGGfy55zICEG03CbieOpdsjdjRyJd/wSLXv2G1pxMmSZ4uj6Pq2fGGWk4n6/AUFWS/4tadaK07ItG7S8q7uCLQe7QUl5sUXQFWArTgcZv1nClSTTb+PWEqDlY2CWmIUZMdBf9xlVV5VqMwr0LqxMKhqR1NMSlsijZQbiqqlnrtpBWEV99MWauo58E/6jqxTgFSFC6yUdsW9prkPStS4h7J/q/L0XC3u+t2lDnK2PweKbt22dSXYDZjwvaTeLtwN4KJs1kM5EZjWO+QzmqSoBIohq+9OxNn95qwcjoGUz5NhQ/pkOgxKFkjlpT9LgC1hiVRg9aKNaIZsCUFpPhSLLoniogGxmridujhIx/keeYfuGPASAtyzu1u5njvBY3R6D6CRTURZB28HTH7HrHc3V+Pg3dZakXRapR3gFc7vyqFQgp5V1eMXfuiJ3NFXytIluodT+zUHiQOArv1W6Xd14t7SrtYjMRtg874YmrYNNu3sdPOMCZRg6KQvClGJdZ6gbCceagVXJNTqRm6vvfFL7SDDrYNMjExd0S6KU/UHdv7tqF8QBkY7tDJnAmxmsn7nhjSxx51U7rc2nI40cVU51cE/Rt3zGhFHF757Jdn7ZKeqmpefzWU3+XJvDkklrB1MF3lg8R9dLdQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9129a874-5dc6-447d-8718-08d9f97c61ea X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Feb 2022 23:04:46.5062 (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: nRoKdVK2j3OqnD+dC0ndFQdILcZbqzPpkT/GJb5e5DzSPjkyQoxK15QTLSrBvL5YPJ5i5XDjOOgxIcCtAe+Ujz8nfOCCML/Puv+ZVjV1hGU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR10MB5750 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10270 signatures=684655 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 malwarescore=0 mlxscore=0 phishscore=0 suspectscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202260163 X-Proofpoint-GUID: SijuU-eY7rTVe-WieGm_jEmWuVDNCWac X-Proofpoint-ORIG-GUID: SijuU-eY7rTVe-WieGm_jEmWuVDNCWac Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org When the workqueue code was created it didn't allow variable args so we have been using a temp buffer. Drop that. Signed-off-by: Mike Christie Reviewed-by: Chris Leech Reviewed-by: Lee Duncan --- drivers/scsi/libiscsi.c | 6 ++---- include/scsi/libiscsi.h | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 059dae8909ee..a75b85f0a189 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -2798,11 +2798,9 @@ struct Scsi_Host *iscsi_host_alloc(struct scsi_host_template *sht, ihost = shost_priv(shost); if (xmit_can_sleep) { - snprintf(ihost->workq_name, sizeof(ihost->workq_name), - "iscsi_q_%d", shost->host_no); - ihost->workq = alloc_workqueue("%s", + ihost->workq = alloc_workqueue("iscsi_q_%d", WQ_SYSFS | __WQ_LEGACY | WQ_MEM_RECLAIM | WQ_UNBOUND, - 1, ihost->workq_name); + 1, shost->host_no); if (!ihost->workq) goto free_host; } diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index 4ee233e5a6ff..2d85810d1929 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h @@ -371,7 +371,6 @@ struct iscsi_host { int state; struct workqueue_struct *workq; - char workq_name[20]; }; /*