From patchwork Sat Apr 24 22:05:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 427410 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 365FAC433ED for ; Sat, 24 Apr 2021 22:06:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E5CBF61422 for ; Sat, 24 Apr 2021 22:06:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229778AbhDXWHB (ORCPT ); Sat, 24 Apr 2021 18:07:01 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:53464 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229734AbhDXWHA (ORCPT ); Sat, 24 Apr 2021 18:07:00 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13OM6FBp124433; Sat, 24 Apr 2021 22:06:15 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-2020-01-29; bh=36nlTOlTLMTxpspKVCPpHxZS/J4B44QEijTKxwhPzsU=; b=tJ6uM4BFrsSwFNEsTWAAsnV9ilgB1bwaaAnec4lzKStzpKb78uHF+PHZGrH/6lSGuo2h bKWOTJYS8HjVMtRiYhSiwH/t0FxHJkJz2YcksolV/709vzmvK7aL/nSK3vwMMnkjVYNp PdQ/gxzZJ6HwPzPymTShDbjT76GJJg3D/25V5l4P7rBRJZYPwIVx6h+e2vrt1SJ2jbtP NCoOO8heEn+B0tSZ4AmXFFyF8I4ezBvTnvgcCXZrWCSSibeydW0fD2xwHLxzxlgNVgUq e7kC8BXqCU4xZ1mzwrRkBAM3/RAyIO7YEBGHaJ5u+W0OE7LC0K5RWUfnlLx6VMesReqk 1w== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 384b9n0shg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:06:15 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13OM5Yev053539; Sat, 24 Apr 2021 22:06:15 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2109.outbound.protection.outlook.com [104.47.58.109]) by aserp3020.oracle.com with ESMTP id 384b51tykw-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:06:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L2VSIsZTvVq1vNNlQQK1cXxGTeWOQsMxkh+Ix5Ud4LEcEbyI5k7xoe4BuGeKk08nC0OVDTpzHh324PhpDAPi3Cpyet08h7+W8rDRDTbGgTxyLHlDH4uRLHH6uNsWdvb9SfoGaoiG6Ksv2UwbzaQvOQJEXg2PJCEL6RrrvaQ/bdsKVsxCoOjJ39ZtNYpv2iUKuX9ye7LuOVLTpYP67WRj4/Ig4tmI5j5+i+/2cRCNw2R+KPUiUHbAPXnZiSDvkxqWfB3D+sSEuSzaRx8uX2AzeZx/xBI0kPLqTvXYPhTY2BaPYhzyKm1HmPySxRp0OsX/lN0N1vnnc5baUAyOPKugWw== 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-SenderADCheck; bh=36nlTOlTLMTxpspKVCPpHxZS/J4B44QEijTKxwhPzsU=; b=gM5CT1dUng8eGyFf7VN4yExrwUbKD2jwtioRxG3YW7WGZXQUZX7sVBloXW5yR24HjEaRt7542k/4w7LXo9zDvHFZHpQPqtoVG8vqXpc2yTSwGPdOxiplc1FvbrxKneBK5AOlioSctO75P3JNDWQrtwnNyPuTszCVLm2UHH2FySOeKgxzr09xk47y9WW62Qu09O9TSnKRJcPMb7+Uq+3+ZUduena+wk08EHEtHKyrYuJ4B/rliLNWFOxyWMx0QSl/gU6wGeFN6TDDjfE2JwE058A2X182nAQ6gFQo6PvI0Gks3JPma7zU0nksClWmyPAEikdr86I5D/OxytchbYD8Vw== 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=36nlTOlTLMTxpspKVCPpHxZS/J4B44QEijTKxwhPzsU=; b=ljZXJzGiLIJCqKIbe+cCv85KTuJ/zg51YXzIV0/M+X4Ygn1Gyz+L5iaeU0gs6SVZ8wBMscxl1CJMK4Szt5wJRaCU2bi0cZQ4kDoiDs0sVlpBRSZCGjG8v2ULxV+DPbCjGa4wVAT4ZAbKA6n2S2ahr9Sbk/6TlE3I8CNU3oo4BmY= Authentication-Results: suse.com; dkim=none (message not signed) header.d=none; suse.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BYAPR10MB3317.namprd10.prod.outlook.com (2603:10b6:a03:158::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.24; Sat, 24 Apr 2021 22:06:13 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4%7]) with mapi id 15.20.4065.021; Sat, 24 Apr 2021 22:06:13 +0000 From: Mike Christie To: lduncan@suse.com, martin.petersen@oracle.com, mrangankar@marvell.com, svernekar@marvell.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH v4 01/17] scsi: iscsi: add task completion helper Date: Sat, 24 Apr 2021 17:05:47 -0500 Message-Id: <20210424220603.123703-2-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210424220603.123703-1-michael.christie@oracle.com> References: <20210424220603.123703-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM5PR16CA0044.namprd16.prod.outlook.com (2603:10b6:4:15::30) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by DM5PR16CA0044.namprd16.prod.outlook.com (2603:10b6:4:15::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.20 via Frontend Transport; Sat, 24 Apr 2021 22:06:12 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 896691f6-a908-437c-eb91-08d9076d2cc1 X-MS-TrafficTypeDiagnostic: BYAPR10MB3317: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1468; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yPulxCi/RCZayH6aeYGPUwZTPpsXLbDjFxEChsY2onqGznU2+27b6CdECFxmFpmGHDSJT32BMAdU2I8jGDmHiozJgOlXJgP533aTjkNN9Aj6Xiy3rpx4DEFMI8+DqBF+3zW/Ypx1ZlWdUUQKfP12jqHqgyWRDrZGqAnBnnZ4ph4wzJ4YUsdif1o0+E6aYemMCaZ1OARCe692OWkEyGEnT5bdMPicTR8/Zuowbo5FYe24BQFtu1isos+Bgz1yp59kLieOAH8rmZpLkSn30Q61fyQx0wFdpSIrTKjgov27095Fafb9VCxrKJNa8yF/uMl4XBTovHv4YpP/tCCW9xv4IeQsK1ET/YvERZ/ZfGO95fhfSc0FfWknP9qmRkeSsvJTJik79bQ4PVINkStsz3Zt8RZC8humxHX0xYfWo1pDXGfz1yq0vgmRyJ3pPICPRZkIxzFQSIaEcqEKN7P3HAtkFgp3P+xUanTxRuLuiSi6OVzrEr0ghoFlCgbzCy9gl2G3rIAwdXox3h1TXxi9CDm17pCCYhCekWSiPReDxMLYlkWYSklhbg20HAbhayUKJrYLq3kDTCuFq9t1ZgrnJVPdnqLMtLskwiFXzCi3kl70S3GB+jcT3+AHL8imU3heRmBP3l2uNz4XtahUK65usp60+CGZUdH8gGzQCpahEra9MTH0J+2CqRZqNsaagXsuUM55 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR10MB3573.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(366004)(346002)(396003)(376002)(39860400002)(4326008)(6666004)(1076003)(36756003)(86362001)(52116002)(478600001)(83380400001)(38350700002)(38100700002)(8936002)(5660300002)(26005)(16526019)(316002)(6512007)(8676002)(956004)(4744005)(186003)(2616005)(66476007)(2906002)(66946007)(66556008)(6486002)(107886003)(6506007)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: DQ7wCY9YC3EdTq7DfZPKqz/K4gQCTtv9/m17vcxVtuf23vVz7yEBcjwSvaVvTcntqDO1/KIaMo9Eaim/hWnCaYuzikOJjfFCifB1pcWso1tLMcUxmQnYuWihnxHJatNBlC0mU+lakQb8UjpxHFA33fGMsLJaYd8Q4BVWamv+HsQJ+dDJjEM6qmqSCgMB6e8KF05GfIOIkPBfnwfM4qX9niGJJft7cBqAX3uo/u26HKr/PchjZZXxIyrSKqmGzSeYUwnL3D3W4nWs+A4najaeMpjdgGFOYqB9L0xLPxxHIJCBBRJ4qB2Ir/5qsWzTU9xwoOqq8ugdR92ATaPaJkBpF1vY5siOzFyalhLUtCjMhDLZSAGaNlAGUHjdNcLvyvpivOxHuKTEFNmjKJl6CfDZdi0kEugZmAMlbXyJX6f7fTRfChpLmB7hucivkqAwRo7jd7dxMFFkBR6Yts6kTJKO0AVMroyX0FLOpDiJTtHGOZZEvtqhN3bfmc1MNEMBTM/ObUeBZOduEOpNXBhT/QqKzBHIC1+tv4azduPGPBBJlQhSS0WyMkW9DMEWyexoMAjTpNyzjd/TFgv6qy7PqUpTXKy8ePEV47GVDnR+UW7TZkn6xatpXLKGjz94qGD3UbFNrxeqfVXf/JqYSPwXqGZHylPx7PPMGs3vwETTqpFxUnxtNQrwnvwXbPfDS38hu8qD6MqQq+duzVu8Q9E8JZ0DOaPp+hjXe/WRTjwbyfByazoMywePQw8pG9wk0szfidu/y5MQjmyTwooHMZu3Y3CGMxq8l6+z0u5/PJ83yKWgl90bI4Ta38QYAe7GyjIKhTiHJbnBgeK3rh9BMW+7lxJ7bqfyxlcDLW5aWZv+7M+9NlfYqyZLGg9lld5eyliFWoQ4VLvRfXwvaHl8afN56CDGEKx7E1ybP/ayAwS9tLYMVPFdhYXpGGVDmKNQTE5+VNxuqLlvdWy9U7HX7oextfSxPGoeCetLXBVkTkjvOVkFGrAQ4q74cuSymcqod7GfoiE6im0LjmJLnAlTV6BVWReDebqfS9LenO3TXsfanuu+C9UpkS75JsFh1ebtKp/htWbWXL3TEr1MNnqQbxN7TmzQMFGV6yjb3lSSfu2jC+D3Z3gnOFwTMDBgnDru3qlW9kRZaD8Tm2/comBXP/CLIFrSLr6s7OrXzHF3410W3VT67KwTHV1YVMnXg7W17gBvFEGQccI0tzzrDdi/kDqdwGOq2BWErvWxCBfBEMRvg3rCNout93rCY/KOUysfntqeoXTDy1FSaE/ZOlVLkBHkltLoa5vjH8yXibve+A4wDpAwc+utQm8UCYpYQwGXI6G7W9xt X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 896691f6-a908-437c-eb91-08d9076d2cc1 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2021 22:06:13.5850 (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: GeZEDLYYyptR4wjWu7lyJJ8aPn6Vc/6Oc27yKKUFH/XGjOxYex00P1nJU81dTXrhSKWVmfcPTpl48Q8ksxE4QMXLzjYTxyMQOBOC03TAIfY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3317 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 mlxscore=0 malwarescore=0 phishscore=0 adultscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240168 X-Proofpoint-ORIG-GUID: VR91zMDsZPy3UyQy0yIlUbuyje8H2hN0 X-Proofpoint-GUID: VR91zMDsZPy3UyQy0yIlUbuyje8H2hN0 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 lowpriorityscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 suspectscore=0 spamscore=0 priorityscore=1501 clxscore=1015 impostorscore=0 phishscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240168 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This adds a helper to detect if a cmd has completed but not yet freed. Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- include/scsi/libiscsi.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index 02f966e9358f..8c6d358a8abc 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h @@ -145,6 +145,13 @@ static inline void* iscsi_next_hdr(struct iscsi_task *task) return (void*)task->hdr + task->hdr_len; } +static inline bool iscsi_task_is_completed(struct iscsi_task *task) +{ + return task->state == ISCSI_TASK_COMPLETED || + task->state == ISCSI_TASK_ABRT_TMF || + task->state == ISCSI_TASK_ABRT_SESS_RECOV; +} + /* Connection's states */ enum { ISCSI_CONN_INITIAL_STAGE, From patchwork Sat Apr 24 22:05:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 427050 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 773BFC433B4 for ; Sat, 24 Apr 2021 22:06:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4322C611BF for ; Sat, 24 Apr 2021 22:06:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230099AbhDXWHD (ORCPT ); Sat, 24 Apr 2021 18:07:03 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:48320 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229795AbhDXWHC (ORCPT ); Sat, 24 Apr 2021 18:07:02 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13OM4k9r050810; Sat, 24 Apr 2021 22:06:16 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-2020-01-29; bh=2bVq9vMHj6Lvolc8rkZENDqA/a5Et07MVsyK64uDbXw=; b=sY29mVj1YRg4ggJ+loJR8Rlysy2JUxrgWPvYpTV2hyNDoaq3GfuzkWyesGG+IbFxR3vY 1Txtp/DdkHGk3CAwo4O7fkLpbt3NeOKSbc+Q4OM/7PfG3AfZKq4BaOEl91jrcmxX4e/x p+dYad4zHtGsOnSJvNev1NFm01UexdQZ4CO9tH22fFd/cNPJBImjUkpxAQypQI5DhITv hfkSG0ZtwQYMGuHXJSFCJSQ/DKHRFEQuDbJN3UuLQQsmNsEmuzQaS1HEQAdG2i73JQPS +j9QhpSS4eiTnvz7DOcRh/kmR5hK9517epWfXVOOPJi29rO1Q7Auyx8HxV60oRozDJQn eA== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2130.oracle.com with ESMTP id 3848ubrvdx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:06:16 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13OM5Yew053539; Sat, 24 Apr 2021 22:06:16 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2109.outbound.protection.outlook.com [104.47.58.109]) by aserp3020.oracle.com with ESMTP id 384b51tykw-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:06:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Fa4M6p0epNOsEyUacNxZcHY6p2F91/Yo0PCOViUzFDOvEZOTbtaFslHj9UY7d98XVvlyjRzsdq4h5lVMo/3VmYAGCa/lk22/k9Xvs9q9dChbIpRIKA0XsxhUNpH7FLl1j9uNnQf51Q/TM+kuEu7CBiha8BgRk0NsAP7v9dPI+Mmuf+10Fmj/Un1stwlEIlrAokc4O/iF4DWASJWGHucqEzjqz9OoA5R2xcTDyCGWsTdqdYGOhnmmh5XM2gX38E977uXY6NTnp6XfsvaJxlXQo6bUTwol7JepFDb9+6VBDl9tIEAfjTD95LxJK926WRGpO3lTx2A4Op11wYkr2cPEpw== 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-SenderADCheck; bh=2bVq9vMHj6Lvolc8rkZENDqA/a5Et07MVsyK64uDbXw=; b=OK5Z+liz+1ejMdcMTe0S/Di4nAPXyfwcAlUAk2B+cvpNP1VteiUzvxE8dsoZuDB1yHi5mm05gQF8/nrt3lQSvN9sW5sKynfduJI4Rj5bPPPSswjaIfn0qvd6yfzethHZ+aUEOpH5exaZCwllBY6zkTunnr5ENL+GvpZWjA3BdqskLZIkyCbr7e3XZl+k65b69atZbaCypkT2aOzrHIoMJoQKWxdoyS4AQKdAI/QioyZUYI5GEIlivWda6BioZvufkNk9CJr97IfTfejhuRfUkkGs5JOZqACHd9ciKxJdd1CueUGvdhja04b5eGjCJdG9jc8CHrHR77CA+fxiCS4z5g== 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=2bVq9vMHj6Lvolc8rkZENDqA/a5Et07MVsyK64uDbXw=; b=N0Wr0EZ87mgnXd4HFAOP3J+3pOxcHX+B623QGCzpjTxzrHeldgyjZk1q3a4Npl8GEaq80fTj7rs6e7xsEXdMzOq05rtz7HZhFol/SGMo6UDxoUlMOWkpzbXtN4otVyhR2Iga1KEikAGMNqnMZGXIdWNArHghA9CUQ8/ST/w0Ftk= Authentication-Results: suse.com; dkim=none (message not signed) header.d=none; suse.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BYAPR10MB3317.namprd10.prod.outlook.com (2603:10b6:a03:158::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.24; Sat, 24 Apr 2021 22:06:14 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4%7]) with mapi id 15.20.4065.021; Sat, 24 Apr 2021 22:06:14 +0000 From: Mike Christie To: lduncan@suse.com, martin.petersen@oracle.com, mrangankar@marvell.com, svernekar@marvell.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH v4 02/17] scsi: iscsi: sync libiscsi and driver reset cleanup Date: Sat, 24 Apr 2021 17:05:48 -0500 Message-Id: <20210424220603.123703-3-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210424220603.123703-1-michael.christie@oracle.com> References: <20210424220603.123703-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM5PR16CA0044.namprd16.prod.outlook.com (2603:10b6:4:15::30) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by DM5PR16CA0044.namprd16.prod.outlook.com (2603:10b6:4:15::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.20 via Frontend Transport; Sat, 24 Apr 2021 22:06:13 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 379461d2-e6ad-4256-0284-08d9076d2d6f X-MS-TrafficTypeDiagnostic: BYAPR10MB3317: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7Py4a99BEYEUetO9Lq2iI2/In9vqpzhR62b4Dh0XcNGCW9CGd1Ygj18JJN3CvYU6pQZktHpRrZCpEbmmQ7A8lK9raDVbqal7x76YU/WuQOC8edCYqaClzGbZQK6UO29h7LgE9ahnNXeGO+cojve6uaWfCV87SMZzyqNQuLInaP4S54go4Vsss7yVsenMFxUVrtBRFCXGojmy2SHY9uR0BPFfc13nX3Pqc9Np4FEuuxn9BZCHu6JMgtDmOwh2Qu9pSUJO/ue31CJbbomyQ3zCm04lFu8THySNE3h+uAJUp8fJnw+ivA0DeQRC7ST4bgz1bjNuk2Hj4R5iF4m9PPABMh3KKDvnfU7JyMXlU+NYPvunwhlSJ1V9s6au4eA/yuMnBZqflnL0Pmpv+ftNImBmtL8NHGKwg212S1ySFkS9vrUYT2hO3fgX7bgpiNIOjO8codiZ77pk2CojhHTqVK6ndsB5FCxwmwCllDJZlzfk+q32JJ5xnUmkkwMk7KZfl4DLok/XB/8E+S/ZvkJsQHUwAESrr7bj2hZ686NF/Qc4snNYW/6SFbI+yh9+tSqHOuxBolXH3iktltAdO0jciys3DBZ5Aj3lSn6tZIlJbWcwQXkgu/4W+juNVwcNm9kwzKxmPbXvHl6L9KhK+P8fiJdDEgp5c8pgNc5cCWGtiZneG3UjwYh8EQNyyYh6fip+HG/x X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR10MB3573.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(366004)(346002)(396003)(376002)(39860400002)(4326008)(6666004)(1076003)(36756003)(86362001)(52116002)(478600001)(83380400001)(38350700002)(38100700002)(8936002)(5660300002)(26005)(16526019)(316002)(6512007)(8676002)(956004)(186003)(2616005)(66476007)(2906002)(66946007)(66556008)(6486002)(107886003)(6506007)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Y/0bMuu0iw6o10jdz8AKrZFdFXMSNmEMiVYWQyh5JEBwliHYClIhIZcQxDIpaGfl9RXsxYv5ZtOl2BOaSvJxMvn4DUP6HpWs4Y7uLWCaVtz4rciLG0ZQ/fh6xA0YBbJMxv2lKiyAYd2BmULpR3ikk8I2iqPW1jOMLf2uzUsOLwk+1DGjVwGb6ppn/PvgvYT4YwnKZkfxCb8jRKmpcmySApComFW+fmFj75wYfXJs8tTGfDLA9U2b7Yj9QgmoYoYfPXgIyuvk7Xq6urSxwITjSCq4CiLhPdooRBNvJTNBvwLF3ocR2L1UzEoYrZMVDBFIXXyv9HNiR9GkBPkFlqxPHtVKpLmNwhqZ3vCdVuDSeqzvZlt9P/kprm++kHs0v/l0bGWQUKUAm7T0H3KmvAAjVfcuePKyqmhN09PC//AbXaMkKVPVrt6WCPv0/YnBtMbGtgeCnarT+JSig87SH1Z1AiqdIzuLT/4aR9jc1tzfA2Zz54QAdosrpVIQk0W3hrqHuE8ZvQfOwXS369zrUy9/EEhwWmhMkyHEdx88UV/XISZBvMJJQxqw9mIhBea8o3NQFb9VIX9IsXPAAfwLX3nxQ96UUahsATQffki6DpemCp0fl/PGCNGvZ8L12cZlfX2+RIYT3tLWmVXH2lxNyYKcKOnPdGHUt7V0A5u0b3ytK2BxQ8d4zFGqoWHrZTbHZIufztmW/TQiKHP0TN3PsvULvVHTv34oKdpNA4r/PmSdGHRBgSfjtZWS0Y9z2YrGl50O3sWclUACinV78RNZAwnOXM4VsDh9CRUoKtAooH7NToZe3dFQmIpGu4jU7wrc35eQzeZbPdnnSwj0CcxfTqkbkSQvcUEMBlKst3mYpb8EX2RlrxjLS/BW1jpfrAqcbrzag2bELPP5wZFGgXmNHFaFI/l8KmkxLzOB+ROk5m6JyOJgj8L9xuAKAZ2tjjmHeVMwckaiCzsHykCeEGggmUDWh87+zlxgK807X612a7Gt7bWemnRZYXZd/QQF7m3GdUHDPWHGP1yt0rZSGt0z1+LMS+lhc3PoRmom5F2mc10aBCofJDYxt0+r2CplcXtNKEXPGqJCWsQv0OiViSd05iXpYv+n/Nee8utrRvBeFWyga7EXti9qEvrWWgiC/Dfk3Ou829gsb0JI4RTaCOfefpQPLFcpiY0U0kIWJQg1bjdVrJun5KD9ehgyOqCtZmIQ0Qo3vniRwmDSTFHYgRs0/mlc5WDK54Zk4IDpseYXB4A/Kjx6B7qkdc2hyZAnoAVSuozjMrLf05BvqQfaUHx4rFOlM5pPGNFJxkWmqd3OiEK080EBRU7QEuOZxpN9hz5JsT3u X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 379461d2-e6ad-4256-0284-08d9076d2d6f X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2021 22:06:14.7353 (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: d2C1efacX3j/1vVu7Cze2qs/JFF9wCTTZEvsru2TbFvqN1nIGKFr7PMTPUiPxk3NyJlzapbd67oCaUlTQDcLdC4eAqdpuB81KIs2pENqcNA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3317 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 mlxscore=0 malwarescore=0 phishscore=0 adultscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240168 X-Proofpoint-GUID: 6ltk5oHEwjBLFzboZ6Bb2pev7t4jOMbL X-Proofpoint-ORIG-GUID: 6ltk5oHEwjBLFzboZ6Bb2pev7t4jOMbL X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 priorityscore=1501 lowpriorityscore=0 suspectscore=0 mlxlogscore=999 phishscore=0 spamscore=0 adultscore=0 clxscore=1015 impostorscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240168 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If we are handling a sg io reset there is a small window where cmds can sneak into iscsi_queuecommand even though libiscsi has sent a TMF to the driver. This doesn't seem to be a problem for normal drivers because they know exactly what was sent to the FW. For libiscsi this is a problem because it knows what it has sent to the driver but not what the driver sent to the FW. When we go to cleanup the running tasks, libiscsi might cleanup the sneaky cmd but the driver/FW may not have seen the sneaky cmd and it's left running in FW. This has libiscsi just stop queueing cmds when it sends the TMF down to the driver. Both then know they see the same set of cmds. Signed-off-by: Mike Christie Reviewed-by: Lee Duncan --- drivers/scsi/libiscsi.c | 106 ++++++++++++++++++++++++++++------------ 1 file changed, 74 insertions(+), 32 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 4834219497ee..80305b70298d 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -1669,29 +1669,11 @@ enum { FAILURE_SESSION_NOT_READY, }; -int iscsi_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc) +static bool iscsi_eh_running(struct iscsi_conn *conn, struct scsi_cmnd *sc, + int *reason) { - struct iscsi_cls_session *cls_session; - struct iscsi_host *ihost; - int reason = 0; - struct iscsi_session *session; - struct iscsi_conn *conn; - struct iscsi_task *task = NULL; - - sc->result = 0; - sc->SCp.ptr = NULL; - - ihost = shost_priv(host); - - cls_session = starget_to_session(scsi_target(sc->device)); - session = cls_session->dd_data; - spin_lock_bh(&session->frwd_lock); - - reason = iscsi_session_chkready(cls_session); - if (reason) { - sc->result = reason; - goto fault; - } + struct iscsi_session *session = conn->session; + struct iscsi_tm *tmf; if (session->state != ISCSI_STATE_LOGGED_IN) { /* @@ -1707,31 +1689,94 @@ int iscsi_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc) * state is bad, allowing completion to happen */ if (unlikely(system_state != SYSTEM_RUNNING)) { - reason = FAILURE_SESSION_FAILED; + *reason = FAILURE_SESSION_FAILED; sc->result = DID_NO_CONNECT << 16; break; } fallthrough; case ISCSI_STATE_IN_RECOVERY: - reason = FAILURE_SESSION_IN_RECOVERY; + *reason = FAILURE_SESSION_IN_RECOVERY; sc->result = DID_IMM_RETRY << 16; break; case ISCSI_STATE_LOGGING_OUT: - reason = FAILURE_SESSION_LOGGING_OUT; + *reason = FAILURE_SESSION_LOGGING_OUT; sc->result = DID_IMM_RETRY << 16; break; case ISCSI_STATE_RECOVERY_FAILED: - reason = FAILURE_SESSION_RECOVERY_TIMEOUT; + *reason = FAILURE_SESSION_RECOVERY_TIMEOUT; sc->result = DID_TRANSPORT_FAILFAST << 16; break; case ISCSI_STATE_TERMINATE: - reason = FAILURE_SESSION_TERMINATE; + *reason = FAILURE_SESSION_TERMINATE; sc->result = DID_NO_CONNECT << 16; break; default: - reason = FAILURE_SESSION_FREED; + *reason = FAILURE_SESSION_FREED; sc->result = DID_NO_CONNECT << 16; } + goto eh_running; + } + + if (test_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx)) { + *reason = FAILURE_SESSION_IN_RECOVERY; + sc->result = DID_REQUEUE << 16; + goto eh_running; + } + + /* + * For sg resets make sure libiscsi, the drivers and their fw see the + * same cmds. Once we get a TMF that can affect multiple cmds stop + * queueing. + */ + if (conn->tmf_state != TMF_INITIAL) { + tmf = &conn->tmhdr; + + switch (ISCSI_TM_FUNC_VALUE(tmf)) { + case ISCSI_TM_FUNC_LOGICAL_UNIT_RESET: + if (sc->device->lun != scsilun_to_int(&tmf->lun)) + break; + + ISCSI_DBG_EH(conn->session, + "Requeue cmd sent during LU RESET processing.\n"); + sc->result = DID_REQUEUE << 16; + goto eh_running; + case ISCSI_TM_FUNC_TARGET_WARM_RESET: + ISCSI_DBG_EH(conn->session, + "Requeue cmd sent during TARGET RESET processing.\n"); + sc->result = DID_REQUEUE << 16; + goto eh_running; + default: + break; + } + } + + return false; + +eh_running: + return true; +} + +int iscsi_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc) +{ + struct iscsi_cls_session *cls_session; + struct iscsi_host *ihost; + int reason = 0; + struct iscsi_session *session; + struct iscsi_conn *conn; + struct iscsi_task *task = NULL; + + sc->result = 0; + sc->SCp.ptr = NULL; + + ihost = shost_priv(host); + + cls_session = starget_to_session(scsi_target(sc->device)); + session = cls_session->dd_data; + spin_lock_bh(&session->frwd_lock); + + reason = iscsi_session_chkready(cls_session); + if (reason) { + sc->result = reason; goto fault; } @@ -1742,11 +1787,8 @@ int iscsi_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc) goto fault; } - if (test_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx)) { - reason = FAILURE_SESSION_IN_RECOVERY; - sc->result = DID_REQUEUE << 16; + if (iscsi_eh_running(conn, sc, &reason)) goto fault; - } if (iscsi_check_cmdsn_window_closed(conn)) { reason = FAILURE_WINDOW_CLOSED; From patchwork Sat Apr 24 22:05:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 427049 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A982C433B4 for ; Sat, 24 Apr 2021 22:06:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D4298611BF for ; Sat, 24 Apr 2021 22:06:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231447AbhDXWHF (ORCPT ); Sat, 24 Apr 2021 18:07:05 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:53490 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230417AbhDXWHD (ORCPT ); Sat, 24 Apr 2021 18:07:03 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13OM6J90124436; Sat, 24 Apr 2021 22:06:19 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-2020-01-29; bh=IYPZjOJFOM65SKaWIGXna60ujW74rVUhyFbX0xopRWg=; b=ZfHcUmB9F5eTkH5DongPyXvg9M7yc/Xuf1FwUMysGpA2FKPy28vpiF0sDuvRBRvwpBOl zbEcU4GZaxkTavmlJO+XZrCvRFZhZ/9WZBA7FHBKhJAYRsxfEcH6QYGNBR7EVY/grk7y aXrSpt5Z3jcjXRIV8M3QfsoPUn9Tsdxc17EKq0536G2t8QDohDKu6xrMncERhhHYvVNE /RnU/d4rikKq+nwbgApWi/Em4EZfEex0fEwIbo4vk7oxXyFuncocxVWLQt65VPlneKRe benHV3jaX+lgkNacJKi156nJEobQEwyZbB8iOFA4J3YNTdQ3wpZ2bSEMyA7DqGP3TGWK Qw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 384b9n0shh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:06:18 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13OM6Cae045579; Sat, 24 Apr 2021 22:06:18 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2103.outbound.protection.outlook.com [104.47.58.103]) by userp3020.oracle.com with ESMTP id 384anj7ut9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:06:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SCqFQ8j/dmi65Qc5paspr2SChmU7f+7m68BufE0MfPQGZd49tXaDyAH61aavNPU7OIeMrzjtPNsClkO94pDvIpt0QMD5LLUCDLvDCFlp4MEywQ1xvwqI6fDDEQz3oo9HxgXWF9KJdwqEvwmCo+SjRyjVQar032AL4aT2X/71Y9Wxb8DMlJCYD4Qhxeelszvk0oejxANueAaQdWDFzO4HVnF3kM6MQTE0/fXnvtY1XuOlaHd07E2YSVU1CLVCooj0tHXibREwkRYG/76lIXAmXufp/SPG9JDn9GK8esztkHjH2xsRlasWjWggxlgvVJ4YUwsK2Q/cQkOMfBx+C9WPXQ== 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-SenderADCheck; bh=IYPZjOJFOM65SKaWIGXna60ujW74rVUhyFbX0xopRWg=; b=bx321mqQTSa/Y1Wt0rabOo45Zpfn2353QC/LRJcMsofWBiBNMgHjLhLsJoX66HOsua3qVlyYbbAzIksEVhFpenVfPaiz0MLZQFmKe2PjAWAJ3VCpAEM13KYZ/Opyn+mlnJr1RtVz47EUg9aM9hZ3GPTmV4nO6LgEq3endq8ROuHILnVFESi3lGipZoI5hiZkGDKnwNWUIknnE+iEgskkNgg9IvpQ/Lorsayib4hHKbMyY568HCugMf1FGlPnQY+mw46T1zHfk8WtSQGYznODHa7390W9fE6X7mpf04xEcWosvvw0xZFUbu9l0ky21TtriMpHZ1cRwsHyQpQdxmW9sQ== 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=IYPZjOJFOM65SKaWIGXna60ujW74rVUhyFbX0xopRWg=; b=iqVTFbkSyWojRG6Kv19dmx+SXo5V2qRxqqcuMOQ6dJSqCBIXYIYmPGeynHrsZFoWUAYM4lUh+jsYKU5uchI7rZCWgyO1A9mFoukcNY31Ctul7zPz784TEe+D/SURL/T25O4CIXKmBcm9MQvfWyg9Cz8AIOWMeqmGtLyDdODEqls= Authentication-Results: suse.com; dkim=none (message not signed) header.d=none; suse.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BYAPR10MB3317.namprd10.prod.outlook.com (2603:10b6:a03:158::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.24; Sat, 24 Apr 2021 22:06:16 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4%7]) with mapi id 15.20.4065.021; Sat, 24 Apr 2021 22:06:15 +0000 From: Mike Christie To: lduncan@suse.com, martin.petersen@oracle.com, mrangankar@marvell.com, svernekar@marvell.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH v4 03/17] scsi: iscsi: stop queueing during ep_disconnect Date: Sat, 24 Apr 2021 17:05:49 -0500 Message-Id: <20210424220603.123703-4-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210424220603.123703-1-michael.christie@oracle.com> References: <20210424220603.123703-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM5PR16CA0044.namprd16.prod.outlook.com (2603:10b6:4:15::30) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by DM5PR16CA0044.namprd16.prod.outlook.com (2603:10b6:4:15::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.20 via Frontend Transport; Sat, 24 Apr 2021 22:06:14 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 53a00176-1e92-49ab-9826-08d9076d2e0f X-MS-TrafficTypeDiagnostic: BYAPR10MB3317: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gNrpVJGlXX2R82s5jCNunIB/B7STmSlhJF4EIbe+IrcDQHkjz9NhUXJlxpN4gNeObAWDBDbLfoapoM501BGHns+vdWEv8YwzLefDWcS/TBw3FG1A+u1vsshGw/GKe99xddP13uPzvP+Yg32AHvpXuFxjunVUrSap7FI1hbm5mZ21WIlZ1B/AmEU2EL8HbxzaH9JNPkisIQpW06g0OupzOFUWGlzTtVQTeJphnwvpDN8asYkU7FkSVozxo2NcaZrARTl/s6uuiAuqt/02RnDqT/vihXeQqIMEUvgXOjCWExPDJBC7uOMpktbRmOoNUgRMrfW8LWgpF3lOhfFi7GX/gfiALQ8Iln3qgQ8i2s2f2H9yWb+h3HwK8ycvtt225Ga/TOTKtlqe8A+bqlxbOdoj6+Tm2pZ0UJeyjIzkXFiigsGqrkheprVzvkWlmeZJ3cAiGyO5O/OXbE13bomE2Hi6CLGRX7s1gQeYbQNsY89bwUUEyJ8L9MTwnfEwiRwme0D0aECkwq+J2FInLLkgGASPm4O90Pqu5i+z/4QajyvDNqA0BwdMDktjwArIxQgANmxoLS39ko/NyR+0kgDXXceepbQ0oGN2F6qnjx/Fsn/vxccIRgfhqNItAtO1wzXJyxhPYdRxz+9FrPwRANFrgt1NPXm2CMZ+WZISuXtfW/wgEimsyPnb8QWTm92AXsEEDcWb X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR10MB3573.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(366004)(346002)(396003)(376002)(39860400002)(4326008)(6666004)(1076003)(36756003)(86362001)(52116002)(478600001)(83380400001)(38350700002)(38100700002)(8936002)(5660300002)(26005)(30864003)(16526019)(316002)(6512007)(8676002)(956004)(186003)(2616005)(66476007)(2906002)(66946007)(66556008)(6486002)(107886003)(6506007)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 5i/+lLRTXXQL6k4iLYG/LYNE0a+5u9TmWnHo16e0bF8P0e+02VlPZAzXPFcTTI2pPq5g80nV4a0JFvROYnOkIJr/Xpr65VFkU1i08NHT1DpgjzZz7+k4j0Yde11gXWXVnQaJjXcDDM4Q3fhrYxG0K3ykA0D///cOtShSjSGKl/srVjfO3NU3Dj3dRvTXJgTTgV2A+fAI+oLMsQNuc7ojpRSkD6GfRXHdI+EcklA34252cJ2/mxlUWd6a385LHdovZjVwciW1rYyCk+1RDXvf4tAi4ydAtXx4O6KMJy2hNTlWCcgL82bPyBWeLXCAafcHmlHAtQHVKnlCIB8ZBtiy7ivla32iRsp9CeCKMsDyrsuBD5sUwYaA28ZIeluNhD2cVysZNvCFLV/r9NjAFUaytOlvl1gUEWxHWX+YNn7bTriZbf3WmzqgdygmMtXh/HGYNrmzgVHXbK3dAPOPfSUikkqOq+Vf1K9xIPF/+ZHq16LppA1QjqT/OCGtdoZDQL6+b9ipfiCLlmeS6+cEwgDBEyiZ8BtAuBApWYX1agKPeztY2g0wtbUeNsHBG4MFH70wGN4iCIxEFfiYIzzTyX0aYpk30lhhpLpPTiUlBSR76veoUuMZIU33Seizcs2yUJcocjzCzST8R3Hp6QpIpJkqNlS2cKAYocCl3qBkXpf0a0ouNOM0YsK154/Oqmej5sC9Gvw7MRnmBNNQ7evdhw91u2WVc1Dudcu0B6/F6kV655EygV+jzRmuiokTIRKHVNM/hedNoWe1zSCi3dJpQQre18COub9Iqq/FYWj+QfKx1s5UQUTt2nlhONJiL0AILN2jPipjR3jDeQM6lAVOQJsnZ8rs2BMz++J3kizRlXgRWSo5y2Tr+c3/6ivws8DfdZc0ngGSgqPQK0puhZKx1ks2m9A1S3H2dKTtcSVsftlPyl4zcfAFO60G00F7kzK1OSsenT8evFsoPxwwRvZXraPJAJo8MbqjSL0lQFfP34Cqwmjq9EJ9JOkX46EYz83pFvNXuQHgU+4okQAJctTNH4lv7Xyh/P/P+vuNIBbNcrtqw4EUoO0AaZDDdKRfzPWbGjtFqR1OWyNOJg92tTI1bYqvNQciDNh63g5lAio8PFMCUZ18uGu1QMk6QPLQQahYoQD41gwdaFpV0KsIWw5Drg+1yOJhVKoG/iMzXhce+0P22ts1/G7Z9kV6kxTf1LM5jUl4ag6niI39DkBsDo4sREMQUysQiDlCIaJ+m9L/n4W3Zn6wOXskJwc2yNdDMPV8z6Carf6CCcEl65TIct0AG1B5KyXJv5rVPHm3OzxMw9/+S+Tf0ndlTn7RwL1noOYO4W2x X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 53a00176-1e92-49ab-9826-08d9076d2e0f X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2021 22:06:15.8587 (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: +8YlYytj2Nk9U+9fxBA/gGz0/alSWYISLnvrhRorrKHV32skvgy2oRQVf9CdYAYdKYpHrc1p6cGZuczhU+O+kOmqvAHfcPS/2oz/csk8kxY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3317 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 suspectscore=0 phishscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240168 X-Proofpoint-ORIG-GUID: Ve2iehIzg0IqgWyLUwnCd_fpwHWsp1y2 X-Proofpoint-GUID: Ve2iehIzg0IqgWyLUwnCd_fpwHWsp1y2 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 lowpriorityscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 suspectscore=0 spamscore=0 priorityscore=1501 clxscore=1015 impostorscore=0 phishscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240168 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org During ep_disconnect we have been doing iscsi_suspend_tx/queue to block new IO but every driver except cxgbi and iscsi_tcp can still get IO from __iscsi_conn_send_pdu if we haven't called iscsi_conn_failure before ep_disconnect. This could happen if we were terminating the session, and the logout timedout before it was even sent to libiscsi. This patch fixes the issue by adding a helper which reverses the bind_conn call that allows new IO to be queued. Drivers implementing ep_disconnect can use this to make sure new IO is not queued to them when handling the disconnect. Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/infiniband/ulp/iser/iscsi_iser.c | 1 + drivers/scsi/be2iscsi/be_main.c | 1 + drivers/scsi/bnx2i/bnx2i_iscsi.c | 1 + drivers/scsi/cxgbi/cxgb3i/cxgb3i.c | 1 + drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 1 + drivers/scsi/libiscsi.c | 63 +++++++++++++++++++++--- drivers/scsi/qedi/qedi_iscsi.c | 1 + drivers/scsi/qla4xxx/ql4_os.c | 1 + drivers/scsi/scsi_transport_iscsi.c | 10 ++-- include/scsi/libiscsi.h | 1 + include/scsi/scsi_transport_iscsi.h | 1 + 11 files changed, 73 insertions(+), 9 deletions(-) diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c index 8fcaa1136f2c..6baebcb6d14d 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.c +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c @@ -1002,6 +1002,7 @@ static struct iscsi_transport iscsi_iser_transport = { /* connection management */ .create_conn = iscsi_iser_conn_create, .bind_conn = iscsi_iser_conn_bind, + .unbind_conn = iscsi_conn_unbind, .destroy_conn = iscsi_conn_teardown, .attr_is_visible = iser_attr_is_visible, .set_param = iscsi_iser_set_param, diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c index 90fcddb76f46..e9658a67d9da 100644 --- a/drivers/scsi/be2iscsi/be_main.c +++ b/drivers/scsi/be2iscsi/be_main.c @@ -5809,6 +5809,7 @@ struct iscsi_transport beiscsi_iscsi_transport = { .destroy_session = beiscsi_session_destroy, .create_conn = beiscsi_conn_create, .bind_conn = beiscsi_conn_bind, + .unbind_conn = iscsi_conn_unbind, .destroy_conn = iscsi_conn_teardown, .attr_is_visible = beiscsi_attr_is_visible, .set_iface_param = beiscsi_iface_set_param, diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c index 1e6d8f62ea3c..b6c1da46d582 100644 --- a/drivers/scsi/bnx2i/bnx2i_iscsi.c +++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c @@ -2276,6 +2276,7 @@ struct iscsi_transport bnx2i_iscsi_transport = { .destroy_session = bnx2i_session_destroy, .create_conn = bnx2i_conn_create, .bind_conn = bnx2i_conn_bind, + .unbind_conn = iscsi_conn_unbind, .destroy_conn = bnx2i_conn_destroy, .attr_is_visible = bnx2i_attr_is_visible, .set_param = iscsi_set_param, diff --git a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c index 37d99357120f..edcd3fab6973 100644 --- a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c +++ b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c @@ -117,6 +117,7 @@ static struct iscsi_transport cxgb3i_iscsi_transport = { /* connection management */ .create_conn = cxgbi_create_conn, .bind_conn = cxgbi_bind_conn, + .unbind_conn = iscsi_conn_unbind, .destroy_conn = iscsi_tcp_conn_teardown, .start_conn = iscsi_conn_start, .stop_conn = iscsi_conn_stop, diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c index 2c3491528d42..efb3e2b3398e 100644 --- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c +++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c @@ -134,6 +134,7 @@ static struct iscsi_transport cxgb4i_iscsi_transport = { /* connection management */ .create_conn = cxgbi_create_conn, .bind_conn = cxgbi_bind_conn, + .unbind_conn = iscsi_conn_unbind, .destroy_conn = iscsi_tcp_conn_teardown, .start_conn = iscsi_conn_start, .stop_conn = iscsi_conn_stop, diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 80305b70298d..0f2b5f8718ca 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -1387,22 +1387,28 @@ void iscsi_session_failure(struct iscsi_session *session, } EXPORT_SYMBOL_GPL(iscsi_session_failure); -void iscsi_conn_failure(struct iscsi_conn *conn, enum iscsi_err err) +static void iscsi_set_conn_failed(struct iscsi_conn *conn) { struct iscsi_session *session = conn->session; - spin_lock_bh(&session->frwd_lock); - if (session->state == ISCSI_STATE_FAILED) { - spin_unlock_bh(&session->frwd_lock); + if (session->state == ISCSI_STATE_FAILED) return; - } if (conn->stop_stage == 0) session->state = ISCSI_STATE_FAILED; - spin_unlock_bh(&session->frwd_lock); set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx); set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx); +} + +void iscsi_conn_failure(struct iscsi_conn *conn, enum iscsi_err err) +{ + struct iscsi_session *session = conn->session; + + spin_lock_bh(&session->frwd_lock); + iscsi_set_conn_failed(conn); + spin_unlock_bh(&session->frwd_lock); + iscsi_conn_error_event(conn->cls_conn, err); } EXPORT_SYMBOL_GPL(iscsi_conn_failure); @@ -2222,6 +2228,51 @@ static void iscsi_check_transport_timeouts(struct timer_list *t) spin_unlock(&session->frwd_lock); } +/** + * iscsi_conn_unbind - prevent queueing to conn. + * @cls_conn: iscsi conn ep is bound to. + * @is_active: is the conn in use for boot or is this for EH/termination + * + * This must be called by drivers implementing the ep_disconnect callout. + * It disables queueing to the connection from libiscsi in preparation for + * an ep_disconnect call. + */ +void iscsi_conn_unbind(struct iscsi_cls_conn *cls_conn, bool is_active) +{ + struct iscsi_session *session; + struct iscsi_conn *conn; + + if (!cls_conn) + return; + + conn = cls_conn->dd_data; + session = conn->session; + /* + * Wait for iscsi_eh calls to exit. We don't wait for the tmf to + * complete or timeout. The caller just wants to know what's running + * is everything that needs to be cleaned up, and no cmds will be + * queued. + */ + mutex_lock(&session->eh_mutex); + + iscsi_suspend_queue(conn); + iscsi_suspend_tx(conn); + + spin_lock_bh(&session->frwd_lock); + if (!is_active) { + /* + * if logout timed out before userspace could even send a PDU + * the state might still be in ISCSI_STATE_LOGGED_IN and + * allowing new cmds and TMFs. + */ + if (session->state == ISCSI_STATE_LOGGED_IN) + iscsi_set_conn_failed(conn); + } + spin_unlock_bh(&session->frwd_lock); + mutex_unlock(&session->eh_mutex); +} +EXPORT_SYMBOL_GPL(iscsi_conn_unbind); + static void iscsi_prep_abort_task_pdu(struct iscsi_task *task, struct iscsi_tm *hdr) { diff --git a/drivers/scsi/qedi/qedi_iscsi.c b/drivers/scsi/qedi/qedi_iscsi.c index 08c05403cd72..ef16537c523c 100644 --- a/drivers/scsi/qedi/qedi_iscsi.c +++ b/drivers/scsi/qedi/qedi_iscsi.c @@ -1401,6 +1401,7 @@ struct iscsi_transport qedi_iscsi_transport = { .destroy_session = qedi_session_destroy, .create_conn = qedi_conn_create, .bind_conn = qedi_conn_bind, + .unbind_conn = iscsi_conn_unbind, .start_conn = qedi_conn_start, .stop_conn = iscsi_conn_stop, .destroy_conn = qedi_conn_destroy, diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index 7bd9a4a04ad5..ff663cb330c2 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c @@ -259,6 +259,7 @@ static struct iscsi_transport qla4xxx_iscsi_transport = { .start_conn = qla4xxx_conn_start, .create_conn = qla4xxx_conn_create, .bind_conn = qla4xxx_conn_bind, + .unbind_conn = iscsi_conn_unbind, .stop_conn = iscsi_conn_stop, .destroy_conn = qla4xxx_conn_destroy, .set_param = iscsi_set_param, diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 441f0152193f..82491343e94a 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -2964,7 +2964,7 @@ static int iscsi_if_ep_connect(struct iscsi_transport *transport, } static int iscsi_if_ep_disconnect(struct iscsi_transport *transport, - u64 ep_handle) + u64 ep_handle, bool is_active) { struct iscsi_cls_conn *conn; struct iscsi_endpoint *ep; @@ -2981,6 +2981,8 @@ static int iscsi_if_ep_disconnect(struct iscsi_transport *transport, conn->ep = NULL; mutex_unlock(&conn->ep_mutex); conn->state = ISCSI_CONN_FAILED; + + transport->unbind_conn(conn, is_active); } transport->ep_disconnect(ep); @@ -3012,7 +3014,8 @@ iscsi_if_transport_ep(struct iscsi_transport *transport, break; case ISCSI_UEVENT_TRANSPORT_EP_DISCONNECT: rc = iscsi_if_ep_disconnect(transport, - ev->u.ep_disconnect.ep_handle); + ev->u.ep_disconnect.ep_handle, + false); break; } return rc; @@ -3737,7 +3740,7 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group) conn = iscsi_conn_lookup(ev->u.b_conn.sid, ev->u.b_conn.cid); if (conn && conn->ep) - iscsi_if_ep_disconnect(transport, conn->ep->id); + iscsi_if_ep_disconnect(transport, conn->ep->id, true); if (!session || !conn) { err = -EINVAL; @@ -4656,6 +4659,7 @@ iscsi_register_transport(struct iscsi_transport *tt) int err; BUG_ON(!tt); + WARN_ON(tt->ep_disconnect && !tt->unbind_conn); priv = iscsi_if_transport_lookup(tt); if (priv) diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index 8c6d358a8abc..13d413a0b8b6 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h @@ -431,6 +431,7 @@ extern int iscsi_conn_start(struct iscsi_cls_conn *); extern void iscsi_conn_stop(struct iscsi_cls_conn *, int); extern int iscsi_conn_bind(struct iscsi_cls_session *, struct iscsi_cls_conn *, int); +extern void iscsi_conn_unbind(struct iscsi_cls_conn *cls_conn, bool is_active); extern void iscsi_conn_failure(struct iscsi_conn *conn, enum iscsi_err err); extern void iscsi_session_failure(struct iscsi_session *session, enum iscsi_err err); diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h index fc5a39839b4b..8874016b3c9a 100644 --- a/include/scsi/scsi_transport_iscsi.h +++ b/include/scsi/scsi_transport_iscsi.h @@ -82,6 +82,7 @@ struct iscsi_transport { void (*destroy_session) (struct iscsi_cls_session *session); struct iscsi_cls_conn *(*create_conn) (struct iscsi_cls_session *sess, uint32_t cid); + void (*unbind_conn) (struct iscsi_cls_conn *conn, bool is_active); int (*bind_conn) (struct iscsi_cls_session *session, struct iscsi_cls_conn *cls_conn, uint64_t transport_eph, int is_leading); From patchwork Sat Apr 24 22:05:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 427408 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52F1DC43460 for ; Sat, 24 Apr 2021 22:06:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 235CD6144A for ; Sat, 24 Apr 2021 22:06:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231458AbhDXWHG (ORCPT ); Sat, 24 Apr 2021 18:07:06 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:33812 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229734AbhDXWHF (ORCPT ); Sat, 24 Apr 2021 18:07:05 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13OM6JL4005145; Sat, 24 Apr 2021 22:06:19 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-2020-01-29; bh=0WpFiECF1DChCBeoJKNdQaZAr6+kpgCVP9s2jRzxvFQ=; b=eD37Tn0i03qsAt5Togbv2ygZjt5Yi+9k1qvTKATT0SttYOdVX9sXVhPXAmtWRBTSgT1w c7l+gBvqZFkZBSUoG+zTyxE4OFLRdhrjUd5QtuNxGAn6DhaD7Iz/a9uciwVPm1asKJfG U7POFKT9LU7ugUSheAA8X/DeZc4svFk8XItu6XJPu8HXnbZMDvy6qosHM0/XvquTMDL9 sBA2EldGje+mcXLbOS+MFF4UoeZTr/ZQ9O5qEtnzwXVx3ve/GPJQ9eMAuMfEWmSU1kKj qUMJMhZ4JUJ3Am/rn34cUg1E/B4Ao1//L3k2333i/vOSuasKFwr7hWPDFKMVLquntQ3N WA== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 384byp0rkp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:06:19 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13OM6Caf045579; Sat, 24 Apr 2021 22:06:19 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2103.outbound.protection.outlook.com [104.47.58.103]) by userp3020.oracle.com with ESMTP id 384anj7ut9-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:06:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L1RjOaNoxImTeTb9NhrOVSKPc+4BnGYXlmqeCdQugzuBynwmNGAadLCjI40cuQCGSPAKvsI01Bazs0UDiwH3ooWmRWirtZOeaLM+V/2Ykc64ReEh4gof0Tjg30NwPVlzmsiXL7XzRP/0k6QzG5sDllx+BmkYlMcdwQvSJ8QZO/IIaeGVduaHFjzr9MOSQbYN3U9b1IUKQAvZ3Sk6KtdtSyBkBLvhsFRFuZeYGKAdCKCxh+fXfP2ZERLNzzVNgWnn7hvQuygUhL26jrS2r2k0gksrx+VKEHwW3bWi3PcH37TdyFr9Z8j1SA8Mbg5PPiKxZOHf/K+EDfMb1F3vNE3bcw== 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-SenderADCheck; bh=0WpFiECF1DChCBeoJKNdQaZAr6+kpgCVP9s2jRzxvFQ=; b=kUO6TTTWSr70x1XkibgJFi04fUSt/+hBCga28EFsVWilsaRCoUeChWy9Vo2hvPVH/jPmrJUjFdB4+eoyZtJ9uimVbkjs7/HvZ3LqngWZ7V/F+nKGvib0By+J0845TJfffQ10EFtQvUluoyUkEzJB6rYc7FsrmUZOpIYjryt0n6sKabDBfCgY13FZSOJcGXLvsNpEFeDlNE8N9NMASvPa6+Cw+zyJdD4+E+GjMm0elduxIfITn5l+QhW5Ns7q8vU71vLreJc1pvl3GIy8WQtkfJ+x42r7TTchTDgKCJMML03SepgxdAUQWSpVFd3IGEDZK4IbLnn+GwQI57Q+I2+QTA== 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=0WpFiECF1DChCBeoJKNdQaZAr6+kpgCVP9s2jRzxvFQ=; b=z9llzu5ouSxNGLnG+i1Les6RB/k7AguVIPvQSlAwN68YD+yX67TzCf2IXluqPTnS4ej7blHVntQWEF8ZZr18Th6FzJE7uV1wzdExsNW2Isf6xLnxKyWsFNlcGpN756nFACI5QfiFFOKfkifsU/8tp74E01GWwTN41XJ6h8t2zAE= Authentication-Results: suse.com; dkim=none (message not signed) header.d=none; suse.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BYAPR10MB3317.namprd10.prod.outlook.com (2603:10b6:a03:158::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.24; Sat, 24 Apr 2021 22:06:17 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4%7]) with mapi id 15.20.4065.021; Sat, 24 Apr 2021 22:06:16 +0000 From: Mike Christie To: lduncan@suse.com, martin.petersen@oracle.com, mrangankar@marvell.com, svernekar@marvell.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH v4 04/17] scsi: iscsi: drop suspend calls from ep_disconnect Date: Sat, 24 Apr 2021 17:05:50 -0500 Message-Id: <20210424220603.123703-5-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210424220603.123703-1-michael.christie@oracle.com> References: <20210424220603.123703-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM5PR16CA0044.namprd16.prod.outlook.com (2603:10b6:4:15::30) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by DM5PR16CA0044.namprd16.prod.outlook.com (2603:10b6:4:15::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.20 via Frontend Transport; Sat, 24 Apr 2021 22:06:16 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: edf8c75f-0312-4cd0-4fb8-08d9076d2ebb X-MS-TrafficTypeDiagnostic: BYAPR10MB3317: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:663; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6/QMBIUKGGJXL3RdEkVBEkXJJB77MhfBEbkF1Qz0NKB19WuPF/LvJxjoFiwDZcs4IQP8sLup6Mm0bsG/FfY0kdajwmDc3G6PQWWjDpWrCgCO/SfLgQWnT1vy2FNVnvQ3EEGm+Ky1nsFpAvBahgJe0qQfq2Nbk30DTQtJ9+/h2ALwO9uW9iMCqs31Bb1/8G9/w5Tp3VB03ot4N6TpEo/wQ1bFt1gdZQPyrBwNYynhA9o9DQASO7OsRzsNLH9AGqfk9OwbxA18jLxQydvXuWdY2B1Jyv4p2IbeO4PAgrDjktgV100NyRSOmffPeqd6sIElJdw84+7/k6RP1oSy+j5RFEGMrYPEHn9FhVIVrXbjwa5YCf2GaaVB/apkiaMxCFnmvHHD4k8C4saREr3MeodDDZJ0NVs+vCAakhHZH2MbMGZO/pGEPfZKnzmDf5lFDnTNIlPCcTFsBXntIE4W581Puppr0vpHDARVK2VqwbJ0URjxR/towgvr3b1abTqd+ktsqom/Bav5irztRwsgb0UV1QQE1Bja5zOdwXhQAy/tFjPQ2u9MZPzXO61eWPEr1lRubX8GXqTLdpV813GA9hfQC1urDx+L56FEGTTLrmZHdr/HXZbPHvnMqByiomDHpz7/yLfXYUOtNMhwlTTclUAhi8nv4MhxyjJIj3Kfa1NUu10a8rTeWxVOh9gV0zeJkwLI X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR10MB3573.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(366004)(346002)(396003)(376002)(39860400002)(4326008)(6666004)(1076003)(36756003)(86362001)(52116002)(478600001)(15650500001)(83380400001)(38350700002)(38100700002)(8936002)(5660300002)(26005)(16526019)(316002)(6512007)(8676002)(956004)(186003)(2616005)(66476007)(2906002)(66946007)(66556008)(6486002)(107886003)(6506007)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: IReujx/yihfN3wlVTumd0/mjtsebrXXEJZue2JGifABV05NFI1X/m8YGU8XX971y83/UkMGEmzFPEKT7YmvVphR09XD5WIUkeyFNYTgKUHeLddrCjYes+AVBzQ1t5D+xl4unTJjnYWsR5uI4LnIkktXjEPymK7/1De9U2T9UmIEk5/x7PboLKR84a4Q1QttC9T1pzINCeOfHYOCVJGgTkgzT2bDXUQO/sOnQ1FbeQVEnz2kq0NsKCh/j9f0bUKfGXHfNOlfFzl5VRzjQySPAj+bPyenK5ThQWuEBGeyBPLSVR2RB/N+rdcnKyL/q5uEIw4ryfsWWfss/hsbNtLJM4Qmty+OQg/xyc7axY994VS0bWNMnhN5RrfDKi5RegmZOZ50RLYJ5XaVB5IemBHF7s4O7de/Y99kdZ6GdPQriBZJKC/d+YfcQv6Tx9g3esfbcDmiOqhULkpYoK/xwu2lLQYWJ1pT4ARo6wQPQMOQUqWgMhNHHBwNJdfkrMSkDLVlFfNCfzzyd/BzUBeix4u5VwOWQ6D1EEUzCAe228mtMyrOzz6lVGOSm0aUZjjZPsvxdCGcFUe6FQSps6Kkf1O2Ksc4kAJ8aAK3KWMXbPh70PFfBCcLqpdHansIBCONpjR8JKzi5juup+VXTO6DmGFJ0o4KTBNRb8tRzuASfVOvRw//+Qyp0rG31jReJZc3lUTKrCxCCZU4Em4HTQ9RaxZL8j9qmsbNj57PONh4JgVhbvqSLuO/HcUcbJveQrAVIP2XOQObIHI/MmYRimuvpkF0wRJDoET6BbjwqaMtdPEOezrvjRAZzOurC4JZZKzY15tcir44rgFa9KT40R4Q11oQxA96vvjs4WZZpdfuFYJdcG7sD2XI7tj+R5el16CN8a3pVgc1XenG69q0Ynhg7sOU1X+uRczfkRAxN5wKG24L0Uyc1bXPI3JAyUwuzVBV/NnVRdcDZ/anSjq/AWe/MEarOOidhuvs0ln+Gnuu4OImPQXr/9/i7SKgabqbNyLaffdP/dklNX57R+kzZLT6YVcJD8OGJtuirfK9XXo4K/v20Guh+V5tjRiMWMnkvk76NMc/bNI07Zen+/nTjCeH1mgbdDsEjA3zMvJQ+DSevR0m9vfepHCWggslmYOTA8hzl4nhzvSyCSdqiPIvtmp090xAJsaODU5jivhkcKec6LXupYt1/Pdi98acBzhFFEzG4uaL+FFYDNQ4SNQXIzCVoDVkju9yYu9Oyg+dVUvlftZZV4G54q3mUqoBywR39YFUzo+NzK+v5y7g5mNA/jNpkdgLwCMqo2IPC3yXq5Ai060Y43CXIx594GoYLT1qd3qUB8bvC X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: edf8c75f-0312-4cd0-4fb8-08d9076d2ebb X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2021 22:06:16.8402 (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: jeImv05wm9dgnmKrv3uazHtP+8XOmlwhfneECkzkfkYNcrd8B1e9fQwtndLkk9het3gQUk9nQDcwXkV3lkj9m8j3rBoTQlQ8vs/YpcGWoKE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3317 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 suspectscore=0 phishscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240168 X-Proofpoint-ORIG-GUID: 4ocWuNl4pcpR56xGV8JiQQAj4m_m3EQv X-Proofpoint-GUID: 4ocWuNl4pcpR56xGV8JiQQAj4m_m3EQv X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 lowpriorityscore=0 adultscore=0 impostorscore=0 malwarescore=0 priorityscore=1501 mlxlogscore=999 suspectscore=0 clxscore=1015 mlxscore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240168 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org libiscsi will now suspend the send/tx queue for the drivers so we can drop it from the drivers ep_disconnect. Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/be2iscsi/be_iscsi.c | 6 ------ drivers/scsi/bnx2i/bnx2i_iscsi.c | 6 +----- drivers/scsi/cxgbi/libcxgbi.c | 1 - drivers/scsi/qedi/qedi_iscsi.c | 8 ++++---- 4 files changed, 5 insertions(+), 16 deletions(-) diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c index a13c203ef7a9..a03d0ebc2312 100644 --- a/drivers/scsi/be2iscsi/be_iscsi.c +++ b/drivers/scsi/be2iscsi/be_iscsi.c @@ -1293,7 +1293,6 @@ static int beiscsi_conn_close(struct beiscsi_endpoint *beiscsi_ep) void beiscsi_ep_disconnect(struct iscsi_endpoint *ep) { struct beiscsi_endpoint *beiscsi_ep; - struct beiscsi_conn *beiscsi_conn; struct beiscsi_hba *phba; uint16_t cri_index; @@ -1312,11 +1311,6 @@ void beiscsi_ep_disconnect(struct iscsi_endpoint *ep) return; } - if (beiscsi_ep->conn) { - beiscsi_conn = beiscsi_ep->conn; - iscsi_suspend_queue(beiscsi_conn->conn); - } - if (!beiscsi_hba_is_online(phba)) { beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG, "BS_%d : HBA in error 0x%lx\n", phba->state); diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c index b6c1da46d582..9a4f4776a78a 100644 --- a/drivers/scsi/bnx2i/bnx2i_iscsi.c +++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c @@ -2113,7 +2113,6 @@ static void bnx2i_ep_disconnect(struct iscsi_endpoint *ep) { struct bnx2i_endpoint *bnx2i_ep; struct bnx2i_conn *bnx2i_conn = NULL; - struct iscsi_conn *conn = NULL; struct bnx2i_hba *hba; bnx2i_ep = ep->dd_data; @@ -2126,11 +2125,8 @@ static void bnx2i_ep_disconnect(struct iscsi_endpoint *ep) !time_after(jiffies, bnx2i_ep->timestamp + (12 * HZ))) msleep(250); - if (bnx2i_ep->conn) { + if (bnx2i_ep->conn) bnx2i_conn = bnx2i_ep->conn; - conn = bnx2i_conn->cls_conn->dd_data; - iscsi_suspend_queue(conn); - } hba = bnx2i_ep->hba; mutex_lock(&hba->net_dev_lock); diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c index f078b3c4e083..215dd0eb3f48 100644 --- a/drivers/scsi/cxgbi/libcxgbi.c +++ b/drivers/scsi/cxgbi/libcxgbi.c @@ -2968,7 +2968,6 @@ void cxgbi_ep_disconnect(struct iscsi_endpoint *ep) ep, cep, cconn, csk, csk->state, csk->flags); if (cconn && cconn->iconn) { - iscsi_suspend_tx(cconn->iconn); write_lock_bh(&csk->callback_lock); cep->csk->user_data = NULL; cconn->cep = NULL; diff --git a/drivers/scsi/qedi/qedi_iscsi.c b/drivers/scsi/qedi/qedi_iscsi.c index ef16537c523c..30dc345b011c 100644 --- a/drivers/scsi/qedi/qedi_iscsi.c +++ b/drivers/scsi/qedi/qedi_iscsi.c @@ -988,7 +988,6 @@ static void qedi_ep_disconnect(struct iscsi_endpoint *ep) { struct qedi_endpoint *qedi_ep; struct qedi_conn *qedi_conn = NULL; - struct iscsi_conn *conn = NULL; struct qedi_ctx *qedi; int ret = 0; int wait_delay; @@ -1007,8 +1006,6 @@ static void qedi_ep_disconnect(struct iscsi_endpoint *ep) if (qedi_ep->conn) { qedi_conn = qedi_ep->conn; - conn = qedi_conn->cls_conn->dd_data; - iscsi_suspend_queue(conn); abrt_conn = qedi_conn->abrt_conn; while (count--) { @@ -1621,8 +1618,11 @@ void qedi_clear_session_ctx(struct iscsi_cls_session *cls_sess) struct iscsi_conn *conn = session->leadconn; struct qedi_conn *qedi_conn = conn->dd_data; - if (iscsi_is_session_online(cls_sess)) + if (iscsi_is_session_online(cls_sess)) { + if (conn) + iscsi_suspend_queue(conn); qedi_ep_disconnect(qedi_conn->iscsi_ep); + } qedi_conn_destroy(qedi_conn->cls_conn); From patchwork Sat Apr 24 22:05:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 427047 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D5F5C43460 for ; Sat, 24 Apr 2021 22:06:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DDAF261264 for ; Sat, 24 Apr 2021 22:06:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233678AbhDXWHK (ORCPT ); Sat, 24 Apr 2021 18:07:10 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:57268 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229734AbhDXWHI (ORCPT ); Sat, 24 Apr 2021 18:07:08 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13OM6Kf8151674; Sat, 24 Apr 2021 22:06:20 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-2020-01-29; bh=I6CF8I92jPfN97R5RE0SYx0dKqw/3jQxjWrvMpYGEGw=; b=fkvkffQOwCvITC3oPe/YaJMVvfBcZsGxkIGMm3EYGwel8WxW/OVcChZCvJ7Jw1W4yWAr yEBcvF+88QPKVBTFaRz0HlBKyWehmz5goIld7ZuA+nOAM5jtpWZayQFv/93LClwEVGci R+LlQtWVfax1GdcCsEvXL94KBX5Utcy5QF4YIVvKHPUZABtf1JPjoQc+j5v5vq/NI27i /Bjc65fmwUS3Cz/YtlleRPqmWQy+y0Po9zes8w/1u2qGvAF+zLsSeL92ygsYGor119ku I3nUjlG/CN+4GGhq/vL061VS62h8T+yEZCf3zkAbNZzXwS1+kKWtg2jEeyBurAN1hkDz 1g== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 384ars0t10-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:06:19 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13OM6Cag045579; Sat, 24 Apr 2021 22:06:19 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2103.outbound.protection.outlook.com [104.47.58.103]) by userp3020.oracle.com with ESMTP id 384anj7ut9-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:06:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KwX9VyhSgWj2hbPGqi2cnIyrwksJgBj+CDyDk2gkuNBfGr232HHhC6J4JVh+gDrCVSEzeYnVSwnYsBe7JkmkyddlhigA4w0NlX8UXh5w+NRsTENKWrOVmKNLPblBT0LC4oEWQ+Q/4Fqd+2pSab8kKNRDC1/J4Je9xL3Y8IcKJqSp25L8YnQRWUJyZULZyv8nyI942r1+TPV7qp1u0cJIiCbuJzy46CuFKayOLF3Ghb6mO80s18bMJT+r3HJvDng3qdVAvWYfVXUcgz7npHY/pWzgS08ZlH2IDas4QPeWOyMaxVZiB2OE+Bw8T1Mne+F8dd33CSQz22gEKG0t2j+Y+A== 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-SenderADCheck; bh=I6CF8I92jPfN97R5RE0SYx0dKqw/3jQxjWrvMpYGEGw=; b=WVJtnCMd8Oo3dFD0zC9hV/VXv1o34dsxEItZ1fhqGcyrh0PcP2QBjyzGeF1FnYxaxrdUy9rbajXyTxCCwoopr34unqOLjQpBiAbkpCeJoAl8SFBArxzlS1SqLgvpgiZLTjlKPDN3Au7agj6Eh4E8aSrRXNeXSmC4Byx+yD6dy4fiHr+EGLwXZwm6MsiESb/HIqQoZOp0o3sGOi7cOB/Uqr9G7MNbW85Zu4afuawJfkOxN7vURxWnTRJWXYQ5h1DwQapRiERqBR2YSnbnAIPAODDCZwGwFluzHx5eyCb7vy313RyGnVnsSO6AjkWxr/15EGBGuyrzME76s9PZXuMTEA== 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=I6CF8I92jPfN97R5RE0SYx0dKqw/3jQxjWrvMpYGEGw=; b=AWj/FMhaMX2btzGsXQNBmOGIRbWtt9tobIDDZsTm716oVZVjSB9SiXV1dHIeCvW5wr1J6iGoE7LAJhCw2C920VjSHAGR5Z+IK0IJdLllmGW97tsCxFrW6XkgIuHk1TaooAp9q65UVrrdgnkd0I/szuwfQNbviVR8cejwm057vkE= Authentication-Results: suse.com; dkim=none (message not signed) header.d=none; suse.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BYAPR10MB3317.namprd10.prod.outlook.com (2603:10b6:a03:158::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.24; Sat, 24 Apr 2021 22:06:17 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4%7]) with mapi id 15.20.4065.021; Sat, 24 Apr 2021 22:06:17 +0000 From: Mike Christie To: lduncan@suse.com, martin.petersen@oracle.com, mrangankar@marvell.com, svernekar@marvell.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH v4 05/17] scsi: iscsi: wait on cmds before freeing conn Date: Sat, 24 Apr 2021 17:05:51 -0500 Message-Id: <20210424220603.123703-6-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210424220603.123703-1-michael.christie@oracle.com> References: <20210424220603.123703-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM5PR16CA0044.namprd16.prod.outlook.com (2603:10b6:4:15::30) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by DM5PR16CA0044.namprd16.prod.outlook.com (2603:10b6:4:15::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.20 via Frontend Transport; Sat, 24 Apr 2021 22:06:17 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1ac8a55a-e675-485c-0cfd-08d9076d2f53 X-MS-TrafficTypeDiagnostic: BYAPR10MB3317: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 90XXghiiGX3iPDKKVLmyrjfp4LK7e6eMUeqzZJL6Z+UBC6G55qqkbpyLsDQgJGp3btKURJOYXdRuGzgycOoeKZZ/8HHnv7sdPbeXfWvn5fVZz2EhQSZ9lBVr3lxjUYdeJlgLojaKmQb2qXDeRXsgy6OntCmdbg/yJuQXEHoFWdZzurM5MCo3wVyqpHWYZyiKc/MPSyIS/trBNJw3rozJP0o1mmhDdJnL0aYaqeeuUPl/bshH+l6mr8zOKFdhsLjBui7/WAmS/aJ/Ewcqsfzv7G8+udQzxMNkfra+N3iL4gyLtkLy3sOrKB/peQ7Nu9vDQk38rmuMpDP5O5FDCdRSVul6QEzksTf033+Nrzsx2jIDtqxigqS5EQqy9W8c+NeQAFgomeSvo5bGVRyP8xpMHqvCZlY8W+O1L/1b/VzoXrzlSHQLsRejwAJ0I7kRxCrcDyypb6Suk9JG2A2g0PFe8UPBT8UlNtkYAmNuKfDOBCm3cIDuJmNUD+yVaBbcpOoURYNk472oMnBVCUPDfyYpDnEAv9rkynDNO0IGG012GlVba1wXTRmMeVxbNI0xm6WuMA52NPeyX0n/rrG8mocPKM/DcQiiQ93T4lg1x6AHjYrF8JNz37fAVChexmGK+9AAJ3TYYfv9Em8xeUvJTJk+dFgKKG1QoK3Th+ta7MYmArN+zddC5xm0PQ7cydEkUzqj X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR10MB3573.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(366004)(346002)(396003)(376002)(39860400002)(4326008)(6666004)(1076003)(36756003)(86362001)(52116002)(478600001)(83380400001)(38350700002)(38100700002)(8936002)(5660300002)(26005)(16526019)(316002)(6512007)(8676002)(956004)(186003)(2616005)(66476007)(2906002)(66946007)(66556008)(6486002)(107886003)(6506007)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 6YOlU4KgeFMM/As+niTzmSmLToiTN3Q70KXqja+b/gSOSsArTJqT/+MHAfshK42yFP1LFNBqrFaBD913NtDUgNFpHLmbw8fMEqwNM84l52yu0XY6D9nlnk5mL9+rrGVWJfBQdo419Bou42YQdAPkMlU5m+vq5FvykRjZg2CDKzANl9ZvlSStyQd7ILZ1lmnRG/sbsiGhms+ySEEKlgdRPoMEw1gLjyLrMcx0bHAiqxSPgRvbPUY8b8e+sW6El2G2Ty2xE0lkUiJ0bLKUp5oqJmH7oQlLMLjz1Yrl3I4g+DXpBK7+GdBqMzK8ulUTNLOgZPNhRkAcgeVYhzdgVzt8t2a4kHY8ZvTtWXrNR3cSUul9TyN32G+U4tcLbtH0MYSUqOruVZK5qfupdk8uwbtfE//mxHhy19dwuW7QZmbmt5rkx5tYf+sHNoRUNg+5FpA7lxqdQsEDZZVaky0eWonqoGpJ4ulyVxObapNdQ9nBXHMTMaW4n3Ab8HzsbGgZFMzolHF6a9oIcO/ARxBeWKLaOoTbOqeWxAzINhyHp/j7tsS39mLS6uqa5zCT+RBOOhVEBEIdr+XzXVEi7FqhTHyEpIZdV1XFrP3mJMjoasCzGs7pVxU6D1BrrwFQiNKvUc09wA5gQvysM8au4lBRxksY22Fcg7Ql89Nr7N6yuqnIfABU28VBAl8U2MWY0Q0uSsl2POzdHFG7/IiQGUSD9v0eJxlph3J02vmzcFekf3s/SC5rTH7VYsHJtNRzw0SphM/LrAAN3H2oj8X4CQTBP6jrnSWr2wERgFNAiMWKCs1708AphDpDxePGY4X+T2agVNKKXo2jjC2b9BN2K0XXhL3CcU5xDv/898lIQaHyaKIucPSRsxySPUy2bIG5D8bYUA/6yJzM0r7zJjkdzAJi7oavZELrOtz00nuy+tyKEbE3NYSkdRsJ8ml3nknkNiqU3JGwVyrKeRhBiwPp4mRPUGacRC83J8s1tdvoWG8FOHUEOkgp3tA2/UY2mmIIsY40nomLO021xZECyxOXBQ+UilR1P48u4wbF2OkC7c2Ck9s1CwoU7k5p+5pl2u/aF7zZY4FpoeuuGq2c59gBM8rHWzLS6lVfKJUiz3NlWTLg4rMoT07rLegVDXQfxERP3OsKeLpBA0UkLRQKc+2enpYdLsEdOSRRFMm2kdukA1rc2vGjqEk8QMS2K6xmgjhFWzkB4D3ddO1pX7l5oEOlNg/wuRuO/fjpBEpWXULUA5m0SzE2ilIlj/iGl8C8nJMXhqvAaoEDfPXEjh/5ZrizxlnX8wgGjn/V4mfHvdtPIn7JsZGBjfsAsbCKREQidv1Uqsa5WTXv X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1ac8a55a-e675-485c-0cfd-08d9076d2f53 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2021 22:06:17.8196 (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: /Zy+K6N4+WBzZrEWp7LwAAZJ0x2QlG0hkrMFn8MVYdQoU6PXFWxpp9Htnwp8ic3lPYFpdDrb67bd+oWF9NzwwRJu2f8/s/DH7/WgZ0TxzfI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3317 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 suspectscore=0 phishscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240168 X-Proofpoint-ORIG-GUID: IIeo5mZFcf-QVRyDzxhKy_PAP7yyx3US X-Proofpoint-GUID: IIeo5mZFcf-QVRyDzxhKy_PAP7yyx3US X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 impostorscore=0 adultscore=0 malwarescore=0 phishscore=0 mlxlogscore=999 suspectscore=0 priorityscore=1501 clxscore=1015 spamscore=0 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240168 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If we haven't done an unbind target call, we can race during conn destruction where iscsi_conn_teardown wakes up the eh/abort thread and its still accessing a task while iscsi_conn_teardown is freeing the conn. This patch has us wait for all threads to drop their refs to outstanding tasks during conn destruction. There is also an issue where we could be accessing the conn directly via fields like conn->ehwait in the eh callbacks. The next patch will fix those. Signed-off-by: Mike Christie Reviewed-by: Lee Duncan --- drivers/scsi/libiscsi.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 0f2b5f8718ca..e340a67c6764 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -3124,6 +3124,24 @@ iscsi_conn_setup(struct iscsi_cls_session *cls_session, int dd_size, } EXPORT_SYMBOL_GPL(iscsi_conn_setup); +static bool iscsi_session_has_tasks(struct iscsi_session *session) +{ + struct iscsi_task *task; + int i; + + spin_lock_bh(&session->back_lock); + for (i = 0; i < session->cmds_max; i++) { + task = session->cmds[i]; + + if (task->sc) { + spin_unlock_bh(&session->back_lock); + return true; + } + } + spin_unlock_bh(&session->back_lock); + return false; +} + /** * iscsi_conn_teardown - teardown iscsi connection * @cls_conn: iscsi class connection @@ -3148,7 +3166,17 @@ void iscsi_conn_teardown(struct iscsi_cls_conn *cls_conn) session->state = ISCSI_STATE_TERMINATE; wake_up(&conn->ehwait); } + spin_unlock_bh(&session->frwd_lock); + mutex_unlock(&session->eh_mutex); + /* + * If the caller didn't do a target unbind we could be exiting a + * scsi-ml entry point that had a task ref. Wait on them here. + */ + while (iscsi_session_has_tasks(session)) + msleep(50); + + mutex_lock(&session->eh_mutex); /* flush queued up work because we free the connection below */ iscsi_suspend_tx(conn); From patchwork Sat Apr 24 22:05:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 427407 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B83A6C433ED for ; Sat, 24 Apr 2021 22:06:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 99551611BF for ; Sat, 24 Apr 2021 22:06:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232120AbhDXWHJ (ORCPT ); Sat, 24 Apr 2021 18:07:09 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:48350 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231911AbhDXWHI (ORCPT ); Sat, 24 Apr 2021 18:07:08 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13OM5THb051156; Sat, 24 Apr 2021 22:06:22 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-2020-01-29; bh=3WxM/r7mgYpVYjBA3HJL1OhUDs02JhzdIexylbakZN0=; b=JGm+zDgEpeJ3rITHpR/iyiBvXDIqpJXMoRbx47ouLAvWL2bUTGz8B0y1QyvbdHStgcpf 2rZt/xEJEfhzgOBT99vsJIJkmmzyCN3wZhPPcVNtHOJm8W8vQMdqw/wajZFT+2Ndg/M5 oVJnw2MR2ToCFL9gDbsRTfhxz21MuYHn48RvlhkeEVqlYVp4IbEFM01BQx+J/JnVmXma nujHO3LxX7TrGQ29e4jJLJdMXYXy7mUGXX2n1dyXLEZb4pxzUIBj09+KajIBDT/AmCqa 4FgPmasQSXe5wbTBtYr2VGCSG1rkclRf2nGxgpQ6JXS36+UMc/KuHJAG3wCwnJY0JNAU 1Q== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2130.oracle.com with ESMTP id 3848ubrvdy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:06:21 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13OM66YT182267; Sat, 24 Apr 2021 22:06:21 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2104.outbound.protection.outlook.com [104.47.58.104]) by aserp3030.oracle.com with ESMTP id 3849cakfth-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:06:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DbDfgcpq7I4KD9u4XZEty8/q9ULgO8fSnVZ/KvRY1hh0A+rX8uhwG4lMj9AhQRshlXWtZ7nvp7pjxwfMjDfFEsTrG/7N9hVO3bNBVEJhUl61oYnkHQdGKUIiAba2sx7pbtoq5LWslJmh+eATpkK7eUcRuHHJbDMRNlrX1iN6Rzx6RoelPzZv6b/vWs59AWMW5OJ0w32O2Xg/9ejXztF+GH+bjo//JgfQVTbYWkCMFiin00eBngZfYjcz9qTOsYvwEs4nZmyT14BtlRUz8mmZoCVWq0OiJ5oz4zxx+hd+/ptkoRZNHcbEPWJ6FK3qfS0FRw5KXHavpGpH353ZfU/pWA== 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-SenderADCheck; bh=3WxM/r7mgYpVYjBA3HJL1OhUDs02JhzdIexylbakZN0=; b=Vd53iAxg1m4CrLkCnUI0raqiAIejgJKkR6Wo9maWDGT7L/IwZ1LLJiszVkIUyLfn3y8jFG7tL4EJfV9b5fGgOywVnG7QfJrg/mwdN6z298LG74M3rUVmsDhAcSPe89vIlrOCw+eyg0cfclBYKbm0W5XpqdfOA0+FNJ7bD6UpiWw13joAuCoKNhgTVBV4UhHDAlbDjfbr45kYYeA7rq60dzMud6Il50P69lmpMg0iaoMoN/akVM2ttGZ/3p9QQGTNFTplJPjYbZ2y/AKwPUmLpn6bgdWU9qXfwFYNtCYiqbnzfJwWhuUXE0c9qHZbJruxIFsVDHDNzeVi3+QLihPS6A== 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=3WxM/r7mgYpVYjBA3HJL1OhUDs02JhzdIexylbakZN0=; b=ebWTv0CUeUsjNkJvqvMyutSBTDCSlkA4qFYemk61nC7dpAtV6L6wNPAyIa3JaKrILk8/TimL09/LAVUHeu0Q+IxmegP7nffqNd1Tyfc+sssJpgYEmLcQ/2TxtjkahCSSfCb8OtaxTB8wdKg1yPmk4YrEcLZzYy9pnp3j21phI8E= Authentication-Results: suse.com; dkim=none (message not signed) header.d=none; suse.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BYAPR10MB3317.namprd10.prod.outlook.com (2603:10b6:a03:158::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.24; Sat, 24 Apr 2021 22:06:19 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4%7]) with mapi id 15.20.4065.021; Sat, 24 Apr 2021 22:06:19 +0000 From: Mike Christie To: lduncan@suse.com, martin.petersen@oracle.com, mrangankar@marvell.com, svernekar@marvell.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH v4 06/17] scsi: iscsi: fix use conn use after free Date: Sat, 24 Apr 2021 17:05:52 -0500 Message-Id: <20210424220603.123703-7-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210424220603.123703-1-michael.christie@oracle.com> References: <20210424220603.123703-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM5PR16CA0044.namprd16.prod.outlook.com (2603:10b6:4:15::30) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by DM5PR16CA0044.namprd16.prod.outlook.com (2603:10b6:4:15::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.20 via Frontend Transport; Sat, 24 Apr 2021 22:06:18 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 65873b30-ae56-459e-7750-08d9076d3032 X-MS-TrafficTypeDiagnostic: BYAPR10MB3317: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:608; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IO8HW4m7sVH9QGW9ELsaJHf/5MuWvqE13HmRALrCs4ek1/NFw9gigPUz+jbd7ejKdrRKapeAXNtXIqnz04xQ3HekV2xt8BCWMpGoA4upZM3CO30m4Ygizm2npKqWEMbWfeh1zQO4QLkydssAvG1krlLh2fSJ0HjwAQUZio9n6EFUqNCAzg955fhbQJ9+K7Q/aIjRzJsfMnhJ89SE4W6xrcPnxuof1jumE2l/57AzBHdw0Duyuwvb6N9cQIf2ui9BNbHNE/pcXIc3Fp9tb3TZ/IS68sNpejXLw71pPSRl/AoIGeuRdb/YAoYEgz0eV/cNcu7fOQe3sT6HXEzTAd2DYVJjQS6d+B+FV4I2yZbEiZbBnIDMCDAEImLrn3jISGNRAQ8YBwA65WC+q7GK/kNAg8YKY3m57k6hPeZG2IFGNyWmdhYkn8wARmlrCXsqbCbbvcCIVus13OPcBru/dcfPn+KI9/PXFNN99uEsTekv+jkpSxN9blowfz69f0wRVbwV1jXnnAt1iYamHkQBKKD/MTsLM/DZf99Dk50vlwi6cSiFqHqZcexIUXM+NmKkvLmHb8dqcDcIgxmzGzSu8rAjmPmoBeJg0dY+pvTWfgrxTDoAB+eluBfQryBhNS7lnSVk9RPsYsaOxEGP23wMRR8gpX5F2NyozKzuKa7ZXfAWRXCYP6mQLzRxJGkclUznV9/x X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR10MB3573.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(366004)(346002)(396003)(376002)(39860400002)(4326008)(6666004)(1076003)(36756003)(86362001)(52116002)(478600001)(83380400001)(38350700002)(38100700002)(8936002)(5660300002)(26005)(30864003)(16526019)(316002)(6512007)(8676002)(956004)(186003)(2616005)(66476007)(2906002)(66946007)(66556008)(6486002)(107886003)(6506007)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: C/IMlinQk8NDV6WoNA+uqYW3ubPSjZVc65E+H/lEifUJsuO4mG5BH5XDaoxDOOI0nDPpEwxgzzif0MPYu1VvLAbavCa3KctVFRMw8tyUPDdBmS/SjeA3qaJVCA8kIbRQtboqMM14n6Jj0lzCBdggAf4siw2WUefAt4+mpKo17DnHjcUMPKxLNC8lUkBvoTvhT4eBbkc4e062S6CvUgx6R30RG0SBqYzPW087eILwU0gZo3BiY6vEuluaE+8dY/7tY8WsnX9p29WaBYDbza4uaFTJXSWvNtlTJTQUzOF+GeaHRlnXGSS2SKrksYah2kEKRcycR1JTnLMamZONPvjgQ8Y2qQYayXHHGdHTMBMTSgfs6WaTmnVatzlGMTMfd02qDTRHKuNR27u06HJxxPsP/BwRhanxsB8zGFSOt/95OV5VW405jyYRXBSttxL5SAv/lW6ZCRBTS5alVDWiPTiTjERJuN10rBIr4QBX7ihmc8GLtDiGRGIZe1LV3WJAv8zCO2j1M6OIjdk9DlvCTAiFz4QLoUVsbNSD1/3Uql0vNnmwaeMdaCOijHLIs1LLKvg5DqqWL6NPaNeDteKe9h5ph25lXd+LRBYeNsAlGbGe6pGdekBH5hpziRhZ6jYNyZuPNS0DD0fbN1+622rTCAoDYAN9mxOFVxHzn4XWSK3BWBowKnfXqnIBxBJ0pBANG9sLPLzYO060pcinmgUXrgL7p3PqlqNyq4raRm9v9Ti2K+SzgRy45F7UDvrp4PDm4coLAzhpZik5ixP/VhXzjoQ3dpUroiXHr0ix1f8wOev9JKP0m+TL5UA0OOgSdPMY6wodN0vOSr0ihmTRitaTAwrFnPrII2mzOnEWUbaCsjl22oN7lOmRHfX7ACg1RCxRIBZpte1VAhaYHgI+2JWL34nVIost+X98B4V+x2UB4CAbkosy+FeROdb70DaetWCxcw/hfznQq1+5JlgirNXyDpENuRkbLPFiPkmeyVllP2h9iNMFGhz0GK1tjlOuvX0t5Lmki2fP8zV7y6JWd6OkB6xcmaa+6kdDN4HW2mOCmeOIEehDbcxKfQezSvthY7gu9qDEOlMW06HbPqMck9Zw3J8/jj2PDduEA88KEc3mk3/4Z4P0nCk5OFmQarpcwAaAix76bTlaeOMS88Ap9qRxkuLeHgP1wCva0aIMID3EyDMmMboJu6z7RTaS9jlP24cMO5B/SP6VE1ZNyFIflD3MzqBuCemrYVIIkngYu5gGLnehCtbHpxJMN2mTfoIjbgYWgGayuIW1NPw/gODAw4gY0goXPOkHeRcb3tjfJN2bl2CTm7JbTvtQWmAcoolYXyi74QLs X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 65873b30-ae56-459e-7750-08d9076d3032 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2021 22:06:19.3238 (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: EOrtIpbO1Q3JSWZvd9qKcPZgLCMGIzde15Pnd4Kgid9JBs5fjdvWd0dU4VGa5UzBp2IqCNIz3cvePEylGr7Us2WqeReTF1vkC2pYQYabIBU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3317 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=0 adultscore=0 mlxscore=0 spamscore=0 phishscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240168 X-Proofpoint-GUID: mz4HQlJhPaaBOCywbU3XyROUWWME52et X-Proofpoint-ORIG-GUID: mz4HQlJhPaaBOCywbU3XyROUWWME52et X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 priorityscore=1501 lowpriorityscore=0 suspectscore=0 mlxlogscore=999 phishscore=0 spamscore=0 adultscore=0 clxscore=1015 impostorscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240168 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If we haven't done a unbind target call we can race where iscsi_conn_teardown wakes up the eh/abort thread and then frees the conn while those threads are still accessing the conn ehwait. We can only do one TMF per session so this just moves the TMF fields from the conn to the session. We can then rely on the iscsi_session_teardown->iscsi_remove_session->__iscsi_unbind_session call to remove the target and it's devices, and know after that point there is no device or scsi-ml callout trying to access the session. Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/libiscsi.c | 123 +++++++++++++++++++--------------------- include/scsi/libiscsi.h | 11 ++-- 2 files changed, 64 insertions(+), 70 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index e340a67c6764..32363e758df2 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -230,11 +230,11 @@ static int iscsi_prep_ecdb_ahs(struct iscsi_task *task) */ static int iscsi_check_tmf_restrictions(struct iscsi_task *task, int opcode) { - struct iscsi_conn *conn = task->conn; - struct iscsi_tm *tmf = &conn->tmhdr; + struct iscsi_session *session = task->conn->session; + struct iscsi_tm *tmf = &session->tmhdr; u64 hdr_lun; - if (conn->tmf_state == TMF_INITIAL) + if (session->tmf_state == TMF_INITIAL) return 0; if ((tmf->opcode & ISCSI_OPCODE_MASK) != ISCSI_OP_SCSI_TMFUNC) @@ -254,24 +254,19 @@ static int iscsi_check_tmf_restrictions(struct iscsi_task *task, int opcode) * Fail all SCSI cmd PDUs */ if (opcode != ISCSI_OP_SCSI_DATA_OUT) { - iscsi_conn_printk(KERN_INFO, conn, - "task [op %x itt " - "0x%x/0x%x] " - "rejected.\n", - opcode, task->itt, - task->hdr_itt); + iscsi_session_printk(KERN_INFO, session, + "task [op %x itt 0x%x/0x%x] rejected.\n", + opcode, task->itt, task->hdr_itt); return -EACCES; } /* * And also all data-out PDUs in response to R2T * if fast_abort is set. */ - if (conn->session->fast_abort) { - iscsi_conn_printk(KERN_INFO, conn, - "task [op %x itt " - "0x%x/0x%x] fast abort.\n", - opcode, task->itt, - task->hdr_itt); + if (session->fast_abort) { + iscsi_session_printk(KERN_INFO, session, + "task [op %x itt 0x%x/0x%x] fast abort.\n", + opcode, task->itt, task->hdr_itt); return -EACCES; } break; @@ -284,7 +279,7 @@ static int iscsi_check_tmf_restrictions(struct iscsi_task *task, int opcode) */ if (opcode == ISCSI_OP_SCSI_DATA_OUT && task->hdr_itt == tmf->rtt) { - ISCSI_DBG_SESSION(conn->session, + ISCSI_DBG_SESSION(session, "Preventing task %x/%x from sending " "data-out due to abort task in " "progress\n", task->itt, @@ -936,20 +931,21 @@ iscsi_data_in_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr, static void iscsi_tmf_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr) { struct iscsi_tm_rsp *tmf = (struct iscsi_tm_rsp *)hdr; + struct iscsi_session *session = conn->session; conn->exp_statsn = be32_to_cpu(hdr->statsn) + 1; conn->tmfrsp_pdus_cnt++; - if (conn->tmf_state != TMF_QUEUED) + if (session->tmf_state != TMF_QUEUED) return; if (tmf->response == ISCSI_TMF_RSP_COMPLETE) - conn->tmf_state = TMF_SUCCESS; + session->tmf_state = TMF_SUCCESS; else if (tmf->response == ISCSI_TMF_RSP_NO_TASK) - conn->tmf_state = TMF_NOT_FOUND; + session->tmf_state = TMF_NOT_FOUND; else - conn->tmf_state = TMF_FAILED; - wake_up(&conn->ehwait); + session->tmf_state = TMF_FAILED; + wake_up(&session->ehwait); } static int iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin *rhdr) @@ -1734,20 +1730,20 @@ static bool iscsi_eh_running(struct iscsi_conn *conn, struct scsi_cmnd *sc, * same cmds. Once we get a TMF that can affect multiple cmds stop * queueing. */ - if (conn->tmf_state != TMF_INITIAL) { - tmf = &conn->tmhdr; + if (session->tmf_state != TMF_INITIAL) { + tmf = &session->tmhdr; switch (ISCSI_TM_FUNC_VALUE(tmf)) { case ISCSI_TM_FUNC_LOGICAL_UNIT_RESET: if (sc->device->lun != scsilun_to_int(&tmf->lun)) break; - ISCSI_DBG_EH(conn->session, + ISCSI_DBG_EH(session, "Requeue cmd sent during LU RESET processing.\n"); sc->result = DID_REQUEUE << 16; goto eh_running; case ISCSI_TM_FUNC_TARGET_WARM_RESET: - ISCSI_DBG_EH(conn->session, + ISCSI_DBG_EH(session, "Requeue cmd sent during TARGET RESET processing.\n"); sc->result = DID_REQUEUE << 16; goto eh_running; @@ -1868,15 +1864,14 @@ EXPORT_SYMBOL_GPL(iscsi_target_alloc); static void iscsi_tmf_timedout(struct timer_list *t) { - struct iscsi_conn *conn = from_timer(conn, t, tmf_timer); - struct iscsi_session *session = conn->session; + struct iscsi_session *session = from_timer(session, t, tmf_timer); spin_lock(&session->frwd_lock); - if (conn->tmf_state == TMF_QUEUED) { - conn->tmf_state = TMF_TIMEDOUT; + if (session->tmf_state == TMF_QUEUED) { + session->tmf_state = TMF_TIMEDOUT; ISCSI_DBG_EH(session, "tmf timedout\n"); /* unblock eh_abort() */ - wake_up(&conn->ehwait); + wake_up(&session->ehwait); } spin_unlock(&session->frwd_lock); } @@ -1899,8 +1894,8 @@ static int iscsi_exec_task_mgmt_fn(struct iscsi_conn *conn, return -EPERM; } conn->tmfcmd_pdus_cnt++; - conn->tmf_timer.expires = timeout * HZ + jiffies; - add_timer(&conn->tmf_timer); + session->tmf_timer.expires = timeout * HZ + jiffies; + add_timer(&session->tmf_timer); ISCSI_DBG_EH(session, "tmf set timeout\n"); spin_unlock_bh(&session->frwd_lock); @@ -1914,12 +1909,12 @@ static int iscsi_exec_task_mgmt_fn(struct iscsi_conn *conn, * 3) session is terminated or restarted or userspace has * given up on recovery */ - wait_event_interruptible(conn->ehwait, age != session->age || + wait_event_interruptible(session->ehwait, age != session->age || session->state != ISCSI_STATE_LOGGED_IN || - conn->tmf_state != TMF_QUEUED); + session->tmf_state != TMF_QUEUED); if (signal_pending(current)) flush_signals(current); - del_timer_sync(&conn->tmf_timer); + del_timer_sync(&session->tmf_timer); mutex_lock(&session->eh_mutex); spin_lock_bh(&session->frwd_lock); @@ -2351,17 +2346,17 @@ int iscsi_eh_abort(struct scsi_cmnd *sc) } /* only have one tmf outstanding at a time */ - if (conn->tmf_state != TMF_INITIAL) + if (session->tmf_state != TMF_INITIAL) goto failed; - conn->tmf_state = TMF_QUEUED; + session->tmf_state = TMF_QUEUED; - hdr = &conn->tmhdr; + hdr = &session->tmhdr; iscsi_prep_abort_task_pdu(task, hdr); if (iscsi_exec_task_mgmt_fn(conn, hdr, age, session->abort_timeout)) goto failed; - switch (conn->tmf_state) { + switch (session->tmf_state) { case TMF_SUCCESS: spin_unlock_bh(&session->frwd_lock); /* @@ -2376,7 +2371,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc) */ spin_lock_bh(&session->frwd_lock); fail_scsi_task(task, DID_ABORT); - conn->tmf_state = TMF_INITIAL; + session->tmf_state = TMF_INITIAL; memset(hdr, 0, sizeof(*hdr)); spin_unlock_bh(&session->frwd_lock); iscsi_start_tx(conn); @@ -2387,7 +2382,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc) goto failed_unlocked; case TMF_NOT_FOUND: if (!sc->SCp.ptr) { - conn->tmf_state = TMF_INITIAL; + session->tmf_state = TMF_INITIAL; memset(hdr, 0, sizeof(*hdr)); /* task completed before tmf abort response */ ISCSI_DBG_EH(session, "sc completed while abort in " @@ -2396,7 +2391,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc) } fallthrough; default: - conn->tmf_state = TMF_INITIAL; + session->tmf_state = TMF_INITIAL; goto failed; } @@ -2455,11 +2450,11 @@ int iscsi_eh_device_reset(struct scsi_cmnd *sc) conn = session->leadconn; /* only have one tmf outstanding at a time */ - if (conn->tmf_state != TMF_INITIAL) + if (session->tmf_state != TMF_INITIAL) goto unlock; - conn->tmf_state = TMF_QUEUED; + session->tmf_state = TMF_QUEUED; - hdr = &conn->tmhdr; + hdr = &session->tmhdr; iscsi_prep_lun_reset_pdu(sc, hdr); if (iscsi_exec_task_mgmt_fn(conn, hdr, session->age, @@ -2468,7 +2463,7 @@ int iscsi_eh_device_reset(struct scsi_cmnd *sc) goto unlock; } - switch (conn->tmf_state) { + switch (session->tmf_state) { case TMF_SUCCESS: break; case TMF_TIMEDOUT: @@ -2476,7 +2471,7 @@ int iscsi_eh_device_reset(struct scsi_cmnd *sc) iscsi_conn_failure(conn, ISCSI_ERR_SCSI_EH_SESSION_RST); goto done; default: - conn->tmf_state = TMF_INITIAL; + session->tmf_state = TMF_INITIAL; goto unlock; } @@ -2488,7 +2483,7 @@ int iscsi_eh_device_reset(struct scsi_cmnd *sc) spin_lock_bh(&session->frwd_lock); memset(hdr, 0, sizeof(*hdr)); fail_scsi_tasks(conn, sc->device->lun, DID_ERROR); - conn->tmf_state = TMF_INITIAL; + session->tmf_state = TMF_INITIAL; spin_unlock_bh(&session->frwd_lock); iscsi_start_tx(conn); @@ -2511,8 +2506,7 @@ void iscsi_session_recovery_timedout(struct iscsi_cls_session *cls_session) spin_lock_bh(&session->frwd_lock); if (session->state != ISCSI_STATE_LOGGED_IN) { session->state = ISCSI_STATE_RECOVERY_FAILED; - if (session->leadconn) - wake_up(&session->leadconn->ehwait); + wake_up(&session->ehwait); } spin_unlock_bh(&session->frwd_lock); } @@ -2557,7 +2551,7 @@ int iscsi_eh_session_reset(struct scsi_cmnd *sc) iscsi_conn_failure(conn, ISCSI_ERR_SCSI_EH_SESSION_RST); ISCSI_DBG_EH(session, "wait for relogin\n"); - wait_event_interruptible(conn->ehwait, + wait_event_interruptible(session->ehwait, session->state == ISCSI_STATE_TERMINATE || session->state == ISCSI_STATE_LOGGED_IN || session->state == ISCSI_STATE_RECOVERY_FAILED); @@ -2618,11 +2612,11 @@ static int iscsi_eh_target_reset(struct scsi_cmnd *sc) conn = session->leadconn; /* only have one tmf outstanding at a time */ - if (conn->tmf_state != TMF_INITIAL) + if (session->tmf_state != TMF_INITIAL) goto unlock; - conn->tmf_state = TMF_QUEUED; + session->tmf_state = TMF_QUEUED; - hdr = &conn->tmhdr; + hdr = &session->tmhdr; iscsi_prep_tgt_reset_pdu(sc, hdr); if (iscsi_exec_task_mgmt_fn(conn, hdr, session->age, @@ -2631,7 +2625,7 @@ static int iscsi_eh_target_reset(struct scsi_cmnd *sc) goto unlock; } - switch (conn->tmf_state) { + switch (session->tmf_state) { case TMF_SUCCESS: break; case TMF_TIMEDOUT: @@ -2639,7 +2633,7 @@ static int iscsi_eh_target_reset(struct scsi_cmnd *sc) iscsi_conn_failure(conn, ISCSI_ERR_SCSI_EH_SESSION_RST); goto done; default: - conn->tmf_state = TMF_INITIAL; + session->tmf_state = TMF_INITIAL; goto unlock; } @@ -2651,7 +2645,7 @@ static int iscsi_eh_target_reset(struct scsi_cmnd *sc) spin_lock_bh(&session->frwd_lock); memset(hdr, 0, sizeof(*hdr)); fail_scsi_tasks(conn, -1, DID_ERROR); - conn->tmf_state = TMF_INITIAL; + session->tmf_state = TMF_INITIAL; spin_unlock_bh(&session->frwd_lock); iscsi_start_tx(conn); @@ -2981,7 +2975,10 @@ iscsi_session_setup(struct iscsi_transport *iscsit, struct Scsi_Host *shost, session->tt = iscsit; session->dd_data = cls_session->dd_data + sizeof(*session); + session->tmf_state = TMF_INITIAL; + timer_setup(&session->tmf_timer, iscsi_tmf_timedout, 0); mutex_init(&session->eh_mutex); + spin_lock_init(&session->frwd_lock); spin_lock_init(&session->back_lock); @@ -3085,7 +3082,6 @@ iscsi_conn_setup(struct iscsi_cls_session *cls_session, int dd_size, conn->c_stage = ISCSI_CONN_INITIAL_STAGE; conn->id = conn_idx; conn->exp_statsn = 0; - conn->tmf_state = TMF_INITIAL; timer_setup(&conn->transport_timer, iscsi_check_transport_timeouts, 0); @@ -3110,8 +3106,7 @@ iscsi_conn_setup(struct iscsi_cls_session *cls_session, int dd_size, goto login_task_data_alloc_fail; conn->login_task->data = conn->data = data; - timer_setup(&conn->tmf_timer, iscsi_tmf_timedout, 0); - init_waitqueue_head(&conn->ehwait); + init_waitqueue_head(&session->ehwait); return cls_conn; @@ -3164,7 +3159,7 @@ void iscsi_conn_teardown(struct iscsi_cls_conn *cls_conn) * leading connection? then give up on recovery. */ session->state = ISCSI_STATE_TERMINATE; - wake_up(&conn->ehwait); + wake_up(&session->ehwait); } spin_unlock_bh(&session->frwd_lock); @@ -3249,7 +3244,7 @@ int iscsi_conn_start(struct iscsi_cls_conn *cls_conn) * commands after successful recovery */ conn->stop_stage = 0; - conn->tmf_state = TMF_INITIAL; + session->tmf_state = TMF_INITIAL; session->age++; if (session->age == 16) session->age = 0; @@ -3263,7 +3258,7 @@ int iscsi_conn_start(struct iscsi_cls_conn *cls_conn) spin_unlock_bh(&session->frwd_lock); iscsi_unblock_session(session->cls_session); - wake_up(&conn->ehwait); + wake_up(&session->ehwait); return 0; } EXPORT_SYMBOL_GPL(iscsi_conn_start); @@ -3357,7 +3352,7 @@ void iscsi_conn_stop(struct iscsi_cls_conn *cls_conn, int flag) spin_lock_bh(&session->frwd_lock); fail_scsi_tasks(conn, -1, DID_TRANSPORT_DISRUPTED); fail_mgmt_tasks(session, conn); - memset(&conn->tmhdr, 0, sizeof(conn->tmhdr)); + memset(&session->tmhdr, 0, sizeof(session->tmhdr)); spin_unlock_bh(&session->frwd_lock); mutex_unlock(&session->eh_mutex); } diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index 13d413a0b8b6..9d7908265afe 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h @@ -202,12 +202,6 @@ struct iscsi_conn { unsigned long suspend_tx; /* suspend Tx */ unsigned long suspend_rx; /* suspend Rx */ - /* abort */ - wait_queue_head_t ehwait; /* used in eh_abort() */ - struct iscsi_tm tmhdr; - struct timer_list tmf_timer; - int tmf_state; /* see TMF_INITIAL, etc.*/ - /* negotiated params */ unsigned max_recv_dlength; /* initiator_max_recv_dsl*/ unsigned max_xmit_dlength; /* target_max_recv_dsl */ @@ -277,6 +271,11 @@ struct iscsi_session { * and recv lock. */ struct mutex eh_mutex; + /* abort */ + wait_queue_head_t ehwait; /* used in eh_abort() */ + struct iscsi_tm tmhdr; + struct timer_list tmf_timer; + int tmf_state; /* see TMF_INITIAL, etc.*/ /* iSCSI session-wide sequencing */ uint32_t cmdsn; From patchwork Sat Apr 24 22:05:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 427048 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4994FC433B4 for ; Sat, 24 Apr 2021 22:06:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1D8AC611BF for ; Sat, 24 Apr 2021 22:06:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232432AbhDXWHJ (ORCPT ); Sat, 24 Apr 2021 18:07:09 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:48352 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231975AbhDXWHI (ORCPT ); Sat, 24 Apr 2021 18:07:08 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13OM4fus050796; Sat, 24 Apr 2021 22:06:22 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-2020-01-29; bh=mDNbYJgqw5DdfH6QIt5Xjxj2oRs7MJaiYV+Yc58AlWA=; b=oW4aqgIFtycSQp81Zl9MfAb8EpOsUZIyhZiERFuZ4AWb/sFF+rRJNV1qvDLhQfOv/sCG wEvmL7a452zICJwGYX0LhfMVlpXTFR+lXRA3wGk9VwGWaI+XqwPCCG5R7c13CRbr18dB GMTMDveCHNyS0WnT3T6eV1VIGBM60/UMUmZ9S1z7lIxBx7NiWmknzCPb5EZNF8XKkMnL GhcGWHo52cfSlYqR7M0Hwc9d3WaKwWmiCq+5hFXbrEZbFPQGLy4AT4LDYe9kWmIQ0+S7 Pm4IxqlpSNylFMBmHTvQ+L6zEuHgx6aNnZlrudFopaSPGBsJEdXIhqURWmkdcqgBPsFD jg== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2130.oracle.com with ESMTP id 3848ubrve0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:06:22 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13OM66YU182267; Sat, 24 Apr 2021 22:06:22 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2104.outbound.protection.outlook.com [104.47.58.104]) by aserp3030.oracle.com with ESMTP id 3849cakfth-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:06:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UzijEIRcDqTXbF1p1OCHdeXKvBKg1cJ4fWlf71LqdBSLTphrl3Df5HeD2DU/wDmGFq0kkbJFnASWD6uTPDNeQN/OcAsbHGcBMJwdlFTevI/d0memezGoEobumEEX7OnwSb2P+VUIMWFeLIYBu/of8Sl1KPNsrAptbxGRMSgyrKGfbzzo+U/BdTSC1rCzqI9bFI6rq6ua+PCUNjybQ1af0ijgrZLGD0FU/oZPfODog13+04cEt2cFB6j8ZfuluZiT9Xde510llG9Rb0FoNpluU7NE3pFo9KpMpV6laEn2CsRs6+RWPEsMRt1V9fDxSZECPzMRyqKMA+EK0W0bFj0UyA== 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-SenderADCheck; bh=mDNbYJgqw5DdfH6QIt5Xjxj2oRs7MJaiYV+Yc58AlWA=; b=cNAnEE/rMEJ7jgEhS7332M5300QISxVaMFcCNHV3CJmNBR53TEXl6kT/geOlwqn8risSmyqEBCzsJd3rvnqlW8xjntN6BGcCek+wSuh9Q7qLo7qdXtBZKBFKRZwtKHY3LIoU2CeNJlfAOjuV5P2X9vktRtigb2qDyKnRFeunH8p17m2PdZ7K9x7IWu6v/wlKLozvGJC33KXIsSXNkJE393RmUcH0+TLQrQo/kAfIxHbm4rjtQR2yq/+DsKlsN0VZ172dNBoce/5PeQkeKWbwGBhX43jxrP9hUjhtjNJooCBoPbVZEQHKBMXne7SEmohxdHtf02uz8g8JYBQ2a7qDjA== 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=mDNbYJgqw5DdfH6QIt5Xjxj2oRs7MJaiYV+Yc58AlWA=; b=dSHebFn8c92TosBCjvlSowkhSIsngocInGLUd3lsIUD1UzimcCJBIbWqtYF4nJ0SZ5exwRt3o3UlQr3GXVX+KipGhUJdlMvfHtYaH5/+A3Waqc6/iYNKbCbKQ7OsJrJiFwSj3pWoeNzA2zt18QHjFz5w1Hh8QDpMIo7Msktw8Rg= Authentication-Results: suse.com; dkim=none (message not signed) header.d=none; suse.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BYAPR10MB3317.namprd10.prod.outlook.com (2603:10b6:a03:158::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.24; Sat, 24 Apr 2021 22:06:20 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4%7]) with mapi id 15.20.4065.021; Sat, 24 Apr 2021 22:06:20 +0000 From: Mike Christie To: lduncan@suse.com, martin.petersen@oracle.com, mrangankar@marvell.com, svernekar@marvell.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH v4 07/17] scsi: iscsi: move pool freeing Date: Sat, 24 Apr 2021 17:05:53 -0500 Message-Id: <20210424220603.123703-8-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210424220603.123703-1-michael.christie@oracle.com> References: <20210424220603.123703-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM5PR16CA0044.namprd16.prod.outlook.com (2603:10b6:4:15::30) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by DM5PR16CA0044.namprd16.prod.outlook.com (2603:10b6:4:15::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.20 via Frontend Transport; Sat, 24 Apr 2021 22:06:19 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0fc8639f-2134-4a4b-ba64-08d9076d30d4 X-MS-TrafficTypeDiagnostic: BYAPR10MB3317: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xowG9iRFHS7scRnDeiGIej21DA18gI8Bv1q8v98GbURultsxsmz9CXC0E1iMTXB99db9aQpvDlqW80+YeF8j7YUcxp3z1sJBF/SYvs34YUtKBXUZNftqbuFz+FGE1jrbbI0C6w/YrRVoEWbNUJhIJRoOUgenR3nGUangl0ZFVEASg2W6B6INNKcVccvnMJjodGprJk+hWNgh6LOYmpxSe7CXVhlCZp5GypOVW/yd0YbRbrw7H8Jvv3CwBM2n76dyJuPwj3RqEBu7xc5x5evvneIS4TNVYwyuE8FBCCYUidabAU/ypZ0jxWxmSz6A1NHGSw/KHIrl2Cfmvh9fqcx/QG3o1Mi5jzliJs6Y4w6yfbsFjao7N5bENScbvzIZI9z5Coogy2NXZC9j0T3QVDLtI+uyqE5iTWuhTYrAfd8aK4H6fMgIQwxVUFxbvcePPiDEXllO7YPtNt327VyH+lAggSIsCLiZ3D2B5uOeI/QHvla0gosLbQ1dZh03WB3TNNPIpNxOACEQWIHstCc+5uAPAI6Gq+7PLWh64a62TfgZMHg5vAa0/uIHrbY0wtLUactLr/aFIgwn+/oDv+MF7Xt9ILNmF66XHhhjML3BmCcB57H8oYOlwm1s3qVD99lL57AhzbCW1YnlEYUr+1lyuuDwmEtC309JtEwCcRbEmJwGQdNO8dVrM2CnT8rINNwQTNfq X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR10MB3573.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(366004)(346002)(396003)(376002)(39860400002)(4326008)(6666004)(1076003)(36756003)(86362001)(52116002)(478600001)(83380400001)(38350700002)(38100700002)(8936002)(5660300002)(26005)(16526019)(316002)(6512007)(8676002)(956004)(4744005)(186003)(2616005)(66476007)(2906002)(66946007)(66556008)(6486002)(107886003)(6506007)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: jECkz2IPm4IfHRoruQ0Sv6g7tohtmm9littO8wf2fCTJ9J69IAeR20e3grRJH1fPLERDnm/iOwR0gJAX9x5LanDmM5yRiqDpiUNRfANO0ktYM6rySiqi9g4e15SL96sd6K82Q5JsJXouIstU8xWcaOkp/YjNfQ0WlLUOaYDly/WrsqN05cKYlR38GG6YccPY4L4ggXk6wTt374fuppPlaIvmgoC5JajllG3Z1PNwa380GHIIFF/jGvpsGryqJL3G7YTOYaMCo0HD3clCQy6meaR8VNrulBtntVGsPkU1UD068HbMdKK1HKSHoZ1KOkOrdph2rw7Yyfa+YkJN5NUUe9qLFwH92QhK2wH9T+m0b1ceEfx+gnLPFBcWyydwtqkqxb/E8HJPJS21Vy1Rs3cIOF02rs2Vk5rsRRn/g5SS2u4EpCdR5tbHJ7Jdy0eam+0YtFU+a7T7pZJEOfQhCbnzA4O6gh1j6D7whcy/+Pw+4lv5KxBIxs7152bjMuMYKCEjnE9PVgGwqMZbyQEJkHgdIIe8LIR+GuU7tj3UuxNeu6D+oKQFYGYGHPq4Pj35lZbG6x/Rvcz19RJrLapxKIRxzFzsdlgAG65fh355i7xnKWZWwB7krrQccLwBdaMBYIHbBSTNGBG4ZBSJkwz2gub/4W4hbdYX0eQz0MLGzFRKbJvFBiE/qTz37i2vDG7DVxQczujKHn8uRzMxJEVeRDEJ63fnXAqVVffq7zlP37Q7LCOersCNTqlCaUpKuDVhPj/vRn0qW4IsE8ra5jQg0OZDYocas5qR7glzijVvkSHXOyb/N63MGkWdswd2yPatY63ELPNb1MjH8VB9UMX7cR+cbmgJB6z8va9YF2wlcaSf4YlMt4J1JGUmTq2i8LsfyAXTD1zdUMUGA8jqcL1gZD4dXxc4jgq5dd9wqRUBne8/LZHeXjS5ipZFsxVSeqTxJURbYa9RBEr3V+xhkJFTqsG/tHtiomW45KMJ1LAllNstCxMzLxnHGN/9+idtnW5b1mCnDmsjjczfqvO07DpL7xQpLxeAK+VNekazNveDpGLVKy/scdpi3kbN+IfWFLCIpI4N1ubHt5GHqOS1sSdLtPIQrN7y3fZ9qDjuRisCW2ftce2Qb/EJuFs4r3qJ0sEqUWZWQFIJKZYiPa4YXPUPGu7TqwfVmtAdL5n185hjqJbR4KcIuk+TBZfY3lFmqut2850vIWMcogbDJU6QheC0DbVdkEndMbkr2R3lgkiIhDtA8o6W7Zbru14re2A42eikVxqmDiCAMV7mI7znHbbOEpT3X4Glz6tnMApX9hjCXz0Hmdts7bPSX6nJWFW2UT1yWoE2 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0fc8639f-2134-4a4b-ba64-08d9076d30d4 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2021 22:06:20.4081 (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: XOaRjLtOkbDl/VJ9q+DwpiSP8Q0D+gG50NmqxEl66D7wyG8E8roEOJmH+w1NwuI+V++BJw04r3QzDibp6dNiS+zyykNVZGqm9rA6ChczonI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3317 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=0 adultscore=0 mlxscore=0 spamscore=0 phishscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240168 X-Proofpoint-GUID: Sn-yqWVNWAH7zahbkVSAtYCgsjwrNpuN X-Proofpoint-ORIG-GUID: Sn-yqWVNWAH7zahbkVSAtYCgsjwrNpuN X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 priorityscore=1501 lowpriorityscore=0 suspectscore=0 mlxlogscore=999 phishscore=0 spamscore=0 adultscore=0 clxscore=1015 impostorscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240168 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This doesn't fix any bugs, but it makes more sense to free the pool after we have removed the session. At that time we know nothing is touching any of the session fields, because all devices have been removed and scans are stopped. Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/libiscsi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 32363e758df2..216afafe5f73 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -3029,10 +3029,9 @@ void iscsi_session_teardown(struct iscsi_cls_session *cls_session) struct module *owner = cls_session->transport->owner; struct Scsi_Host *shost = session->host; - iscsi_pool_free(&session->cmdpool); - iscsi_remove_session(cls_session); + iscsi_pool_free(&session->cmdpool); kfree(session->password); kfree(session->password_in); kfree(session->username); From patchwork Sat Apr 24 22:05:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 427406 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54529C433B4 for ; Sat, 24 Apr 2021 22:06:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3D6FE61362 for ; Sat, 24 Apr 2021 22:06:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232203AbhDXWHM (ORCPT ); Sat, 24 Apr 2021 18:07:12 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:57292 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232384AbhDXWHJ (ORCPT ); Sat, 24 Apr 2021 18:07:09 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13OM6NDE151677; Sat, 24 Apr 2021 22:06:23 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-2020-01-29; bh=0hXH9G4tqcyHGzsvPJ2wfsuvn78NDrL2rLSHOdyBjFY=; b=Y+H7ke43nvm+EZweji6xkmizI0Egx/V/HmuRgalY8wSDeMeGozZjz5Ta+MWGqiwSldTF u89v/prUQdlHMKkxPT8PoKVU+3T7vu9YDTnS8L8j2a5h62PZZavLh1Wig2tW5RUIvm4p M4BEM0yCNaoceBbDh4WmU389s1EbB4p2ipAnYYe5qxO9D3mBlLfh7pHnio8K3dKewfn9 FGZpc0nF/8+O3VsVjxC7DqPLgkIZiL6QVN0iryoLiG9rU5Esc7kZJ0hUJjQVSh9ivjWV gQuC4gtVTmpdPc56Uimtl6d8vX3v/rnrHhAF7M+4NNNKuuhDqXi2m51wQHYC8RBYYzu9 iw== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 384ars0t11-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:06:23 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13OM66YV182267; Sat, 24 Apr 2021 22:06:22 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2104.outbound.protection.outlook.com [104.47.58.104]) by aserp3030.oracle.com with ESMTP id 3849cakfth-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:06:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y5aBk3iKwuru3bHjxJ01gLBsM6IyQ1XuDUUB4dbjcUttFxuEvs8ZRUOpI0Es3zcgl5cUgSr0O6VdcjB44aCg8J61+UZJnvP8K7gZRbuX7R6olc/x/YNZnW28QGn1fxNmENTdEmAqeZJ1/07U4GapiXQ7ggAf1PZGFvOskaXxpxOxo4TIiILOJH+ekhTt9qUPBzvQrs3AKnSbOhpcsXuQJfMNFdLOuxq+lvrbs1EIIxHqk6gqcqHLZaAvGwBJgWh6pMuhQNBbDYAM/6YzLcadiZ9gBDKLcSk8HknJSt/JvoGSL6a49vzP5x8cm1DkqgVsBgWKweMROBkQBpyPct/Hyw== 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-SenderADCheck; bh=0hXH9G4tqcyHGzsvPJ2wfsuvn78NDrL2rLSHOdyBjFY=; b=CQKjJ3Xm5Eb2yNDw5Helkp0Lx5mSLPicemdotCrGvl2Gj2PGk4r3LgM2YGUg5NF0ACdmAudmGbKjHGEEaU9AqtNne4oBaDd59NKoojazFTDPEdDxBjH1005ib8xXXtI+8YgLAJpuLsV/lAFEU7Mv8givqTAhOglNvBmjTy843YnzP5+kDjPk2xmiWZzVhKrGnnby0qeIsvgd9u84afQDAJX6VaLKEqSc3w22DL7DnTKKdt5K0H9Yi3AscSBYqn4T84HBG7H/SvxtIYYkSkD4s386rNZgzfebBcUxLx9kOyp9t4oa56WpTM2DTYypNXP5oBoa2y7THh/B5seNwKMJpA== 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=0hXH9G4tqcyHGzsvPJ2wfsuvn78NDrL2rLSHOdyBjFY=; b=zgO6cDJqauUKIOBd/k17WxO7WfS2S7QqIgr1NJp+EkD/TRrGzWcuzkKP2CLXd9ZxEoSH/dlnW072nK1re0IIumDkuLuEsGVJ5pNIOXJRbGwmNuNzBW/TVogsF6RgjDA3TUo9zpPQGr/M5Beai9QzAoUzX/OD/e8oiCX/t0otRMU= Authentication-Results: suse.com; dkim=none (message not signed) header.d=none; suse.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BYAPR10MB3317.namprd10.prod.outlook.com (2603:10b6:a03:158::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.24; Sat, 24 Apr 2021 22:06:21 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4%7]) with mapi id 15.20.4065.021; Sat, 24 Apr 2021 22:06:21 +0000 From: Mike Christie To: lduncan@suse.com, martin.petersen@oracle.com, mrangankar@marvell.com, svernekar@marvell.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH v4 08/17] scsi: qedi: fix null ref during abort handling Date: Sat, 24 Apr 2021 17:05:54 -0500 Message-Id: <20210424220603.123703-9-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210424220603.123703-1-michael.christie@oracle.com> References: <20210424220603.123703-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM5PR16CA0044.namprd16.prod.outlook.com (2603:10b6:4:15::30) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by DM5PR16CA0044.namprd16.prod.outlook.com (2603:10b6:4:15::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.20 via Frontend Transport; Sat, 24 Apr 2021 22:06:20 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c9f63aa7-79e7-4d18-ce13-08d9076d3171 X-MS-TrafficTypeDiagnostic: BYAPR10MB3317: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1850; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Mr4nec3sevGUxf5oMdF/sUBCj2e31DpOXmLounQ98W3kpwFpIXx4XOggTCOJ1mhs5L4BKZl9ju7S1lBheQbhuuXOf/meyNp1EjORoc9nP5LjSEvMG/MDI/F0iB+V7hg7HqIhFGHWXS7nFrlVEaimXRLYQYLsOQIh4gFZmiuqewkSRzQxxyTkG7CUWwO1MbuI89rL43yCZYn3EGYDbBXPixgg/PrO5amS3xB3teiA6A9HxoCdmsm/VYJFfzVMRdDaVp1VMMpLSRdTyiCmQolNujbMcz5p/OpYtqNVEmcdYRywGMAzfxzAM1X9oYj7Mn6VPvPipZ3TtQSDSXr740VqzHTRU6TAsmvJTnI/1zTPH5Dtm5DTOOKhcdHD7dSvAcNMLufcpmEorQ3viYUbHPphQLJIdjQXXDm60P0wqIreqZO3++skjPJRhynDlcSD7uZ/hd4GytuWcvIhSQFFTVkUv5+DkwEZW4Ya19gFsf0N7oHOsug9g/DRQ9yL8Z0mhvsMFqGYQlDkavFb6Z7/dUhwxK6MNdiZCEYV6TJrJlOac9NzHYWACB2Y7ETWO1vVU3YQMVxZ5aU3cHRjcTNVPHn++sGIavpfslKBp5hW++ZgFVXQn9/ehmjskxcnc1hRXRIzEnZLXmFtqhX8T4BnqGF6mOEVudHo7acpG0SdliYVcfm6RwM3o5lz/IECg0kzS7NQ X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR10MB3573.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(366004)(346002)(396003)(376002)(39860400002)(4326008)(6666004)(1076003)(36756003)(86362001)(52116002)(478600001)(83380400001)(38350700002)(38100700002)(8936002)(5660300002)(26005)(16526019)(316002)(6512007)(8676002)(956004)(4744005)(186003)(2616005)(66476007)(2906002)(66946007)(66556008)(6486002)(107886003)(6506007)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 1tOMfRL0HJ4ZpVLM1ziiYC8zQv6Izv6CqexgT5Wc52ZYWppBHaz82Q89VougyBv1RCsWE6U2CHFKMtDC8a/a2ksyDgTpXqInvEzJdI6UYrOW3YwNTiFDYShZU7elgG0ceXvfd/64GWnt0xGANAiXYpbrc7Q3ox/u1vPacPpN2t8MUwcp7wYVE236+MqHkOiucljL7pwGY/qVZL7qp58/3MRZNwwZTSDAMARPhyqsfBJXtoWikbL57Gi1qnKONJM8ROyweRRLPumVmF8ep75DJ9slZt6M/W1Oc9IRwb5cNut2mzyNDFJ9/ooynR+X9rvNtG7owZQ6jssQuw1k5I8tWG5jmI1QmeWKQeH9f9IGVnC+b3/tQxyzV03AFW19TcyEJ8NLn3x//gssFS4EuODOMOj7loVRY0qS1DTUmw1o5fgllcQ2SkPEmHm0VZn5n/dDgnN3AI/3IfxNOZzMmiU7BzrdoZba5VbsuhdkaezUhbaf1NVYu1xEEfY+ocP2ua4ueSjzJASUc7puVUpOEMnozDDGWZlEx//6Qv+7vyRJ797n6HczNiimesyaFUJAzfH/NhppI9hM6gnheNRcvd/u1Fvm90k+THRn3jFOSVwMaJeoYLqa8KEniZnVewePzF0l/GDF51HJAVHuMEZdJcqc7zsoAocYG5EMIP5Y0XTihZcszG2IXfTalO+1iAsKT86ld0GGHa68EBRZhpVdf1eL5POcGHIASUdxR7hTARnbQladsgcTkdwatKqOCNz1hI0lRJY62DW84xHKu6zSsa6sQe6xTVwKjakoymhSive8ke1vBPriunJ3u5qDQEbNAmtveUgUnOc/C2rg/PX4tt30KaeS0FYOrEoEWJyv6OSWpYDFwfF9Gnmjhf9llExPozVbE8FeEur+u7mnkVCE3zBJO0jqrBec08iKjFkbwev8UXi2N3KL5qYh72NniVGD9cGx9VMGL00Wb6Xk5XssTNtkgANjgNKWqDazZ2FjKrjL5g/Pq4tWvP399OqB/5+yyQ2kp4zdc9InbYHrAskjo2iCIqWlvPTUxF3qvMc57t+hF6xpCUDkrYZEmnlC1Hqq7S6ehdLgTe86taDnBLYd/xetZg5zfJ88RKnjpuI1rDXU1x7/vtWKjSi1Keqi9+jWg3tdeFW9DcfzhawCdU08VuYWIXQMb0Bbez7aGHpm/y4ITsqmMT04dgwzKxoYYxEC7jZoKy9RRPY9K7VYhCNcakZ3LDi5yYP0YPuyIPvFgdz67jgD+k4r1LZ/NRPn4DN4zmgH2vltYsPexQd3KgvUEmCAlLbZpuA+Avxn9thr3C0B8GMhpmiUaRld7Ax3T33T2++O X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c9f63aa7-79e7-4d18-ce13-08d9076d3171 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2021 22:06:21.4426 (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: Nj+L7gzWHNA5aXZqPixHgKVfXzC6L179TPm/0P7QoA6wOdC1G2A/GTjhurlYT4cLXAG044jRQVMiRYr8y8ycQfBlUqlJJTB+1De2DVLBFZU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3317 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=0 adultscore=0 mlxscore=0 spamscore=0 phishscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240168 X-Proofpoint-ORIG-GUID: 9Pz7viH-VMfpByqUXP6jj1D6RR73e-h8 X-Proofpoint-GUID: 9Pz7viH-VMfpByqUXP6jj1D6RR73e-h8 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 impostorscore=0 adultscore=0 malwarescore=0 phishscore=0 mlxlogscore=999 suspectscore=0 priorityscore=1501 clxscore=1015 spamscore=0 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240168 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If qedi_process_cmd_cleanup_resp finds the cmd it frees the work and sets list_tmf_work to NULL, so qedi_tmf_work should check if list_tmf_work is non-NULL when it wants to force cleanup. Reviewed-by: Manish Rangankar Signed-off-by: Mike Christie --- drivers/scsi/qedi/qedi_fw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/qedi/qedi_fw.c b/drivers/scsi/qedi/qedi_fw.c index 440ddd2309f1..cf57b4e49700 100644 --- a/drivers/scsi/qedi/qedi_fw.c +++ b/drivers/scsi/qedi/qedi_fw.c @@ -1453,7 +1453,7 @@ static void qedi_tmf_work(struct work_struct *work) ldel_exit: spin_lock_bh(&qedi_conn->tmf_work_lock); - if (!qedi_cmd->list_tmf_work) { + if (qedi_cmd->list_tmf_work) { list_del_init(&list_work->list); qedi_cmd->list_tmf_work = NULL; kfree(list_work); From patchwork Sat Apr 24 22:05:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 427045 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80766C433B4 for ; Sat, 24 Apr 2021 22:06:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5518161264 for ; Sat, 24 Apr 2021 22:06:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233485AbhDXWHQ (ORCPT ); Sat, 24 Apr 2021 18:07:16 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:33842 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233568AbhDXWHK (ORCPT ); Sat, 24 Apr 2021 18:07:10 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13OM5P1j004726; Sat, 24 Apr 2021 22:06:25 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-2020-01-29; bh=rmTXdr6Aeq+KCTHxUd67/gc4kKaf0WHYZyeGyiBBcPA=; b=KS5M5lYanWM+pIJdLUrQ9j6dd9lmxiDi+nvf5yExc/9cFgotQzmyJhOXCNLnMrNMmy9M JZJjVWMltGcLMwIcJsUJ1a5Tdmm+zYDx5rWkV9E7l4u4Ep6RbAaat/pfP4QW/ko1wEd6 wCUDE51PUq19Q/Q6WS48QtB3h2E0Yeyi10Z6plpW5jjQM8j1sVdNKj0kjjNDEzS0M/t8 k17LImRC7jIOcyAjQT+md6eI4qsiCntAF+bCrtCNOiuNsmlq8TTcZjmZsQZV6zECK4c7 cuNZ+T6FhCWO9ViJFy+0/vwRyej2Mxnw0G+/PDExTfg/1sa5P9prUYeBso5Bat8eiAPL QQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 384byp0rkq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:06:25 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13OM65rQ182259; Sat, 24 Apr 2021 22:06:24 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2109.outbound.protection.outlook.com [104.47.58.109]) by aserp3030.oracle.com with ESMTP id 3849cakftw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:06:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X3zt+OWRqCY/hZbtlg+Pg32xUXkKcpraQyTfpE+oaSkMQo6/KDElED4J5c/4UWDj+U+brzXDvClADKh+9P0xJL/NhSCF1jMhcucvPoNDdh0ZeArnRL1VgUFbaWHSFLR9EHvZ1z/NyuTo/nKrv4YgsniDg3RNtbSROPOmxVP7IgxzA+V7628eLvqKDvUzR3PKN+ZszIw2WDyuWuAPmKGMNBfoy6ExpsXwnWro3dvBuVqPHAjZlOgoIT7EjLN91T7N0NlxwuXcQ3Adh4bAWmegDfJtYzlHnVkSGMmp9wsPqbHJmvYAhg/IKI79YIM2WIA2AWvKN6zmKOQSB4F9dWx4SA== 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-SenderADCheck; bh=rmTXdr6Aeq+KCTHxUd67/gc4kKaf0WHYZyeGyiBBcPA=; b=XrklIs5hzbj7JmYb99Drjrx8EchC+y6fgyjUASRsnX6EaOOLutMYbYMdE8P+ErOj5qXr3p00O6hjKAUWIFH+YzVQz7kOPIT7gbekuHXd9xV9qSlQOZfgo6paXRa5xKAmwqbZSd1RbtttS3VSNu9HHGi9eG9mHJ4gq4kQUlRRudoHCvnJWV1ERYem9hqdkCp7dQM+/Wib9e7QoUR6vhV2hbCnzat2yM2UOoF3SdkuJRYNOeFlZqREVxO1Vgqx7vZcQ2ME/7MzBdh96Y6S1GLX4SSUyugKx+V2c8PFJZ6TAQSnIwT0EuBFtreufKNacxPLTH+wkJ8H7ZxFX/FWmObsqw== 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=rmTXdr6Aeq+KCTHxUd67/gc4kKaf0WHYZyeGyiBBcPA=; b=gUg3j0mUcT1gXFDN3MghNvUs37sPG+UN0wmYCPFHwtduTEUT0M+mAZxke3ILiTKmy5DokvYhinUClJmOLJBllYDkxXpX0rHfsy+rHRJlSSUP2ULwbRKGooXt+Iy77O3jKPb9+zqjdh4Tb6fc1etHnRdjiFc2yRHrcoV8IJW9jzc= Authentication-Results: suse.com; dkim=none (message not signed) header.d=none; suse.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BYAPR10MB3317.namprd10.prod.outlook.com (2603:10b6:a03:158::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.24; Sat, 24 Apr 2021 22:06:22 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4%7]) with mapi id 15.20.4065.021; Sat, 24 Apr 2021 22:06:22 +0000 From: Mike Christie To: lduncan@suse.com, martin.petersen@oracle.com, mrangankar@marvell.com, svernekar@marvell.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH v4 09/17] scsi: qedi: fix race during abort timeouts Date: Sat, 24 Apr 2021 17:05:55 -0500 Message-Id: <20210424220603.123703-10-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210424220603.123703-1-michael.christie@oracle.com> References: <20210424220603.123703-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM5PR16CA0044.namprd16.prod.outlook.com (2603:10b6:4:15::30) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by DM5PR16CA0044.namprd16.prod.outlook.com (2603:10b6:4:15::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.20 via Frontend Transport; Sat, 24 Apr 2021 22:06:21 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f5885e91-a462-4357-4123-08d9076d3210 X-MS-TrafficTypeDiagnostic: BYAPR10MB3317: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: paWf01H06Ar5cog0+D0fEnmAExKwPvidJUuOcgyla+Wdqb0C4qcuvMaDqGADmg0mjcf6+eOxXGwKASo0rzSKHmE4GhOSZHVY8UV/AHG7xtMeH1eqLNd+KxhOWwsJ/cJexJzyiLqK0Au2HPYXZwKKcWp5DP+9YBr+r20rSl4lUYw89zXjOT/HOF+yaPye6XQMYazmCP8bZlOZp0YV+YFzfTrpJcNHIPTG2prVB9E9v5+YB3ytSpLTl5b6wdTFg+4Gvq9PjS8DxNGvSBEollGetxHh0XsamiQmlRFxdySh6VcXGI1R/1Kj0MK1ohsPakqoVjm17FhRaMOYt3AZtCO7NDcLSQUR5h7eD+8n3GunbjlkvsyCjKOZ5vwJdf3KNt93OfsBjLwdMPpuO5qWsH8ki4oy8h7b2fTS/azXpOWZtBU1FeVgnhWlDrAN7sdQTkQ1UEwhgxQNr13vKrLF8zqgOe1YdtGHM8m8KY6AC/VPYQXkqGdeVW5fxNp1T5xMUS2aH+pDKkNODmTfGcgNUzJs5jPcX6kla+xvzoOskN2S5jgjVqdjy20/EmkoYQa3kqoAnEc9ILZXPt7vwA0ltQx3pNou3CrDuqx/oveL6rI3eKatbv7mYInWPmwipWreGZXsLMFHF2a9ycdEAaHrjTvi+JTeRF7PxrGghOC77QKj9AZg1cfqABostUXWEC2fhnjp X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR10MB3573.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(366004)(346002)(396003)(376002)(39860400002)(4326008)(6666004)(1076003)(36756003)(86362001)(52116002)(478600001)(83380400001)(38350700002)(38100700002)(8936002)(5660300002)(26005)(16526019)(316002)(6512007)(8676002)(956004)(186003)(2616005)(66476007)(2906002)(66946007)(66556008)(6486002)(107886003)(6506007)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: JSHajzlD/Jy9NXHxDIj48hJ20y7cywz+O8xSEEPMJR5/L7VHQ4JQiavKPr8Lu1g2AcDK+cldSsaRS+StOBt6DNuR/8W4BNie+kK4xPVDLVoSqoOJ1OdqH1s59btuf7ZhYpLPRk7TbNfOLI9L4DCw44d0AL9OjmiDACM/ryksTkr+sGtjvkNT+SzPipmd8GONriXHfdlzy1mmw9xIUodg49enyiU26d1ccKVoDN+vyqWQHfRMA/ZlkQ2adOfVI2Vlg//7hqICvmVG2cUatZaEz4wecMw3wLeIgSJj8hp6u4YtWZ7x77ExXDX2nOE8bI6oj9ACmOu2FEi3HTuDUUfE/i1s9uUUhQ39zbbXjDaWChDD3drQlQTx7uAQ1GbKTh38yXI8M6QRuhzBpmqPqpVc2x+kvZUviUJ8BMi8RTgcsIYQezwbOaUdIyyjtSWBwqh5AjrLSSPhkT8gvoxOEI0RyZIhes6f+ctIhnXJ6Vqfv4iYlYtSZNQQFMWIPu7DKqQ+c788Lzm3EghOOsYwIWqU1LoGtGAEJoSh9eiwuxxr13kvvvF0LIJvpHqLzr7t+ijk+Jl8YXwGfofQvSJvSsaaf/qey7icq4U39FHPito7qjAo0U2FT5JN8BYipK3+CE1pQxTD283Y0J7t54MLw1tb8cZJ8JZeMTlvyiJBgYZdsqwYZ3jfc49a3s4azBfsNkEpzu6/S8FFhu9jt/cvuGK2EdoZD9Ba468TcvKwwpSPR6GzhaatDg/X/YpFF577hZk/dEbjpJNBMOd0dgObFXXUly5d8xQ4agE8VZJJXk4NiOLZRBQhjs/4hyNccUpQiriCOx4ClH6sPdwf9RKtnzIsZiUcEOTFBxV6esThIREWhPhsg7uZx7f7fPuwKYiSm1sa1NYNmDwB54FVGaIW/KRfcqzZMS+uTnqkcCAvDbTmwrgA5XwZ9I55eE3/PYZTWfjENlskcyt8b2hxRjOgFjhfglkKgHmILsKe+zpaOVUQYmRvN5eNmFya/eWPyqA+XgYtdEX0sf6CBEcGCYYsMOZ4mlIPXTHdR2fMIKByHnZrBJ7oo03OJq9J02WhoUVFLiRdBnJxfvg2jT3JdDagab8rV1yTlSodp2aA0ccOJMhMsDlJlTlAIrB2SVF6bugC/3doKzGwdmlEc1a+suatQ2ore+eOCf7TySkRoVJaLbNatmsO2KtG+27h2irk/0S4OBsXlnL/ZeE+FiF7+n/Bz6MonMMRz7jq6r/pcQO2P6yKPSsQ3eYUhjAjJ8xjUfZliAqZAMIEYt9QxrTt5wmLQC7oBkpC2YP1czrAwJZstYOm83iu8sNX8yd7ScRDPOJ4v98d X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f5885e91-a462-4357-4123-08d9076d3210 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2021 22:06:22.4330 (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: d01K5LAPRpdPJce4WZ3YS/bpnfcpZmLCWL9eexjKhGiS+c/K1zRTJeFWRD0r6FVF4Gv9ZrvBZBip/tsSuzuyedH0hWootBHXPqmjR/GTtys= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3317 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=0 adultscore=0 mlxscore=0 spamscore=0 phishscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240168 X-Proofpoint-ORIG-GUID: hpuZ_reOaTX4N1q_sAOrE26fdD6uNEI6 X-Proofpoint-GUID: hpuZ_reOaTX4N1q_sAOrE26fdD6uNEI6 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 lowpriorityscore=0 adultscore=0 impostorscore=0 malwarescore=0 priorityscore=1501 mlxlogscore=999 suspectscore=0 clxscore=1015 mlxscore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240168 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If the SCSI cmd completes after qedi_tmf_work calls iscsi_itt_to_task then the qedi qedi_cmd->task_id could be freed and used for another cmd. If we then call qedi_iscsi_cleanup_task with that task_id we will be cleaning up the wrong cmd. This patch has us wait to release the task_id until the last put has been done on the iscsi_task. Because libiscsi grabs a ref to the task when sending the abort, we know that for the non abort timeout case that the task_id we are referencing is for the cmd that was supposed to be aborted. The next patch will fix the case where the abort timesout while we are running qedi_tmf_work. Reviewed-by: Manish Rangankar Signed-off-by: Mike Christie --- drivers/scsi/qedi/qedi_fw.c | 15 --------------- drivers/scsi/qedi/qedi_iscsi.c | 20 +++++++++++++++++--- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/drivers/scsi/qedi/qedi_fw.c b/drivers/scsi/qedi/qedi_fw.c index cf57b4e49700..c12bb2dd5ff9 100644 --- a/drivers/scsi/qedi/qedi_fw.c +++ b/drivers/scsi/qedi/qedi_fw.c @@ -73,7 +73,6 @@ static void qedi_process_logout_resp(struct qedi_ctx *qedi, spin_unlock(&qedi_conn->list_lock); cmd->state = RESPONSE_RECEIVED; - qedi_clear_task_idx(qedi, cmd->task_id); __iscsi_complete_pdu(conn, (struct iscsi_hdr *)resp_hdr, NULL, 0); spin_unlock(&session->back_lock); @@ -138,7 +137,6 @@ static void qedi_process_text_resp(struct qedi_ctx *qedi, spin_unlock(&qedi_conn->list_lock); cmd->state = RESPONSE_RECEIVED; - qedi_clear_task_idx(qedi, cmd->task_id); __iscsi_complete_pdu(conn, (struct iscsi_hdr *)resp_hdr_ptr, qedi_conn->gen_pdu.resp_buf, @@ -164,13 +162,11 @@ static void qedi_tmf_resp_work(struct work_struct *work) iscsi_block_session(session->cls_session); rval = qedi_cleanup_all_io(qedi, qedi_conn, qedi_cmd->task, true); if (rval) { - qedi_clear_task_idx(qedi, qedi_cmd->task_id); iscsi_unblock_session(session->cls_session); goto exit_tmf_resp; } iscsi_unblock_session(session->cls_session); - qedi_clear_task_idx(qedi, qedi_cmd->task_id); spin_lock(&session->back_lock); __iscsi_complete_pdu(conn, (struct iscsi_hdr *)resp_hdr_ptr, NULL, 0); @@ -245,8 +241,6 @@ static void qedi_process_tmf_resp(struct qedi_ctx *qedi, goto unblock_sess; } - qedi_clear_task_idx(qedi, qedi_cmd->task_id); - __iscsi_complete_pdu(conn, (struct iscsi_hdr *)resp_hdr_ptr, NULL, 0); kfree(resp_hdr_ptr); @@ -314,7 +308,6 @@ static void qedi_process_login_resp(struct qedi_ctx *qedi, "Freeing tid=0x%x for cid=0x%x\n", cmd->task_id, qedi_conn->iscsi_conn_id); cmd->state = RESPONSE_RECEIVED; - qedi_clear_task_idx(qedi, cmd->task_id); } static void qedi_get_rq_bdq_buf(struct qedi_ctx *qedi, @@ -468,7 +461,6 @@ static int qedi_process_nopin_mesg(struct qedi_ctx *qedi, } spin_unlock(&qedi_conn->list_lock); - qedi_clear_task_idx(qedi, cmd->task_id); } done: @@ -673,7 +665,6 @@ static void qedi_scsi_completion(struct qedi_ctx *qedi, if (qedi_io_tracing) qedi_trace_io(qedi, task, cmd->task_id, QEDI_IO_TRACE_RSP); - qedi_clear_task_idx(qedi, cmd->task_id); __iscsi_complete_pdu(conn, (struct iscsi_hdr *)hdr, conn->data, datalen); error: @@ -730,7 +721,6 @@ static void qedi_process_nopin_local_cmpl(struct qedi_ctx *qedi, cqe->itid, cmd->task_id); cmd->state = RESPONSE_RECEIVED; - qedi_clear_task_idx(qedi, cmd->task_id); spin_lock_bh(&session->back_lock); __iscsi_put_task(task); @@ -748,7 +738,6 @@ static void qedi_process_cmd_cleanup_resp(struct qedi_ctx *qedi, itt_t protoitt = 0; int found = 0; struct qedi_cmd *qedi_cmd = NULL; - u32 rtid = 0; u32 iscsi_cid; struct qedi_conn *qedi_conn; struct qedi_cmd *dbg_cmd; @@ -779,7 +768,6 @@ static void qedi_process_cmd_cleanup_resp(struct qedi_ctx *qedi, found = 1; mtask = qedi_cmd->task; tmf_hdr = (struct iscsi_tm *)mtask->hdr; - rtid = work->rtid; list_del_init(&work->list); kfree(work); @@ -821,8 +809,6 @@ static void qedi_process_cmd_cleanup_resp(struct qedi_ctx *qedi, if (qedi_cmd->state == CLEANUP_WAIT_FAILED) qedi_cmd->state = CLEANUP_RECV; - qedi_clear_task_idx(qedi_conn->qedi, rtid); - spin_lock(&qedi_conn->list_lock); if (likely(dbg_cmd->io_cmd_in_list)) { dbg_cmd->io_cmd_in_list = false; @@ -856,7 +842,6 @@ static void qedi_process_cmd_cleanup_resp(struct qedi_ctx *qedi, QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_TID, "Freeing tid=0x%x for cid=0x%x\n", cqe->itid, qedi_conn->iscsi_conn_id); - qedi_clear_task_idx(qedi_conn->qedi, cqe->itid); } else { qedi_get_proto_itt(qedi, cqe->itid, &ptmp_itt); diff --git a/drivers/scsi/qedi/qedi_iscsi.c b/drivers/scsi/qedi/qedi_iscsi.c index 30dc345b011c..416202bc4241 100644 --- a/drivers/scsi/qedi/qedi_iscsi.c +++ b/drivers/scsi/qedi/qedi_iscsi.c @@ -772,7 +772,6 @@ static int qedi_mtask_xmit(struct iscsi_conn *conn, struct iscsi_task *task) } cmd->conn = conn->dd_data; - cmd->scsi_cmd = NULL; return qedi_iscsi_send_generic_request(task); } @@ -783,6 +782,10 @@ static int qedi_task_xmit(struct iscsi_task *task) struct qedi_cmd *cmd = task->dd_data; struct scsi_cmnd *sc = task->sc; + /* Clear now so in cleanup_task we know it didn't make it */ + cmd->scsi_cmd = NULL; + cmd->task_id = U16_MAX; + if (test_bit(QEDI_IN_SHUTDOWN, &qedi_conn->qedi->flags)) return -ENODEV; @@ -1380,13 +1383,24 @@ static umode_t qedi_attr_is_visible(int param_type, int param) static void qedi_cleanup_task(struct iscsi_task *task) { - if (!task->sc || task->state == ISCSI_TASK_PENDING) { + struct qedi_cmd *cmd; + + if (task->state == ISCSI_TASK_PENDING) { QEDI_INFO(NULL, QEDI_LOG_IO, "Returning ref_cnt=%d\n", refcount_read(&task->refcount)); return; } - qedi_iscsi_unmap_sg_list(task->dd_data); + if (task->sc) + qedi_iscsi_unmap_sg_list(task->dd_data); + + cmd = task->dd_data; + if (cmd->task_id != U16_MAX) + qedi_clear_task_idx(iscsi_host_priv(task->conn->session->host), + cmd->task_id); + + cmd->task_id = U16_MAX; + cmd->scsi_cmd = NULL; } struct iscsi_transport qedi_iscsi_transport = { From patchwork Sat Apr 24 22:05:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 427046 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2731C43460 for ; Sat, 24 Apr 2021 22:06:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7BB2661152 for ; Sat, 24 Apr 2021 22:06:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231911AbhDXWHO (ORCPT ); Sat, 24 Apr 2021 18:07:14 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:53556 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232715AbhDXWHK (ORCPT ); Sat, 24 Apr 2021 18:07:10 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13OM6PrP124448; Sat, 24 Apr 2021 22:06:25 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-2020-01-29; bh=ipABApYBx/qHtNmgooPAL349hnbndgGsnw3Q/t4olBM=; b=F7JS3Ys24CZc68/c67bmKqSQ1hL6Ugl9TdHhn1LMJc5ALs0BB+FOfE/hciFcLsrAMz+U Ls62I//88JA3IpQ8RxM0ODLvTFcxNbJICutemYQnC8gkHVJ0ht6e4Fr5ScGY7iuBczFW KYJClzhWajwoIQxQzWFuOVCqKo4bk5SEMdCbR2960KR8i4LwkUCjDe8aeFN5q+jxaqXt nbrs62KTidyxAQMBT4siu0p4K/5pUUjBNU9PjS7M3PILDSVVUPFou7HxXCB+OBS1flBR 9xRKmL3RdlrHCP6/D7SSRAWnBtez1KQ7xarn3OJ8mMZx50veRhmoIDFFS3UozHNuoUoK jA== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 384b9n0shj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:06:25 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13OM65rR182259; Sat, 24 Apr 2021 22:06:25 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2109.outbound.protection.outlook.com [104.47.58.109]) by aserp3030.oracle.com with ESMTP id 3849cakftw-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:06:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GcsvjxvGpG2vzc71vYaqNKvbPOaGOrualTkFi46HjcDIwA3+AFodPUf1EckJjx/vr3DHIf4egWSxeLoSWraGTV4WU0jtVgZJbp+uQl6CnvIfCHVjlfRezbahW5pHilz5C43lwj+Vd1qdJHUI18ldEwSRc0WP8G2gG7fG0b54KILZLO0RIkDg2xLqC7cJ/VT5naJAVUVy5V7Z6nAmZ2e9vItERZvGouYunymhwaJ9vAzC3aHpZRkgc6ddrhBXsKO9osZ4Omz2PYD0/qoqDjNiuaHBW3j0qUPuAA3ZhnXHJwPlMsBGEio13HAmzXkkbShSBhSSwlztXhi23AE9rqhzPQ== 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-SenderADCheck; bh=ipABApYBx/qHtNmgooPAL349hnbndgGsnw3Q/t4olBM=; b=OdFrXim049orJyoD0uTLXhSo6a69luQayzO0SYWDmqdNVydAtkKu/OdL8UKROk1gV/3kwADwyykjCZXkQ4cjdeHUiUmwzR72innaDKJRfoXHFOMW8/zRH8RZCxLnkMWGqILPetydiK2eBhj2sFZapYd6HMys4U9vyf+Hv38RzTZiDPaKwDKAmvqi8n2tO2q1n+J82LE4SQvKeF/LMh4xcBoxYdyQcrKcSYg3uAovBVzUZUPHhI8ybJ1YwZJsncQb/Hxa7+UBZ/zNqhXNN4pplqxNId+hZ2CWjM2su+rbfOyd3NpuF2FxsP12ObIi8iZYxYjx1NPpBrC/jfRZ4vTkgA== 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=ipABApYBx/qHtNmgooPAL349hnbndgGsnw3Q/t4olBM=; b=CgnEJKewDjjxFMrERWnqSVuYD6bnw9ZjS5bGhzOkom5RPHU+Pq4T1JjUOvIgzUddMApr6SDMfMQbNW/DjqFdoDd5dutluyO2JR/OlXkJ1uZCAuIYJ+pMQAv6ks1qh8nSEycDNNY8ZRVR6+pHU7pFPbCKvqdo+ldvqrMHj/lBuI0= Authentication-Results: suse.com; dkim=none (message not signed) header.d=none; suse.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BYAPR10MB3317.namprd10.prod.outlook.com (2603:10b6:a03:158::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.24; Sat, 24 Apr 2021 22:06:23 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4%7]) with mapi id 15.20.4065.021; Sat, 24 Apr 2021 22:06:23 +0000 From: Mike Christie To: lduncan@suse.com, martin.petersen@oracle.com, mrangankar@marvell.com, svernekar@marvell.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH v4 10/17] scsi: qedi: fix use after free during abort cleanup Date: Sat, 24 Apr 2021 17:05:56 -0500 Message-Id: <20210424220603.123703-11-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210424220603.123703-1-michael.christie@oracle.com> References: <20210424220603.123703-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM5PR16CA0044.namprd16.prod.outlook.com (2603:10b6:4:15::30) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by DM5PR16CA0044.namprd16.prod.outlook.com (2603:10b6:4:15::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.20 via Frontend Transport; Sat, 24 Apr 2021 22:06:22 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e7e926f2-b1d4-4f77-91a7-08d9076d32ac X-MS-TrafficTypeDiagnostic: BYAPR10MB3317: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hGfBWUqE1ZFxJk6CLUPLDVt/7UJZltYpmvYkwBRP2HE1MesPyNnMDZSyeuFMSAk/pyfmGhSln2ymufJ0qLG0En0nBgj8BSLWV34510rh0WTCLDj1xgFZlhVy0mmJPrCiawGRGsRWqs8d8cz9htUpPEyrZ08Di+25D+e2AdJwHSQvZ7l+xpO2QUw/MBCWHnOZzL4sHJC9HAYz26CaSTtfBTIFCmTGzX52DRkF75VBi62ZEMsnaZk+Yw5uhmMICgpYdp/GZvBXtu0uZH6BiwayNOZ5saWHTgDF41Isnzj6EK4waXztwTA+s/aIG3YuqPwIbxKZNrSItJxTZq8mfk0sCslbt96ZLc/Q2crqRnC23aTKm95Wj8TuteEsOxrrPI+so7v1ifHyJfXl6jLLSJM7InnDIfFk8Bn/aUA1TDmEuMXCfeouLdRz94da0hOmmxhOsq6+eWveBsAPp0oVA4WrB5JDWVyymmLFrB1dUTKXoIEdlUsYSBH7s1nsvW3j/B9ay8Q/adJa/qArho3Ri/rmSlV5gUlA4dKBE5YCyaU0pzgvJkzv8zjfWfbCQInFbHrPqrK/dajiFfNEoCdbJRR/b808oY9O9BsTTLKftD4wUL8u9J8Q8YnKl2IuPlsojY/P5uHRbhNLxVCIwaZcsJ2nsqhKUUaLoFyxHqtRGTxIyoM= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR10MB3573.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(366004)(346002)(396003)(376002)(39860400002)(4326008)(6666004)(1076003)(36756003)(86362001)(52116002)(478600001)(83380400001)(38350700002)(38100700002)(8936002)(5660300002)(26005)(16526019)(316002)(6512007)(8676002)(956004)(186003)(2616005)(66476007)(2906002)(66946007)(66556008)(6486002)(107886003)(6506007)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: OW9cEcgF8jO6Fisk/zjM4YfpxJntyCqXY9lXv1V+NYeeyE6XhAd+AvNcRLSxype1GG0uau52Eb3YjNcMY7LPP8d0bfh88+Lo+FgmNXbOwlHnx8UVPQhUt7/hLLWV7mTW7R79ccMNCL9fWG6lK1nl+YHZQi64E7bhHsF2vuEIPgViQBrC0I0ZBeJpLh2KOCOvKOcn9U70DnjfCaYDBd/HXaDW6AKcxvesx44S+/6LafN3zbAdVzrtyBJdA7wFJoNmh1lGqUREwHlKbe7bhn5t9rbMW4rwmuLOGVJJmbSNfZhZMb+lfTAEFeIkE2tNM89MO+TMIQDz2Xc/U6GqIXf2k+Km7zZ9fTB8/EBngx7++hHY17S6Ff3sILWGstYbtUdZ23csPM3iIPBJs/Q4IpM7OOwfb3cHeYTiOQiLw1ytHwJd3V0B0Ff9JuZjit6tYFhT5lNbJcA5HcHyrRWrN/vomoRqc1z6jZTTfd/gnp9UbrxRidQNz1Zz6Vr5VwnGW3q/HOEX35inPV1OpsFbpsaDcRDuNKKp43kpxLSXIFW9p5pU/Fmriu/6UMXt2T5iEfBNcspakgCbovx/wPTOXS0cfchw7FfOCkWxPsHzmHmw01Z6ySrh8w3dk/uMtd083p3xI+z2C98nv9UnwRqJuwVIyyXdC3f98jQm3hrvfedzwpu/E2D88wj72axgk26sn/W5IBKJRdCAyoCubSegIx00350bYnPJ2K7eaIt6LGUY75U02hCzgqb3NwbUBf5Bh8ziwv5zbeCygJR07Kk+MhXLOB4IRYYiJfBXxSKdK3XikWqQsK5B703nI98KGU2ZpvA/morXVYn5H0SPIT3OT42eFUswHH01jD3Tjmx2Efa+VS2FbXAnpj/UXZmyb582g+ZXyPtH8GXUi9g3Q0epmeugt/C/exrWhJI3ZzrgvuJfAmweaqcTxj1i0jnvPsV2bk4YsVCETD9JvvftsE9q5hOY092DFdAIWrEc0HJPOFRRhN+9CYuOdRH8nRe9HlqKqeT5KUWavkKnEJyiUxaUUUuhgE7PTbHIHzey8efrsEEMo0SOdnPxsN81sSHkL3mG8oqRtfDLgfgpBwZYZrY5wG1pnNJbAJxkgqU4jiKhleU97IFkdYDWnmLPVqS3W2sLpHk/Dnk4DP7NkO4S9iPLtx+1J0fpJGx/d8pUmjahgXNiGGOylhwb8yahVP/bIzAIYvQnFF12cW71KX7PxgR43+xmRVuy994KTvxhZR6hOVtRMu25roUX6PwbWr0a/eKf6Ax3A6rAioX+7VcwjCSbeF2UzaFoIh7ZeAL7IoO1DApSYHF0KL7ZTtBeiHvOMGSjKe/b X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e7e926f2-b1d4-4f77-91a7-08d9076d32ac X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2021 22:06:23.4654 (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: UxYURskn+wSJOKjJBBqDE9Tbp6Oc0pk6nPTa1bRiWNugAbeQLKTSrjRTyaYsEsbK+VU6NBcoa/xlJjKkmcLrbxKdeKCN09T9n8Og2Gdi7R8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3317 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=0 adultscore=0 mlxscore=0 spamscore=0 phishscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240168 X-Proofpoint-ORIG-GUID: 7EMEbQcMK5yC0xU2tCXf93vr7yje9UY2 X-Proofpoint-GUID: 7EMEbQcMK5yC0xU2tCXf93vr7yje9UY2 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 lowpriorityscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 suspectscore=0 spamscore=0 priorityscore=1501 clxscore=1015 impostorscore=0 phishscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240168 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This fixes two bugs: 1. The scsi cmd task could be completed and the abort could timeout while we are running qedi_tmf_work so we need to get a ref to the task. 2. If qedi_tmf_work's qedi_wait_for_cleanup_request call times out we will also force the clean up of the qedi_work_map but qedi_process_cmd_cleanup_resp could still be accessing the qedi_cmd for the abort TMF. We can then race where qedi_process_cmd_cleanup_resp is still accessing the mtask's qedi_cmd but libiscsi has escalated to session level cleanup and is cleaning up the mtask while we are still accessing it. To fix this issue we extend where we hold the tmf_work_lock and back_lock so the qedi_process_cmd_cleanup_resp access is serialized with the cleanup done in qedi_tmf_work and any completion handling for the iscsi_task. Reviewed-by: Manish Rangankar Signed-off-by: Mike Christie --- drivers/scsi/qedi/qedi_fw.c | 110 ++++++++++++++++++--------------- drivers/scsi/qedi/qedi_iscsi.h | 1 + 2 files changed, 61 insertions(+), 50 deletions(-) diff --git a/drivers/scsi/qedi/qedi_fw.c b/drivers/scsi/qedi/qedi_fw.c index c12bb2dd5ff9..b53940af4230 100644 --- a/drivers/scsi/qedi/qedi_fw.c +++ b/drivers/scsi/qedi/qedi_fw.c @@ -729,7 +729,6 @@ static void qedi_process_nopin_local_cmpl(struct qedi_ctx *qedi, static void qedi_process_cmd_cleanup_resp(struct qedi_ctx *qedi, struct iscsi_cqe_solicited *cqe, - struct iscsi_task *task, struct iscsi_conn *conn) { struct qedi_work_map *work, *work_tmp; @@ -741,7 +740,7 @@ static void qedi_process_cmd_cleanup_resp(struct qedi_ctx *qedi, u32 iscsi_cid; struct qedi_conn *qedi_conn; struct qedi_cmd *dbg_cmd; - struct iscsi_task *mtask; + struct iscsi_task *mtask, *task; struct iscsi_tm *tmf_hdr = NULL; iscsi_cid = cqe->conn_id; @@ -767,6 +766,7 @@ static void qedi_process_cmd_cleanup_resp(struct qedi_ctx *qedi, } found = 1; mtask = qedi_cmd->task; + task = work->ctask; tmf_hdr = (struct iscsi_tm *)mtask->hdr; list_del_init(&work->list); @@ -774,52 +774,47 @@ static void qedi_process_cmd_cleanup_resp(struct qedi_ctx *qedi, qedi_cmd->list_tmf_work = NULL; } } - spin_unlock_bh(&qedi_conn->tmf_work_lock); - - if (found) { - QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM, - "TMF work, cqe->tid=0x%x, tmf flags=0x%x, cid=0x%x\n", - proto_itt, tmf_hdr->flags, qedi_conn->iscsi_conn_id); - - if ((tmf_hdr->flags & ISCSI_FLAG_TM_FUNC_MASK) == - ISCSI_TM_FUNC_ABORT_TASK) { - spin_lock_bh(&conn->session->back_lock); - protoitt = build_itt(get_itt(tmf_hdr->rtt), - conn->session->age); - task = iscsi_itt_to_task(conn, protoitt); - - spin_unlock_bh(&conn->session->back_lock); + if (!found) { + spin_unlock_bh(&qedi_conn->tmf_work_lock); + goto check_cleanup_reqs; + } - if (!task) { - QEDI_NOTICE(&qedi->dbg_ctx, - "IO task completed, tmf rtt=0x%x, cid=0x%x\n", - get_itt(tmf_hdr->rtt), - qedi_conn->iscsi_conn_id); - return; - } + QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM, + "TMF work, cqe->tid=0x%x, tmf flags=0x%x, cid=0x%x\n", + proto_itt, tmf_hdr->flags, qedi_conn->iscsi_conn_id); + + spin_lock_bh(&conn->session->back_lock); + if (iscsi_task_is_completed(task)) { + QEDI_NOTICE(&qedi->dbg_ctx, + "IO task completed, tmf rtt=0x%x, cid=0x%x\n", + get_itt(tmf_hdr->rtt), qedi_conn->iscsi_conn_id); + goto unlock; + } - dbg_cmd = task->dd_data; + dbg_cmd = task->dd_data; - QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM, - "Abort tmf rtt=0x%x, i/o itt=0x%x, i/o tid=0x%x, cid=0x%x\n", - get_itt(tmf_hdr->rtt), get_itt(task->itt), - dbg_cmd->task_id, qedi_conn->iscsi_conn_id); + QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM, + "Abort tmf rtt=0x%x, i/o itt=0x%x, i/o tid=0x%x, cid=0x%x\n", + get_itt(tmf_hdr->rtt), get_itt(task->itt), dbg_cmd->task_id, + qedi_conn->iscsi_conn_id); - if (qedi_cmd->state == CLEANUP_WAIT_FAILED) - qedi_cmd->state = CLEANUP_RECV; + spin_lock(&qedi_conn->list_lock); + if (likely(dbg_cmd->io_cmd_in_list)) { + dbg_cmd->io_cmd_in_list = false; + list_del_init(&dbg_cmd->io_cmd); + qedi_conn->active_cmd_count--; + } + spin_unlock(&qedi_conn->list_lock); + qedi_cmd->state = CLEANUP_RECV; +unlock: + spin_unlock_bh(&conn->session->back_lock); + spin_unlock_bh(&qedi_conn->tmf_work_lock); + wake_up_interruptible(&qedi_conn->wait_queue); + return; - spin_lock(&qedi_conn->list_lock); - if (likely(dbg_cmd->io_cmd_in_list)) { - dbg_cmd->io_cmd_in_list = false; - list_del_init(&dbg_cmd->io_cmd); - qedi_conn->active_cmd_count--; - } - spin_unlock(&qedi_conn->list_lock); - qedi_cmd->state = CLEANUP_RECV; - wake_up_interruptible(&qedi_conn->wait_queue); - } - } else if (qedi_conn->cmd_cleanup_req > 0) { +check_cleanup_reqs: + if (qedi_conn->cmd_cleanup_req > 0) { spin_lock_bh(&conn->session->back_lock); qedi_get_proto_itt(qedi, cqe->itid, &ptmp_itt); protoitt = build_itt(ptmp_itt, conn->session->age); @@ -842,6 +837,7 @@ static void qedi_process_cmd_cleanup_resp(struct qedi_ctx *qedi, QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_TID, "Freeing tid=0x%x for cid=0x%x\n", cqe->itid, qedi_conn->iscsi_conn_id); + qedi_clear_task_idx(qedi_conn->qedi, cqe->itid); } else { qedi_get_proto_itt(qedi, cqe->itid, &ptmp_itt); @@ -944,8 +940,7 @@ void qedi_fp_process_cqes(struct qedi_work *work) goto exit_fp_process; case ISCSI_CQE_TYPE_TASK_CLEANUP: QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM, "CleanUp CqE\n"); - qedi_process_cmd_cleanup_resp(qedi, &cqe->cqe_solicited, task, - conn); + qedi_process_cmd_cleanup_resp(qedi, &cqe->cqe_solicited, conn); goto exit_fp_process; default: QEDI_ERR(&qedi->dbg_ctx, "Error cqe.\n"); @@ -1372,12 +1367,22 @@ static void qedi_tmf_work(struct work_struct *work) tmf_hdr = (struct iscsi_tm *)mtask->hdr; set_bit(QEDI_CONN_FW_CLEANUP, &qedi_conn->flags); - ctask = iscsi_itt_to_task(conn, tmf_hdr->rtt); - if (!ctask || !ctask->sc) { + spin_lock_bh(&conn->session->back_lock); + ctask = iscsi_itt_to_ctask(conn, tmf_hdr->rtt); + if (!ctask || iscsi_task_is_completed(ctask)) { + spin_unlock_bh(&conn->session->back_lock); QEDI_ERR(&qedi->dbg_ctx, "Task already completed\n"); - goto abort_ret; + goto clear_cleanup; } + /* + * libiscsi gets a ref before sending the abort, but if libiscsi times + * it out then it could release it and the cmd could complete from + * under us. + */ + __iscsi_get_task(ctask); + spin_unlock_bh(&conn->session->back_lock); + cmd = (struct qedi_cmd *)ctask->dd_data; QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO, "Abort tmf rtt=0x%x, cmd itt=0x%x, cmd tid=0x%x, cid=0x%x\n", @@ -1387,19 +1392,20 @@ static void qedi_tmf_work(struct work_struct *work) if (qedi_do_not_recover) { QEDI_ERR(&qedi->dbg_ctx, "DONT SEND CLEANUP/ABORT %d\n", qedi_do_not_recover); - goto abort_ret; + goto put_task; } list_work = kzalloc(sizeof(*list_work), GFP_ATOMIC); if (!list_work) { QEDI_ERR(&qedi->dbg_ctx, "Memory allocation failed\n"); - goto abort_ret; + goto put_task; } qedi_cmd->type = TYPEIO; list_work->qedi_cmd = qedi_cmd; list_work->rtid = cmd->task_id; list_work->state = QEDI_WORK_SCHEDULED; + list_work->ctask = ctask; qedi_cmd->list_tmf_work = list_work; QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM, @@ -1432,7 +1438,9 @@ static void qedi_tmf_work(struct work_struct *work) qedi_cmd->task_id = tid; qedi_send_iscsi_tmf(qedi_conn, qedi_cmd->task); -abort_ret: +put_task: + iscsi_put_task(ctask); +clear_cleanup: clear_bit(QEDI_CONN_FW_CLEANUP, &qedi_conn->flags); return; @@ -1453,6 +1461,8 @@ static void qedi_tmf_work(struct work_struct *work) } spin_unlock(&qedi_conn->list_lock); + iscsi_put_task(ctask); + clear_bit(QEDI_CONN_FW_CLEANUP, &qedi_conn->flags); } diff --git a/drivers/scsi/qedi/qedi_iscsi.h b/drivers/scsi/qedi/qedi_iscsi.h index 39dc27c85e3c..68ef519f5480 100644 --- a/drivers/scsi/qedi/qedi_iscsi.h +++ b/drivers/scsi/qedi/qedi_iscsi.h @@ -212,6 +212,7 @@ struct qedi_cmd { struct qedi_work_map { struct list_head list; struct qedi_cmd *qedi_cmd; + struct iscsi_task *ctask; int rtid; int state; From patchwork Sat Apr 24 22:05:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 427405 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99F88C433ED for ; Sat, 24 Apr 2021 22:06:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7682C61152 for ; Sat, 24 Apr 2021 22:06:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233856AbhDXWHP (ORCPT ); Sat, 24 Apr 2021 18:07:15 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:53558 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233068AbhDXWHK (ORCPT ); Sat, 24 Apr 2021 18:07:10 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13OM6QYp124451; Sat, 24 Apr 2021 22:06:26 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-2020-01-29; bh=Ds8aIWHgDHKWdmQzIG/BSx7pkm84h4tu9i5T2LzU7pE=; b=iHBpr8oTAA0x78ue4Ka+Wthk3VcggTamnTdL7WiQcfd6+jd0HfUTvg862dt9KCSL9MjO HWU7J8uVzcR9MdDn4nDeYgdg7dIuLXvay0EdRmCkoZzGj8iVEsO/0Z9p1y127vm+jW8A XvosEsVKycX4Jw5vdVnIAulpLxQtjHYLdxAI6b5u6iqEZ87P9iruFwWfLeKXd7D4EvHy Wqbg1uk39lRrH5HzBk4I+nekNfRd7Ngu4zCfeTT7QS5XQl8xkJ0/9Gsx/Q1d0BzM51rr QpS3ZdmbGaXd3bev0KMr9x8S0w5njZUY9Y1mpfMLXgj6s3/idDaWSMl3ZBHddeD+Tc21 Jg== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 384b9n0shk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:06:26 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13OM65rS182259; Sat, 24 Apr 2021 22:06:25 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2109.outbound.protection.outlook.com [104.47.58.109]) by aserp3030.oracle.com with ESMTP id 3849cakftw-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:06:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=awfoqroYzQYscg9mWDCPGoraiOO/W7y/yXkTKyhGFv2BmDTajCcUXlE+VdcdZoT9Bjr/uSd21sKRxQm8mzp/v7YpDT5Hguf/DAIOlDRTNAKKJsedZych5t6feiHj34S6oyY/qi1ntVBZMjZQg4wRoGXy6AI7wemUeL/9pyIIqxA4ExJ2Nc7nE444It7eBptVKooasC/PTS9aj+ZD6Sp3ekRLft4gNlBM7bp27bzezmHstqbdwG4E7sQSw4v6J4yCLqH0jnTf0C2nnOegYWigtzK+lZAyYKrsIFn66YHTZO0vTjsDL+NjS4F537MEGihu8OxBWRGxjHYi1w9x4idwwg== 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-SenderADCheck; bh=Ds8aIWHgDHKWdmQzIG/BSx7pkm84h4tu9i5T2LzU7pE=; b=kal5przgvUd7P3ClUWl49x1Thore90wcOk+xO2BtVkn6eSfrAzteQHGwxJexT8Q8pq51yJp+ht/Jidj1Qax3kgmFLyjE1fG7/RReySXRkcIFseuLgOp9d4BskALJ69Rbg1G+dZ7jT9KFj0r4l3wypNSJUWqJYUJvgb9dIi+jFliRoMlC5EQbkCBPVslZg+Pznak0htiY/sDzvfwi8tpY0wAxv4suomdYsG80I3uhUMw8HgutQ2jztfvwyuA57jpiNqhhnxdGOLPdkbFLsR9Na0UilLZhJGYwCna6tldkdpJI1owigjPg4zmzGL+6LRL4+alYATv5Cbcr9IM+DoOezA== 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=Ds8aIWHgDHKWdmQzIG/BSx7pkm84h4tu9i5T2LzU7pE=; b=iDxwzmP8j8MoK26xY9LrtSgCgqWrs3UbnCjk5O/iTkUawOg5F/B1mYxJf2WHqQxbd8vT9WGUtk0+lclAdgY57jsxM8KfBMh98AAZNj44yimb80dMbJ532o79+a8heuXyzmnYpf53WEqL+9SgX8I15Heaij+YRC5gu9vJHEE7BCE= Authentication-Results: suse.com; dkim=none (message not signed) header.d=none; suse.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BYAPR10MB3317.namprd10.prod.outlook.com (2603:10b6:a03:158::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.24; Sat, 24 Apr 2021 22:06:24 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4%7]) with mapi id 15.20.4065.021; Sat, 24 Apr 2021 22:06:24 +0000 From: Mike Christie To: lduncan@suse.com, martin.petersen@oracle.com, mrangankar@marvell.com, svernekar@marvell.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH v4 11/17] scsi: qedi: fix TMF tid allocation Date: Sat, 24 Apr 2021 17:05:57 -0500 Message-Id: <20210424220603.123703-12-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210424220603.123703-1-michael.christie@oracle.com> References: <20210424220603.123703-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM5PR16CA0044.namprd16.prod.outlook.com (2603:10b6:4:15::30) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by DM5PR16CA0044.namprd16.prod.outlook.com (2603:10b6:4:15::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.20 via Frontend Transport; Sat, 24 Apr 2021 22:06:23 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3e8135f6-5acf-40da-f367-08d9076d3349 X-MS-TrafficTypeDiagnostic: BYAPR10MB3317: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4502; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: W+rMtqNYye2P+WK5XZVHwFnByQsOmaSmKeKv3oGLztZWIaudAttu0usT8HOkgfljrgHlZ/RJWhMfPVfmJaHq6BDw18X6Bd/UnQEx0Z+bfaJhNeqDF2fOdXlMTGGP0yUG+cBKiem9QjuCqt38MPH82PF4su/3O/KnGDiLALRatKgZEZALbacALHB6xiasukfr0YnnuX9yANHxBYK+KYBbcqXqE3Cl/quyyCeG3WpoRe6Jy5fl0QVOeCKpoCLnDGABSjTKxLGW4omLHb5ItQxdefWBpmghyH+7XreIX/YraaceRyD3ofmtuQd82V6TcZ6zofzD6DwNJ7PHof8DC6ZiKUQGZqNR3LOASPlabLXxLzlypN48ibQNRyt4JMgPSL7/kajxxW5bBp+DQ6ncCYBmDwzre7WjVSKRolHeHqY8s8RDDo56fZfm1sSGFJsofI20x/nGlleIveL+t4MZSBtYO4xDsGN8PrXB8x8CISyLa7ngC7y4P72I/F6Ojm4ID4cIpcVjR91NDmX9pGHcP3OApqAijpnRqytWginfEEasY6GqjmTXDC2QS8NYBKvpvPdlcmEzfPOIdRC8lejXydQ0zmcvC2lVikEQ4nAOs1yvaYPbGVJ9jUY62G1eN6tXpIAHG+NIwS7JjeCvB1+brdGXqupoZbPPcBBixO7yzuUIo01fv93JgEb07UFRRGF8ITLT X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR10MB3573.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(366004)(346002)(396003)(376002)(39860400002)(4326008)(6666004)(1076003)(36756003)(86362001)(52116002)(478600001)(83380400001)(38350700002)(38100700002)(8936002)(5660300002)(26005)(16526019)(316002)(6512007)(8676002)(956004)(186003)(2616005)(66476007)(2906002)(66946007)(66556008)(6486002)(107886003)(6506007)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: awuIgL3q37y7KdEul+CtpZ/1uq1CQSPs96hY4VYmuCLQ/y2cyzo+LcWktKdMPsaN6zcqbradYdWtYXkQToZi2c+NFPbCi5VdNULltr3MQTIq+ipKn8A0IXGoHbgqyLGnnBMpsj358fhTbpjb8majPP9/Ol0nq8Fr2vYHOCNcYqncP8uoBRKqx1tMKmvOFYb548aWZYtnewQ8djNgHTw6vhrPN7Szdb3aCY9OyUgaGnnFTMBVyNSzH4g4PPv6x8QA79tSIEKCUVKt1NZnhKYp+4g9JbmPEaY4rt0mP9mFN6/CPc3jK6rGrQGr0S4y1ld6AGIXCf/bIkX8xpdgPLD0MsGUNmBXlR6LkHulKlP9XIXacQkXK6s/2VuH0iGeQjFBXZ9ryb9ZvgjRQiwiUM4Fcz8shl1sXOsoWe+k73nZS7pNYcY746B93t2qCVCTCmODZPc4STnIDfqy/sXCnq4ghj38izpWkgEdEo+s14N5+cxKgzfpK9RMgDm1eSDRluG7cG9taww2Lvi0qZKqtR2HXEV8IyfKYK//86gAJG4c0FfSA/rRGuNKSOD1kXThqFprNJbNFoIVrSGfPBxR6R7pZQhj+L/x+Qtw/cubCy8cA8N/QDTvf6UQNVWleATLccasw7Jp8BGEjUFHqAtDd9pcqjqTXU8TDVvZ2Rt8X78M7r+xH+MC8Fb4uOCiI+EziVr2x+IX45VTvY/boEnvAb6oZ3+sf4PrMYyIOyEba6QE3nloklocEDvp/Y69sWJW4+JouDkcr3i1kn3mMTMM2jAnSHgh6UWN7s5x4nsyoOI0zQibZYiQiGULGW3yGaw6BhAXyN5VxZZQS8utSlc1mPP1ODmj0QQi9iyGXvxbsKmUmQW7xdjTQLkDuCZEchLjvkkIg1kolh9frwdHWt+Y1tzuRIzWIlf3VTKfQ4JmlZBRDiZod1mdbOO1ytuqPu5PUOUscIt+YDnxnoHvHsvy7YNCc1wJjmiqwzPPQ7NtbmqWR1j8R6ebwYK8QLPdPsa1Gsepg4mUHYruDgAVkROuSjU7AUEed4a3LuoFbblWlM0/NO2KyN2HjJE+uwcrSRb+Mp1BW8AslAmZmPD2isx9+B1DYhRN9Xcge2f8XyIoitzsi5ZBbJupzWh2Ph3TBcnLGhUEaTHz6Q/lvx8mlIsoXlAZkxuWIaHcR254IPCMYmk3upG0+3qaBsIHr3sSQDXgD99GHwFRUdZF2B+MQnInLyXqodhvow2/gp45QXvXOWk7tT2bByDRmjBF6MaQaDsLlrfTMvf2dUD2ENj6gc83JIa6GMh1PpGJuMcnGBH5xHv6jf7sjYrcEUlVbk0Es0ZWtmh5 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3e8135f6-5acf-40da-f367-08d9076d3349 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2021 22:06:24.6577 (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: i29CnacMAlUsC4bIQik4LFquFh7IVKcnLDAH3kl/urIefuJHGh0DqvwHN9JtJdJ7cL4XaL5A2//NQSDhiK9S9gLJSKeUikg7FO1vF3br0vY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3317 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=0 adultscore=0 mlxscore=0 spamscore=0 phishscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240168 X-Proofpoint-ORIG-GUID: Fb1eF7-Tii6PJpv7TkrQVn-ZgZfR3xw1 X-Proofpoint-GUID: Fb1eF7-Tii6PJpv7TkrQVn-ZgZfR3xw1 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 lowpriorityscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 suspectscore=0 spamscore=0 priorityscore=1501 clxscore=1015 impostorscore=0 phishscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240168 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org qedi_iscsi_abort_work and qedi_tmf_work allocates a tid then calls qedi_send_iscsi_tmf which also allcoates a tid. This removes the tid allocation from the callers. Reviewed-by: Manish Rangankar Signed-off-by: Mike Christie --- drivers/scsi/qedi/qedi_fw.c | 76 ++++++++++------------------------ drivers/scsi/qedi/qedi_gbl.h | 3 +- drivers/scsi/qedi/qedi_iscsi.c | 2 +- 3 files changed, 25 insertions(+), 56 deletions(-) diff --git a/drivers/scsi/qedi/qedi_fw.c b/drivers/scsi/qedi/qedi_fw.c index b53940af4230..b4cbc385d0e3 100644 --- a/drivers/scsi/qedi/qedi_fw.c +++ b/drivers/scsi/qedi/qedi_fw.c @@ -14,8 +14,8 @@ #include "qedi_fw_iscsi.h" #include "qedi_fw_scsi.h" -static int qedi_send_iscsi_tmf(struct qedi_conn *qedi_conn, - struct iscsi_task *mtask); +static int send_iscsi_tmf(struct qedi_conn *qedi_conn, + struct iscsi_task *mtask); void qedi_iscsi_unmap_sg_list(struct qedi_cmd *cmd) { @@ -1348,7 +1348,7 @@ static int qedi_wait_for_cleanup_request(struct qedi_ctx *qedi, return 0; } -static void qedi_tmf_work(struct work_struct *work) +static void qedi_abort_work(struct work_struct *work) { struct qedi_cmd *qedi_cmd = container_of(work, struct qedi_cmd, tmf_work); @@ -1361,7 +1361,6 @@ static void qedi_tmf_work(struct work_struct *work) struct iscsi_task *ctask; struct iscsi_tm *tmf_hdr; s16 rval = 0; - s16 tid = 0; mtask = qedi_cmd->task; tmf_hdr = (struct iscsi_tm *)mtask->hdr; @@ -1402,6 +1401,7 @@ static void qedi_tmf_work(struct work_struct *work) } qedi_cmd->type = TYPEIO; + qedi_cmd->state = CLEANUP_WAIT; list_work->qedi_cmd = qedi_cmd; list_work->rtid = cmd->task_id; list_work->state = QEDI_WORK_SCHEDULED; @@ -1428,15 +1428,7 @@ static void qedi_tmf_work(struct work_struct *work) goto ldel_exit; } - tid = qedi_get_task_idx(qedi); - if (tid == -1) { - QEDI_ERR(&qedi->dbg_ctx, "Invalid tid, cid=0x%x\n", - qedi_conn->iscsi_conn_id); - goto ldel_exit; - } - - qedi_cmd->task_id = tid; - qedi_send_iscsi_tmf(qedi_conn, qedi_cmd->task); + send_iscsi_tmf(qedi_conn, qedi_cmd->task); put_task: iscsi_put_task(ctask); @@ -1466,8 +1458,7 @@ static void qedi_tmf_work(struct work_struct *work) clear_bit(QEDI_CONN_FW_CLEANUP, &qedi_conn->flags); } -static int qedi_send_iscsi_tmf(struct qedi_conn *qedi_conn, - struct iscsi_task *mtask) +static int send_iscsi_tmf(struct qedi_conn *qedi_conn, struct iscsi_task *mtask) { struct iscsi_tmf_request_hdr tmf_pdu_header; struct iscsi_task_params task_params; @@ -1482,7 +1473,6 @@ static int qedi_send_iscsi_tmf(struct qedi_conn *qedi_conn, u32 scsi_lun[2]; s16 tid = 0; u16 sq_idx = 0; - int rval = 0; tmf_hdr = (struct iscsi_tm *)mtask->hdr; qedi_cmd = (struct qedi_cmd *)mtask->dd_data; @@ -1546,10 +1536,7 @@ static int qedi_send_iscsi_tmf(struct qedi_conn *qedi_conn, task_params.sqe = &ep->sq[sq_idx]; memset(task_params.sqe, 0, sizeof(struct iscsi_wqe)); - rval = init_initiator_tmf_request_task(&task_params, - &tmf_pdu_header); - if (rval) - return -1; + init_initiator_tmf_request_task(&task_params, &tmf_pdu_header); spin_lock(&qedi_conn->list_lock); list_add_tail(&qedi_cmd->io_cmd, &qedi_conn->active_cmd_list); @@ -1561,47 +1548,30 @@ static int qedi_send_iscsi_tmf(struct qedi_conn *qedi_conn, return 0; } -int qedi_iscsi_abort_work(struct qedi_conn *qedi_conn, - struct iscsi_task *mtask) +int qedi_send_iscsi_tmf(struct qedi_conn *qedi_conn, struct iscsi_task *mtask) { + struct iscsi_tm *tmf_hdr = (struct iscsi_tm *)mtask->hdr; + struct qedi_cmd *qedi_cmd = mtask->dd_data; struct qedi_ctx *qedi = qedi_conn->qedi; - struct iscsi_tm *tmf_hdr; - struct qedi_cmd *qedi_cmd = (struct qedi_cmd *)mtask->dd_data; - s16 tid = 0; + int rc = 0; - tmf_hdr = (struct iscsi_tm *)mtask->hdr; - qedi_cmd->task = mtask; - - /* If abort task then schedule the work and return */ - if ((tmf_hdr->flags & ISCSI_FLAG_TM_FUNC_MASK) == - ISCSI_TM_FUNC_ABORT_TASK) { - qedi_cmd->state = CLEANUP_WAIT; - INIT_WORK(&qedi_cmd->tmf_work, qedi_tmf_work); + switch (tmf_hdr->flags & ISCSI_FLAG_TM_FUNC_MASK) { + case ISCSI_TM_FUNC_ABORT_TASK: + INIT_WORK(&qedi_cmd->tmf_work, qedi_abort_work); queue_work(qedi->tmf_thread, &qedi_cmd->tmf_work); - - } else if (((tmf_hdr->flags & ISCSI_FLAG_TM_FUNC_MASK) == - ISCSI_TM_FUNC_LOGICAL_UNIT_RESET) || - ((tmf_hdr->flags & ISCSI_FLAG_TM_FUNC_MASK) == - ISCSI_TM_FUNC_TARGET_WARM_RESET) || - ((tmf_hdr->flags & ISCSI_FLAG_TM_FUNC_MASK) == - ISCSI_TM_FUNC_TARGET_COLD_RESET)) { - tid = qedi_get_task_idx(qedi); - if (tid == -1) { - QEDI_ERR(&qedi->dbg_ctx, "Invalid tid, cid=0x%x\n", - qedi_conn->iscsi_conn_id); - return -1; - } - qedi_cmd->task_id = tid; - - qedi_send_iscsi_tmf(qedi_conn, qedi_cmd->task); - - } else { + break; + case ISCSI_TM_FUNC_LOGICAL_UNIT_RESET: + case ISCSI_TM_FUNC_TARGET_WARM_RESET: + case ISCSI_TM_FUNC_TARGET_COLD_RESET: + rc = send_iscsi_tmf(qedi_conn, mtask); + break; + default: QEDI_ERR(&qedi->dbg_ctx, "Invalid tmf, cid=0x%x\n", qedi_conn->iscsi_conn_id); - return -1; + return -EINVAL; } - return 0; + return rc; } int qedi_send_iscsi_text(struct qedi_conn *qedi_conn, diff --git a/drivers/scsi/qedi/qedi_gbl.h b/drivers/scsi/qedi/qedi_gbl.h index 116645c08c71..fb44a282613e 100644 --- a/drivers/scsi/qedi/qedi_gbl.h +++ b/drivers/scsi/qedi/qedi_gbl.h @@ -31,8 +31,7 @@ int qedi_send_iscsi_login(struct qedi_conn *qedi_conn, struct iscsi_task *task); int qedi_send_iscsi_logout(struct qedi_conn *qedi_conn, struct iscsi_task *task); -int qedi_iscsi_abort_work(struct qedi_conn *qedi_conn, - struct iscsi_task *mtask); +int qedi_send_iscsi_tmf(struct qedi_conn *qedi_conn, struct iscsi_task *mtask); int qedi_send_iscsi_text(struct qedi_conn *qedi_conn, struct iscsi_task *task); int qedi_send_iscsi_nopout(struct qedi_conn *qedi_conn, diff --git a/drivers/scsi/qedi/qedi_iscsi.c b/drivers/scsi/qedi/qedi_iscsi.c index 416202bc4241..0061866614b4 100644 --- a/drivers/scsi/qedi/qedi_iscsi.c +++ b/drivers/scsi/qedi/qedi_iscsi.c @@ -742,7 +742,7 @@ static int qedi_iscsi_send_generic_request(struct iscsi_task *task) rc = qedi_send_iscsi_logout(qedi_conn, task); break; case ISCSI_OP_SCSI_TMFUNC: - rc = qedi_iscsi_abort_work(qedi_conn, task); + rc = qedi_send_iscsi_tmf(qedi_conn, task); break; case ISCSI_OP_TEXT: rc = qedi_send_iscsi_text(qedi_conn, task); From patchwork Sat Apr 24 22:05:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 427404 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96C42C43461 for ; Sat, 24 Apr 2021 22:06:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6999261009 for ; Sat, 24 Apr 2021 22:06:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234081AbhDXWHQ (ORCPT ); Sat, 24 Apr 2021 18:07:16 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:53572 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232363AbhDXWHN (ORCPT ); Sat, 24 Apr 2021 18:07:13 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13OM6RGQ124454; Sat, 24 Apr 2021 22:06:29 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-2020-01-29; bh=E0xAxkZw2zDna6WyY4IvHyFUhdsRoY3UrA5Ng53z17g=; b=jIb8LHv1Q2vGiHelNfv2CvJLAaAThxBdqMbL+0veyg+GEJ936mIbXIcusW+2CvdvU382 K0N5nWu9H3YayboUzv/DXXaQ/kLi4nnY46xcNZpP6P/ZI5lvRN0pvAqWK650usDdpYEh xLyrJwoyrLwXseE0g65sFjTpxZkDjKe7ZGv+/q6a3bz1UKnHq4Q/tCmRVN2wLMebd018 InDL0rqNgnbQ7vpM2awp4KQE5FZgkHEwe20mMeEGAOECCHj2JbzxtDbeF37mncRLn6fs 9idruzc3TbnNQYxOgJaq4QFmEmpp6IxfrLTvvP7DquqG8hG6vP/z8pkpYK2pB1dKw0x+ Dg== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2120.oracle.com with ESMTP id 384b9n0shp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:06:28 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13OM6Qla143191; Sat, 24 Apr 2021 22:06:28 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by userp3030.oracle.com with ESMTP id 3848et2a85-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:06:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TkV5/2p4fLiiEwsbBhqxSlrmiyekMeVaj53A+g3Vo4XkjqBcJQKRWgr1BjhvosHL2VdaR4Ek5jukyhlzRcF4fQLjkZDoU4SJ6p1LWBC/tnEAD05NB69bfxxk2qfcMI4B4vkTjvdwkssC7SYaMWt7PIkSm5XXU3iyOdXxQh9D8KgC/KHdN3KDJHTvZVcXgIcky8tdpXqqzEfp0GZdSagW0VjzZQjfU6G9obwPLV1e/81BJJeR0IL2+6q7Ysn/SNvWE8MSPhyjZBJqKOMfXXHd0Ig2uaTv97yAEVmc4HDEocP1aNt5UcXcOgdsnxmB5a7oh74EKBGVDPsLRSLSoUf8+Q== 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-SenderADCheck; bh=E0xAxkZw2zDna6WyY4IvHyFUhdsRoY3UrA5Ng53z17g=; b=GRa9UuW45ARFquNZLIla4w9kg+xr3G86m0nD6tOhbZEZbcnG8hVZY0NwuJgGhugs9D8FCMW5YJ5iSLhEQ9kXruGVqUP9aUxy6FvcDGlvHWxSOFw0+JiieVKYUn2XOEw2XDl2ngcDuHklCwRaSlgk7clXKo5fjcCRDdXrU4PUxFXobevX3BfoBRHVbBJjljLvvrlqRymLezs4PTqNgwy1+KLo+iOkEoI8MZ/tQeMIEI5/roXJoDNqWFrmewGYE/rNHLSrVpVp/BzQ5WJEhbYFHN3eedni0r3PD76WLc4mKbPkCWKXvFdtRc0PIyfFbps4ZJleaaZbT5M4SoPok7d9YA== 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=E0xAxkZw2zDna6WyY4IvHyFUhdsRoY3UrA5Ng53z17g=; b=KdBdZHEHhXdEHCs/VVXXUaOz/j6Ap3lt3Cen45XrfOpdbKotOViePVC0Fpd9u5LXN2uUxuflJTPeo+vbCaJmhbgZxBNLvvy+8VlN5/0WMo4t+E65sbXuuw4vq5BBGrcoJiJqbHi1MXzt17ZazOnuvIaU4Alo3A5AfJ6kENykU9g= Authentication-Results: suse.com; dkim=none (message not signed) header.d=none; suse.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BYAPR10MB3317.namprd10.prod.outlook.com (2603:10b6:a03:158::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.24; Sat, 24 Apr 2021 22:06:26 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4%7]) with mapi id 15.20.4065.021; Sat, 24 Apr 2021 22:06:26 +0000 From: Mike Christie To: lduncan@suse.com, martin.petersen@oracle.com, mrangankar@marvell.com, svernekar@marvell.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH v4 12/17] scsi: qedi: use GFP_NOIO for tmf allocation Date: Sat, 24 Apr 2021 17:05:58 -0500 Message-Id: <20210424220603.123703-13-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210424220603.123703-1-michael.christie@oracle.com> References: <20210424220603.123703-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM5PR16CA0044.namprd16.prod.outlook.com (2603:10b6:4:15::30) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by DM5PR16CA0044.namprd16.prod.outlook.com (2603:10b6:4:15::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.20 via Frontend Transport; Sat, 24 Apr 2021 22:06:24 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 49b0a7ef-f357-4eba-d0ca-08d9076d3407 X-MS-TrafficTypeDiagnostic: BYAPR10MB3317: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:404; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0ZsCCmRlvcQa1wbwbtgKKeAP5aHT/4JuDqYAIokQ4ualRk8CWceGb8AcZ85g4SWvO3YsAmJO60V46TIKcEJIDSvPsQb7kSUADW6Vby/XsARsMUDow7xJmzWevER0pK+eLlcOQQdqRf6PPPCjoAyw9Z1Mw7s9nWwDjluiRcwJQkZopHKf39Y1KOKWyNeNYmfU8b3TMSOrS4BD0mov5FSw/fJ54ciDAc/IQqXSVBBiHs3VFi6nF8OBPebXjEFE1AzTgIelr78yo+6Jv/D+v8DiYP2aWiVydrSGJs7cyMV/cosOknmQTmZgolTCB11w6DnS47tb3ft7M+CZlQaIY/Ww4HCHS/jW07q2s5pXpsF4rODzA8mHNmIQl9WX0zliXGkCuConb35OtyR7Sk+1uZOAfZnCB/YidFF6tdFcZ5gjMJnAucEjBOBE9kEoKVMZHWLh6q3w1VbA+iFQEQ48rl2HAQ+m9z9oSsVK2mO/IRmIW+K7RP5reDazupVzeVo3Vw29PFgK4sgs3l0Ae4FPMlLraMUmGfedqQQk9bT2kIRDhY/hgXwcp4FTmEN72crxHScoJQpTXr+LdZCHUYDubr0MlipPTdB2LdpA588Elc5wreEDx0sFJVwyexf8Bl/lkjUdsW3xUPbqhV6HsgZ+ANYfqap/SwKb7Klj0O0Ma+4StZHHBTp1w/tohEZpybdWpKp3 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR10MB3573.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(366004)(346002)(396003)(376002)(39860400002)(4326008)(6666004)(1076003)(36756003)(86362001)(52116002)(478600001)(83380400001)(38350700002)(38100700002)(8936002)(5660300002)(26005)(16526019)(316002)(6512007)(8676002)(956004)(4744005)(186003)(2616005)(66476007)(2906002)(66946007)(66556008)(6486002)(107886003)(6506007)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: YDqfNwDS8ey9HAxXkjeDdM3gwbbQJ5SSbItB9oAj8QO7lrKREwlJCPQxKygUgPQIP+JoBozEJAjgIZS7SLD26c/VWtXKqV2o0yIb/nnKfbM7ONxlozmmA4Dun+XeB5jNHEL7UtTNDBy1oeZPXIFaSmffLPy1gUGXVhmVOoIqyCWlRwexndzRJmsCWVFS4jlBnRdC6Q5f0wZy26WOQpjksLs6ki4ipZ2RZWHA0gn+rOzkE70ZxxEng1yXZsax0A5zPdGuGxzv3d/VurUuQ2SQg4urr7RBmufM2m0+v4kZ9FfwWfwyu/fqaS8L7aK+9ot6XHDH6uGmTZTcZOsVxxZDSxiFVS2Uh8vLzy+fBQgr43Gc50asn4Q+pwqM2bttE6K0cAnalGorH+v9MJwaLZXQtXe/c1t5AMdFHNmhLyDSYF9+gIN46ndVymnP4czUSGK/iW1hBMEVXCW48VZVubwC0BJNZRdK8q10hD4PlPA5Wh5Xxy2A8A1H5GJvbXuKViZXy8WFCbpmLISAnz7Vx1wPHHiFb5wIZUrpxOCQJ1MeNcVlYE+Xm2jU7m0wCUq2gFWIlimSDWBbJLmNFcs4T5KSNh8e6KBzogFS0Gwre2qZFR8PiT4Dp4AMKaNy7n/GeWZ1FxvvruMtJhmmjxa03TI7XU4LmP7MMh1j44Bpx4Tu+ctwujR/E2bKw3Cbeuk195JPorf5NvA5L9ye94oc+PofL0EG/OVEIRVxSC7aHdTvWVrZriMG5mCnYOLPtIJ3X08L4U0+5Lk+B7XVoaGDwFW56LMuUMawBMxv7RqKLP3/FnmGEsl4M1U4N27sbOCrWkiOKfSA74gKps9xHku4xalmxyd/4p0kYdLJjJyE9HgJYci8IvUfkHuE8zA0B+Tqq4TQM6kyPFjgN+3/ypnDGwKPHddL8zi/7BsLFNU6Rai70PD+op2Psep74LCMhzmYQk/WDWM8tiyPJ00yBuo+NafFc94HByUJNwcfxFi2vHk1+vCcflUlWKYYX1oYuMafnWu43crApm6EIaqRQ7wyDmLdTZwvwpqvMjBs5JXB8UTISZ7M2xTCj1aTG4V3RPUtQjxLBukvGd6sMZa48TvCwc4xxxshOq6I1RTeAs2KD679l0kqQokAOQiPTIIkqZZwaccvL2xlGlGpu1hdXrkcIovs8L6KfjGJWOqVhFwwxSemMqq94ypZzIVNMgNCkSdMY+ldZLC7zLYlEVQbmJ3u874t81KaVZHEaG+YGXZjQpNZUw9lD0J3Z2LfsZjXx2qXyWWHx1i8sO0pQgw7MItnO4fuQKcYrLqebhMIdwZrbB2oDtSeOfsWvTzHbqAZr44VeakF X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 49b0a7ef-f357-4eba-d0ca-08d9076d3407 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2021 22:06:25.9840 (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: 3mo8AszT09eftweoDpFlGaRsoQPFA+a/k44rwyu0njc3M2sLb7rt+HY6h6r12inFGPHvAFyCG3BPq2o/yZZJO5aBOxzSuttNUmeDp+5ULu8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3317 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240168 X-Proofpoint-ORIG-GUID: oHi0OH9F5ZbdiPtOSloS-RF7JGeVjaV1 X-Proofpoint-GUID: oHi0OH9F5ZbdiPtOSloS-RF7JGeVjaV1 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 lowpriorityscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 suspectscore=0 spamscore=0 priorityscore=1501 clxscore=1015 impostorscore=0 phishscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240168 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org We run from a workqueue with no locks held so use GFP_NOIO. Reviewed-by: Manish Rangankar Signed-off-by: Mike Christie --- drivers/scsi/qedi/qedi_fw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/qedi/qedi_fw.c b/drivers/scsi/qedi/qedi_fw.c index b4cbc385d0e3..1fbb74c109b9 100644 --- a/drivers/scsi/qedi/qedi_fw.c +++ b/drivers/scsi/qedi/qedi_fw.c @@ -1394,7 +1394,7 @@ static void qedi_abort_work(struct work_struct *work) goto put_task; } - list_work = kzalloc(sizeof(*list_work), GFP_ATOMIC); + list_work = kzalloc(sizeof(*list_work), GFP_NOIO); if (!list_work) { QEDI_ERR(&qedi->dbg_ctx, "Memory allocation failed\n"); goto put_task; From patchwork Sat Apr 24 22:05:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 427044 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C612C43460 for ; Sat, 24 Apr 2021 22:06:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5B65F61152 for ; Sat, 24 Apr 2021 22:06:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234087AbhDXWHS (ORCPT ); Sat, 24 Apr 2021 18:07:18 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:57342 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232384AbhDXWHN (ORCPT ); Sat, 24 Apr 2021 18:07:13 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13OM6TwE151684; Sat, 24 Apr 2021 22:06:29 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-2020-01-29; bh=WuAPXIQ26+yk6vAnba24Tfly2PS6q4RRVpSQpFjI9oc=; b=WeDSz2mp2uTAuXtL7wR7jd0FddI73jAVZ/iVFteoh315PhbQj8fmlJmMUCd0YstCU0Rk Iy5wkLVAbCbRvBAVYCE5yo63xxjnB+MDN/rivCROpDwYclzFxdAPJ/VshRcO07UhsZa3 bHNRyEEonh2h2O8UaNIhZtROGTZrhSNtqIKPzaSJaPCmGqyVUEZFT/CRtJ8GWCrni9cF gnMOdEqDDduMJ2Z7YOM5H3PyXlB1CEpMu7Taz3RvaBlIKgnZD335iY/y5yqIVmjL3JTl nGuQ4R9a8BYu98CbvPZT+8dI1GIRHb5/sNb6KUFzDn6sD8xiim38bh76+7acJ596PF9B tA== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 384ars0t14-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:06:28 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13OM6Qlb143191; Sat, 24 Apr 2021 22:06:28 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by userp3030.oracle.com with ESMTP id 3848et2a85-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:06:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RJrk59VF249H16GInd2TBqbODkEAzTzfEe2HrVZ/cHsJ1qTjhEGtrVFs2czZ4Ju4OmffHPrZgDKCaqDx48luVcawx4T7aO6Saa0KDTIx+DjZM4G4dQKxnUEgOyGRpTLTG83PAuq3GUCuWZY6kFNM7KuSput7N5+r/a9QTHMECR/owT8qz4LXaG8632+dLrghny/8GWc3fqYSD13sjMts1sC4sLYPmbDTU1SSTN87PcoRVk8VTXVmsGJvXPEzt7xoIOhdOHRZQuxt8wIYt9S+BzQnHpRLsRr0AnmBYeiHSyJsR14sLLFnd397VUtLzLuu0OFKQyLr+wKjUxr7vkjOGQ== 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-SenderADCheck; bh=WuAPXIQ26+yk6vAnba24Tfly2PS6q4RRVpSQpFjI9oc=; b=dFerZTVi7rP3nUty1HQ72egXShQECy/hlTPyrAoO8lBetO3PvLh25/UEuKEWQiDum49Om8oU9o8VaN4OFp1mFS7ZC4F2wB36kafeDaa8+P2WqGlXyyAI4rOpBX+SRMwYVzbG973rzDjSTugq/PYiQUm0Km7twHy0BfU+EVqo+Efq+eMHUGy2J8/OwIbp4d8kpf6SXkFbPtIL2VgkUCG+bLeOd9nJ2tYEYFJo2OULzI20fAbn4hgcF/KYWktull7J5NCxPjfKtJUD4EgSd6XdDmi0WYdzzQtfri0vmdOpJlss//HPbZt6Q/wYIC1oljhmRCNvBcrCPAK2QDj2dhkb9w== 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=WuAPXIQ26+yk6vAnba24Tfly2PS6q4RRVpSQpFjI9oc=; b=qke0GtQ4O62PIXRRCUs70ybkxMfNwi+pBd0oL4KKiM7UCE6a2EhEN0U6mmvPnROUPvc+sV5toG1phtE8k3FlHvHz7lNUNzWFpCZr+lMCRMONf6UREAndA0NW27CkTye6ToGrJUvT0sxJvHpchTAnLhBiXxKXztBd/itvrgGejPk= Authentication-Results: suse.com; dkim=none (message not signed) header.d=none; suse.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BYAPR10MB3317.namprd10.prod.outlook.com (2603:10b6:a03:158::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.24; Sat, 24 Apr 2021 22:06:27 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4%7]) with mapi id 15.20.4065.021; Sat, 24 Apr 2021 22:06:27 +0000 From: Mike Christie To: lduncan@suse.com, martin.petersen@oracle.com, mrangankar@marvell.com, svernekar@marvell.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH v4 13/17] scsi: qedi: fix TMF session block/unblock use Date: Sat, 24 Apr 2021 17:05:59 -0500 Message-Id: <20210424220603.123703-14-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210424220603.123703-1-michael.christie@oracle.com> References: <20210424220603.123703-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM5PR16CA0044.namprd16.prod.outlook.com (2603:10b6:4:15::30) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by DM5PR16CA0044.namprd16.prod.outlook.com (2603:10b6:4:15::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.20 via Frontend Transport; Sat, 24 Apr 2021 22:06:26 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 48444cef-00f5-47c3-d9b8-08d9076d34c3 X-MS-TrafficTypeDiagnostic: BYAPR10MB3317: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BrwONkbLuiEIOy5jg6ZSL5oJ40Sima6xoY+rYUj1kN4/exFwFiTRWjM391QKmB/k5FNYWZJndw61Gw5v7mD3ItFKS9nt+p7PbSo5sT99rwrZKXRjPV+q/nLvX/3/I/vxxanMbLoH6u0DutHobJQlIS5ptOZA0lCvM9pdMHno3NBu+OLpVygXnfqrsMZ+jzfPDUor1dkJD38tuJfYPzCy+O1Ipz70BUktD4iJ/ze1AyI3U/w+5BOuXQU6nYNSlEcNWlVUqJ2ZQFrRM7gMbeQ4gK9o6+Jel+w5qQDHfni1cg/HVxN6T6BgLZnufuu+JSjuIcVDa5k0ebmSItnHzuSieBc51Y/hfAvgSRM6eb9vddRJ7gfEt0JxAwUwvPo/nHMz02t9K3qR6Yp10hbgRHARMpphktT0hNHc86zN7Q9GxastA/VGMg8IUV+nwsQMmViwVvtvvhXrI3+ICj2lmDyTLWme2sIZvK+qGIVwYZx34gnlvZtJcFy5JiDXioqkuNIxcuHGeYL4srFzCc6pjFob4GeN+/zZeaE8Wot2yjBUdB5o8DmXufLTvP6c7OkrKNRZ979CNjwwgawvYBiYNJbCgkAhiDzmqT2bmIIVFx8SlIcasGFgj3x6bt9AmJ+AxVPG0bCfDyas4ebxPif/sf+Eb16Y6n1Xvfow2KQze3vP6mmdKN5clnSK0M+obdm1KJaq X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR10MB3573.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(366004)(346002)(396003)(376002)(39860400002)(4326008)(6666004)(1076003)(36756003)(86362001)(52116002)(478600001)(83380400001)(38350700002)(38100700002)(8936002)(5660300002)(26005)(16526019)(316002)(6512007)(8676002)(956004)(186003)(2616005)(66476007)(2906002)(66946007)(66556008)(6486002)(107886003)(6506007)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 8D7vNTKTazAR46EgPnv+dlj/+gMJkN7mQoOz3kcnEukZ9QotIUTliJSg30jk0Ye0JrR1TSKAYd74ZNd0f48epARffffTQEpXFetIG77oihWrmblsuSvlaNjk6F9d7gwUYmXZUijk45FbCZp132toWT9vcl79Eydrun4T6sZ4nCfwZAjIoiwkJ8kIK+1/+IxJv7Gv5xyh6RYg0UAKRismBphHC/g4V8Ot6MG3Rye/4Iy0nhxV1Ev+iJ7jLtFe4cPMgGID5R91I0XmynNFYdhJEMZyCX7jOTjepERgTrjCWWvsLbeMYjKNC09pNGnpxFQOJYm8An2V3EZQEDVExhLpPCNBjyG55g7kx4vPgFWQNFLSPfwXX5UHn71xhhMEEYzkY6hMJogKDgLg/xN1WkXaJ4ZjwlgiwjixJXerHlTdXrM2lXdBSl68palV8vT8Ch35ta4H/lwB8LXpFKaveKYf810+1ZTvBzgf9+tDi48phA704/WthGfx6tYh6OUX2TZIlCfhsNgMdXl7fu4xQSCsHtbCL6J5ht9mXV+CX3XkeMRPJoVUm4usStwPncVJMPYqfsrLEuCCwp6xtqZ41PsRNyWxXnu87X+sLuCF2lM720YwY7XPLFQ1DFcjWYXVKvrHBLUXYQHWbdoBkh8IVwxhE5OXvOdqWYtx3BVK83MnT4gaGzbhT4AEmbrWq+Nu+MuyU0z78all9VpQKeymulfQW4Zo5VG0NtkJH3pWDfInReE+FFwf3RINpEsfB6dtaB6Jm2cT8ag0WK4tnISFpEJmJEqETOo9s6yDRY6ixuRWbdlk8ja0RXuGHxFSjiXsgfSxub+rZa/9seMgLuPjJUjFiFVzhbESQN4IEzvXyaXNVZpw8XgsN8AEUklpGIR5UH2rDDONVA9f1UbhOkNgPx1YeTa79vF1L3hrihgOcEmuFlESm6J5J6mu/ud0QMI3XNg2xm8mjIS6T6ILmKxsE2QSJVmlTs581gdFxRpTvjkKF2Vs2XqNstuC6eV66/9TEfAGCrglbiDnpRBX1Uf69p4x4zBNQd8inN6BPduGgsiMat/NhMXOSDdM9GrnZxUil8kfc48rDUKnrQUGYLtdWtbrqG3gRNBSi/U3avXU0HY42OaMvaZPA69xnB3JaBg86q5lj4qz407ygYpF54YEqmDDd3mtTgrTh6JmBBRNBNvmNkBBLZ6MsKNquCNgwaPIfC7vDsNKWI/APFUJbiHcqGwg3i8Vgb73oDamskV0eVRnEWdjq+h1rW3NkFGl0ySYZa87g1Ytp26gu/8mxKnysxN2nj8T67kWUgBFcHiXFFJyBMjK2wfFwipPpt/+N2DG32x9 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 48444cef-00f5-47c3-d9b8-08d9076d34c3 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2021 22:06:26.9874 (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: NDZA/BJB1itx2WjtDCRcMIzfdDCC0sNRxQJxei3hPWzRaL9x3EfrgIStavjcu76Oys4ml4oCGd5qx/tc4Ert1cj0nDPdprfGqasdfklFvAQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3317 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240168 X-Proofpoint-ORIG-GUID: kdnCnT3TnRQgAhyTH6M0d7hpa0_FBEyn X-Proofpoint-GUID: kdnCnT3TnRQgAhyTH6M0d7hpa0_FBEyn X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 impostorscore=0 adultscore=0 malwarescore=0 phishscore=0 mlxlogscore=999 suspectscore=0 priorityscore=1501 clxscore=1015 spamscore=0 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240168 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Drivers shouldn't be calling block/unblock session for tmf handling because the functions can change the session state from under libiscsi. We now block the session for the drivers during tmf processing, so we can remove these calls. Reviewed-by: Manish Rangankar Signed-off-by: Mike Christie --- drivers/scsi/qedi/qedi_fw.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/scsi/qedi/qedi_fw.c b/drivers/scsi/qedi/qedi_fw.c index 1fbb74c109b9..f9c0fa94859d 100644 --- a/drivers/scsi/qedi/qedi_fw.c +++ b/drivers/scsi/qedi/qedi_fw.c @@ -159,14 +159,9 @@ static void qedi_tmf_resp_work(struct work_struct *work) set_bit(QEDI_CONN_FW_CLEANUP, &qedi_conn->flags); resp_hdr_ptr = (struct iscsi_tm_rsp *)qedi_cmd->tmf_resp_buf; - iscsi_block_session(session->cls_session); rval = qedi_cleanup_all_io(qedi, qedi_conn, qedi_cmd->task, true); - if (rval) { - iscsi_unblock_session(session->cls_session); + if (rval) goto exit_tmf_resp; - } - - iscsi_unblock_session(session->cls_session); spin_lock(&session->back_lock); __iscsi_complete_pdu(conn, (struct iscsi_hdr *)resp_hdr_ptr, NULL, 0); From patchwork Sat Apr 24 22:06:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 427403 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD3ADC433B4 for ; Sat, 24 Apr 2021 22:06:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ACAFD61152 for ; Sat, 24 Apr 2021 22:06:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232384AbhDXWHS (ORCPT ); Sat, 24 Apr 2021 18:07:18 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:53596 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234013AbhDXWHQ (ORCPT ); Sat, 24 Apr 2021 18:07:16 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13OM6VBT124468; Sat, 24 Apr 2021 22:06:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=7ET05EV6JQSKO/pVD84JdRXW/MzV5wyzCxG8rjKN84o=; b=paubUKhXKIc0UyeSKT04yGOyAWqo05d46vCi8Ezj567wLgzy5rchy7qooHeojoMb6QGX eadL43EI3DD1DJUV/HOUdgotiOF1gpjvFVpMQiwxpchqkG4kjr/zitXzbI4biK2347Qw UJXAo0fZHYuTUUEk9kWOzu6SoaCg3kqchwpHDbx9v+Nqu8F094JR2UN/9qOSCG0sUgHc 19I+XZsMhUx91sMMlu+xCV024IFzCmDmqyDZp1Gmiiyvm2npLMGMBhWERvunDc5Qpf2y siIQOuLaYb0v4YWLOaer5iwwXKreQqoxSef+n+l0kUfYXAo9HNz4vqBWzLDXaKEI6naI wA== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 384b9n0shs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:06:31 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13OM6B7x045523; Sat, 24 Apr 2021 22:06:30 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by userp3020.oracle.com with ESMTP id 384anj7uv3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:06:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ec1LoDL/CuuADrqgBxDREHD3s2B6+gtDiZr9F13byxbuCwsu7vewLddMOUQTx8VdGhFqQKbgGB30dva5h6sjyf7+h2rM1hvskPeiqq12nzYYqWwF3BkCaZDfBgXjcHcimiC0EPypi4ETxMI6I7y+zg0D3iP72O18MiXEd2w30+Raf/usHV2h2COeyG6Sxcp7juuKC6JCHMbae//I0/NqHFIZb1gCmzhHTsvPweRLel8RWXCjktkDzMGVOttbI2UsUOEqyP7MBn1d5VQWswGA0kalwKqNGHR/3DOPzfCY4QSI8N4+0r2fn1FltHhYERfqMswjqmE+fx5V3zsiFrSAyQ== 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-SenderADCheck; bh=7ET05EV6JQSKO/pVD84JdRXW/MzV5wyzCxG8rjKN84o=; b=C59W+x5vYaBAoW9oG+cBz+/HWhjCpnHcgxiPQdM5AdMwpXHyiLYhZeNoetISo4a0ERw9+izYlsTbacFwI86My3xxV28m0MPvPTOMG6NPIIEpj2Z6zh8CN3CfTTyvb5wHQJjr46uhVGz7idvuStoGzSToNM6Zkumu3Nha8oN5vPW8VeIOEDU2SYSVN+Pg3tiqRkq4QGdJhjpboXr4CThE5HDrmbF9nWn2chsMScvLd8BAuIFEK5KIAOTbRYQeLBt3nXXAYoub5CtW8rIf4QM/cpjct4OnZPZOUQf2aoPIiVey0/Vzi9ZUUqgGJSUEc0WefqaBxq/RUpBA4PBXgAxqAg== 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=7ET05EV6JQSKO/pVD84JdRXW/MzV5wyzCxG8rjKN84o=; b=mSN8XFzomY2ZB7/45EN0dztI7OjoOt7Zq0VRT0kTAmz+gxCX5XIU4V110dboe+JgIiaK5r8UZhWoDlN5PVJ7pNlMvbV9bgmctCte3e724Z4I5mpCxzUeWWRNr836R+TjRCsHePniTPVlnsw7O6DLyvx3TLzC6JfLqsT+FkDpgWg= Authentication-Results: suse.com; dkim=none (message not signed) header.d=none; suse.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BYAPR10MB3317.namprd10.prod.outlook.com (2603:10b6:a03:158::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.24; Sat, 24 Apr 2021 22:06:28 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4%7]) with mapi id 15.20.4065.021; Sat, 24 Apr 2021 22:06:28 +0000 From: Mike Christie To: lduncan@suse.com, martin.petersen@oracle.com, mrangankar@marvell.com, svernekar@marvell.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH v4 14/17] scsi: qedi: fix cleanup session block/unblock use Date: Sat, 24 Apr 2021 17:06:00 -0500 Message-Id: <20210424220603.123703-15-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210424220603.123703-1-michael.christie@oracle.com> References: <20210424220603.123703-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM5PR16CA0044.namprd16.prod.outlook.com (2603:10b6:4:15::30) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by DM5PR16CA0044.namprd16.prod.outlook.com (2603:10b6:4:15::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.20 via Frontend Transport; Sat, 24 Apr 2021 22:06:27 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: faec8b64-c257-4f9a-5eb0-08d9076d355a X-MS-TrafficTypeDiagnostic: BYAPR10MB3317: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gNg50RUHwSYFJQ3kCke87G5NRfaXxGWPjlXFWldl6hZhjGEPMXEMbUJ+ZGwRu1j1/a3Q/6+BBmc89Z0sl0Cx9hDWgbeZHjvJOdjpXQUch22tffkNigGlfnKiBrvwAjvuRgTvTNUtd5eNg4qPaZVBPJBQPWRrQXvp7+3h1Bbmw0ttKfIQolI1lBpFNeXxQbPZb7aBDZ/IdkwdJmuFB2TV2LhKH4Uhm+pOynUXXr6XKSFhCeewaxJli86Xtx+gMyEbNIAFoGXnlPVjwTdrcAUViQKBfLZAY7aojb9mroLJPhE896iJSTdBTJ15pW62Y4m9qMRfF04eToBQPbdh/+kz0Pi4F9qju6ZGLGiUTbhAQm2j2zeX2sS2WlIrZZ564/3CMn7+xi03guHbZ+YE/BllWVJzB1WG++SrMNN1W7qD35LPEXYFwXKlaK95hNcMn1wkp+MhefaJs4exJ7Sy41nIWyLRNJ7KPK7qckkwwUd2WtdBis1SOJ5nGRdWUFbuJKvd6eA/liNLW9owabLb+oArq9QmeMoBmztcQwTbneIh4ob17jW2Pdkx7WmDlE3IMO+qjQC+l7Mltz3nxi5x0HVWlvkemgv7Vjzp8JnXXOg3FyMlfDW6P6fIY3k/Wr0Mus4C3i4VdLOWfsf75QR9oH505QXZV/tC4owELiBJLXVgchBaRN2vbLaiObitJNb1D4PR X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR10MB3573.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(366004)(346002)(396003)(376002)(39860400002)(4326008)(6666004)(1076003)(36756003)(86362001)(52116002)(478600001)(83380400001)(38350700002)(38100700002)(8936002)(5660300002)(26005)(16526019)(316002)(6512007)(8676002)(956004)(186003)(2616005)(66476007)(2906002)(66946007)(66556008)(6486002)(107886003)(6506007)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: rn5PfZd3Z0Wz4C8ktcLx2tOMuMVivqxXC2pzNo8qwxBIV3i7MuPh9UimLXve5ggQnmb7Z2+cdArJL45ibgvCJuDNfdb0XjQjEPPujl/BAOrnaC5ZrTlzIB2htck8195Vtuvj3PVrw8bxrhorfANxhiTDaSUXzQQ1ueLW8qV6K8U9ad+jAano96LM9px6i1VHfBWCnArKYZs7rWQEkvH5l2YFbq0hpwBiYo8IAa5jfoIvnQ3jW0oihCq56K3i0YzlhAPPrusaw4aEIQ4lI4hkLSpAVMJfK22yBKNaj6NV808LykIZ1Voi1SeLvl+IOYQyPe35rgl1vv7ptAbbcVzdf62/61vVZ72QHxuxBO7tihyrVMSMvB6G8aF3WymrTFe6Snfr++N1hZ54AR01nDPYfZM29AgYvOiz+OdlN5UgXwPpUJl1Dk2jTVtbudsOBraFgrYKDtjOlzUyIECXMewQW2Q6HnzmSPiEoq8+jtT6/kkFINtGRruXVkdiCv8QxgDhXCHYoZOP4p4WY0tDo3K3xM6Q/DaCjt2Hu9nkgpG0fkihwzTwUXht1hzEcNVB80bIqaa5loEyfUH4XftVF99zIrtwvw02+CIFwvh3vIZZUimv89SL4BwgN8sKTIOANMfxKitC7OoOBKWc/diHLBN4ulaT1WNhgXhb6AkdBmn05mOIuV9oY7LbomxgjPZqHKfcpcVA3mAIfV4sNHb6El/k9GlHQOmxhwsGix0bg97m4AsFjw2tUdcTSL3Nk6CaOf2P0TOnQiDuiLGhPr/u0wI21aXjFNzzL3o2L2JPQ0cKSoIlvt8COG0EMVl6IEcHWmahqjXCT7Gp72IvLyZLfdSgINc1tmINXXEzBtf3f/OmrYn3xRDpusZGXvWZJCxjC8i/37eMldHQoE1k17kOPEkODNcfzqms2pjG6p/TVywRCdG38ex9l0W1MVSsBscRy3qoHwb7pHhuq5ZtE8o9fV4BuwowSNXi2zK/s3Ps/u1dLqrGrfknO5XQOmFS3zwD7tKI+cZtDC7g5XLEYA3HEu4opDS3C2bOn9+I79CZGCBt+gEWxQRk+3yirqg+t2OqV0agfJLHoqWaIfwFHOZuEh5RDyHWPsgkGQx4aQpjSOAZmNbAQOXSct6G4iIkfVkUbbD7QSIsZ5i6K3owto/OCW6axl9Zte7S4VPzXusYxOXMKQc81z/79s8yNhe99SOOiNOqR5/7+Qqz2HHEq7RmDPyGsUVRwThl6RDNTaPhkvqXxQ+YX76IQ5+BZuodqDHZq891BBUXdQk/KXBeNBCJ0Xxq/kIBgIE6sJc+6kNDQr1RA/AnddSeYJpq53TGUgoSiw6l X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: faec8b64-c257-4f9a-5eb0-08d9076d355a X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2021 22:06:27.9339 (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: WLCwFLJ4TLADxXIFUfjidVXNkcQ/NcuBQhszJHzPB8Y/zu3n8c8mGDugF5UeTyIc3so/86AVqyU1TiWCAp/zR324vPYHnMwBhsv3h+NLoI0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3317 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 suspectscore=0 phishscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240168 X-Proofpoint-ORIG-GUID: dZbhIG1IKeyQBg-LOxVYbH4dnY3VuuA2 X-Proofpoint-GUID: dZbhIG1IKeyQBg-LOxVYbH4dnY3VuuA2 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 lowpriorityscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 suspectscore=0 spamscore=0 priorityscore=1501 clxscore=1015 impostorscore=0 phishscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240168 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Drivers shouldn't be calling block/unblock session for cmd cleanup because the functions can change the session state from under libiscsi. This adds a new a driver level bit so it can block all IO the host while it drains the card. Reviewed-by: Manish Rangankar Signed-off-by: Mike Christie --- drivers/scsi/qedi/qedi.h | 1 + drivers/scsi/qedi/qedi_iscsi.c | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qedi/qedi.h b/drivers/scsi/qedi/qedi.h index c342defc3f52..ce199a7a16b8 100644 --- a/drivers/scsi/qedi/qedi.h +++ b/drivers/scsi/qedi/qedi.h @@ -284,6 +284,7 @@ struct qedi_ctx { #define QEDI_IN_RECOVERY 5 #define QEDI_IN_OFFLINE 6 #define QEDI_IN_SHUTDOWN 7 +#define QEDI_BLOCK_IO 8 u8 mac[ETH_ALEN]; u32 src_ip[4]; diff --git a/drivers/scsi/qedi/qedi_iscsi.c b/drivers/scsi/qedi/qedi_iscsi.c index 0061866614b4..6e4f7c427af1 100644 --- a/drivers/scsi/qedi/qedi_iscsi.c +++ b/drivers/scsi/qedi/qedi_iscsi.c @@ -330,12 +330,22 @@ qedi_conn_create(struct iscsi_cls_session *cls_session, uint32_t cid) void qedi_mark_device_missing(struct iscsi_cls_session *cls_session) { - iscsi_block_session(cls_session); + struct iscsi_session *session = cls_session->dd_data; + struct qedi_conn *qedi_conn = session->leadconn->dd_data; + + spin_lock_bh(&session->frwd_lock); + set_bit(QEDI_BLOCK_IO, &qedi_conn->qedi->flags); + spin_unlock_bh(&session->frwd_lock); } void qedi_mark_device_available(struct iscsi_cls_session *cls_session) { - iscsi_unblock_session(cls_session); + struct iscsi_session *session = cls_session->dd_data; + struct qedi_conn *qedi_conn = session->leadconn->dd_data; + + spin_lock_bh(&session->frwd_lock); + clear_bit(QEDI_BLOCK_IO, &qedi_conn->qedi->flags); + spin_unlock_bh(&session->frwd_lock); } static int qedi_bind_conn_to_iscsi_cid(struct qedi_ctx *qedi, @@ -789,6 +799,9 @@ static int qedi_task_xmit(struct iscsi_task *task) if (test_bit(QEDI_IN_SHUTDOWN, &qedi_conn->qedi->flags)) return -ENODEV; + if (test_bit(QEDI_BLOCK_IO, &qedi_conn->qedi->flags)) + return -EACCES; + cmd->state = 0; cmd->task = NULL; cmd->use_slowpath = false; From patchwork Sat Apr 24 22:06:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 427043 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C5CBC433ED for ; Sat, 24 Apr 2021 22:06:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 51FE661370 for ; Sat, 24 Apr 2021 22:06:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234794AbhDXWHT (ORCPT ); Sat, 24 Apr 2021 18:07:19 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:33888 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234031AbhDXWHQ (ORCPT ); Sat, 24 Apr 2021 18:07:16 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13OM5LpQ004723; Sat, 24 Apr 2021 22:06:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=RgQABGq+XqacCzfgv5Sdx3p15QKZ24X8dWjfabDnYoE=; b=SjNmE/g6xZoRirjpe8ezpsVnaWh/ME8MxJwMQSp5EiKvXzcdWd2X5ZMUb9xep+YQ1FGZ AUb0bRn0oqOp3O2AQu0kYjd96d56Ljc5l9NCKQN0aMo0EUj28YmcrdVm1N2QW9R5f/SP jI1TlDnqlXo2ynWhP4U4KaeQfAUletUPScdM5MsIXV11uf9MegiNbuY6iQUPGGAFaYev 4UGegjvxl6AdQa+lb08deFsUtISIfAokUO0jvTM3pHCx2u7EXq3nR16zJsz4alJIXrWd Wtb9ZHteuueFvafjXMy//2pcBK0yyKzWB2KT5qnD1T7N6bRCjLB0R3PaMfNxOc2Q/tfi 6Q== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 384byp0rkt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:06:31 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13OM6B80045523; Sat, 24 Apr 2021 22:06:31 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by userp3020.oracle.com with ESMTP id 384anj7uv3-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:06:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PzV8nAqwjh07IOYdF3WMTITNydd8Mw6qglzo9Q59ESXPwccEaImd/OITOoW26gDWNEIQGWd+53KiaECgFrp8jZeZby/GsQ4BavSpWCGI+xP2nMx5j5wa9k9UUCQJvX/dnGG5/Yp7Ghucv6iMzVyhnEdTEqxqvB9cbHvfQQVNzOrqtMqPofninEgKTW/Bt5j8O3ESN7G3QqQVRSiMcWUcBexL5Rp/kMYFbLk95Sjyh/kMP3jZg4spp6mPM45DrpgCHk3K1iE71RUtOOduRL712wvGOHlktShRG8cmYFSfZnUnTetuj0OtyzVwMyQEUSnHvyfTBjD0u66Nb+fYL1ULVA== 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-SenderADCheck; bh=RgQABGq+XqacCzfgv5Sdx3p15QKZ24X8dWjfabDnYoE=; b=NTd/WVjUhX77iuI5Lm5LrqxbzK78K/7hgX0B4oUs8/2Vmhxn9kvOrohR+6BCO+U0MRtxU0E4vMd6vWRsMwWs5J8dqQ8N4/S9htvp7qrIJpUI1PkK8ZimnXMfgwB7GFS6wqdzueZpenympWINyjPuMq+em0mpSnayb1tdn4NV8xcZCjnlw0YsZoGxCzRUAVxmPbmUp9vmj87r75JKBV2GQutPktZ6TwdLvjAbHcNcw9eps2ravI9Ry5eSI/2hhj+/S56f0DNNuRmlJHJ1NF0NOJXHNU03+Ew+U69nPd9KHZmHiPyyZ1bqO4MMzACibf8ZycjOxMFCCcO6JhK21e0ctg== 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=RgQABGq+XqacCzfgv5Sdx3p15QKZ24X8dWjfabDnYoE=; b=JHyxAzg+y+Q/D0IeZFOPj660u8J9qDSgyv31B8mndMCxgRYWNbV02IVqNm2Vi9sSJngKwv3eYctodPBlsZf+KX0jvi3KliSyM1nztnN4d32JA+2937yhya83AfreuN5kykF9hZA9xzV+g0brnfnNSYdC/1rzd5JeXfpkv7NbUw8= Authentication-Results: suse.com; dkim=none (message not signed) header.d=none; suse.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BYAPR10MB3317.namprd10.prod.outlook.com (2603:10b6:a03:158::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.24; Sat, 24 Apr 2021 22:06:29 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4%7]) with mapi id 15.20.4065.021; Sat, 24 Apr 2021 22:06:29 +0000 From: Mike Christie To: lduncan@suse.com, martin.petersen@oracle.com, mrangankar@marvell.com, svernekar@marvell.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH v4 15/17] scsi: qedi: pass send_iscsi_tmf task to abort Date: Sat, 24 Apr 2021 17:06:01 -0500 Message-Id: <20210424220603.123703-16-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210424220603.123703-1-michael.christie@oracle.com> References: <20210424220603.123703-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM5PR16CA0044.namprd16.prod.outlook.com (2603:10b6:4:15::30) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by DM5PR16CA0044.namprd16.prod.outlook.com (2603:10b6:4:15::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.20 via Frontend Transport; Sat, 24 Apr 2021 22:06:28 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 761bbcd2-a543-4d8d-afc9-08d9076d35ed X-MS-TrafficTypeDiagnostic: BYAPR10MB3317: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:962; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fUodTzIbBc/vxtrRXeD8qBeai1w8EA0p7D62QL91Gun1xdqlqDLChltigjuxB0JcPApNpJVBsBaj8K/uPhEgqPJfV7wAd8+3h5F/491m10mo21m38zKwevgu0Ge2a8WdHd5swi1ik9gjSVCgW0reUIiirWDa249WL5oPQ0PtWfNXhS4WQ9AWHhGmy40OEbWzNBzRA+LKGymbJTT7+MCya4++FaAqRJQqyXFlGaEhHg2nbzfWMVbQh8ILZVtacfPz8xqV7rpp0YypVpI1FqfmpgCawbwnBU79A+CcvOS1ECjdHIWtzSx4BGv1hugjir5wGFa1zgzQzYreqAt1TTTff/YiunNhVvPiZkHO1abnU0CSGwdzi08dOhqU4WotV7UwCzeMCalHTjEk/3LsNhZghE13lJT+wsf8UjdMoaYS/sqWMiSDyN7/8xhSm9w/QLR033GA8rzfljKNtBAWu8thxRS4L7zUORbNdbGvPXegzlHpVqga/uFo5j0OlH1j8t+MdcjvJyhPfV/pJuKtpK8HQALASdYSdLFiZFUwYNo8JeSdvzORy2NwH7wbGCFKlN9N9ut7tXzb7yyzIv5Fku4PgpnlJgbpZKyJaEsoCXC+MOZvGqTfNJCxi7O2k3+gHwBxxdUIt+ExCzntgw6xcpaWfOEL2QcGk3rN2O+M0HtI+i5mdxEpLr0qfPx8en2UrqfP X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR10MB3573.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(366004)(346002)(396003)(376002)(39860400002)(4326008)(6666004)(1076003)(36756003)(86362001)(52116002)(478600001)(83380400001)(38350700002)(38100700002)(8936002)(5660300002)(26005)(16526019)(316002)(6512007)(8676002)(956004)(186003)(2616005)(66476007)(2906002)(66946007)(66556008)(6486002)(107886003)(6506007)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: kB2wMGm8i5noFlABhRsR3URVOd3yP6d0P5CB+NQYTf5uAvZoBovECzta9oYTia2yXznYsaax01sIVAvT8ovknqMT005LpHqglKmPo2uJBCAjGk7i0KaMVd9Hu8ysRgnWviTq6KURKveLzx6fVpR+SqAROwaZEH4P1hNcIUshsn/u/TONjttZLby9B0wVEnf/0rLfJfWuQSfJD+7GTZHGUMcknSvhJ/3viiJcneG3tokJ79lqDMuJZs8tryfpYo+rCO9dZWzOhLuT1pb0E7BJYIC3QIEguB+8lVB2TifIvBxVI3KekYyJVH3NxvBt+fWCASoBOGFuo1PsT45ktOCvWh7EJv0Mij2VrTjcr+9KxgJrUBFeDBaUvr7HOfmLgxumpmFHk5g5bhYr+jQvJ8ikaFlovi543VQq+zE2AH6sP6UZ1P4lHnojMm75KsLEwL0T7nofoS0O7KTGRtX52GBJmso4UVduoeNt7Ild5efbGdS6iiTV7p4J99tumazcLDdWYLV6kqVhiG6Xo/UcUgrckPePnXhpXOgmButwtsVI4oIWkNcmYOX6x81H+zz0fFnu4UIk06TsVygw4bPck5w8Evvz/kc+2s6OG205vZiDmLlHuE9naZWUTYM5j4kCI5jWE9aV/v3L1xQ740kZCA+STfo37WXAs6uvzftd3D5WFmVfaJxJpUVSwDprn3NXQGpy75VXFT9AxWIQEWtoI3KuCMxW7kZ+X8HDjQzj5Gehr1RVopdOfGCqT7X/M7BeXCvJlaZBTWi+ECxg7UsqOQpw/F1KfJxhOb3Xt+lawXH8TAMR+0aUTHhG6eZaIrTNHnVoHt4b13a627AhNZkFqjmnWkoyJrEKGHM4Ty8p5dinttWTXgTrblkrsxAQBGnOPGq06im3/YepNPxS4usc4PaDn7EjEAEcWzWZWvheVakrY+kiI0v9ZP+KcqE5gJ9xDDwLpWYpJ+17+uZIoIQtLC4/PHyidFzqT3vC9Z/3xutG5rkNP43Ej/lPP+CfqRZj9k7UafzuvbNOupB9ykgXFRHjVWdeMyKJx4vcIpnYQDnc1NK9msSy2idKhQ6FldVaasdVSBfS6ONihxdRB6W3ncwsGXN12KtS789N4TdYPB/uY//Kh9iZVpVAdOYlvuzBWjkNAV/8QJQhSj3lMkm5cgspNWpX/F8o2t4lgmrsE4cRlMX4ipkpg3l4SEt7YZ8xGBFqJU/G6/3gAc6aeRIOgZLMM1S+ODmD57UZggo8xqfDPJAlrwYTBBD7fu8jOfD9py3Lhqg0Sa+T9bad8gng2xEp2QQ5VvjpK9pTVpfDJl28Lc8gNTw3IsaaBHVGywjACzvm X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 761bbcd2-a543-4d8d-afc9-08d9076d35ed X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2021 22:06:28.9123 (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: XR55AB3dYl/rukrZYDJjULlktpy9WCXJfjyGV+2oHgeL+xHmF3E2yk3avT6DtkmlvtGfEzzft2DlCy9p6EWkg+rbAw//KoNHakaDZn2Na1o= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3317 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 suspectscore=0 phishscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240168 X-Proofpoint-ORIG-GUID: dGrhis9FQVE66Cfz_2jmYiZOIDtx_EhB X-Proofpoint-GUID: dGrhis9FQVE66Cfz_2jmYiZOIDtx_EhB X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 lowpriorityscore=0 adultscore=0 impostorscore=0 malwarescore=0 priorityscore=1501 mlxlogscore=999 suspectscore=0 clxscore=1015 mlxscore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240168 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org qedi_abort_work knows what task to abort so just pass it to send_iscsi_tmf. Reviewed-by: Manish Rangankar Signed-off-by: Mike Christie --- drivers/scsi/qedi/qedi_fw.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/qedi/qedi_fw.c b/drivers/scsi/qedi/qedi_fw.c index f9c0fa94859d..0ce4bf0d16a8 100644 --- a/drivers/scsi/qedi/qedi_fw.c +++ b/drivers/scsi/qedi/qedi_fw.c @@ -15,7 +15,7 @@ #include "qedi_fw_scsi.h" static int send_iscsi_tmf(struct qedi_conn *qedi_conn, - struct iscsi_task *mtask); + struct iscsi_task *mtask, struct iscsi_task *ctask); void qedi_iscsi_unmap_sg_list(struct qedi_cmd *cmd) { @@ -1423,7 +1423,7 @@ static void qedi_abort_work(struct work_struct *work) goto ldel_exit; } - send_iscsi_tmf(qedi_conn, qedi_cmd->task); + send_iscsi_tmf(qedi_conn, qedi_cmd->task, ctask); put_task: iscsi_put_task(ctask); @@ -1453,14 +1453,13 @@ static void qedi_abort_work(struct work_struct *work) clear_bit(QEDI_CONN_FW_CLEANUP, &qedi_conn->flags); } -static int send_iscsi_tmf(struct qedi_conn *qedi_conn, struct iscsi_task *mtask) +static int send_iscsi_tmf(struct qedi_conn *qedi_conn, struct iscsi_task *mtask, + struct iscsi_task *ctask) { struct iscsi_tmf_request_hdr tmf_pdu_header; struct iscsi_task_params task_params; struct qedi_ctx *qedi = qedi_conn->qedi; struct e4_iscsi_task_context *fw_task_ctx; - struct iscsi_conn *conn = qedi_conn->cls_conn->dd_data; - struct iscsi_task *ctask; struct iscsi_tm *tmf_hdr; struct qedi_cmd *qedi_cmd; struct qedi_cmd *cmd; @@ -1500,12 +1499,6 @@ static int send_iscsi_tmf(struct qedi_conn *qedi_conn, struct iscsi_task *mtask) if ((tmf_hdr->flags & ISCSI_FLAG_TM_FUNC_MASK) == ISCSI_TM_FUNC_ABORT_TASK) { - ctask = iscsi_itt_to_task(conn, tmf_hdr->rtt); - if (!ctask || !ctask->sc) { - QEDI_ERR(&qedi->dbg_ctx, - "Could not get reference task\n"); - return 0; - } cmd = (struct qedi_cmd *)ctask->dd_data; tmf_pdu_header.rtt = qedi_set_itt(cmd->task_id, @@ -1558,7 +1551,7 @@ int qedi_send_iscsi_tmf(struct qedi_conn *qedi_conn, struct iscsi_task *mtask) case ISCSI_TM_FUNC_LOGICAL_UNIT_RESET: case ISCSI_TM_FUNC_TARGET_WARM_RESET: case ISCSI_TM_FUNC_TARGET_COLD_RESET: - rc = send_iscsi_tmf(qedi_conn, mtask); + rc = send_iscsi_tmf(qedi_conn, mtask, NULL); break; default: QEDI_ERR(&qedi->dbg_ctx, "Invalid tmf, cid=0x%x\n", From patchwork Sat Apr 24 22:06:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 427042 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08D81C433ED for ; Sat, 24 Apr 2021 22:06:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D940961009 for ; Sat, 24 Apr 2021 22:06:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237218AbhDXWHW (ORCPT ); Sat, 24 Apr 2021 18:07:22 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:57392 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234608AbhDXWHT (ORCPT ); Sat, 24 Apr 2021 18:07:19 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13OM6XII151687; Sat, 24 Apr 2021 22:06:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=I453EkNqOXHHxU9rVpcwy89WAUEWNMirzkmjh3pEDQQ=; b=yXCrQYnW3xvbUeE7iYv9vUletAfQdSbVA4fDjjGmiyUrzrzVL1vSlc4TU/oB3uJmntbQ 36rV3P5C30EyHwicar7ax/bJqIuGbGJqN/Za6aWbHhWImxv/H8lYoY2yjck+4elEUYQf CYiQkH+arPfHD8Z6HctjdAKF3OiHoJSIyErqsS6zZksus0dEsmFI8JZYVmplSiv08atW sfaa82J2YQvyNM43nO2aRN+NHHm7xyNHn+0OwYUolT3HnBrR/LcKvgYyG8aZU+khS/yY puZrfm1gQG0HiKDzlbLpVlw2dKiHZrGeeIn2yYlsWaGdsspaBCQcx7AU8xsHO8oG7wHY mA== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 384ars0t15-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:06:33 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13OM655J182233; Sat, 24 Apr 2021 22:06:32 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2040.outbound.protection.outlook.com [104.47.66.40]) by aserp3030.oracle.com with ESMTP id 3849cakfvq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:06:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IRo2El0c9L/SpdW7QoZf6jILsMKxVz+0C5n4F2kkVdWYAowCjMWTe6s2gAWi40AmJVRHvQS0FwpXV7YkdmWwaTHE74X7k5yIkj/dNkbzm93FJcn6Oh0CLAUIwcDCPdoswk4X//72BZtU9ygpcmsl72DN67BnbjwPqHV1XqXy+QZqW+Bo0w4Y3gBryh20QiphY8uDRNtxZT95lTTQ6zNxulCcg7JtyHiP4Fp1DrMi+BVmHegxD0KYISCcUZl2Yv80WICUsPlMdU2Y3h8/eaaxYkQTgyiNjNYoY2OLqJmzxuUmVMIHGMa28KnqzqRwljpu5xNWYn5GAVGtNSZZb9vLew== 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-SenderADCheck; bh=I453EkNqOXHHxU9rVpcwy89WAUEWNMirzkmjh3pEDQQ=; b=LwGiaptu4frotK+PUNhUrNhbxF/7mb3npW9FTE7bPMaGFyWKQTOv5hkdQb95kQjj6P/Tw2nC8lHOVUE0G9GqGD3rS5a6xQ8hjErdH6r5e/6/aabu3nk4JW187BWY2Hnxib2LIK02Ngy+nXq4dsZlBOA1stLDoVfVpbX3pI01G3cB+9TJdgsj7acr8EyGcFz5OlQFlwpAElQLkSQOPinKb3wRN69BRQbNAZBVosVqTLlZDouZp6kRuV0yOc0+JOAH/JcC2Os0LwRRduG0AxsQ3uKgaXvoJNA3iUNOC+JSCMQtdXARoY1swHG30fu8M6uLnIqhMYzWlyVvTwxKbvrSBg== 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=I453EkNqOXHHxU9rVpcwy89WAUEWNMirzkmjh3pEDQQ=; b=ektM+9mYRTL3AD52QoEYShsPE00ZEmWKqGPFyZT9B/a2BK1lo0CC6W8s2W0tsXp4EWIyQwnsrlR5ZaAyzP8WDRUevASrrskcmZp8nMfQu54mZv+BCjapUQEj1HuDMhkv25Ob4o6qSsb/jjfVv2aexYc2WzhkAAu1dMzHhRUc3ss= Authentication-Results: suse.com; dkim=none (message not signed) header.d=none; suse.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by SJ0PR10MB4493.namprd10.prod.outlook.com (2603:10b6:a03:2dd::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.21; Sat, 24 Apr 2021 22:06:30 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4%7]) with mapi id 15.20.4065.021; Sat, 24 Apr 2021 22:06:30 +0000 From: Mike Christie To: lduncan@suse.com, martin.petersen@oracle.com, mrangankar@marvell.com, svernekar@marvell.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH v4 16/17] scsi: qedi: complete TMF works before disconnect Date: Sat, 24 Apr 2021 17:06:02 -0500 Message-Id: <20210424220603.123703-17-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210424220603.123703-1-michael.christie@oracle.com> References: <20210424220603.123703-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM5PR16CA0044.namprd16.prod.outlook.com (2603:10b6:4:15::30) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by DM5PR16CA0044.namprd16.prod.outlook.com (2603:10b6:4:15::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.20 via Frontend Transport; Sat, 24 Apr 2021 22:06:29 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 21d743fa-60f0-42cb-f375-08d9076d3686 X-MS-TrafficTypeDiagnostic: SJ0PR10MB4493: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FJMaM7khBBNmq53On7y8YYSgvXPZePoLVGXfHqaCRiA/7+GQO7xpYpPoaMq5gEkSMbv26bxtCn6wd5qlA9HR4jgG7Wz4YVfeC+KnpnaeXe10NC7+LIO/qxG6NuKvEF0jANtd0wb8AV9g9tcKCIO7HGAzWO1h9DvZTEdY9iaWLZXWS7lMJ980olGq+a+oOmqQ81GaC+y6UXWSb+ZXbaPEfSxtA+Orh5ad/t1NIBIK/EP6hMxzxsv4ihrI9ZZb94IyMVRCja4OqtAEjrz8Vt1gmFnw1EUo9MUwoXtGKV9/SwgmPN45jClsxO70kojfVTUUkXHTAiSO/HMri2iWDhtuMfzQyJ5cf878iuA2U7GkIdeP6tfrNURcMyjx1dfrGIk3G1U6an8pNDDp7fgEReO3jQ8UMpB+9co+SnDnGIxtVuAgekcO01wu6rQyO5e4rHdpcRgcXSX51HeTErcLVTNIrta7X0G/ZuTCe6cA3588mp2VIDj1S7rqwfiHbo+s6M9kRfQVkx216X8aW+WHESV+A7Kt1KvFYlMqHa7q7UudsCGvpYSZypRCyU68NHSKwSpPlIW3a/pZ2XSHzi5jZiFoeGVfgMXl3y74f1+HaZKiG0F4h9aqNl06c0azSbTMVivTcTcr7dPX+O85nnhJPmXjUejbvrx5ZpAZNXozM/fbK4DvVstossxiJGemxUfNE7/e X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR10MB3573.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(39860400002)(366004)(136003)(376002)(346002)(396003)(316002)(8676002)(16526019)(66556008)(66946007)(5660300002)(66476007)(186003)(26005)(36756003)(8936002)(52116002)(1076003)(38100700002)(956004)(2616005)(83380400001)(107886003)(2906002)(6666004)(6506007)(6486002)(6512007)(478600001)(4326008)(86362001)(38350700002)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: zMBUmgHUYATLAQOFrXrUC9ElIyFXogqe1lugcsPLxxuYg//zcUCQVbtQ9xH9NX82BvfsPsroCTdT4tDk0SFjyLgy7N8PcuFuZluXJ7ihjEnYjCzsUCxIcZdb7PrqPfc1QSRHnFn9ZmuUAEFl60BDp0zaxaulkHjoEJuLU+qNNVQeYl4VE/fs0ZIDeTO1fRMWO+rHF99992+fybQKDGnnTIwoeFJfQn+rwZ4+I+IuamkiEsqxAYjcA4aZ6O5SWFoMHnLRMImIqLGx5uvyPvauzzzuMlhfJbmDrB0Tfxji0Kf78GsO2C3KUD8pjvYlfpHTkZmglpE9A9I9S0JR6Ao2p7VXCHX/46VaZd2EkZ8zCoWxa1eGa9rOy0iuyjYAtpJ6txdf3ET5W7nulxdVwSglDvYrJaE0iNJHewIhzYmFnBgWzSeBRkcMIqsA2Gu0zlZgevjM4Y/32Kp0BEqOlQ/82nzFvRJ6/OD1lcs3aiHjIFiLyeQQs+2s6OmmjkoPR5pC71eAlZBrmF6UpyvrGTnDLKbVbmxavSKpGZ7H0IkTumtyNl50T8/TRGchYsPxdcfUGlNBQj9tbs5Nn8voN/TcSHUf6EX1HDICPAaeSqPiCWXqUMvD2dWmhkFWBj8vTpLdK55AjIW4+RCPeVSIgD8v2Li+X5fT4UF/LQfwFj5XmTgPyBo/MlTa3RA87bHSgV/ewlxix3hIqnvJquq9Rw8QOOd5pWbnam+DHwSyKGXmuzVKu5u9B2XX2Rw1erUECJBtxDm17UnJMtWmLpcY/x6xWzhMWtFcaPyzP9TMvJ6VQQjvbfCGIPX23X+mnIcExPljUK+Av0NK/4w1P0oIvtg5RnGn5XZ9IkNCq7bZAtPgvOZMMu1DEa/G5RKh5e8UZUHBSvytbIuVlLr9AVQxUDYNQI7wG/UPZAaxhhes7vB7XTOq87D/tS8M/QgT29ExekAMgmUwzlUcolK1szKks/ubvYloSB1AU4H1FCU9bzqmj9LhkQQ5n9i0g1q2g7yFKJ7TcStnOxYmz9XAi0rE0PaVmB5RyLdIKLkBN1dPcw4u7R1LJdZv0HFAhjTYBnAUNP1u6q2ZCZQIhKpegeUyAKHZ4pDDqr8ffN7qAZdZyy0VR62EoigVyjLkFODrBmGJshz8b3D5ERX3ocr433xWfhWDFFOgbpDaTWnuU9Eq9rohrhKpMZh5M8aMa0yjdD9KppGgiBQgIKyriQ/gN3oqcNwCM31cKo9aC2h3ErXFa1R/8js3Cdw19hvOW7WNvb3MuPTGydyETUvyaszwiwx/Uf6ZZAxmA12Apl57hKYsX2LZRXLRUobB7mvVblDwtMK+yb2i X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 21d743fa-60f0-42cb-f375-08d9076d3686 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2021 22:06:29.9947 (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: bU6aUEd94keMJ16goocd4OIdg6DXNzJGApTpXt/vNuhw+9Wj8ZXXj0ipZ8/yfetDWdHxKDZcalkRaWhAru41v+rDYKkozJfbGW2I+SFXZDc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4493 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=0 adultscore=0 mlxscore=0 spamscore=0 phishscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240168 X-Proofpoint-ORIG-GUID: ufM1WZOTs_7VHRYuqGO7uKkZPQZzmWp6 X-Proofpoint-GUID: ufM1WZOTs_7VHRYuqGO7uKkZPQZzmWp6 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 impostorscore=0 adultscore=0 malwarescore=0 phishscore=0 mlxlogscore=999 suspectscore=0 priorityscore=1501 clxscore=1015 spamscore=0 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240168 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org We need to make sure that abort and reset completion work has completed before ep_disconnect returns. After ep_disconnect we can't manipulate cmds because libiscsi will call conn_stop and take onwership. We are trying to make sure abort work and reset completion work has completed before we do the cmd clean up in ep_disconnect. The problem is that: 1. the work function sets the QEDI_CONN_FW_CLEANUP bit, so if the work was still pending we would not see the bit set. We need to do this before the work is queued. 2. If we had multiple works queued then we could break from the loop in qedi_ep_disconnect early because when abort work 1 completes it could clear QEDI_CONN_FW_CLEANUP. qedi_ep_disconnect could then see that before work 2 has run. 3. A TMF reset completion work could run after ep_disconnect starts cleaning up cmds via qedi_clearsq. ep_disconnect's call to qedi_clearsq -> qedi_cleanup_all_io would might think it's done cleaning up cmds, but the reset completion work could still be running. We then return from ep_disconnect while still doing cleanup. This replaces the bit with a counter to track the number of queued TMF works, and adds a bool to prevent new works from starting from the completion path once a ep_disconnect starts. Reviewed-by: Manish Rangankar Signed-off-by: Mike Christie --- drivers/scsi/qedi/qedi_fw.c | 46 +++++++++++++++++++++------------- drivers/scsi/qedi/qedi_iscsi.c | 23 +++++++++++------ drivers/scsi/qedi/qedi_iscsi.h | 4 +-- 3 files changed, 47 insertions(+), 26 deletions(-) diff --git a/drivers/scsi/qedi/qedi_fw.c b/drivers/scsi/qedi/qedi_fw.c index 0ce4bf0d16a8..03feabcefc7d 100644 --- a/drivers/scsi/qedi/qedi_fw.c +++ b/drivers/scsi/qedi/qedi_fw.c @@ -156,7 +156,6 @@ static void qedi_tmf_resp_work(struct work_struct *work) struct iscsi_tm_rsp *resp_hdr_ptr; int rval = 0; - set_bit(QEDI_CONN_FW_CLEANUP, &qedi_conn->flags); resp_hdr_ptr = (struct iscsi_tm_rsp *)qedi_cmd->tmf_resp_buf; rval = qedi_cleanup_all_io(qedi, qedi_conn, qedi_cmd->task, true); @@ -169,7 +168,10 @@ static void qedi_tmf_resp_work(struct work_struct *work) exit_tmf_resp: kfree(resp_hdr_ptr); - clear_bit(QEDI_CONN_FW_CLEANUP, &qedi_conn->flags); + + spin_lock(&qedi_conn->tmf_work_lock); + qedi_conn->fw_cleanup_works--; + spin_unlock(&qedi_conn->tmf_work_lock); } static void qedi_process_tmf_resp(struct qedi_ctx *qedi, @@ -225,16 +227,25 @@ static void qedi_process_tmf_resp(struct qedi_ctx *qedi, } spin_unlock(&qedi_conn->list_lock); - if (((tmf_hdr->flags & ISCSI_FLAG_TM_FUNC_MASK) == - ISCSI_TM_FUNC_LOGICAL_UNIT_RESET) || - ((tmf_hdr->flags & ISCSI_FLAG_TM_FUNC_MASK) == - ISCSI_TM_FUNC_TARGET_WARM_RESET) || - ((tmf_hdr->flags & ISCSI_FLAG_TM_FUNC_MASK) == - ISCSI_TM_FUNC_TARGET_COLD_RESET)) { + spin_lock(&qedi_conn->tmf_work_lock); + switch (tmf_hdr->flags & ISCSI_FLAG_TM_FUNC_MASK) { + case ISCSI_TM_FUNC_LOGICAL_UNIT_RESET: + case ISCSI_TM_FUNC_TARGET_WARM_RESET: + case ISCSI_TM_FUNC_TARGET_COLD_RESET: + if (qedi_conn->ep_disconnect_starting) { + /* Session is down so ep_disconnect will clean up */ + spin_unlock(&qedi_conn->tmf_work_lock); + goto unblock_sess; + } + + qedi_conn->fw_cleanup_works++; + spin_unlock(&qedi_conn->tmf_work_lock); + INIT_WORK(&qedi_cmd->tmf_work, qedi_tmf_resp_work); queue_work(qedi->tmf_thread, &qedi_cmd->tmf_work); goto unblock_sess; } + spin_unlock(&qedi_conn->tmf_work_lock); __iscsi_complete_pdu(conn, (struct iscsi_hdr *)resp_hdr_ptr, NULL, 0); kfree(resp_hdr_ptr); @@ -1359,7 +1370,6 @@ static void qedi_abort_work(struct work_struct *work) mtask = qedi_cmd->task; tmf_hdr = (struct iscsi_tm *)mtask->hdr; - set_bit(QEDI_CONN_FW_CLEANUP, &qedi_conn->flags); spin_lock_bh(&conn->session->back_lock); ctask = iscsi_itt_to_ctask(conn, tmf_hdr->rtt); @@ -1425,11 +1435,7 @@ static void qedi_abort_work(struct work_struct *work) send_iscsi_tmf(qedi_conn, qedi_cmd->task, ctask); -put_task: - iscsi_put_task(ctask); -clear_cleanup: - clear_bit(QEDI_CONN_FW_CLEANUP, &qedi_conn->flags); - return; + goto put_task; ldel_exit: spin_lock_bh(&qedi_conn->tmf_work_lock); @@ -1447,10 +1453,12 @@ static void qedi_abort_work(struct work_struct *work) qedi_conn->active_cmd_count--; } spin_unlock(&qedi_conn->list_lock); - +put_task: iscsi_put_task(ctask); - - clear_bit(QEDI_CONN_FW_CLEANUP, &qedi_conn->flags); +clear_cleanup: + spin_lock(&qedi_conn->tmf_work_lock); + qedi_conn->fw_cleanup_works--; + spin_unlock(&qedi_conn->tmf_work_lock); } static int send_iscsi_tmf(struct qedi_conn *qedi_conn, struct iscsi_task *mtask, @@ -1545,6 +1553,10 @@ int qedi_send_iscsi_tmf(struct qedi_conn *qedi_conn, struct iscsi_task *mtask) switch (tmf_hdr->flags & ISCSI_FLAG_TM_FUNC_MASK) { case ISCSI_TM_FUNC_ABORT_TASK: + spin_lock(&qedi_conn->tmf_work_lock); + qedi_conn->fw_cleanup_works++; + spin_unlock(&qedi_conn->tmf_work_lock); + INIT_WORK(&qedi_cmd->tmf_work, qedi_abort_work); queue_work(qedi->tmf_thread, &qedi_cmd->tmf_work); break; diff --git a/drivers/scsi/qedi/qedi_iscsi.c b/drivers/scsi/qedi/qedi_iscsi.c index 6e4f7c427af1..25ff2bda077b 100644 --- a/drivers/scsi/qedi/qedi_iscsi.c +++ b/drivers/scsi/qedi/qedi_iscsi.c @@ -592,7 +592,11 @@ static int qedi_conn_start(struct iscsi_cls_conn *cls_conn) goto start_err; } - clear_bit(QEDI_CONN_FW_CLEANUP, &qedi_conn->flags); + spin_lock(&qedi_conn->tmf_work_lock); + qedi_conn->fw_cleanup_works = 0; + qedi_conn->ep_disconnect_starting = false; + spin_unlock(&qedi_conn->tmf_work_lock); + qedi_conn->abrt_conn = 0; rval = iscsi_conn_start(cls_conn); @@ -1008,7 +1012,6 @@ static void qedi_ep_disconnect(struct iscsi_endpoint *ep) int ret = 0; int wait_delay; int abrt_conn = 0; - int count = 10; wait_delay = 60 * HZ + DEF_MAX_RT_TIME; qedi_ep = ep->dd_data; @@ -1024,13 +1027,19 @@ static void qedi_ep_disconnect(struct iscsi_endpoint *ep) qedi_conn = qedi_ep->conn; abrt_conn = qedi_conn->abrt_conn; - while (count--) { - if (!test_bit(QEDI_CONN_FW_CLEANUP, - &qedi_conn->flags)) { - break; - } + QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO, + "cid=0x%x qedi_ep=%p waiting for %d tmfs\n", + qedi_ep->iscsi_cid, qedi_ep, + qedi_conn->fw_cleanup_works); + + spin_lock(&qedi_conn->tmf_work_lock); + qedi_conn->ep_disconnect_starting = true; + while (qedi_conn->fw_cleanup_works > 0) { + spin_unlock(&qedi_conn->tmf_work_lock); msleep(1000); + spin_lock(&qedi_conn->tmf_work_lock); } + spin_unlock(&qedi_conn->tmf_work_lock); if (test_bit(QEDI_IN_RECOVERY, &qedi->flags)) { if (qedi_do_not_recover) { diff --git a/drivers/scsi/qedi/qedi_iscsi.h b/drivers/scsi/qedi/qedi_iscsi.h index 68ef519f5480..758735209e15 100644 --- a/drivers/scsi/qedi/qedi_iscsi.h +++ b/drivers/scsi/qedi/qedi_iscsi.h @@ -169,8 +169,8 @@ struct qedi_conn { struct list_head tmf_work_list; wait_queue_head_t wait_queue; spinlock_t tmf_work_lock; /* tmf work lock */ - unsigned long flags; -#define QEDI_CONN_FW_CLEANUP 1 + bool ep_disconnect_starting; + int fw_cleanup_works; }; struct qedi_cmd { From patchwork Sat Apr 24 22:06:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 427402 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24D9AC433B4 for ; Sat, 24 Apr 2021 22:06:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 07644611BF for ; Sat, 24 Apr 2021 22:06:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237147AbhDXWHV (ORCPT ); Sat, 24 Apr 2021 18:07:21 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:57390 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234013AbhDXWHT (ORCPT ); Sat, 24 Apr 2021 18:07:19 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13OM6Y8t151690; Sat, 24 Apr 2021 22:06:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=GDkkzTtxytpZ6zgGq7anNQ6wwOwUostgnsTvjKVgibw=; b=uBYn1pPAJUhelTwDV4PWY/hNYsEKA8pXmtkM7WoA4MYtH8ISVU2ZFYGX0tu/kqPnJBrA zAm9Vk7ccFMjWc1GmVifWkcJzxE3BQXgg0sE7fcBYT59DiaznpQ4PTIa8DH/mn6FY7+h fKHqYY9Ck23DclMeNCzh256X5AYpjHmqCtjtWaAY+SOgykK6MbatzIF8+V/vAJKELN82 WjtRuto25lMld2PkUkTKVk6MKG1cweQIri02EQ6a0E94NdOfbabYSEyAigM698X3fh4J Ntqf45YvCCC++YWCNXYhKFs73Jctq9lN/PurPiyAKPbj+hmzA57oXhJ5TzHRJCdeFkVw Ww== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 384ars0t16-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:06:33 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13OM655K182233; Sat, 24 Apr 2021 22:06:33 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2040.outbound.protection.outlook.com [104.47.66.40]) by aserp3030.oracle.com with ESMTP id 3849cakfvq-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:06:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QPq6wZzd92CGIk3HxUtbr3Sf1fRN7XdsyrUXVcWG4L3zzaVZZStcD/vj7UTeA5j8FmUFBEsz8yIo4S+V79GMYryoSFEqGpRL33ATaDcWk8VMvGtO2cuC3KoBuZKgQ9H96bweZYoUZ00dEE1JV7dNciGnK000ijhK+9UsEMlpH7hIWqg6/BrapUNnjcqf9I4Y1jjyeui3yJNrLvtKxV2PXpqBixhBvvFcdGfMtL/V19JF/IMC3Fjp+Ihh1IGNHXj62bZ7IcPIYF/pUZx59yrvHBCj1JGbuKt4wJXMQvAS0yAB2Wm3I8t/WUC1ibwvp5JTMFFdPW4ca4F6daqk5eqozw== 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-SenderADCheck; bh=GDkkzTtxytpZ6zgGq7anNQ6wwOwUostgnsTvjKVgibw=; b=RkYVzeQI2o/UIKftdCiXoPwTQsoLH4vHWpPgwci4s7sBP2BsqrC/2wkmCipRp5tIOkEFrjEaqh8JgCHJFRLoZC/8Dizc3XswuBviZnxJ/RU4wMdZANwpOWAU+ojV0bM/B58+0Hkg8ynZlFUpQjLPFTL4iT3XZwzkolDqo8HeY6QXtk+FiLbdyIMAiD73KBmvh2j2vsCegRmv7hPZNkW1GuocwD9xSl1q59fRlEVfy2majrreYFd9Va5ugvVFuMIndHLOapXgJa0FkMNoOX8cYU692dfd41MN4lf9/PX8xXwFXwYqRUdaA2HwOhisOR5Tnz8sp1yX413XEEZkTM6ZMQ== 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=GDkkzTtxytpZ6zgGq7anNQ6wwOwUostgnsTvjKVgibw=; b=p3NoU0L+UQQ4niP2muRS9QrKw2wnMrT/KPT6iZD1EYeojfwPI7raFx5mMHUZWedn4MiEnTaWHzef2gD5LDVojMR56LVqNNb92T3JFijc8VDmXh8ju+OYxwuHCmiv6OXWVr/tlhT48DOFENt2Oz+IrvxNnTALA6y5UvV/7a8ZLl8= Authentication-Results: suse.com; dkim=none (message not signed) header.d=none; suse.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by SJ0PR10MB4493.namprd10.prod.outlook.com (2603:10b6:a03:2dd::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.21; Sat, 24 Apr 2021 22:06:31 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4%7]) with mapi id 15.20.4065.021; Sat, 24 Apr 2021 22:06:31 +0000 From: Mike Christie To: lduncan@suse.com, martin.petersen@oracle.com, mrangankar@marvell.com, svernekar@marvell.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH v4 17/17] scsi: qedi: always wake up if cmd_cleanup_req is set Date: Sat, 24 Apr 2021 17:06:03 -0500 Message-Id: <20210424220603.123703-18-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210424220603.123703-1-michael.christie@oracle.com> References: <20210424220603.123703-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM5PR16CA0044.namprd16.prod.outlook.com (2603:10b6:4:15::30) To BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (73.88.28.6) by DM5PR16CA0044.namprd16.prod.outlook.com (2603:10b6:4:15::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.20 via Frontend Transport; Sat, 24 Apr 2021 22:06:30 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 44a145b4-e28d-4f1c-b3fd-08d9076d372e X-MS-TrafficTypeDiagnostic: SJ0PR10MB4493: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vDsSoQTh+pe77J58Z8qxboNyUufzpfTfwfhqO1gqTPaQEw4mTdtMt7GfvxHWA57bhDQJ3U/R1Ie4qLB1QmCrj0ouYGUBjhtryvmL74+8+NhiyjYgJwDA1grNLUKSCmepbvvrXZnD8Mn031GzI3fApKJ+nM6jX2VFPdhlMjKt0lsCdJP+FpZd5Yg+erZSi5mySN05wuY202Igr5emYtW6ws8af1uP5oL0A3uF2/ViAPV102Qm13Dsg9ZQHUUbsPClb8/AsuZKJuP9YvwB+R/qMXwvdJnGfQRR84gv6O+28kSuO2Hg2hs/y3LUMzymtPClKqA0DRg3GrpN7PBfg+lYIcNAXs3RFAw4QoLWXnunPYfXVC50EFVlOd9Lt5YtN7nzrRTGkA4Frog4zY2+KOecRQpXjdqfrM7eMaFSEd/aoj+I1kFv+bs1hvQNKvvFwI6t+EKPHlzDT4qkJJ+a0XmHwM1M1V5qGo6u1tQKVVnud9x8biCYGGeT4B/4kRlCL8SzRm6ZLlACclOAVO5uAFsW76vM/Wt13eS/ArwbgtuWFefCulAPnATTYRalN849ABMY6REY/3GNvbM+9YmpNonwx5/PxF30zhfl9ywUWIwOpBG2FZCvB8Vz8t6ey6QB6vtpi5gi3/SBfb+8dfHybNJYzuGTvMReSEa6PFcx9nhlnYI+bVBmqZSxeccx8rKlY5S4 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR10MB3573.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(39860400002)(366004)(136003)(376002)(346002)(396003)(316002)(8676002)(16526019)(66556008)(66946007)(5660300002)(66476007)(186003)(26005)(36756003)(8936002)(52116002)(1076003)(38100700002)(956004)(2616005)(83380400001)(107886003)(2906002)(6666004)(6506007)(6486002)(6512007)(478600001)(4326008)(86362001)(38350700002)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: bCo2qZq8sD7DcrvT8tPcJGbwWWcsqVYpucakgs8dwvxRB3KpT/n8KsQL4yHZA5ErhIW/cynahc+gkd9dw2vXxX3d8kd6eRPkYeboc7gZsk+Hywhm1pdZXELFrOqcasm0SNgbZyJCNx1D5Ck56sXBZY93RayLCWWmyFY6Dz1FL67aitT8Jvagv7RnJxMIUwKA6McA+qPr068E5MuGEmpe9YCZl9YDcHiN6fvj8trOTn5e1c2KkIsfho8PbJLhV+V74vAycbzg7CLitSccop9k1S6JvSwUBLTA+goHYHfjIz3+exNhxIa8IVyIQTtALsErLOabCrtooXwPxMlTGn0D52sCdkYjrRybwY71TFOhJsOiC7Sy3Efv6hrX2NFtNYkbThRe8FotF0CIZhpTDKYJh3A7v66lE8UWNpS+877eN5vlkIV/GkjayL1m1xP216/bZY+6N1UFgPa9uZuuP4zfRQU/ZaWRW9aRRXZIciujzBgk4kH13rqkOk7bIRFgeBwFPevitmQhOWqw7JsfirhXEFXyQBYn765XpTWDyvVjwokt3j2V4BLGNCoxv+erd12cx1R7zp7cJsfzuXBY/D3UJpuPsE8+pn8T3sTdN1BEm6Qah6PIe7QJYRqtGh0j7y972NCsUlFZDzrl8nOKIdYoxntJZ3HDcKDxcXqXZuO2ykGw+8PwqfGEunHZ/OXddJ9pZmeZNpKEqIW5mCF7V2/obCTVvShdD0tYWzQ2rt8fLuL7Z9gw+1594iNMUWkH5FPPOlNhOpOERio2WSWk7pTv1xwaUkI7gicsiPzot+h8dyEwNYvrfbFOkmlFzthEDtvpRtKeO3D8ovtfd7AMur+ZIFuAI6IDyctUy7d+2iIbKy8ImMpfnGM41yfEiUU2z/kwslSZWp2aOazS2YEQ9rzMaeCDzio1voyUBed2ZnHsWpOEGSNMqMsWJxIHIMSjt7MDQtV42FqkYHVYKP0Fk0Tl7wwKnppQkNssY08pbTLtCTUdvIzqW/uoBkLLaOoYBkSg1ZvvW6VBSndZRWjRD7WxIYUFDlCSL3UZeuJeASbZTWxbWn+peeiVxOqXSXdNepvRmtq4nqoRoZgX4+Ao40AAyUK44U4lGm1UmFyjf0bz9b86CzNawM3kCF/Moot16KHyjAPhaYgFoKZFh/p8aCPwP+EtE3wsGyHUBkEss/cO7A/8frC+gzJA9/gaSnwbWkd7iEBW9XPXdRcE9+rdicojm0pKYCHNdwgwn75SUAPLcsOAQA06VhwDG/StGSGLdWI1beBRx49zWc/rfSuNGc1kFme5YZKhWSJS3v3szUavE0kuLdBRWscpcUHrQ8I8npP+ X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 44a145b4-e28d-4f1c-b3fd-08d9076d372e X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2021 22:06:31.0152 (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: dD/V9RzCDnHau9KwYImx6CsVTagvjAPyq7IIuzD65V5E7JXskasTPNWllRAY9F1oEqdGwXroJhk7Xl/Yxf3u8ys2rxeUhHc9UzwuU24K5J4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4493 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=0 adultscore=0 mlxscore=0 spamscore=0 phishscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240168 X-Proofpoint-ORIG-GUID: RuHNvYqLgvyxp-Kj9DMYeWHuCbtuzcf6 X-Proofpoint-GUID: RuHNvYqLgvyxp-Kj9DMYeWHuCbtuzcf6 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 impostorscore=0 adultscore=0 malwarescore=0 phishscore=0 mlxlogscore=999 suspectscore=0 priorityscore=1501 clxscore=1015 spamscore=0 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240168 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If we got a response then we should always wake up the conn. For both the cmd_cleanup_req == 0 or cmd_cleanup_req > 0, we shouldn't dig into iscsi_itt_to_task because we don't know what the upper layers are doing. We can also remove the qedi_clear_task_idx call here because once we signal success libiscsi will loop over the affected commands and end up calling the cleanup_task callout which will release it. Reviewed-by: Manish Rangankar Signed-off-by: Mike Christie --- drivers/scsi/qedi/qedi_fw.c | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/drivers/scsi/qedi/qedi_fw.c b/drivers/scsi/qedi/qedi_fw.c index 03feabcefc7d..37547618743e 100644 --- a/drivers/scsi/qedi/qedi_fw.c +++ b/drivers/scsi/qedi/qedi_fw.c @@ -739,7 +739,6 @@ static void qedi_process_cmd_cleanup_resp(struct qedi_ctx *qedi, { struct qedi_work_map *work, *work_tmp; u32 proto_itt = cqe->itid; - u32 ptmp_itt = 0; itt_t protoitt = 0; int found = 0; struct qedi_cmd *qedi_cmd = NULL; @@ -821,37 +820,15 @@ static void qedi_process_cmd_cleanup_resp(struct qedi_ctx *qedi, check_cleanup_reqs: if (qedi_conn->cmd_cleanup_req > 0) { - spin_lock_bh(&conn->session->back_lock); - qedi_get_proto_itt(qedi, cqe->itid, &ptmp_itt); - protoitt = build_itt(ptmp_itt, conn->session->age); - task = iscsi_itt_to_task(conn, protoitt); - QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM, - "cleanup io itid=0x%x, protoitt=0x%x, cmd_cleanup_cmpl=%d, cid=0x%x\n", - cqe->itid, protoitt, qedi_conn->cmd_cleanup_cmpl, - qedi_conn->iscsi_conn_id); - - spin_unlock_bh(&conn->session->back_lock); - if (!task) { - QEDI_NOTICE(&qedi->dbg_ctx, - "task is null, itid=0x%x, cid=0x%x\n", - cqe->itid, qedi_conn->iscsi_conn_id); - return; - } - qedi_conn->cmd_cleanup_cmpl++; - wake_up(&qedi_conn->wait_queue); - QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_TID, "Freeing tid=0x%x for cid=0x%x\n", cqe->itid, qedi_conn->iscsi_conn_id); - qedi_clear_task_idx(qedi_conn->qedi, cqe->itid); - + qedi_conn->cmd_cleanup_cmpl++; + wake_up(&qedi_conn->wait_queue); } else { - qedi_get_proto_itt(qedi, cqe->itid, &ptmp_itt); - protoitt = build_itt(ptmp_itt, conn->session->age); - task = iscsi_itt_to_task(conn, protoitt); QEDI_ERR(&qedi->dbg_ctx, - "Delayed or untracked cleanup response, itt=0x%x, tid=0x%x, cid=0x%x, task=%p\n", - protoitt, cqe->itid, qedi_conn->iscsi_conn_id, task); + "Delayed or untracked cleanup response, itt=0x%x, tid=0x%x, cid=0x%x\n", + protoitt, cqe->itid, qedi_conn->iscsi_conn_id); } }