From patchwork Tue Apr 13 23:06:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 420559 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.7 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 98EE5C433ED for ; Tue, 13 Apr 2021 23:07:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 662F061004 for ; Tue, 13 Apr 2021 23:07:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348740AbhDMXHb (ORCPT ); Tue, 13 Apr 2021 19:07:31 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:47166 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347896AbhDMXH1 (ORCPT ); Tue, 13 Apr 2021 19:07:27 -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 13DMjeSp168910; Tue, 13 Apr 2021 23:07:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=5Jtu+FbIYasPRbIky/mRTjBkwO8yZmSp8avNWEv58y8=; b=kyiShbTZVIrJKFGlmYReRKxaHB/vgimdlHmTitg5piu2tR1ZtjnIsVeS0acdMgSCbK/R 4PlXEiMjRVR1q/vDVIthngxrOf8XJQCf33RhLvd031CwziyDzloplfMRDnQuPifF/YNk ILW56HQk69p86GWIFFCnNap8V/+AceudLjEAmn3bgdJlZVaEsro/posTBrHnMeHGyG1s lycywsKv12wP91/9rzyD9DnssKr25JZouQCSlTcg2zVV0N9RxRgRdMfHEh/02MoHbuu0 LwJibEHQN/Ybby37ed5gLSmN7HGex9n3V7ogtdQi8aaGNzi0xmMBot2MKK9QICvQw34c 1Q== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2130.oracle.com with ESMTP id 37u1hbgsw7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Apr 2021 23:07:01 +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 13DMjTQv105371; Tue, 13 Apr 2021 23:07:00 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2168.outbound.protection.outlook.com [104.47.56.168]) by userp3020.oracle.com with ESMTP id 37unst1tvs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Apr 2021 23:07:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V/SPLcEUQ5v7C9M+YzVyYcwiQ8oZISZ9b0dLC1jCykn1XFs6Ur9h7lwpAsGcNUtKIydVOySazndxWbaVdRb06b/S43T5NqFk38xC7qU/0QJuy+SH3AQVmGEdUnC9vto8WYELhLLv+jWYLj1P4CW0n57qHY/bhldkEtz6UMgxu1QLgKi0fcPE48zZGrSLTkoYiuPMCLworL/yihjRtK8S7HHe4ltagM03xG5pCEncM/23HCiOorFk2DbOkNbzzC4LqJ2mmomuvuwg0iQ6IHcBytD8I8mlylX5WAAXTi8lBN0lQwFhIwx4kh2MlbkOTJUI9szp2ckTHDccr1r5kQQSMw== 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=5Jtu+FbIYasPRbIky/mRTjBkwO8yZmSp8avNWEv58y8=; b=P21Y3t6xhscznZzPLhswOpBvNA3LQBsjw+ZwN458y+v7ozh6Ha84w+080wxj1LpjBE5QHv9OanSPU7cDD+wbe1YV66+B6uWtXuZjxbTupUCUHQWvzVO2QBlM1qYQru+pSP/OqvmJ1FS4eM0eETVH/e3mUTipoaYF2hLL9NOyeSIWaB3+0ZWaGtLo1WHRv3fa+qiVNQwG7LYBKzhDu3W41G0qOhYNER3rikDcfUzeVtONqVRyvQK5L9Bala0h19T9hQe4ehqfwb9kmbaRYrVgrIeJpl7355r1s0wWtQryYRHTa2MzU25whlHmGlTRYN6aTIvlmvKbJZ1KlGIQmBx4Yg== 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=5Jtu+FbIYasPRbIky/mRTjBkwO8yZmSp8avNWEv58y8=; b=l2xP4+6lnk3xiP0FFkgX3hwLSv9brUEU85lXvklb/3ZlpGocj2/4HPNY09xNe8GlRDx8fFMRIWoPYxdY+ojx07WEJjqREgFvv8cpKNq/3DbPsUbBbtWlqT4yR1AEByKfiH9ikBFd83gmIcbPhMYUhU3mDeiJwLFnxL8pi7GdhiM= 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 BYAPR10MB2469.namprd10.prod.outlook.com (2603:10b6:a02:b0::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.22; Tue, 13 Apr 2021 23:06:58 +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.4020.022; Tue, 13 Apr 2021 23:06:58 +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 01/13] scsi: iscsi: add task completion helper Date: Tue, 13 Apr 2021 18:06:36 -0500 Message-Id: <20210413230648.5593-2-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210413230648.5593-1-michael.christie@oracle.com> References: <20210413230648.5593-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DS7PR03CA0212.namprd03.prod.outlook.com (2603:10b6:5:3ba::7) 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 DS7PR03CA0212.namprd03.prod.outlook.com (2603:10b6:5:3ba::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Tue, 13 Apr 2021 23:06:57 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 84c3bbf0-088b-4846-ce6a-08d8fed0d6b3 X-MS-TrafficTypeDiagnostic: BYAPR10MB2469: 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: EdL4KtBxqRsxjgW77FwFWm5uyNyVhjE/9pHwNBHxS3y24CDXlmZUW3fxYMbn48OnvhnIraI0Gx0pOxq4VSHoFmAv14fKfdOxTfaRq6Yp2gqTIXMgieYJh0dQ0Ino/mEA/crUaDTab3aIe6iWEcoLzAz5r3LW805W+IrqjrJ2D1O0izhgH4/jwnPDG71HcrDzpfA/caMl40j+Q2UR0TnyYEHjnhZ9GUK48FX89ETIh63TAnh9cFN6I37i7tdCif5fGiJSd7qlxZNoVb6Lbdiqu41OK17LduleQeNB0ZbNJlGd4rIM3jRwVCtopao030Equ3yXMRHCfaC/eLnkLx6oOvkXiY/qZAsiFxs9YvUS3FvkYEQ8pabB2W7rftmMzrHMqmA6uYbKKEV70770hH8Rww51EbIsGRcfuCA1zjxKuh7qUaExjZvLlUqzM/Xx1z8neIlF/R/k12X+LFl9T8dd8WejGX2TEajZ1EBIx/lCP4imNNp22i0qDbYh1Apo3L2HMv0YYrE5aAQG9TuETqoba6td8U7oi/9LFphZKtpa+nN5U+MwYX1ZOYZYLuJRzggVwppvLcaHJ7esqKLE1aX/95dIxtuXoNOgBy5QOJphV9CNKwlaRgDNIuePwW/ji+bnrDxQsVy1MSOfkw4mpyXuj4RizcmXv7omLfXas7oV6rVzxeo89/n4FX2NUGvANg/T 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:(366004)(396003)(136003)(39860400002)(346002)(376002)(52116002)(6512007)(478600001)(16526019)(186003)(2616005)(8676002)(66476007)(956004)(69590400012)(4326008)(6506007)(66556008)(86362001)(8936002)(6486002)(83380400001)(107886003)(316002)(36756003)(38100700002)(6666004)(2906002)(66946007)(5660300002)(26005)(4744005)(38350700002)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: U74+XwdQCIK8HZMCDda9DjFqq5tIy8Ium43MGKxqX4kJDsMQXHFq6+dA7Yt3Kqf8SG7UBh0pwTFo58E97MpeBUrW7hsu3xhsrwcSkBO24w/NrbgNNFiQAoKygPPnz4BrvMvtaR3/v64JD/Gu2apG21rFerddJQ12Xc3WTesxfKJQY2wBxhvYebmYHWvD3cdR50wTpWbqwaX6x4Mb1sAA2y9L2Va9tyLRKBeoqloCsVEk9CPxkOnpZ7H96zAkLIIs/xqR2oPINxI+xu+N/Mwx+Gsm2ALy7PSLtezxqNsgo01YkHoSRCLALigp+HcXjwUAnWUiryTFPaUYKV2RfxgKupR/VPH89i1t1xeMn/oIPypZgestDACngW4Evf/BiQGXjUYKFMsCpsCUNJpV0DJ/XqLIUKB9faB+w9A77riv9LJ7qonalVHp46gPYuMksmL9MJjDle5mRF9BSqTy1inkEB9IdeWa9orsX639r0bGnokcsDkXFgXASbo0Cm+QmdOw7Ec/u6YJZq8V4xgmqEahTkfYQizKeiXk7HwVk8RT3hlNwYdVuD40WT2EV0iOViss6rj9ZWKkvY3+yV9UDAOoRH4X6ffSL2Yv70FY68Wlbk9PzDb8XfDjiUUQn2lRN74++6tUIm1vfhAoAH7n0bmBRMImlJAluUyqktenExx0Y5EqkZqCQB5FdI0x093oVjazB4g0SK+QGJEZnjCl2LxMjAdsQ8uS+9I0b5cJciswYZGllzwIUGqZhXplJAa4Vdwof/LdOUP7Cg+FaM9pwG6F+qIOAPJWvYIv+ggHFFa5c4tTdnhfnAXwud22FJxDBtacThaTZMSCv3TJ5oUGqi9HmZwMgDWafJ3iiqfNyqNi2RC3os2H4IdPJEdskSdsHcnt/AKStPgMMxybhItAuZeMVsjntXKCcRra2MBZ5svdtItN7wCPCZmhR039ioj8QmCmIjINcceOqhGJGYWNgATc5GrAWqvbrtpnH/O1O9bBmidwczo6fJUMLqt06tOj0sWHlMlRZ/zsN3oWP/w/97ed5e3cWDyU3zsrX05o+mxZkWeAH/5yvCIHzWmSr1hKloKRNHEnwKJIfqUroexE4onPP5RKpylnFKqmaokNmEyby5bBGjtgzECmATFiLounDsnku2mr5lLyy2P9wRlvzhWHOG9M95JgnFE7mzQLrIj+M5ehhUlGxfKkIf2K9xZhvWmytnDV0ZHp5lgKsPi2+2t7niORFFybqEjwcxfQNeU98nqGmtuBuNvpvqVAKEf0hymqSudc4IQyqJorC8ADUClnnzRHEaATXHxuBy03gIU2u+WkCbG6vXHUrVT8HOfGr8nb X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 84c3bbf0-088b-4846-ce6a-08d8fed0d6b3 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2021 23:06:58.4764 (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: aC/dGDsHxklkkSFhCoJcVdbEKerqA8YwXCYQh0YfX9iL4n0RMXCDXOlPpl4ETJF+3W0bf7z6ytDRw3vDCp0YolpmeQ2YB7yWQh/9tUB3/Ho= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB2469 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9953 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 malwarescore=0 suspectscore=0 bulkscore=0 mlxscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104130148 X-Proofpoint-GUID: P6q3tiupuIVVebIMNA1YUiCjrM-f7E8G X-Proofpoint-ORIG-GUID: P6q3tiupuIVVebIMNA1YUiCjrM-f7E8G X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9953 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 priorityscore=1501 clxscore=1015 adultscore=0 mlxlogscore=999 impostorscore=0 malwarescore=0 lowpriorityscore=0 spamscore=0 phishscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104130148 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. 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 Tue Apr 13 23:06:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 421456 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.7 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 8DF2CC433B4 for ; Tue, 13 Apr 2021 23:07:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5A68361244 for ; Tue, 13 Apr 2021 23:07:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348743AbhDMXHc (ORCPT ); Tue, 13 Apr 2021 19:07:32 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:46330 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229690AbhDMXHb (ORCPT ); Tue, 13 Apr 2021 19:07:31 -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 13DMj92g055490; Tue, 13 Apr 2021 23:07:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=PD8qYoi2TfdNcWnPbGfaKvMwqo+sVE7Z/0+Ou0uvL5U=; b=obw2jJaxLn6i0oPBbEH+hy03xp2KrDW5LuBMDzBr/4ACotxIvI63j93aEX+Z1lEok5A5 hhepzdEUlHQqS96ZDTbXe+RHWkZt1v746d7vwgcoDT/2byWmZtPdpzbPofTC0w8+UZFl GzslxaqbYqF33Kltm7bmCpukOY575hTGW+oshiGaT/zRQGfvmWzo2PjuN97BMl5AJk32 a9h9JwHIS+JP803Ky/NDkqa+QXTT6o+OQ4seHz6KyX+zRo7CUUQX4HM+vS5fyWT6jmWU jGIf/y/c8IrxF5JVIYsI7TT3O2/y1nBHJ1mQUq+e6ahebfvvCfDd6lMjWf6oFKyUQ3qx sw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 37u4nngmya-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Apr 2021 23:07:01 +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 13DMjTQw105371; Tue, 13 Apr 2021 23:07:01 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2168.outbound.protection.outlook.com [104.47.56.168]) by userp3020.oracle.com with ESMTP id 37unst1tvs-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Apr 2021 23:07:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=luy3epF5WUJPd8xufM3ZT4KVUgt54U1KlVcLhzpGdLd+Y21TcA8xgmsmLXlQMZ1FaP18Pdt/+4QKRMkE9dC8ZwzAkoxW/QrxNJ2hmm1kYlfXat4nq1tz0mcC7TQiwAqKsjkMTY8v9qhpDmUSePsTcW1V/Wf5ZlodSyoz2mnV7+Q3sWne4bcMB/nGMhJ/Zm9hpD4iZL9oSxxT5cArdURizOq9d3fa6p6xqd/XSo7UQmVwNAr4RkViCLVfNzUdwsmTRyVP225b9u3+UfOkuzZgiWng6MFymk9mWEJNpWLOys75T8d4+/Ll3LDP9ty/Xx9iJ9DIHKYXj05/Y06OHZDdag== 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=PD8qYoi2TfdNcWnPbGfaKvMwqo+sVE7Z/0+Ou0uvL5U=; b=LxqG1sW4vAjiEUkJ3BoAKIKvaukSSN4buwDXZID2k4dSCHPVETZh/RG7eB16HrRTmRIVe4E5NY8lschXZgQeUsWpMjDrM6TdR8GlWdJp1YgYpX6uSKUoEb+Sy66dbKkyb7jNqaE2tsY4M72MHsJxpythqvk/dtZeEis2LiKgwvl6FXksPnZlae5GLAGLxKR6+zjwvsSqax4ZMiBwkijn/f888y7WYsPbYBC7OdScQ/sHVkfstIXv6JuvcwHrLRN270hCQmXEoqBTCEhcuG3n20rL1yVP2Tdw+AueOopMaZHO9u4laz8e6GVm1xQvGtsmJJfKHGWdPfMBNjJAHsmKBQ== 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=PD8qYoi2TfdNcWnPbGfaKvMwqo+sVE7Z/0+Ou0uvL5U=; b=fjMkQ3gHGCBIvzjc/PJP3L0LcworhNgbdE/McBf9rkeKJiOMQ3OYvvYick6RVcNBLzHPBEpIy4Py2ZLeMSkbbYCDQS0/wxurnXUGEWJO7dYFyk8X3bXpJ6/Hc7M4fWNDo3iVM1M6jApW4FlN+rOkXHJ1v3AdPhK/5ulsSz2ulxo= 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 BYAPR10MB2469.namprd10.prod.outlook.com (2603:10b6:a02:b0::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.22; Tue, 13 Apr 2021 23:06:59 +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.4020.022; Tue, 13 Apr 2021 23:06:59 +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 02/13] scsi: iscsi: fix lun/target reset cmd cleanup handling Date: Tue, 13 Apr 2021 18:06:37 -0500 Message-Id: <20210413230648.5593-3-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210413230648.5593-1-michael.christie@oracle.com> References: <20210413230648.5593-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DS7PR03CA0212.namprd03.prod.outlook.com (2603:10b6:5:3ba::7) 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 DS7PR03CA0212.namprd03.prod.outlook.com (2603:10b6:5:3ba::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Tue, 13 Apr 2021 23:06:58 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: deaf680a-9209-4b66-dd94-08d8fed0d752 X-MS-TrafficTypeDiagnostic: BYAPR10MB2469: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xtrvW9hKZP3LWgsZH2ln84e6oBiTqm1kC86w8rxR8KJUNQjliLL12PrzlULhHC5Aqct3pfc6OdGy1fB0rPcut2drxwizd3hVsTxn6ZWozC+QUQoKKXKVjvqmCaRekI9h0BeYeCgjwimDFHk28OmxccwQqBpIjZgMBqmrRyElPhqRn79j05SD1NTEd/8piqGkvV5FeiUjydh6T7WKsL8NHU/XNO56Y19Mvb0LBDt4Fktxf6lG4YbV9IAUyEIa94mQzYsmqTt++Acvgtj6p4ueBqebLXuii4YyC6Hgy+e02K36pR+TKYsVIXzWiuGPtLvU7fd33/YtC8PhdjPpEV19CwwtFbHZtUVO8aIvy4RS4PdfjnLGEYxcGXG7kClfumLui6Zl7RaY+S43EOilMmn0RLZ3v7vNDTglD15rqgTYyxiXSAbt/spbSbQbF3Sycm7B1dTJIjEKaW7Y04o30UenxK18KFjaDsKHlHxfGeIEsOjqPkkwtLeJNVTyaSwnwlr71CC4YqB6F8RRyzJBjIm8kcv07SKYyzgKEi7HEwS0EcwWKJyi2JP7sRPrOoEdBgfI1JY2dpXYz2xO6+x7Yx/AHcbClJ2lHuS0/enbqYtp3AoIUelKN1n/x467+1LuxdLhYzcqlf7XE9blnCv1y4aVZZmP+hHdimpihxfoLpMSvGXaVIazoqe50vtc7G0F/VZF 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:(366004)(396003)(136003)(39860400002)(346002)(376002)(52116002)(6512007)(478600001)(16526019)(186003)(2616005)(8676002)(66476007)(956004)(69590400012)(4326008)(6506007)(66556008)(86362001)(8936002)(6486002)(83380400001)(107886003)(316002)(36756003)(38100700002)(6666004)(2906002)(66946007)(5660300002)(26005)(38350700002)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: wJar8dErpl63c6KAyQzteJqJqJSV9nMBIWqF5488mAO2NLMb04Ck5utJ+dcTrKPWlYvegcKm59T+6EYyOVyQ5Bn1ujUZI1L9Emr8B7OGrNr7mI/q7pW10WUE+uWrYWsw4irJkSdLNkQLncIIaFZ/ppem77pUDmIFczqKqkw0C1+/Z5/n7eKGGBii6JyZDpYRG0bRMBXFvfgzIYKuyDV8kZIzuPjUCW4bwhQolEez7kvNy4ChE/+Z98mdo6KefA2PmiIbCqILHCtJLm8Q9XFIXvV/S3iyElCc/ya8dmK8/1O4Bo72A80J6lHbxa0mV8UfTYEzyYtB6/oWlw4xf6lljW3AcT3rw/CoQo8yPdL/67Df4WpAosMIR4xeL8SlfLSdLSHzOLQloRMROd+V3LuYv0vxlRefdVdgS/IVSh66CdOjV0V6Gz2OjMrcyrYiyqUoQDgZrPMIM2dfMomVy/9iJyo4fBfkgZGNZM0uRaSq0mAd5AlkwdTT0iXVVbmNwPgJMUrP61PoyyH/mQZuTLFqgaxiU30yhcDRaWu/NVegYIvFWbMl5GyaqlAMIZCkTBZotcT6OOUidcsyTBU1YwJCnzYsanh5+Tffif3QkyJpnVRvebhgH0Bmc+hoFKD1g475XTYi7by6pA3CP3bp87R0CRxs8neK0XyPa9r99oZsRnGn6Cq+nvPPaLqUFWEm1UzuawJYCgydWHvz6A5oJxkZP7OmvZth2sD+skOocJuTIRQxEjjgu2cv1aeO2c58hzrECGtHqim/tqNUuC2V3rJfSbyhxXQOsa66UniVAcKf9eP+eMVk/BUN1HOAsgT2e3o1rqmfYKRFZpNhEb3iMeLkehzj50kJQoV9T6Ngy+nYoW21EBtGLtTUUSogB1fCwXSQckK+4WhYjcpnjg2IKHqa8eMvd/z0eH1GHsWNfiKCPg3DCwyxVnmCjpP0bjX1P83abB0+HjK2gdm2qVaEnSfeYIfRBmizMSuAqJOu7UB3aVbbeXFXVqO7NeXzqiPxceiMhiS2KntLEvIN9BlG6O+FVkefuIigwsKLw0Z9W+8PuNrmNS6+BrQG1/17dADZupfs5HmpwY8jn+F05ZouzgW68vytm53ZCPKBal40vEnoR6qbehlpDlby2+bwhG1tdL2XHJhpZaQ/SKBwYbxXRBAQIHA6VpGMW2hFbh+WtyYMtMXypQjENUQkjAHVw8oOmRiZ9D0SrR0efhE1nhVcdKOmvbFIE+5saJB/FrEvRcIeEflFLRmAt1t1yUdXnAgO+Zd/E+mVjRwMiIQDo83OgZjj6oqxhBNGWiiHeanAXHNuD2dCoAFTd3ba4M8HAcocN2XY X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: deaf680a-9209-4b66-dd94-08d8fed0d752 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2021 23:06:59.4438 (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: qvpZ9svI/MnkNdSk4A2fi8gqFU1IlJkthy3S80AaqDmyfCJxi43oQ14Evf4MAvDEFQiUjME1DXVFziNeoTj9N6bHsHxX4cjhJ5tKswlJ6XY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB2469 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9953 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 malwarescore=0 suspectscore=0 bulkscore=0 mlxscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104130148 X-Proofpoint-ORIG-GUID: B5koV6EsZgTXL5UPLuaGD8d6IxbNo9du X-Proofpoint-GUID: B5koV6EsZgTXL5UPLuaGD8d6IxbNo9du X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9953 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 phishscore=0 suspectscore=0 mlxlogscore=999 priorityscore=1501 clxscore=1015 lowpriorityscore=0 spamscore=0 impostorscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104130148 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 tmf_in_progress is set. This seems to not 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 sent to the driver but not what the driver sent to the fw. When we go to cleanup then 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 --- drivers/scsi/libiscsi.c | 104 +++++++++++++++++++++++++++------------- 1 file changed, 72 insertions(+), 32 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 04633e5157e9..3ff440d37a36 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,92 @@ 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 drivers 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)) + return 0; + + 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; + } + } + + 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 +1785,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 Tue Apr 13 23:06:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 420557 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.7 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 01DEDC433B4 for ; Tue, 13 Apr 2021 23:07:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D2C4A61246 for ; Tue, 13 Apr 2021 23:07:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347841AbhDMXHg (ORCPT ); Tue, 13 Apr 2021 19:07:36 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:48078 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348738AbhDMXHb (ORCPT ); Tue, 13 Apr 2021 19:07:31 -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 13DMhoVn002699; Tue, 13 Apr 2021 23:07:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=yfX4mBDsuBCr3AAdOOD8MHZqfm+FIw6N0IaLkEYzFWg=; b=SD53vKFVvaoU3rLmOeI1Gph/qzXwPCI45rHngKXrCMmnTwLD4JejQJKYmKvlg+IguuPP o1f266ceY8HzE6/1oHgYYimq7VWNNiSo8hC4RE/y5O3gXijxxV6ghL8XNx/xfXgA7Bxs myNvYn4luFQQ29o6mf03Tsx71QnT8DkXqYyf7cOAH01LnQBtdssNG++JnTOwP2f3URTf ZUw1Q0bfO4LV1bP6v55PgC1uPouZ4qstGIZprzodn7BLHHri0aSExqbMhuwKoAy4cGTV 6Bz7jHH0d1RcB5ZTvSwcO5skFwga4jf0KTrvwVfsJXdjBEFO+suTqEArG8Nxtms6p5Pa xg== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 37u3ergpf4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Apr 2021 23:07:02 +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 13DMjTQx105371; Tue, 13 Apr 2021 23:07:01 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2168.outbound.protection.outlook.com [104.47.56.168]) by userp3020.oracle.com with ESMTP id 37unst1tvs-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Apr 2021 23:07:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KVSeV8e4LXE2BrWXjdEtD09kD4Igt3izSfoArum7G8XKsSMLPHwRkAgnnQ7GRPgGtmMh15RuMD6VuhgbTuXyDLPfMIfMdNUnOLtMqSmEXxQZW87WH696riP1dNFRhIp+P/5qlc6JUrsZblpYLTBUerU+EJMlcAXHh8McT5ca/+288jZaMnKnaDb3skMCZyoQy6aMx+H11UGuvjUa74QiD08dAdBfF7djleQXhkWHl4G8bIbi5h/Q/8VeEyfnxIQK3vNrzTvrhwE6fzC/nDQUYVRwWuPPFdRXwtNGx0IO9YBZoq/iqTa2J/aVKMzDEjvlTsLJ9IdLER1M9XHkZ5PmAA== 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=yfX4mBDsuBCr3AAdOOD8MHZqfm+FIw6N0IaLkEYzFWg=; b=IDHW34RKS8ID77kaDHtPhFAhzyK8Cvvbx2gteDoXesbpZfJHnoNTpDDrPyNrDpuEKy03LdzdcVZw2/dzAqCUCAXQxnMgOBNisG4G+LGRyIOVliYBPK1bbwLYPeEgGlao+mR3K1SGc+88gthFBJeiTDJw2xCSGxiPSJJT/ofwzWyVk967llIa2P8DtbjZXNbLHojsIOxkueglWWx3lUgRUyfk+VOZ5ZzWftdw64kr6Zhvsrch3wo9DMB9HwBBX2/oYcT+e2URnzcwWYNwfGGh0+jbqnEPk0MmnDoqT3nsLpj6wvkk49P0hs2VXIFlzJ7eD6aEcr9jXbFUhdcAs87URA== 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=yfX4mBDsuBCr3AAdOOD8MHZqfm+FIw6N0IaLkEYzFWg=; b=lHMGrO05oJglb2n3wGOHojEE5upvGIP3AmeHTzorJ2mRyZJTjIp4wU0D0Co8U96dCl6EwEjBQYr6w4zHpewDcO1TR/xS7fUnWRDQRgcZsg84bfYOgDpxFt/sP1Fs41rdDE9pEYH5bLpi5Pv9ZYuI3xoRdKYYJxI/qZHD5chVERo= 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 BYAPR10MB2469.namprd10.prod.outlook.com (2603:10b6:a02:b0::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.22; Tue, 13 Apr 2021 23:07:00 +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.4020.022; Tue, 13 Apr 2021 23:07:00 +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 03/13] scsi: iscsi: prevent cmds from queueing to driver during ep_disconnect Date: Tue, 13 Apr 2021 18:06:38 -0500 Message-Id: <20210413230648.5593-4-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210413230648.5593-1-michael.christie@oracle.com> References: <20210413230648.5593-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DS7PR03CA0212.namprd03.prod.outlook.com (2603:10b6:5:3ba::7) 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 DS7PR03CA0212.namprd03.prod.outlook.com (2603:10b6:5:3ba::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Tue, 13 Apr 2021 23:06:59 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2809e527-5fd0-4eba-2f50-08d8fed0d7dd X-MS-TrafficTypeDiagnostic: BYAPR10MB2469: 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: +hQSiMH9UpRSst70LzYyWFlFBHa61uM1vBrm1EiHm8yCgm3YHo2jYehFyMaW5Wkh7PK0uDOptMfsdh6TuMcCYukgFhBGjlbPoSFZOHE7u8HVccBh2+xeyEvL4K0MqmBKHj5HPLHUYfg7yRLBiu/VnEB96qWFOLjqEpwPjHmZNeFKM2qfY//N5ozW2ZB+BEQIGx8NQtbYTL4tVhQtjnt1xeUl2x+phJuGtqobEkvBO2v0vt00nnkRZDPCrVM12Z5OvNbNXWsXjUlj/yJ+k37fRfZnegDP7bucyBwggtYz0/p703jPArS5t2vMRUmoL19PLz9ucPuQLFFrGmBu6CxCHvTkvlwaama8N9D/ERQ+40KyW0Nbx4EPUr2BXE6qLicH1pgRPTCzGYxSIHBXxKmAbkJQ6RHo6yGNotJsor0TXLp6keWp+uk87BLpJLfK3cNaYVyILcMZXtQrG1Hsf4e16gRsiqfsARPU7mBqr+8ZjNgdFkm+jsWaw3oo22/Hxom/Oomwwyx/85HSk5klow9/xpl/ljdbqypFvDt0zPbCaGnjsMFy+dZoPfuetsKR6Ee8SXwJZ67QsfwTDLWQQZX9qWyWfziramX3aUx2Qy33WFtiXiaE6ZOoZBaVMeqGK1oyu2F6Oeqn/D0NssPdkAzhLIxU0ayP/e3k/tU3sRg3I1BBt82q5klJEHrsvArciTqk 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:(366004)(396003)(136003)(39860400002)(346002)(376002)(52116002)(6512007)(478600001)(16526019)(186003)(2616005)(8676002)(66476007)(956004)(69590400012)(4326008)(6506007)(66556008)(86362001)(8936002)(6486002)(83380400001)(107886003)(316002)(36756003)(38100700002)(6666004)(2906002)(66946007)(5660300002)(26005)(38350700002)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: H8xks9SMP5zW5ZdFA4ztX9qx0hx+LsAgIbm9SH8z7U89lXh4NGtbPRcK+plqITg4hzoi1N/UlFVgJkB2H27XpK2h3rp7NIidQEawXvI23qQn/opJBDbbuq31S6eFgZZvUOUMx263/+MQgh06PpnaSIkiK7f0uPPjK++jAAWbGeea+JOGeSxkGJ6+nsI9qILXTfEhVr6XXgHgU7YwmETBslFv6Wxdc7Tw0JFmMZVqkjrRy9IuuRdvoUCFrH3igmBc/ET58kzBO0VlUTm48nDAbbSf2W2us5DD82BtfhuBYuKJnyKFQmMvFnX8VkSJC3QnTVNgLNTw4H4B/PrsKoW7+snVY6Ar8ERElFGirI93b4eFO9u3UJtjWPMAhqXtzGorWQym+JsKRDHN8tUgflen2Ub3wJfoWVdOX5D2h7FZAhH2JvLBKp1emhZpEh5nkcmWChE9GThCSK13m7uqIIlEgU0ygozIq7hnDBfK2dwejsZLMmX/+5OyC65wo3ARFSYeFqnrHWm8MePluPHxk+mTqOAPy/hq0BgPwY3Sbirk49EZ8atUz6zWgjhw/DkohIUrEO4F9vKxN8ysRgBhEIYdL/q+4EXuZsJ+Rt3THkvwkfWck6yZpgjPQpJChkUlQ50X8KHvlCKDFR9Z9MfnIhD0F82twoos0iRjM/3/C2TY6VrPvmT8v9fN9BP4kb7X6YoOUYy0xTp0ms3tfSZjAYKpcb63cI7Jx4TxUneV0+DmsV5a3Rz5duRMnKnLfQAU3XqAf4KSo7hNLNNw1RHxMeMRUI/xhCBER+6DROQs+yF46SdG7K/92TJ+UgRVMMtvxeYKTqnvCfvXvVXRwczwKnG0ap8KUD6RqhAB1Ax5PgAKNNH5lIKfOoYJUikY6HhsXAJfkSktV2EBFxSe6ne2U79vYGqKkppX1ftmxPds9iXSLPfueLnIcQkdyj/Dw3eV0A5KTWWyhx+aRB9xaw+9Z/t+f+4m8Cpc3xHLXQSRDEcm2N8/9XeY7cyJ5RmNT0PEVJYhOd/rBXkNIWUQ0t6KmnIaaiXHRs6DGxwh1sRw5ObXCGGtsScmg+uKxUNpPiZU5QJZK7VLHzUF32Bqar8rnzsQyd3WnMPU7VUi9JvbSfIGPuCj8ypc7JAxuew6daW4XKttC4lJ8sQoWu6J1gQng2p2YpTOtS5XRHyXzH+ZGpDGNT04z6ELfci4+f5xMTQag+0ofRJUz9EHbI/50lFAGRj/tRrIc0JktTd/6pol0ByP0C1Kz2dB/MHnSp9YpIFt4uWctpX2kYUHE1ZFLvfc/7jPsYKakKefx9xkkno4J6BAaXU6N/E3zDIpeGiH7JOLognk X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2809e527-5fd0-4eba-2f50-08d8fed0d7dd X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2021 23:07:00.3573 (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: JAUQaBrMLU925jZEUtNOly7U+W0/5S2S7gHXBxBOQMqEHqEHoWOe2Qy6zliqS/iWDBxZVAL092UP+WDCGLkFU932d8R6QlsVxamThC1z+yc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB2469 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9953 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 malwarescore=0 suspectscore=0 bulkscore=0 mlxscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104130148 X-Proofpoint-ORIG-GUID: lER5tCPnEXvtwK_ENuZn_W_EWmAhlL_I X-Proofpoint-GUID: lER5tCPnEXvtwK_ENuZn_W_EWmAhlL_I X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9953 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 clxscore=1015 adultscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 spamscore=0 impostorscore=0 suspectscore=0 mlxscore=0 phishscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104130148 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org When we added iser and all thes offload drivers I goofed and didn't add a unbind_conn nl cmd to undo the bind_conn. So during ep_disconnect we have been doing iscsi_suspend_tx/queue to stop new IO but depending on the driver we can still get IO from: 1. __iscsi_conn_send_pdu for TMFs and nops if we haven't called iscsi_conn_failure before ep_disconnect. 2. Userspace did a ep_disconnect during shutdown before we saw a logout command and userspace didn't do an session unbind event. This patch fixes the issue by adding a helper which drivers implementing ep_disconnect can use to make sure new IO is not queued to them after calling it and until we do a new conn_bind. Signed-off-by: Mike Christie --- drivers/infiniband/ulp/iser/iscsi_iser.c | 2 + drivers/scsi/be2iscsi/be_iscsi.c | 2 +- drivers/scsi/bnx2i/bnx2i_iscsi.c | 2 +- drivers/scsi/cxgbi/libcxgbi.c | 3 +- drivers/scsi/libiscsi.c | 56 +++++++++++++++++++++--- drivers/scsi/qedi/qedi_iscsi.c | 2 +- drivers/scsi/qla4xxx/ql4_def.h | 1 + drivers/scsi/qla4xxx/ql4_os.c | 2 + include/scsi/libiscsi.h | 1 + 9 files changed, 61 insertions(+), 10 deletions(-) diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c index 8fcaa1136f2c..3089502116a5 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.c +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c @@ -899,6 +899,8 @@ iscsi_iser_ep_disconnect(struct iscsi_endpoint *ep) iser_info("ep %p iser conn %p\n", ep, iser_conn); + iscsi_ep_prep_disconnect(iser_conn->iscsi_conn); + mutex_lock(&iser_conn->state_mutex); iser_conn_terminate(iser_conn); diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c index a13c203ef7a9..a3b5f7f6ccc8 100644 --- a/drivers/scsi/be2iscsi/be_iscsi.c +++ b/drivers/scsi/be2iscsi/be_iscsi.c @@ -1314,7 +1314,7 @@ void beiscsi_ep_disconnect(struct iscsi_endpoint *ep) if (beiscsi_ep->conn) { beiscsi_conn = beiscsi_ep->conn; - iscsi_suspend_queue(beiscsi_conn->conn); + iscsi_ep_prep_disconnect(beiscsi_conn->conn); } if (!beiscsi_hba_is_online(phba)) { diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c index 1e6d8f62ea3c..5cbca9657c35 100644 --- a/drivers/scsi/bnx2i/bnx2i_iscsi.c +++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c @@ -2129,7 +2129,7 @@ static void bnx2i_ep_disconnect(struct iscsi_endpoint *ep) if (bnx2i_ep->conn) { bnx2i_conn = bnx2i_ep->conn; conn = bnx2i_conn->cls_conn->dd_data; - iscsi_suspend_queue(conn); + iscsi_ep_prep_disconnect(conn); } hba = bnx2i_ep->hba; diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c index f078b3c4e083..dd7b41a092f1 100644 --- a/drivers/scsi/cxgbi/libcxgbi.c +++ b/drivers/scsi/cxgbi/libcxgbi.c @@ -2968,7 +2968,8 @@ 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); + iscsi_ep_prep_disconnect(cconn->iconn); + write_lock_bh(&csk->callback_lock); cep->csk->user_data = NULL; cconn->cep = NULL; diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 3ff440d37a36..3a37628e4024 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); @@ -2220,6 +2226,44 @@ static void iscsi_check_transport_timeouts(struct timer_list *t) spin_unlock(&session->frwd_lock); } +/* + * iscsi_ep_prep_disconnect - prepare the conn for a ep disconnect + * @conn: iscsi conn ep is bound to. + * + * This must be called by drivers implementing the ep_disconnect callout. + */ +void iscsi_ep_prep_disconnect(struct iscsi_conn *conn) +{ + struct iscsi_session *session; + + /* Check if bound for the driver */ + if (!conn) + return; + + 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); + spin_lock_bh(&session->frwd_lock); + + set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx); + /* + * 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_ep_prep_disconnect); + 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..8ed1852627e7 100644 --- a/drivers/scsi/qedi/qedi_iscsi.c +++ b/drivers/scsi/qedi/qedi_iscsi.c @@ -1008,7 +1008,7 @@ 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); + iscsi_ep_prep_disconnect(conn); abrt_conn = qedi_conn->abrt_conn; while (count--) { diff --git a/drivers/scsi/qla4xxx/ql4_def.h b/drivers/scsi/qla4xxx/ql4_def.h index 031569c496e5..4ca7f4228b4b 100644 --- a/drivers/scsi/qla4xxx/ql4_def.h +++ b/drivers/scsi/qla4xxx/ql4_def.h @@ -838,6 +838,7 @@ struct ql4_task_data { struct qla_endpoint { struct Scsi_Host *host; struct sockaddr_storage dst_addr; + struct iscsi_conn *conn; }; struct qla_conn { diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index 7bd9a4a04ad5..5977fe403086 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c @@ -1772,6 +1772,7 @@ static void qla4xxx_ep_disconnect(struct iscsi_endpoint *ep) ha = to_qla_host(qla_ep->host); DEBUG2(ql4_printk(KERN_INFO, ha, "%s: host: %ld\n", __func__, ha->host_no)); + iscsi_ep_prep_disconnect(qla_ep->conn); iscsi_destroy_endpoint(ep); } @@ -3234,6 +3235,7 @@ static int qla4xxx_conn_bind(struct iscsi_cls_session *cls_session, conn = cls_conn->dd_data; qla_conn = conn->dd_data; qla_conn->qla_ep = ep->dd_data; + qla_conn->qla_ep->conn = conn; return 0; } diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index 8c6d358a8abc..f409f521681d 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h @@ -441,6 +441,7 @@ extern int iscsi_conn_get_addr_param(struct sockaddr_storage *addr, extern void iscsi_suspend_tx(struct iscsi_conn *conn); extern void iscsi_suspend_queue(struct iscsi_conn *conn); extern void iscsi_conn_queue_work(struct iscsi_conn *conn); +extern void iscsi_ep_prep_disconnect(struct iscsi_conn *conn); #define iscsi_conn_printk(prefix, _c, fmt, a...) \ iscsi_cls_conn_printk(prefix, ((struct iscsi_conn *)_c)->cls_conn, \ From patchwork Tue Apr 13 23:06:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 421455 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.7 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, URIBL_BLOCKED, 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 4066AC433ED for ; Tue, 13 Apr 2021 23:07:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 201EC61246 for ; Tue, 13 Apr 2021 23:07:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348748AbhDMXHe (ORCPT ); Tue, 13 Apr 2021 19:07:34 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:47184 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348739AbhDMXHb (ORCPT ); Tue, 13 Apr 2021 19:07:31 -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 13DMkwpk169430; Tue, 13 Apr 2021 23:07:03 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=I1Oe2AWVorcjAuB+4EZUsQ+4mDqnLURyB8JF+FnjzEU=; b=Wp/6M2Ks8Iuy/ZJFzeScrjFYp48yYqZQDhDo87U1Y3+iL9LNoQEeltKIAVzNG2kvaCld Jbxx4bD4wfzPRdWPSzRSg+lSUtcNxscRrgdudNRhjUSudTAoSglDrZSFE96C6MCT539d qtnx9meb1hC6g2Hz4CUK4Ek2vxb0PkDpr+lqXnPDog9Quk4hnkqZUmLyCPwB5QxWDVGS ZXzrfgvVJMJJ4qcQqJHplkxyJAhn1VJMdSVg8UrveFD7fyQgqnNY5PyCsgIKky27rbSl S48skT02S+pww3uGmgzQ/vtHCWO2yewObDOAUVIdE02QYSfS3RIumil+Mx8PSupoAMq2 uA== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2130.oracle.com with ESMTP id 37u1hbgsw8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Apr 2021 23:07:03 +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 13DMjTR0105371; Tue, 13 Apr 2021 23:07:02 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2168.outbound.protection.outlook.com [104.47.56.168]) by userp3020.oracle.com with ESMTP id 37unst1tvs-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Apr 2021 23:07:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YXwRM+KrlDDWocths70h7p/Gb7MEzonX8zXCRgk0+MN3Y9hvOFuP2j5Ak5q+hCHhoMa1XHhgrwZCtAX5cxE01UdBGfHoan7OEjURhdLlFnlHdAMmlaWXJkQBs1BQJOT84xMPYuH+nbuCif+yo+3vR7kmoooH4F9ySHXxeCdeGw+DmVLcHqCPTwKGYUzcVp0BHeOE6DIppDgVpJdxcILHjqnBHB185QmEvYHCXVkPaT7KOljspWjnrqNpy2pfaMGUGbXVCtab1aHyQt+TpEXdoa4HCDvIdf/L7ItgDQJme+AOBuVsvNNkuPTbOuQhzkuIu1ducC9HbKooy5yLMjjfgg== 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=I1Oe2AWVorcjAuB+4EZUsQ+4mDqnLURyB8JF+FnjzEU=; b=R7XtWn/n4VSH69fBmsZP7MWkOp07XLP7WNkP8MyxYmEf5N4YGXRxC93o7SGDvcQlaVp/YvRsnPb9ZgRzmJ9VcfstBNjc5Dg4k8/uyJ2V7mMfM3IfWeY6cwdDwTLewMNp9eTgYgVJr32+ehfc43s4fFnBcYkkE0zlkLXcCj5GGT9iZZ3TgLab6VQNG9s0v0ZUOJI6ZYKefAqS+kFTsTmu8QOuiLisHBtdWWNYzuPiqJu2rsK0o/UfXYytCZxrKxNIpWRJPlG3c0ziAxTRV3b9jz4VRzbHpTqdrzODrf1Qrj1bsPxYUwvXuWZ4zMgXX9JsM9A3Qw4/VJE81LNIoX4qyA== 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=I1Oe2AWVorcjAuB+4EZUsQ+4mDqnLURyB8JF+FnjzEU=; b=NJ5dedty3UBOHvjZfyO8DmWnc+28Xs0k5FC5Gfw+aWfgcsfJYTwDJ4uB79GWl0yXXZtWaADvBwS5Hw3he7ZScMSZaTJ/X5TRjeFO0ngxpr7aQ6ePkTVzz3QSZsrf8OFMJJZOuGmQx/W0+DpUG0fSq1G4gzwTmsOZqoTaufbAtcQ= 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 BYAPR10MB2469.namprd10.prod.outlook.com (2603:10b6:a02:b0::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.22; Tue, 13 Apr 2021 23:07:01 +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.4020.022; Tue, 13 Apr 2021 23:07:01 +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 04/13] scsi: qedi: fix null ref during abort handling Date: Tue, 13 Apr 2021 18:06:39 -0500 Message-Id: <20210413230648.5593-5-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210413230648.5593-1-michael.christie@oracle.com> References: <20210413230648.5593-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DS7PR03CA0212.namprd03.prod.outlook.com (2603:10b6:5:3ba::7) 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 DS7PR03CA0212.namprd03.prod.outlook.com (2603:10b6:5:3ba::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Tue, 13 Apr 2021 23:07:00 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8dca14cf-c982-4ee2-780f-08d8fed0d86b X-MS-TrafficTypeDiagnostic: BYAPR10MB2469: 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: UXuCBQiABPQUwvKGG1D7r+OLK/IIxQy1APcSqVwebWvu+X0Szxeqq8jKoKlb7eTPgnUn6V8Kpjb4kraxKuF0UaCm1MIp9PhxJuxkKwzSS7Wz+7bZkHE8qKXhrjC+SnDFfQdq9Qz2blQmQZRAtmU/RSx4PmBywCDykwaxfiHulnRJIt4Unp0AP96LpeiKjZqJaYqpL/ra4dm5JMB6eQVaqeT3uHnhUs2FRB1bSicwCDHy3vAqE5Ku0QThtHwpQS96wT4SX7lrQLkjCPJJgIGvJtIYhPicpSCGnGotwPiyD2zzAiVETl2YrD2pxC596zq1Mf0s1TEH0PI4OCUuMStRPHI2BicR8AiX/jUlxfkJK7gqyT5kyW519WvcuNaQUJ4xl1rsu6Zi6gKrpcYE0W323uHqQwf5glcl8o+Vd03nrnk+pgOHB4bQtspUJvt06UXc0qH96HKNjKr/zhh5DTOMam2byVXlNmLm3c9jgC+b/jNL2edHEAl5d2ndGLXsip3LikXkk+7D70bZ4PyEXY9YGUa/i+3tmIcDIjlQoTJWza/tLTylOP3XL/OmP1hDBy5fODqLBbNKrbGK2pK50YAlNm0pqs+UgsIOL0KAxqeL/O5joTyO47303trzN2c17rdQmYvLtFyu2nlVc/hLoElEETs3ELWuQsOtOQb7Jce99qBwUX8fhkjddUXYZl8yOvZZ 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:(366004)(396003)(136003)(39860400002)(346002)(376002)(52116002)(6512007)(478600001)(16526019)(186003)(2616005)(8676002)(66476007)(956004)(69590400012)(4326008)(6506007)(66556008)(86362001)(8936002)(6486002)(83380400001)(107886003)(316002)(36756003)(38100700002)(6666004)(2906002)(66946007)(5660300002)(26005)(4744005)(38350700002)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: tsMj07jVR0BUBKDCsRgcGA95wcFqQvzADR5jpm11LiLRCpxeeyAUeVu8fM5UJI6+HogtfR0TCWsXojKmICQSOav2+Q7gUp7uyBaCUQbHZ2pd8FZ7pN1xX8cmH3xv/dVqxRLJS6HmoWqr2QyQp1zEIxBbR1s1tyReKoqTkRPRJhN6K86MqrRudFRQQB2M0AHgLmqxZfuINWrEgkdlEchvX4Q2a9HtKQ1UIHFGs69vDLaFU5KlKEtbCoxeq1+ZesL/3nqLjxL0pvCp+mdj8KkMZy2lQz6ipzV02Bh/FV/Gy+0fyESXVVk052V8eP3hHoHMGG34fv+fNoazCOxnkYY1J/P+RYCiB2FTb/bC2WgJN0qVDKZfC/i2DTT5Gup4OgulAjF07w6pOSEllSp0p48NsdwCnwB98RZ7zR3WOY+lH5xHHl4odYqpP0Wi0Er4j+NpoPxme6fAVLfGLY9OAWXB8aVjaDdcwhXMF98K1Dp1xEVMq64F7Zuy8n7o04jufiT3mUSvewJXHDVCp0QzjX4X3aijW3gT0Xb7oGb9PDALE1DAyfWFicIrMV3TZ5MzbWuFyAPtgCXD94BWROUbrKWUHLTgrjp60FL6m8siqujHCICUjrufFUNlckweu9HDJ42HA4t0GvJe0jBbSaKczXWnnuW5AFTyHD0hEgURd2e8pkRNpcajt1XyutqCGARuBhjz9yloF+BZ1Z8WmtdW1DiSq7yweX76FW4s0Bp4dNBZcaHA34lMhXSip4XH3RnwAx313RGKLvlcYqS6So6uWlLXapFNNWtfSQmOliFyOGLB8taiap69jCxJhxMVhdw6lbvZmsfNaajgdq/kUpob1XHlzHKYVn/DB8I5wm38EfE1RVsuB0BXp4YjpY3bed8Yk26AXoW3DVc8vbo1DW5Ds/BQqNeY56OUlcz6NDayxbOG1xKyv6ddYC8JhlihndWSdqaHhZ61zm7ewrGDNETY2NDojFFBNPeySf5K2L7OSuuHIT3zqAQ7gyHGNwgTo2klc4usq6LGB7m5frEM5ilj8E9MdHjR0Rb2ncaMi+9hvsT/jYh1yzzoGTXjJHLsUK0Vrcbz5HpOy3z5jNFPUnUk4HXRHj5COfMeQbgI/vWp5GBtR+8O1L5ZNkSEJ8Qt8GXWjUu5kaSZbtxeaWrYh2stOsImb5FD7/p8XqdBToGiOmIxZxroHKChXKf8ycrTr/oQsfeVVbR9IEk6bnJZ9BphMcBAKH7Dmy9ZZBNRb2nLqv2duwxYLeZSFwNVJXMTLW4c8PM2cjcGzuUy8aPKyF528MHkfeLc3coPYHwNOhwWBPHsTPwRFAGPRAKxUgf+wA8PkUVg X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8dca14cf-c982-4ee2-780f-08d8fed0d86b X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2021 23:07:01.2798 (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: 1PpTM6QeGWwB/OIwVdsaqLMUl30rV1Cj9kZH9rB54/XgZ+ry49zxveZq7O7qI6zmy7zsvtyefLHX2jjqFfG5rg0AEkwSApWiN59+asCYW0g= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB2469 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9953 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 malwarescore=0 suspectscore=0 bulkscore=0 mlxscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104130148 X-Proofpoint-GUID: eqnbOCLGIP5BY3Ia0noi4ggRm_0VmLsT X-Proofpoint-ORIG-GUID: eqnbOCLGIP5BY3Ia0noi4ggRm_0VmLsT X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9953 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 priorityscore=1501 clxscore=1015 adultscore=0 mlxlogscore=999 impostorscore=0 malwarescore=0 lowpriorityscore=0 spamscore=0 phishscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104130148 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. Signed-off-by: Mike Christie Reviewed-by: Manish Rangankar --- 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 Tue Apr 13 23:06:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 420558 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.7 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, URIBL_BLOCKED, 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 43892C43461 for ; Tue, 13 Apr 2021 23:07:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1547161244 for ; Tue, 13 Apr 2021 23:07:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348745AbhDMXHd (ORCPT ); Tue, 13 Apr 2021 19:07:33 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:47198 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348741AbhDMXHb (ORCPT ); Tue, 13 Apr 2021 19:07:31 -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 13DMkguk169379; Tue, 13 Apr 2021 23:07:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=fSKfXmzBezzuIir1n114MYgYzGXMP/cHnNbr3DRfRjk=; b=hY2kHWr70B7zGra/msCfGibeLAvFkVm6SYJiJcO2wkevmCl+02nxaUd+w9489w/nKTzB gOx6SrqpolS6+JsKyDdagQ2/nCdigU2FrAWhVC1g29HgfC8Ss+kR3xkIMhewFhxe9Wou N8ECBfDoqjAqhuwCz981aYh8khIxjZKvDc3UJLZlAHTqPnfWlmAtI6FVRJpdbbg0zMI1 WRKT54kBLMj5ya6A2IQ6aYTdhTmt1Z6J1cf8p/hIIgEfGC1/99P80IXgUOWBel3Dbtrl XbvmlmGgTA5NaTVpUZrB+MITRnvDVPMqFaUk8lxw+4AH8fPakZ0ikaXdf2AfKMIfrgzM Fw== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2130.oracle.com with ESMTP id 37u1hbgsw9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Apr 2021 23:07:05 +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 13DMjgau142820; Tue, 13 Apr 2021 23:07:04 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2175.outbound.protection.outlook.com [104.47.56.175]) by aserp3020.oracle.com with ESMTP id 37unx0e1gr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Apr 2021 23:07:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bhncvF50UdQrFmEChGiVCtOd5O84j9DtXHdY461TemDoFtTjaSmIyzpKiy+bNo5Xov1QVVtNgmg/GDMqw/2XSxfHEliLS0jKglB62DR/nSr0k6NDOMgjVi5B5U/JXSvSRJa6tyhoGCJQVKQWL8siENPG0TxisWXWXfWK9MAsZVIdeM5niH0uj/0toE7/VABRQ7nLk6I00CgLCGIxoeAL+lF7shb4HvRLCvQdWdPt6WyJa1NERAXaHu81nkR7XP5GVYDNSR09qVGQdrpc6O/c2kylFwFTj2DuQvo77kzkMk7CvJcioWVHQINlsL46HmDus4EgiHmXqpYJtpjg6bOJkQ== 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=fSKfXmzBezzuIir1n114MYgYzGXMP/cHnNbr3DRfRjk=; b=Mx6zt2jYLdyJp5qWLN7eyM2QaO0lT09LiafKxOJChHTZMkFYrjnx5PM+edNVQgHEJgyLg9wCBerGP91DOy3ZMk7t2aP+BZgwDJTi1F4s42INMGmLPNF4oEVF2AUziQCkoGX+pH+Yg5oZTDhR5zVUvJV1Si5lE3GJtKqBhDY7Vldxfj/lqa4RZyhQikLCsDHS291Snaa3kRdavjpDrAHaEV45h4qCDz93Nm5Ru1NKXrpqRJf74YaNkimtr/RRNjj2SvkSzhIlCHteG8V0ANnEb4D2yA4e7c/wnLoZCoo2B8aVaXNkmLM5oLs0jl1DBMus2qGtC3wFR+XeOIkgJqFjkw== 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=fSKfXmzBezzuIir1n114MYgYzGXMP/cHnNbr3DRfRjk=; b=RzCz7ussHuJbIj5oPiKAdO+zAcLgdh99IpZ6tyq+2IgR/x0BOqgANQ87IlS3XkmsfxEUHO/laPaaS6KY90GoSuOd6ZpfVc/Ngqo5e+krYJeFwmMoE3A9KNCPifulxMl3VjUDT3iYEWx8Pc6t3FtY//tbsVr+wBFnCYiW7S2ZtEM= 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 BYAPR10MB2469.namprd10.prod.outlook.com (2603:10b6:a02:b0::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.22; Tue, 13 Apr 2021 23:07:02 +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.4020.022; Tue, 13 Apr 2021 23:07:02 +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 05/13] scsi: qedi: fix abort vs cmd re-use race Date: Tue, 13 Apr 2021 18:06:40 -0500 Message-Id: <20210413230648.5593-6-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210413230648.5593-1-michael.christie@oracle.com> References: <20210413230648.5593-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DS7PR03CA0212.namprd03.prod.outlook.com (2603:10b6:5:3ba::7) 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 DS7PR03CA0212.namprd03.prod.outlook.com (2603:10b6:5:3ba::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Tue, 13 Apr 2021 23:07:01 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0b973306-b719-4d8f-1bbc-08d8fed0d8fd X-MS-TrafficTypeDiagnostic: BYAPR10MB2469: 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: CfYX88/Kh9vLrZ6cAvD4mQWFed2JzNZoyPYjDdmGikVXNR/FrXrO0LmDsSG0i/vCGtLWD8p4d2yeeSiBMiV33IY9SREaPwvlxdNfm2nPa3FoeBu/KxtQOJjuNIlygWoLSUvR5lHX1QwxjLHfRM/hZ5NADJmqrA6tPxK5b6BkyXZw2z7WV0DoCAoFlXvndSmdBFFImzW74nl8URR1k86iN/NUI3RvX3PhO1tmgZ0D2UBlMEkC3i03b9e9VDttew0Q20tzejvbZIffHBB4J+X5KpTvFSIsk8zmiJZFpNEfCKddZZaZ96YjueCFEci6ayg7AH9GauJqZbKUPeuseHvGtzYfKLDhuT6ljDMPWge2llOT0vaGG6/RKlotoZiPJWuvdksJ+m7/Y49/SQWgg/Q775eMrJk502JwoZwQP0NnDhwQ2TzpWQ04wzngu4GMJY9Hw2GODIc7BrM1U1zdfiQae4RP2C1O5GyyK2jjFNjm59LdJPXyYpCrcnDCAoUWLugCyP+KhnTEyP+XANc6sYgX3d3oIcl+5nxJBpsp5QoCJ+O4nYBERe6d+IMMP+hnxXwUSVWVRkmSxusS8Wt8PcyIWaZKSnU7Yz1MVI22SuqIsAg3mzl2JDqYNt4+Qqw3YVgkIe9pOaWlLE7eFpD1s0R+BRwutjxGsRIuGqjJkQ/0iIa3jJYPkVbWEpO0svx0UDp6 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:(366004)(396003)(136003)(39860400002)(346002)(376002)(52116002)(6512007)(478600001)(16526019)(186003)(2616005)(8676002)(66476007)(956004)(69590400012)(4326008)(6506007)(66556008)(86362001)(8936002)(6486002)(83380400001)(107886003)(316002)(36756003)(38100700002)(6666004)(2906002)(66946007)(5660300002)(26005)(38350700002)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: oy3adNmGUHOwpeQP5emSGUVs31tANz4IwOET4D5XMJ8Z1ukh8UC3piR96ldNRun0XZI5gFR3XX9ZDnX0AHcXbkje6OsJKAdshTzjLYJGJEZyIb3Rk7ec7GjIDhtX9XL+CqyhE3y3EizTUWFGn05TzKu2IGjTgfKhwiQmHB0wlToaQEU46/om2n+smHT/L4+wRj7m+d2DuW/844Xz/uGRAuCKBNVaVk6u7Hshf1gQwS2A8b5ZMf5mYU4Ob3fBjjmvB8opYMoO4CHmtPCMwdjQq/EEapKpejD6RxRY8Zy8ZXm+Diq34aAdrevr+0VH8VKYIwSvcaDeJCHyXIB7pAPYUb/ue/CkMlcgMS+HX5KO+VUKX9Vacfvl6WaTjIjInGRQoRqTHENGBuBmtktyxRw5cysD2XalL4XZhhZU4v7DXHV/91a65FmbPDKe++DCj+CY6sdvsrjQ+o37nmiYcWbM0EMMMGvQi00TH3tqVCMzhPsbn2BV68jnQbZI6bqBlqFjOkzdsGqVVtSj4suF242o3IaiVelcvvFjjpbKQzvYpzjVUF0AqeVoxAjBNUcYC3brCKmBagTQ+A+UAEBMUxsd/XYRrNqjB6iRRnSpm5RssLt+/5rIYrJO4sACgjMaO1/J1H0e/lO963nwmlfVrZ46GIIonovvT/1C7zjLGM4sBg3xZX6W5W/SOHudPTtcNw1CLv5GECFL008LgyL8wAEde1Irj4ePdMwwewib8TBa8o8I2VPeXxvdpbZ0shGmIEMnB/ngxaHHjb5ejAotm7p2QZKTAVMQbkvu7gs7ExMZzdOerJpFvUfvQ4K0jPMzJcxNgJS6HXLwE+jjPHjth2J0irYgkhLCEw5Lt1wbu3A4gUI2N5hFEM1l22RMI8wrZhhOdnfjdOYrbS+eQkdA/IrwIRC2XeHRKQwUrKld+52am1epdqt2mhpaow9Gc0c4UiQrgF/3IxwaSC/6/hIiQ2r13xJOVtL1pjhnVJhP/haCrQ7Jc9xAi61LoXGUFBYxTr+R2uF20On0kH2PziAyD7U/gjx3rUwlE5wa4873CSJ+qKthlKzH0QC0HJClUJ0S0bh6V1TEkDp6LbZ0zylpAYOdOo9tfPyYtSl3b1P2ox2M+ts40F4cFmUJ4p058Sxf9OoPBHAqS9GzE9qbNMHZ+nryLIoJtZvBlXmVe0JvBiPn/zPN+VhnLiVjQXFNXiSMabk1AkoiPZecPj7smtLzN/HqRdl3hm34sfiUYXxIlSAkcM615bLryADcA9L3KDusJutLLn9J4mgJopcKMKuSNsheANYM2epTTlLqkF50wAEmA30jFoG+Ilti0dlN4ZvO1Ru4 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0b973306-b719-4d8f-1bbc-08d8fed0d8fd X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2021 23:07:02.2113 (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: jXnZ4I98JTnW3vFu6gv/K1EAlUV3tbMSyDB2HI4XnCjJVv2Zl+XVMSjNNiRk+wv06lqinfKv0ZpUzsJxoIR11q+NZDy2rRZKVqgXBH2ug6k= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB2469 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9953 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=0 mlxscore=0 malwarescore=0 adultscore=0 bulkscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104130148 X-Proofpoint-GUID: v9CjcI6gVHB2A7NgLUPuFcRwFE_sXk7y X-Proofpoint-ORIG-GUID: v9CjcI6gVHB2A7NgLUPuFcRwFE_sXk7y X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9953 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 priorityscore=1501 clxscore=1015 adultscore=0 mlxlogscore=999 impostorscore=0 malwarescore=0 lowpriorityscore=0 spamscore=0 phishscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104130148 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. Signed-off-by: Mike Christie Reviewed-by: Manish Rangankar Reported-by: kernel test robot Reported-by: kernel test robot --- drivers/scsi/qedi/qedi_fw.c | 13 ------------- drivers/scsi/qedi/qedi_iscsi.c | 20 +++++++++++++++++--- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/drivers/scsi/qedi/qedi_fw.c b/drivers/scsi/qedi/qedi_fw.c index cf57b4e49700..ad4357e4c15d 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); @@ -821,8 +811,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 +844,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 8ed1852627e7..9b794afbdead 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 = -1; + if (test_bit(QEDI_IN_SHUTDOWN, &qedi_conn->qedi->flags)) return -ENODEV; @@ -1383,13 +1386,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 != -1) + qedi_clear_task_idx(iscsi_host_priv(task->conn->session->host), + cmd->task_id); + + cmd->task_id = -1; + cmd->scsi_cmd = NULL; } struct iscsi_transport qedi_iscsi_transport = { From patchwork Tue Apr 13 23:06:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 421454 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.7 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, URIBL_BLOCKED, 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 9D59AC43460 for ; Tue, 13 Apr 2021 23:07:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 753A761004 for ; Tue, 13 Apr 2021 23:07:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348744AbhDMXHh (ORCPT ); Tue, 13 Apr 2021 19:07:37 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:49636 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348742AbhDMXHc (ORCPT ); Tue, 13 Apr 2021 19:07:32 -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 13DMjFgu129870; Tue, 13 Apr 2021 23:07:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=OZncqnTwMEsV9VIuAksXb4AgpHpOr5IInC+8pBGc3zY=; b=OiAa6GSykNMRkHN8Mv4ElZXGvu1M0Xm+wx2IyAPv9QEpLDTo+sFoA507kquUHfd1j8I2 9ktrzxd1ytjK2RDWY5VT2rlIfVTPTp1FWBqR/7S+7WDWKjFGfYyftpC5I1PbONy0xrIr vUE+xdArxGa2FNeK4Au/3LFifGueJlL5yN4VhdImkg2fqFHDOsvGMPU2Tfxn0BgsWCq+ qh10tJ83ZnFHWkZaXYSUP0BMbzrEuq4QNbSzMagWJABHQ/UFHfe76Jl03AMNuzjYfu/d E+IQjCEPmFH6/z1EYJtNh24vN2L77QVzws1O0HYq9H3wg/v2+GgviBtzn2zW1PK+7SMS 3g== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 37u3ymgn94-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Apr 2021 23:07:05 +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 13DMjgav142820; Tue, 13 Apr 2021 23:07:05 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2175.outbound.protection.outlook.com [104.47.56.175]) by aserp3020.oracle.com with ESMTP id 37unx0e1gr-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Apr 2021 23:07:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NI2psDHP8CDFZWsAwoHyTwXhAm2Lfso1G+IHACVbFiVsOrGdFgpnMblxqsb5eUTBNswrj5AYA5rnChK16DpiLEnnpP3lGW1Rf6wH+Q4dPXVc5CVbWpMB36/05S/vPBxzXLHZQPzLCCUhRfvlVVt6Pbq0fKHVbumH9Q6KRkSpVQbHIXR8crXMxbEFoqvdSjgdaLCTeTGzvloNvCiw/ukggWfQQWyZdlAJwAoXcS7Uo/rTGcStQGqj1+6fMUJfoqnuXYdpdnngM0UYmw5XJ/8pi7iJRpu8a3b1sRhrGliPl/fhwsWQ/Wh58E3oBc/rTy3dOnY2MlSTDtAa1wUdK55ezg== 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=OZncqnTwMEsV9VIuAksXb4AgpHpOr5IInC+8pBGc3zY=; b=nlcISl84Gv2TV+121zXcIMFX7bUmNCUrjctjIQkasQU9JLBMHN2Kxdb+ipuCQcrwPQUw6AaQFyPSqDtyqD+4KsRdbnNBNocOIfBOlXkMIgtLK8LOpUeG+af1+2e9ilPFMH6WuwUsQX3iZZ9jsFqEKTxmvEBlIzXHUKAifboNzr0XrYsysxLrvi6hk/gbHSup0yOCgpQ9c8so43/cLs6SX1h99MCsU9XloSLsBltYA4Q2trxOAHfc89ai/Yb1IMTJ+C557eY/95OvlszBHNSm+Npfe5a7ZasVLff5VCqKSXXhPrYLWbWsJB09+YJo8NLZhWhgNnK5NtOK3lfxc/bf4Q== 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=OZncqnTwMEsV9VIuAksXb4AgpHpOr5IInC+8pBGc3zY=; b=TyTXwAflsfhfQjjKgV2nLY+HDgY7/Zs8VKSmcL4MePhSS4R8tA30AO6qKGb5dEVKlX7JJCFPa7xVIC4Uxmwyt3c5/OrqGlGPpuR4TOl87M2m7DtYc74uKVvYIOFuNNb7wGqpEuKqMPRh4DcmNr6o/XG3Wv1g49bhDYhPGUc5f/0= 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 BYAPR10MB2469.namprd10.prod.outlook.com (2603:10b6:a02:b0::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.22; Tue, 13 Apr 2021 23:07:03 +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.4020.022; Tue, 13 Apr 2021 23:07:03 +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 06/13] scsi: qedi: fix use after free during abort cleanup Date: Tue, 13 Apr 2021 18:06:41 -0500 Message-Id: <20210413230648.5593-7-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210413230648.5593-1-michael.christie@oracle.com> References: <20210413230648.5593-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DS7PR03CA0212.namprd03.prod.outlook.com (2603:10b6:5:3ba::7) 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 DS7PR03CA0212.namprd03.prod.outlook.com (2603:10b6:5:3ba::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Tue, 13 Apr 2021 23:07:02 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 68a5eea1-1342-40c2-e28f-08d8fed0d987 X-MS-TrafficTypeDiagnostic: BYAPR10MB2469: 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: sbhzmUJnSMpnRUw0wmtQ4IAGlIorWzrvdeuxrLMBKSLWLYX2g28wj3AAHSkrxJMv5WVoSHBLUZSiWB429BBzMRFEgFtr7mpQ6lGyDVgOur4vdcQYhUINowYEn2TKVq5rVIBmqKSr/VrOmeYgzfnnG762tbwcVl0obuUj3CZbchY522yy3xMl5HFeNphdzygZOhZDycjP3rexFWMKYIIPGMNtKIjx6pEXAC7djTLWIuWNDL69VOyWGG93DnIpCBoVgKgpl7ufqafKGwxPX1Z67yr7YYE1McTl7MdxnNmZkJT04nDXvXUAqk+VDfvv6hoWg9tHm+h9lStksFp7ztfECjT5P3kY75qYDXbaFhKBuhvEJcQB9W+I5eDWvpBcUXdTI0GkX+4g0GIN3nxRJqpsdw48gxUQN5GzyQkq2wOxL+6ru6E8Ea7hoYfn7B2f0g9AutYq31GES6dJOD6EPurr7pUlTdy/nR8ET69QQM0P7mlAU+Qq5v3PkgIgELxsay+PYjfOkmvqfcsyNEAudbszuh+9NjeNlLR5x56cDsR3SNOqsT6jnQmrab4GI91m+c1mxhVN4HiHy+VOB8RTaeEtMBfLYbmaQnRPZYQJ9M/rz+L5PDkbJkYIQMy8tARDmPGIT3K+0nhHNKNR2xw3R/o12IGMZgc63L0EqWGdtJ4+qRjg3+xNXxXtVquS/Nufq+No 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:(366004)(396003)(136003)(39860400002)(346002)(376002)(52116002)(6512007)(478600001)(16526019)(186003)(2616005)(8676002)(66476007)(956004)(69590400012)(4326008)(6506007)(66556008)(86362001)(8936002)(6486002)(83380400001)(107886003)(316002)(36756003)(38100700002)(6666004)(2906002)(66946007)(5660300002)(26005)(38350700002)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: M2lR9GT1WgXXDLJ71BY/hI7BbRgopuWU0PfkS4z+0b7vu97QayvHwOuFBamqHU73Hvj/X1V8to6xy5+M8ccWlHsTCLZvFRizaUfYzyCudcuUFhPSayNfmJgX3md8Wxbq956aGGa1YZdNt6gOfdvrSD53JxXAyiDF8KSxjyejyxs8sQbAiJGaBtFZLUwkhKJeUAGm5mqmp33HA/DbzRzq2+s7GcNRxNS2zphZVG/4ICV2z2JW4ZbfoXIHj1R+mQ9PyvXHTo96WYfW6OAIwteyEzNMIGYf81eLMmaPbSjFIoiHzuKNXRNcqZFRBsxjpNvhheQMrmdnxgSbqpkrrhfq/3k/CgE/5FYRPaIxsQbPUrWqBsi3C9zt6zYl1kdsPwdFe+dys6R4Bbxkmyz59hlZ082m28QHb54P4oG+HoJc4hi3/I5ipYE6G/w1aTVjYSI3eOHe6JhnpeM/AgT9G4y7sYn7DlHGqARZ0E98f3fXzGmEKTaUKSuKUKNb0YVDgtGJ/aR8uV7ACR6SfKCaLXenKG/782FQ3jdYFEZJ7etilbIIFLTzybYUvImOniJxUrv5+9izLXUe32uVehWqyZkgbTyLtRZgAUUjPYqOjXjc984EMOQ1jFkQ/Ol7dyNWX/0wnlEEeYynyTrEvNy4061yQCg2YdIn9yHaIZHbHLzfbd6YQfCYUFrWn9QvtBFkDyGd+2teYNnsjlOHnWaw+FdYo9vG4PtwLga91nFbqeyfiXcTg+hpWM77tstIOx1W8nwM/ZPA+M62Wc5cIlTcOqtlK0r+aXt9MVPnujp/3J1XO51aRCU5gC80dnz/lik7iXIdRXpWHKkqffPI8n8XO7zE3h9nXDLmEhC7DyRyC7dXz3cx8tfGbfEciYrpa6byzLEkTrQXxBW67CjMsQbDC6SU+W5Xdjp0Er3zUsiGP/hLts5SRJ0DgPUegZMS/RsW+JhMBq1K0I3qEXUC2vkvaAAnvge7VqeJh1Z3bxu3F/TBvtXVp+WnXXIMM8/W35v9/HaVtk8HpgvkQxsZP70Vwolc2IMDA+kKWFCe0sBhSs+G1ostPRf8qoIOhcGhLYL6dITEHHRBcUVI+7n533I8Q6f6yLdhhPdvTfY+hZOcXM2Vyltj4j2TSKvAaR+hShdrE0EiKXv4LiH3Wr+U79xUEGWrKLcnDf50eamBAl5cz91wRqYJPGfgfgXAH0MultI0UErYenM/naf+DmiOFt5Y4m9st4ROEvk+Y/zv4YpXK8qRf9PYZcY8nl27WAaWHjdz7mI1MinCNWj6hhDVslDhLxbiO7UQVH5XGRbTlS9TOjfjqQUWehOcH+62mEgUoSy5hXyz X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 68a5eea1-1342-40c2-e28f-08d8fed0d987 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2021 23:07:03.0998 (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: wN45jPgEZYOPmybSyKI0suYIi/OYXTw34pc8a8kPGD1PXFDTkSUsRcojnTPSMq2FJ5S/JYIrkbuaYXQT6rp6Z4CR7atupAC/DwJjSGEwXP8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB2469 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9953 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=0 mlxscore=0 malwarescore=0 adultscore=0 bulkscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104130148 X-Proofpoint-GUID: ht_jQyVmkrMkBt2-qgFCwnHIhcxpq8wr X-Proofpoint-ORIG-GUID: ht_jQyVmkrMkBt2-qgFCwnHIhcxpq8wr X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9953 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 mlxlogscore=999 spamscore=0 impostorscore=0 priorityscore=1501 lowpriorityscore=0 adultscore=0 bulkscore=0 phishscore=0 suspectscore=0 malwarescore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104130148 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 then 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. Signed-off-by: Mike Christie Reviewed-by: Manish Rangankar --- 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 ad4357e4c15d..c5699421ec37 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; @@ -742,7 +741,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; @@ -768,6 +767,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; rtid = work->rtid; @@ -776,52 +776,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); @@ -844,6 +839,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); @@ -946,8 +942,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"); @@ -1374,12 +1369,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", @@ -1389,19 +1394,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, @@ -1434,7 +1440,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; @@ -1455,6 +1463,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 Tue Apr 13 23:06:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 420556 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.7 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, URIBL_BLOCKED, 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 D5000C433B4 for ; Tue, 13 Apr 2021 23:07:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B948161244 for ; Tue, 13 Apr 2021 23:07:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347820AbhDMXHh (ORCPT ); Tue, 13 Apr 2021 19:07:37 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:46374 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348741AbhDMXHe (ORCPT ); Tue, 13 Apr 2021 19:07:34 -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 13DMj9wt055503; Tue, 13 Apr 2021 23:07:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=PUX6Stv5NxY0MT+rbcvNoY3vVaOd+2fYyROjMBmWJ0I=; b=tDHEWc+gpGAKR6cCpdpaTOXsxaFWFk5ygDRRELX2OcIIkXW9vK5jStHCwZqVgjguJ1Jc H8R26PeY6WeSqOUz6Br6t3F4h8P7SHMVAjv+zW1BOgXHUJWJhk6LM9do1zdlTEg3wd38 7e52AajLG62m4Zqi5vjL12z+D1DvxGzCHhr25OL0osGdHMaINDW4gCLwPJWAa/vB2xiP luD+ZyKN4N+4yJUJ/LZay6m2fmWlloOm2CYtmlv+ZXB6Q0ClYCRjYzgJHRx4NgCs7mR2 YZvKGq6CAXTHlGEeQMSDF4CB2WkJ5iNqPhmQu37bTuVh6tvga0f9IN5vOu7GFtPsvdvd qA== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 37u4nngmyf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Apr 2021 23:07:07 +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 13DMjgku142878; Tue, 13 Apr 2021 23:07:07 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2177.outbound.protection.outlook.com [104.47.56.177]) by aserp3020.oracle.com with ESMTP id 37unx0e1jj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Apr 2021 23:07:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eAzi55BrcbZgRFLy5ei3kZZZr+hYXSjJDwCeCYm2K8kAz0t3IWuoQIZjmdRlkGxCvL5kxedSUhN181dXIGffaFtkjRj4XlEs2qj7CEqAtNCTPyLxFZixQIHytL15MZhmx/JGUczQmI8O7wHVeoaUXReeCDtptm+lrAyGZkIhdF+7hGnARjobFv5gSvVqd0YkEpRtCeqh5N6pJBXG4L8aAVSuSp6EtV2vCKLvEKwCShRf2qy0Vg/ByMqGXnbEryO/Dy3r1fCwORsR6W4ltwVreqEAIWcmo/ZE0S7xVyCVGgKCUlCg2K+Pns4I6TtsJ6CejGahpxnNs6n1Uy7FzsPxuQ== 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=PUX6Stv5NxY0MT+rbcvNoY3vVaOd+2fYyROjMBmWJ0I=; b=ayQ4A0jB3vJ/jgS8BxVHgWaRIdf0yJmJ/gAIfukZCAahz4HU10Iyv2YH6ao2uo1ryHrrWRF3Mh3xChS3aHuMNMSXM3m2GH6Ft/Fz7hgUfIX4RGwwi+w80WC4mwRtfM3Wku3FPgffhr18yN1neCXeFrEq2r1e6DfLJSZHe2pKcYv1wF3I/wF95YKpN6b7Zxe06VnH5BG907BtC8loRnNW7w4B0A0T3XZjObgCBo5tOdvF07+lKxQkda7IsutsCWas9gfr7DUrHNeSA5aWmPlRb1CJQDUsKBxQo7AJfCwC429lahci7pHeQvjMHD90fAW9VVuyRWD7kmyN4rfxaiNqmw== 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=PUX6Stv5NxY0MT+rbcvNoY3vVaOd+2fYyROjMBmWJ0I=; b=JEzt4r9nSDHGhrECruDdoS7MlqdrmBfyrGGt+oz6uMzPoEOFNzE6n/DURdFJ83gdMqWHPWzn77OlwOHEKMpn3oYc2zO1k2oiZQe4Se8KAM1BB5Ku68U7OJRVpBHEB6Cjg0ahsW5uJgXibh5q3uIfg1o0c9ULijtItY+cLLPhv1w= 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 BYAPR10MB2469.namprd10.prod.outlook.com (2603:10b6:a02:b0::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.22; Tue, 13 Apr 2021 23:07:04 +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.4020.022; Tue, 13 Apr 2021 23:07:04 +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 07/13] scsi: qedi: fix tmf tid allocation Date: Tue, 13 Apr 2021 18:06:42 -0500 Message-Id: <20210413230648.5593-8-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210413230648.5593-1-michael.christie@oracle.com> References: <20210413230648.5593-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DS7PR03CA0212.namprd03.prod.outlook.com (2603:10b6:5:3ba::7) 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 DS7PR03CA0212.namprd03.prod.outlook.com (2603:10b6:5:3ba::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Tue, 13 Apr 2021 23:07:03 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 56024905-a3a4-49b8-2b51-08d8fed0da16 X-MS-TrafficTypeDiagnostic: BYAPR10MB2469: 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: Q/RRieBOXKC6Eh8UlTltpDb+2QfFEOj47e1rqVdGIv8bzeLPJjM6j6psj5bUv5GUTSTtW4RF0dFPJJtLRmp1xzwqtlAxcYIHeUCLf7kAMziGnAaYSN0nwJieq69XnhVH7DeoX1u5lgoYXRN3I3DWwT2k2n2eFZ5Yq+OsAIa4E16+C0armU+kKTXEsDRtoT4L2GrD45waID+mDzqse2BSFxEXeV2zEnI/coX4AdSAhkHrrvKUbvs79poUDwykNcp8nK4ijsYZKPjGf7qMmoeFH90aj9V3PGlEdzqku4l5FVHR4PoNlVT/toXj9uRnPW9cEx6zW03JNo7ZgaDROl2XRYJp6GrxNV8LpnTpQTXJ6CRNmRNgzQhEjNA+beH9K2Zyjt4C7knoAf3mUaENWyVL3BnguOfsxzwjTmDtvAD70rmDBcLtxLInf764KON4sw5Ppe5CmbMHahWzP1U2weJhxqxYZ+f1JbdJIhgQtyYnOyxvFRFEJsGHvgpbrL/fM7CiAtwr5719DCgbGJWDXz8xtOONPJUg5UuhkTH1zZR5XwXYZ8g/P+ar1inntd2evkV2Xyj+R0Qdnc/MV51R7GnLiBRhOhaUlQZh8gG9pR4TpRZWfyomvBZHZ93Xl8Jf6NjqBOyZI0p3uQ9XllxLA5MgmCvLWk9B0UnolTrAimIWpbVvAEC59nHmdXMzoRFrMiTY 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:(366004)(396003)(136003)(39860400002)(346002)(376002)(52116002)(6512007)(478600001)(16526019)(186003)(2616005)(8676002)(66476007)(956004)(69590400012)(4326008)(6506007)(66556008)(86362001)(8936002)(6486002)(83380400001)(107886003)(316002)(36756003)(38100700002)(6666004)(2906002)(66946007)(5660300002)(26005)(38350700002)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: gagPJg3oVn73OQzHJwFNRqSxdTcpiWXv+s/4f2C1dKnj06KT20dJ0pwiprkF6mbF8K7XYHuWisBEdn0W5LRhpENg0ll9AcddI6IOsp9ngA3N49dNYPUMLWikSE6hLO3XVR6gk9c5APL3FFoXok/PkhcRmWHU4Kd1jKmfNKzxMi/IvuF05gXgXWRCtIUgqpTgj5mqKAJA6nOzkqOmGLKoJryIZYQw81SJQDmp2bfRaRCWzTT15MKV6QEVWRx2do3UQQtTGRiosXUk7RW4HhxhBGbMmrYyCoPGnPPTsmjQo5K3LIUlpcf+S+sl6CoBimD0pR9ngSJWUBUTNQIw9S/hmzfeP/B6xUUXcSh4mKHymmbiC9WOxg8EGwhCR4fKqTXuxg55pcbsQ4JI925M3qMnmrmCQ2ObOKUqm5T+r/TXtbHpgy1Dm+D8KQpvYdEPrpINp7pgcPL2Dfys9pbGJaCGWppgDEKeTpyJFIjx3AffDFgnuTe2hO1cqnHW+0Wk9mz9xpthSBPfUkW70co3wMhLVPI9S+rE1OogWPFdzXsFOAhkrRkJ+kNdt2JPz/kVTiZ+1K8JLn6QUQFKoZ1fGXZn2r/V4IGQqQbR+Yry00xAyjYZGnFawpE8VYdQqHx+yhihkJtDXEJR1Xss5gbSUpDs+ZvtE2C4N8qz0OBwESlStrfmomzvrXriYtpD5hvdv5VQ421+6cQ1AwZk+xpjI8iYbvEZwltyDXfZjMKJlr3JWoYMD7ElDGD8hF4csNaZ6n/7rLIYNLQ5AhtWlQzVSEKdkJdFgt0627zeKkFr9CDc71b7zIn6cBum0Tg4/oTgXTcHJkVrc20kDJNSrYMgzv8tC6dUDT+KUKWfWn6DHPvyQWjmNaCLZFUU6DyOsci8nXXrqpXe38tHJEl9Y1sqdGKmDSnsKYmuzxb50QUl7qn9GVtmg3qnb51xd9CEbRBfttgmp/Lzc3zChQ6gqu0e8olY/XSOrTVoU857puG70LR204wdZMzuRL8JXmak4FdSa5p+nISbmaBy0Q6VWe+qX3txHT9zmvLcOCeNIVgXFSTMawwxurlHGjpM+EzsR4jVIAAdUM+C4nWPON81TFaI0nFYOT6c7A6Xz1+S+rVONRygIoj7m1FAcFKFi3Q88GH/oJBWo11d9b4NO0Fw8yrhrm0EG9qdrUZpTFDwMDx9HXdb8IIkeACfsvyVyy3AEiCwwsYhmgF53l8KR8C3NN4N5S6oNUX5c4aLIA32g8PLt3YsvsGpdas+eM59hybhgXWxFLRtGchG6EvwEJcJx+/6+VqRIrPdL8ZD+f4ytngJRLiqA8iMTZeK0zzR+P0E58CI16Rq X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 56024905-a3a4-49b8-2b51-08d8fed0da16 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2021 23:07:04.0902 (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: HLh+cESSOhCC9UzU0doSHnYNlNR2TJSHh2/I0mG4w1w/Yhj5/AUCfBy8xFxgRH2fJn1IvrbpRlMTspup+eYd61Rduid5KKME8aX67H/Zr2M= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB2469 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9953 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=0 mlxscore=0 malwarescore=0 adultscore=0 bulkscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104130148 X-Proofpoint-ORIG-GUID: y77Sf-ST1fgT73zLJUTaz0j5-PPHyrPb X-Proofpoint-GUID: y77Sf-ST1fgT73zLJUTaz0j5-PPHyrPb X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9953 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 phishscore=0 suspectscore=0 mlxlogscore=999 priorityscore=1501 clxscore=1015 lowpriorityscore=0 spamscore=0 impostorscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104130148 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. Signed-off-by: Mike Christie Reviewed-by: Manish Rangankar --- 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 c5699421ec37..542255c94d96 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) { @@ -1350,7 +1350,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); @@ -1363,7 +1363,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; @@ -1404,6 +1403,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; @@ -1430,15 +1430,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); @@ -1468,8 +1460,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; @@ -1484,7 +1475,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; @@ -1548,10 +1538,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); @@ -1563,47 +1550,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 9b794afbdead..b06ebbb3ed39 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 Tue Apr 13 23:06:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 421453 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.7 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, URIBL_BLOCKED, 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 80FEAC433B4 for ; Tue, 13 Apr 2021 23:07:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 62B9261244 for ; Tue, 13 Apr 2021 23:07:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348753AbhDMXHn (ORCPT ); Tue, 13 Apr 2021 19:07:43 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:48248 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348747AbhDMXHe (ORCPT ); Tue, 13 Apr 2021 19:07:34 -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 13DMi1Cx002773; Tue, 13 Apr 2021 23:07:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=q+ZU0Em1wAO9+sQuST+7PsE/cBrnnPmCbzDa5O0c+FA=; b=rbNrZezBuxonb3RHSrFiD3lAw8qrlfo64w3rJm7cgIPGYYdSgZkv1W4fjRx1IGwvTXbm dtsWHrcrKvmUpTYDrFjfRd9+GUSGa9fc6YwPl0Vu5ADeP3u0dnCVZGVNXeDVUbnr0qF9 NPwc8pVL8bjE4YnhgOKXEHbuNZjiQ4EFtmG6H2saDBUchmg4Qa5RbpMhciUXoktGgTG7 nJpm5UvEqG0SpluovBWCiKS4UGLyL2ALbuv6DxKxV5JOgimznfy16ukhb5hGucuSGG6q y7n8Zs3wLP/jYRM4umQTNjlvYqMMRAL5uzFcYoi6pKFmaCEWCWPgC/uSzHdrHj9JdcPs fg== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 37u3ergpf7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Apr 2021 23:07:08 +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 13DMjgkv142878; Tue, 13 Apr 2021 23:07:07 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2177.outbound.protection.outlook.com [104.47.56.177]) by aserp3020.oracle.com with ESMTP id 37unx0e1jj-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Apr 2021 23:07:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bYaXavIkR2WLnCrUokWfAaim74yCLaVOTae4tlYkvZSpBEXaRFHALL7wSnkmPj5cSEHEd0YpTQFTG0nbyA0wWi8P6DKrmJNYWKy/gvBoAC7osxCQcJgTLF6yHYmGevMJmab/+pFko9MiRSKT7VUj8beKjIju7JsOlvefQwAKXb4vFvU4NeUnCXwBZ0hXOMbPDhXgR4xdy4lBuW3wP/h3j6bOzmzmWg4xbz/tkoZ1tc56r8OSqjOwzyUg86i68kzNC15XaU6knP+XSfHflYIosbTX0xneHrNDn4S4XBuomFfAIO8blU6QRpSTDrc19s4mbqOmhauCDBkWNt25ldptUg== 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=q+ZU0Em1wAO9+sQuST+7PsE/cBrnnPmCbzDa5O0c+FA=; b=WgouHzu0z9mbcDRi+C1pYabkCSxjISyDHStLwv+9Ob6FH2siq9C5T3R1zvDy/1ujFThuSiDz49O3pLBGZCY8MZRj00kia/s1GTaVvby3T8dsSB76OkW3/7cFLfJDciHP16agwJQckmQYFJYD1+DX7mU0h79jokTYSu2gKRuUu4aelFoRSO1i74Sx7WrCCAccqg9s5TevF/ERA8ak66/RC5ejbtRM7o0zBovYmP1I/5Ll+/X0qswpsIpeA/JDcZ5tJQpjDWrEMIiNF9WzM9mb3VbEhJn2oP5tUi4kcmEnKTBxiIW/qz6Mr7vVcU3k5IN7PwY3H5EFPvwZswpBXZmo+Q== 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=q+ZU0Em1wAO9+sQuST+7PsE/cBrnnPmCbzDa5O0c+FA=; b=Acds25ApLVG+11EXBtFS/zm56xGcaTVe88UCei84NQ63HTb6wc+BV6BEu208AUgDZQP/jkUg7WfT3IrDZMXs5hrt6WXZcQXvJjunDjcq5tdNQiD1iIsDaxWfKkWrfJwql7vY+Vr+3oq1q2KKovDI0adDqRtNYMh54/fZDjfBEz4= 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 BYAPR10MB2469.namprd10.prod.outlook.com (2603:10b6:a02:b0::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.22; Tue, 13 Apr 2021 23:07:05 +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.4020.022; Tue, 13 Apr 2021 23:07:05 +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 08/13] scsi: qedi: use GFP_NOIO for tmf allocation Date: Tue, 13 Apr 2021 18:06:43 -0500 Message-Id: <20210413230648.5593-9-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210413230648.5593-1-michael.christie@oracle.com> References: <20210413230648.5593-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DS7PR03CA0212.namprd03.prod.outlook.com (2603:10b6:5:3ba::7) 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 DS7PR03CA0212.namprd03.prod.outlook.com (2603:10b6:5:3ba::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Tue, 13 Apr 2021 23:07:04 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 83f51cc4-a943-43da-e422-08d8fed0daaf X-MS-TrafficTypeDiagnostic: BYAPR10MB2469: 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: kTFJJ1A8bvObHVjFNF8U0RjfCfhsBak/EYoXQDgfSOfC/uyCa0g4eEhjbjm2U9baLnz7mjrSd7obVRjpf5w+dm/3MllymMFFJVuEuvo0rhHHHHSDwLkbaoJ8raXyUt7fZ3NVR5hMGhHqHkFIC17eVIfBewDDx8Z0ijeAQvnqonWr+5xVRVRTf49FSWWKEG4ptgIJo23MqlDsasR4l+ulkeNcNCSZCHsc7D10yXd/toSQLCWwKRMtE3T3ZCc8u1gV5wfdO+4vx4le93fUqGp5lIUr+9gVFRTak4BUX9tXlynoNvLPO3VbKcNpK+RNiiXLCDTCupEhIyZrrdPXWhuktcGk/AK1sUKw70jof8zTqDHyr+s8+n40q3fBGg1AVyikyOmHea8vqF2ugIse0c9K9upPtE7E1qrQ6cvaf4xw832P61PPiorhDLoBIhGuFAc94pPLGzxp43BrRRVndNmkVdRRnIctcDx6KS79T6osxLZsYJ89OZLwIe1F7AIX0sCVCgliDdKbCc8H4y6F1Av8xQLkfuc+PoYgru7GmC1OLXaepv2fMqgdqTBjqLlw83iajm5VeNAq/eDJ6mNZbP4VotTaGjQVVFhduTTfrdaVxeJac0YHVcSlAQv9bjBGYss/NSuRDLoDU+fSsoraPIJxfERBkklivorG22pD6SawpPknDkWvkKms+qrXPD1TD3Aa 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:(366004)(396003)(136003)(39860400002)(346002)(376002)(52116002)(6512007)(478600001)(16526019)(186003)(2616005)(8676002)(66476007)(956004)(69590400012)(4326008)(6506007)(66556008)(86362001)(8936002)(6486002)(83380400001)(107886003)(316002)(36756003)(38100700002)(6666004)(2906002)(66946007)(5660300002)(26005)(4744005)(38350700002)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: iHNK67tXre6uTCfETtVd/F8pBdpIEHosrvk3HObhiBeI9d6F9JtPk7OhkKD7JMtnOrDbC/wh4oKe7EHOWj0YaCQ9n5HDr0h8wOshTogGtMKmrzRmUH5DGkO9usbNpE0Ji4ywx4pfJQnGPTd51uipT7wLUCDEwCPGQ8xk3TUdQVGv6GzuQGehJ9o/pDMrHIN6IzDo01f5E2XT7ekisF7GOTXkSUZ+Ish3poYBdT1EQxvFuTYUYczJWDgrTSgbc11iwQFvsnvZbu3WModE4OAXNU22ne16IBCR2AV6CdqkUqijUEWmER43+pPtt0Rg85tQvRw4uM/PfwG26F5ubqMYbJpyO/f6tTy9kZTvBmvbpXjz3SVqyB5CaOUN7ohDEyvdYXHU3TflIW7ulabSPNw4ucci+fYgTy4kcPTkWJXly6zBIBtKUweifOpS7qbNEKCQP3ipbwPv8mrkxgAqU5+f2ONaLlec6+HQ5UrVWYmdS5e+c93e4k0TH4F0x64E6A4Emf3xGQBBHFRbfY3jjGLqtzdsbPbCnPyuwaNiqqTmBi815g4xKcfdb9dJGz1JZ6kGpi2F7O/1cSgzhANdLXxZeW+hhiBl4HgKyslps6Hk+0Hg1C9ADNKheBbZS6zpULemBB/w09lWhnTsuaYCT8Jagcopaav7v19CBgdsU9zTENuMHG7zMCwiUXFR4CcK60ZRlWOZE8Ny/4iyuMnHnDDEvM35qo6Ypfn3cAZHQLw99bjXA9QUFkVNXsHt0Pu4DDDVwp9EygR7p0RSKoj/9s1Zat7hTgDoZJI8QthY1nTLCjadZRj80po0XmF09UxOCoMO0wJDI+IdSWf1EnAzHKg+g8AmV21IxYJ2uUChGol8SXs4T8qYQR8N8WwpeFZZwV4Zz9OkhvwYDpwRTQJBf587IMx8Auiyce0Y2NpFi1H8Krk0A3xOs1Xuz9KWXjFZBvw4QJTN+Qg68HD+ibsieA4sGlBwUrWc0oKHW7Z/1WZaRai5M11FIbfOOL6o3TXySrRGUaRnEEDvubbq5X46npboeFpMNiUfX0VS15z73axWs+VtQxKeYNxpF6dD8pz8oAXuX2yEfoE61w/QpHE8NTW03ujpYHOMOWGglmoukS9p75zppkBlhhO/Xp/XZeydBGi3WIUFjFENAr79lsIOjA9S4mUmKA1jWuB/lH8QdTjmvMcCJTyJSkjTTM8ZdIxEj5PRcqoFWJ59n8PP/rioRmfpmBcMjgtNYgImmgqx/GCd+8JvyOrovaG5eiZvT80f4p6Sfi19FnOYrmWcatgt+FN1Ge9yxM1eIz544nZwmWSShL5Ild0pmYeVoVCK2xWhYhB4 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 83f51cc4-a943-43da-e422-08d8fed0daaf X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2021 23:07:05.1246 (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: zNibXmvyWxzqvjyfjrysEexbRNFYg15UL+LpwqRrObaQI+dSU4nRyAxpWyEX3pveULpx8Q7HnsAuG7CQLtP/lg1p5YpytJQ/OYRI4IwbHT8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB2469 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9953 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=0 mlxscore=0 malwarescore=0 adultscore=0 bulkscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104130148 X-Proofpoint-ORIG-GUID: 9NFEWigUFtj6KpkCSUPBIeeHwN38N1AR X-Proofpoint-GUID: 9NFEWigUFtj6KpkCSUPBIeeHwN38N1AR X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9953 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 clxscore=1015 adultscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 spamscore=0 impostorscore=0 suspectscore=0 mlxscore=0 phishscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104130148 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. Signed-off-by: Mike Christie Reviewed-by: Manish Rangankar --- 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 542255c94d96..84402e827d42 100644 --- a/drivers/scsi/qedi/qedi_fw.c +++ b/drivers/scsi/qedi/qedi_fw.c @@ -1396,7 +1396,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 Tue Apr 13 23:06:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 420555 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.7 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, URIBL_BLOCKED, 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 107A2C433ED for ; Tue, 13 Apr 2021 23:07:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EB4B761246 for ; Tue, 13 Apr 2021 23:07:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348754AbhDMXHn (ORCPT ); Tue, 13 Apr 2021 19:07:43 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:48260 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348749AbhDMXHf (ORCPT ); Tue, 13 Apr 2021 19:07:35 -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 13DN0OcX033816; Tue, 13 Apr 2021 23:07:09 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=K/B5rRNmYVJNN2J4KA737HZkJVg5xY4jizf6H3gDQq4=; b=E5cPMYtuj6vw0O9fYok/2Wphwwvws1rhr7ImU6KWgAc60Lo4hmY5xoE4w7wMDvU7GCrS a5if2poqoe5Sx2VNIwKo3ruML8EO1Ei8YGeWpp71J7OffyD8in2wNfu5pNKi0DYyUNGM R+j2rochqhPPP0xzKZDc7ggNGKDbhq0Sq9Ib3QfaCpm9jNzp+2b9pue2TbpGF6qkW9m7 s0wwGpvJK9pk/VMbV2VkEoply19+9NLA9L8zzT7lMq69Uoun5hGAwrYz8XuP0YMCknQD 5OHDHoZ1ecKbEYH3EqwKNXIYpWlx0zvKqYuIp9hTXnikqz2PA12kNNBXVGwEtwe0lMIe zw== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 37u3ergpf9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Apr 2021 23:07:09 +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 13DMjgkw142878; Tue, 13 Apr 2021 23:07:08 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2177.outbound.protection.outlook.com [104.47.56.177]) by aserp3020.oracle.com with ESMTP id 37unx0e1jj-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Apr 2021 23:07:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Pw6C5BnCBHoVu3NIhnUI3QGcFo6rF+ZYYR5/lHpzuQi78jxiZIIOgRJS9x4EODelYcqV0sytnNEJjmiaFCw9t7Rp0v4Snm3WnNofEynd0pnJH9N9IgIN97If3h3M6+aOYpkBuc2om+eXRjI5ACF9UZtNma0vjOC7BpwnwUzT8SfEyZ/SXV62iydwiqMgOLR1UMn0IBTGn8p9cfRUMesNE91PWatWhBftRvn8xkFXFEdE0qYbnyfQPa3F07ocEC+TawUcnDv3qSkJrXogd/ORVe/Oyoio44feHwBGQAqwV1WtNELvLVOAE5wxT6Op1viJJSnOh0x7T8fVzAcLJ87t9w== 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=K/B5rRNmYVJNN2J4KA737HZkJVg5xY4jizf6H3gDQq4=; b=CP3ljELaHcxGTzr9tsWOLixUlObLlTC0o8t52hwALEPuxs8O0mA0t2iPjG0JKEzQR8DJS3DZVjqsEb1iCnfYlDbuSIojOfcVotnnJuA78ogauK1M1B/OSCa6JxaT508S5bBf0H+soRF0fv3easftIuMx7ZtwZEiacslkLAuSZAGhXFSxLNZD0mO66p5/YpCrrUYcXxNFz5pSBHlY05iqEn9Lnow5cqODGrbqIez4a1QnxKi03jVE1wFbPVdh3rnZBPZKZIqr2kz2Zzxh5Ud512/+/0yijSA7CYgV8oIOixGUGaTugOUm5+73Pq79qmPF0dkTNNKEnXQa2zfrckgCBw== 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=K/B5rRNmYVJNN2J4KA737HZkJVg5xY4jizf6H3gDQq4=; b=y1wnNieCjU4B1eqCcLqYkkzvLkMm5Rf5P61X0qcSBRyM0qqWpbuG7tmqCDWjxLFkcN3n+3HruASijzR/jWt9eDXqFBSodjtwfoKgzABOpnoGHHfUTmy2r8EUTR01epkdvjVQreV+Fosv/oQy7lBUFztEBvP/DQxA31lDfsep+xA= 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 BYAPR10MB2469.namprd10.prod.outlook.com (2603:10b6:a02:b0::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.22; Tue, 13 Apr 2021 23:07:06 +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.4020.022; Tue, 13 Apr 2021 23:07:06 +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 09/13] scsi: qedi: fix session block/unblock abuse during tmf handling Date: Tue, 13 Apr 2021 18:06:44 -0500 Message-Id: <20210413230648.5593-10-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210413230648.5593-1-michael.christie@oracle.com> References: <20210413230648.5593-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DS7PR03CA0212.namprd03.prod.outlook.com (2603:10b6:5:3ba::7) 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 DS7PR03CA0212.namprd03.prod.outlook.com (2603:10b6:5:3ba::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Tue, 13 Apr 2021 23:07:05 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ff3d1b20-3d36-4f02-572b-08d8fed0db4e X-MS-TrafficTypeDiagnostic: BYAPR10MB2469: 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: LrtwOkejg9fW51h4+MOa32OQGqMGe3PcMVcfCNi2G0HUkFAtqrWcxrx2fpLzsk+msTmRGReIr/IWp5ALDVf/1DG5gy8gs1eDa7V1xEUge1PWBEDbgWq9cwp3amDEq2cYfCZ7f1jIf7/WzKIwUsO7gszIKZ7UvTl00Vq+3TFQG8J50ui8wdX65U5URRYSqNhsapPXJoB+tg1rboaejE9IWAXxa0UtrzBRjS5/by0+zTmQrdz+j0FzYnf/fPugzgJoSm4eUVBiqvW3Q7jmDYiuwTlDdgB3UDcSxgM0o/qJCCxZ8qfGEqMPe4cmaJPxqeTS3y1sc13btWE/iGZNdDLHXmhiYu+MepUtPr9QZ8Jgqs3w4pImf6S7AjshGxjn5m08fI34kL4+ugUK33F5J5cMlyKT1x/bySrXz/gM9GAQALzsj+OcBBsJku2/CTp+3g87onC6r3xALS6wH3oh2gIAKKlBXokxDgLRszSPPdq4yqeoyJNmw3NwEdUeTbhJTRVi2Fk7C8NmYe2tCQLJLLC4jA4Fx2K3eW9RCVLuNia1DoDlzfBjiNZxsOgwIC5/3lwKD8Q7NBigt0DANH/ZYU8A2SrqbcIX3tPw/CoIwvGVdTNIVIrezxhjcPMyoSSB0SW3wE6rLH/NpN8RHYFFQVvheThuzP4we6zfHmzNZw5ylMdSAWCccoYU0/yx5KaDP9mY 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:(366004)(396003)(136003)(39860400002)(346002)(376002)(52116002)(6512007)(478600001)(16526019)(186003)(2616005)(8676002)(66476007)(956004)(69590400012)(4326008)(6506007)(66556008)(86362001)(8936002)(6486002)(83380400001)(107886003)(316002)(36756003)(38100700002)(6666004)(2906002)(66946007)(5660300002)(26005)(38350700002)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: qClIymrSKvrc3reDh3ULfXm8dUrn7qsBGZoLWgt71b5aJFb8wcKDYJLPq2BzmbjVUw8GQbWRf0JzoAGkoZFRzCDXmlL6orI/lj00tB2rH7XQE4S13u9IfzX0mmCNULOh9lW0jwx2ShncjaJhc33wXtcegnqK+I9jr5iOdAGzmeesCgpMEL0ppMrDcFrLLVJW+wY9pFQG3HYOBmDWhWi3FxYl5tzY3ynDfSVzb1VVVDJvVMYqNMMWko/1ovWVwMmkyDzRXOYPO8NMFn1diitoHtoRX5FngAB2+eX/KB24zseX2erA9U1/fHGu5m/GSgLCIpGD0tYud0eEBcp4HTIeW0mCf5rBvm9oDPuY8tBpEwTPsmtOw/vGDzy29/F5CY38HSmoolR5pBu6nauqK8dt/3qrqkzR0vj+00U+rHimzEHMr1MA72LXESbnehSKgfYurYGyWlGDV5M5JZOhmOGBKM7ysyTXk4rgJiFD2vdWMkWUPUQdG2AEjxGfoDucNY6GjTjEw6fkMFbcMV602J1IEendb/MbnRzY+YXpj4NxrQHE3jMJ/fLNz260IJ6JmmPgZc/IFA58NEFHGzN6Qw0yC1iw3TgDBISqGx1gTcgte1Sch0toNkg7K/gZAGWKOexSdslo+z1TPpzI/62vxUZcVx5s5gw+haRo0z31d1b3cfpB7vKSzlf8BQa84C68go4AM1ARJIT8B8cVZrgsWL8NVpEvPfCS8UIrTGtevwN1UTq7uGjtvN4aa7s+brFN3J2yptIdZ/xKJyfb97hsGEEmfxnfbyva6tcTBcNeVedxqlfGMjSwYZyzlmv+oYUQs8KhkAbarVlDwsa3Msf4a3dIN3ZTa+f67kdotdkA8D3vG2crpsWMnWtRfnCEph6d/DkF0AsQZ3iRsR1cOV17m9wvUCkD78yx88IcnQrF5uU70OBsj8sl6NhRpDvPmQtShhUpO5x08hlQwu/3H2Q1Q/+4AvJqoCXa+veCVOtq7ho4JJtvjS95mGAfEGY2Uutk/1y3BdUJ5HxcL4xxlObTCMFAXCz7FGgBlNltJw3M1cv1n8Pe5kS4wmxLtB8/ifGcCqGbZr+BSmkYMshXSBHS4NWSu5qErNYqW6EVjm+QdC1d3GfjhXqTBZp4xvXiUl2eXd5wV8WOBX14iy69nwlVF4rnYD9tTehJq+a2ksjoJGJWYDrFQOnO/wj5LGTWt0xG/DRpN97zdtnRQOpOQ3N/JXgbR4h1j1rH6kLCVSAj6oY5uhMQvo06oZCXRminqUIXCQXJ6E15zsBVLZgt/yMujGJtj7U6gTfY34JgJy/n4MMk/mFM5dysQsIwgqkNkoBKweXb X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ff3d1b20-3d36-4f02-572b-08d8fed0db4e X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2021 23:07:06.2600 (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: wg3O1IUbAZhyNPNvedECVkmUeimpH1BHH5XqiR/unlsgWBcV1yOydfp8JclY8DjwyJlJP543TUq78Azqc9hKRoBhNMNjRZXzs2pBDz675f4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB2469 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9953 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=0 mlxscore=0 malwarescore=0 adultscore=0 bulkscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104130148 X-Proofpoint-ORIG-GUID: oQ7_TLqCLzCWI9z98Vetbuwm_zw05a1P X-Proofpoint-GUID: oQ7_TLqCLzCWI9z98Vetbuwm_zw05a1P X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9953 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 clxscore=1015 adultscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 spamscore=0 impostorscore=0 suspectscore=0 mlxscore=0 phishscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104130148 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. Signed-off-by: Mike Christie Reviewed-by: Manish Rangankar --- 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 84402e827d42..f13f8af6d931 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 Tue Apr 13 23:06:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 421452 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.7 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, URIBL_BLOCKED, 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 8366AC43460 for ; Tue, 13 Apr 2021 23:07:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5A3CF61242 for ; Tue, 13 Apr 2021 23:07:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348755AbhDMXHo (ORCPT ); Tue, 13 Apr 2021 19:07:44 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:47256 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348739AbhDMXHg (ORCPT ); Tue, 13 Apr 2021 19:07:36 -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 13DMkgul169379; Tue, 13 Apr 2021 23:07:11 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=1e3/v6DvZdELplq+Wgzf8bzd5omWS4+YRI9kqXEZZo4=; b=yqvL0GzVqcd+Te6J4RSfNPKdmPfrXXs1n9engiQ/GQHJlVX5k2qjs/olJJ4JZi8+TIba a8E6PCXm86HDoseBaDmaA+N25gmbEJ2Yhchf7bzC6wEnX70kXCj05ZV1HBdBv2/tsSyd 3Y82rbZJKaMLnveFyF67plOtRnbltpvgniSncbtgfnZ741dl8wIdyCSUbaSESmPyu62j ViGKFEOAam7NvEiId7heT+zoofNx3KWDdLbt2Mxvr8Ji2SiBWHjgtzSruBmhnzz7vCo8 gR3XpmaHY4DC/TVGeTVllZ7Y48Ej0cSNF80/aK95x1YrkDkCoR5W958giNGIkWbnT31y RA== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2130.oracle.com with ESMTP id 37u1hbgswe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Apr 2021 23:07:10 +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 13DMiLat064242; Tue, 13 Apr 2021 23:07:10 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2107.outbound.protection.outlook.com [104.47.70.107]) by userp3030.oracle.com with ESMTP id 37unxxgjba-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Apr 2021 23:07:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=adHGudDtP9Sj4H2VxKxvo3Gv1k4Tqb3e2NHA/xYWFfxXPmyE+EVeMo5cbITfWCDsa3j+x7sOLLBvRZze3z3tJNdByPSmLquuUaUHp5Q+ME/IBTE0HiyxWJ1rLseTa/Bg+TtmKQR3deHzNFjeZJQUrkGU+gr0YiIzwaeNI9DaLervQuq9EP++9TNBzsKKE6aBZ/f033kYtt9IA9nqixPvRS4BgsskUHtf/cK0WsgSRPjVFHd8uMiVsDru/m8XBF9GjkRTEHFo79CIZhIS10tNqdMnbytip41VXnUjAm2S3j6f9QHlXBD29ZE0YMW7MneJv9Zs8riWTgwIhScDYDtg7g== 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=1e3/v6DvZdELplq+Wgzf8bzd5omWS4+YRI9kqXEZZo4=; b=YaDeD7vIGiYxfBH6rLcqhjtU0ow5a3Vn/m0csQtDNcuia34qQQBWYY6BOXPm+3ekId6fmMWBHXzX2+c8uNdJQeY2G+fmqO8JIoXJELhz524CR+cLx5sUHw0abyhWY1vMzIjH2L7iuARKUY+sjWX5/sEk7hiiT8AKsZO+Qo+kpmhwrRHPBwRqLt1I/1W3jUK7BM/1EK3jtRT5zPQM22nHhjsdmpQnEVhfJCrnm3m2CiXk1moohbslY7AAAG1Cw2CVmH/e0VAoiqUJkq55M73HG7rBLCzY3TZwFIISjlLQq9RnrQaUfIP/iDT/5nexosXNTk7cD/yZ58dNCLKNi/5l8g== 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=1e3/v6DvZdELplq+Wgzf8bzd5omWS4+YRI9kqXEZZo4=; b=F2bUZDgIM/wCp23T3vrNLcQpKBScdrANYuenO0hFIjceCDa02vYaGS0rKbiE22EhJTYphjUKf9CIFNq71sGvES2SSgu0uPIuAcjvqd3k+wjVxmg/OYLGfXtc+lReYfaMQ9zKc26PRQ3rHzwp3cUmjQfR6ggUz/BVAdg7lTLDxVI= 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 BYAPR10MB3653.namprd10.prod.outlook.com (2603:10b6:a03:11d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.28; Tue, 13 Apr 2021 23:07:07 +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.4020.022; Tue, 13 Apr 2021 23:07:07 +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 10/13] scsi: qedi: fix session block/unblock abuse during cleanup Date: Tue, 13 Apr 2021 18:06:45 -0500 Message-Id: <20210413230648.5593-11-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210413230648.5593-1-michael.christie@oracle.com> References: <20210413230648.5593-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DS7PR03CA0212.namprd03.prod.outlook.com (2603:10b6:5:3ba::7) 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 DS7PR03CA0212.namprd03.prod.outlook.com (2603:10b6:5:3ba::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Tue, 13 Apr 2021 23:07:06 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c01484ae-dd79-4aee-e338-08d8fed0dbfb X-MS-TrafficTypeDiagnostic: BYAPR10MB3653: 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: hJKNH70wzsWRqBF+PI+p45xzR9+Y4VU4Rxk5OcNqlD8ltBBtpCLqTVknbshla623UQYCim6El2nKsEa9s5d57d0VwE4OdMSkrkN9oIDM1Mz0REeF7UkC00d6vE6g+ycqApCAJVSgpn10Gnx6cQL/JIHoIPcaN+2k4xVX2FDwK4l0mt1LLO2Ry3+0YX+TNk1m4iWoQKaiY3qnNti1u3SaeabhSSsCon4aoc8JU+6aYtRis5hPsZXXMVq0EdPLa4cUFSyUQ4e7ZOIQV12CQC8q0k99ALu7EM9JaSXCLMNh5Q4m9kaZgo4ZVxjclpGMh0PM3ZP8gV3DaA2KBOv0bV/WiQZ77q3xlT0c34Hb2WgU3/MclpSsAyzfbdblbigEz5cWSwEOZkCvmpelJLdQeanWBFbJHXOv8/bklw51K7KYMoZ0BupuWuGGThBAtVZ74dS9Wyf/T5Q3xKJutr4vpw74ffQlt4R4C7oqiT0U94YyZPto28jZyde93yijG0Ia7jHwdr7DbBwUMa2xUPVIh6aUul9Er9bJaWSFJ/2W1te0T2be1e0aXo6CiOGAbcmT1Mj1c3gZYjBzvvLGiDmTK2/zBtzDDHGnJPRFj6tmer6q5nGjpzpJOv/AWPFbgEU9NvWOdWeqCedz9Cu7XH8brDn0M/XLn5xwjUlEy2kOP2P8wX7Z3pr/4C68mf2IbXbsme7V 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:(376002)(366004)(346002)(39860400002)(136003)(396003)(83380400001)(16526019)(66556008)(186003)(26005)(6486002)(38100700002)(8936002)(36756003)(8676002)(316002)(38350700002)(66476007)(66946007)(4326008)(6512007)(5660300002)(478600001)(2616005)(1076003)(86362001)(956004)(52116002)(2906002)(6506007)(107886003)(69590400012)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: g6M+jvW3MvWB37QPVvyt50efCSl76k00wqsXBA1x3wA2aDzvMbuxERqjgP8RE/5/x+b81syi0WOWQeW0npR23+SmWqdSq3q1k3bfQi2tJLj6OoX9lnqOUq4Ugu5Lww3OOMWVhb/w143VMAaSjeZDe500oC6hPZk4RfnO5+WwZhjDRa3yeqZg3SU6qlMIthnjJnFjfxRclx/gooHYIBNrW8neoDxexq+DdHsnQul7suN7oksxOR24wH/ecqPsjGnOTmRfA3ju88I6A0M3SOQcXNkaYgGg8v9TD9np621vqppz2D2TG0u83hX2kmfFJcNrTQmxqGDxJJAmAXK7tPjEj3c8zAJmaLGVA6QEoTuUIX1kZZL/PuNifHiUF6HR1AQiV7BZk41tVlYDvStrRQ2ve+0kNI2mLkEmwSPhZWtGWOFpSlWaB5PwOov7JaQPs1tqVzLZ0WJDihcHVqY/X5Gd9KE+aHsklyv7Br2K/8QTeVAShT60mCjLMwVMJy7//gMc+fHq6M38zcIglO+pmG8UkRkcKsATXuwXO34k1JgyrTw8rfz9BgAy8Ffo08qcIYs+0oG9/GJLXi4tpZYdUi2Mov2BbLWQlm9d8LcTYoi44iKOiz7uO5Rm+SpZUYIFoPXIy8ZMywqzmcR7z44Uh9mHhqAQRLNpSK1eMCeZnFtBH+enSwa4oDyk/XXJE1PKJr1+gvKU4tzj3qeJJNUQT1juevytLjTteAbtS0+oInQGyHYxD/H8ocCLUQRHKLQAtgH5DVvElfTEW8mGSjMyElMrU42ISL6ZH90owvcr6i5h3RhSGbM15Qr9whGlMg0hAK15FBTRk878XlWx+5o58ZlnWqxZCN/3HprK2pUDqK+I4MPAgfDrRFwpBE/Zdo6oGCuOL7Ebf/ixtQEAQeduUE+hEExtPASvPWL+XprgrZ+HjGOx6GoBgc2ufpcRZU9tuzaJJ1GrOKPhE4ipEKH+EOgvae0HWXOtyHgt0du50mri1J/l7ifm8Q4asy8crvTmzzli7Py0898I6pEzFkHkmtwPI6dcFvN4wZ4n/KYQr+I9jkQrDzqXmqzU44S9MC2KXzBhh6MfFb3XAh7tsVBHtCSSvUer9N3fqhbzlfsoleujzPCInzOPI0nkFBdFDsBs+00K8zny97e8vCFFx4qXpWz/XvVnPsWYtfFLiqo984/nvImsDvDTwX2+uRkmd/dkq3AFtR0R3uyhovo0nz14vzuxnU0YCZwPCflj5d/ZjuNd8NJjszlPu+20fXubN56VBnavag5ZgUs75J1nV587HKeA//RCHU0yvf2HzvaiIV/2bVG+v/BEq6jRq1zwNPnCyqqz X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c01484ae-dd79-4aee-e338-08d8fed0dbfb X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2021 23:07:07.4173 (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: NgJjJJ+HWWMvmJhHeOKDaL9rtZyBOLb0PFxq0OTBxPH3b7BwI0w4mwfzupo0XifthFOcgZiZf/yY73+RgjwLk80pWGkbspw/VpdPGRj/ojs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3653 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9953 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 malwarescore=0 spamscore=0 adultscore=0 phishscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104130148 X-Proofpoint-GUID: ZumhTaExEIa7ZtYDbYp_bY9VruCo9CIG X-Proofpoint-ORIG-GUID: ZumhTaExEIa7ZtYDbYp_bY9VruCo9CIG X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9953 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 priorityscore=1501 clxscore=1015 adultscore=0 mlxlogscore=999 impostorscore=0 malwarescore=0 lowpriorityscore=0 spamscore=0 phishscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104130148 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. Signed-off-by: Mike Christie Reviewed-by: Manish Rangankar --- 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 b06ebbb3ed39..9a2d9a29fc01 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 Tue Apr 13 23:06:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 420554 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.7 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, URIBL_BLOCKED, 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 2D2F3C433B4 for ; Tue, 13 Apr 2021 23:07:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 11B7061246 for ; Tue, 13 Apr 2021 23:07:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348756AbhDMXHo (ORCPT ); Tue, 13 Apr 2021 19:07:44 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:48298 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348750AbhDMXHh (ORCPT ); Tue, 13 Apr 2021 19:07:37 -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 13DMj0hJ013468; Tue, 13 Apr 2021 23:07:11 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=/AmxtKfrrWCb7CnO3FCn9o2o0AouYFIz0f5+lqQ+M8g=; b=J5Lqufce5y4OSWZ18PNGi93CM6ZNuXPMUpQbvnfQanEW+RUUSowu6Pj0Aa6fnwn3SW2T wFxSD0KcXa8qRlbN7kbHUQJV+YECJGir5qpFMYIb/0We55Y5kmPu2k9Ei6XZYBlKcBTl nbj2PLyNIeq9Ua/VrPeBW6zM23Pf+31B4LWg9Tvvy7jMHSCo8/HYe6fXAWcesoJ2ZRfe n0iD/vQPyYwcCNtncO8bd0RqIqo8IVkmIZ4ckxxCrjQatsx75KC/y2Pzqhh5FYVP2kqB Vldm45fCdLlbDC/stFJt3x0LN4RvwztonO17Bp9TPRIONFWt3WmMv+DY5wlnjIH4SYBe lA== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 37u3ergpfc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Apr 2021 23:07:11 +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 13DMiLau064242; Tue, 13 Apr 2021 23:07:10 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2107.outbound.protection.outlook.com [104.47.70.107]) by userp3030.oracle.com with ESMTP id 37unxxgjba-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Apr 2021 23:07:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T1fp6eqtQVkIDfuf4t9ZfP+V79/12Yw3KGwlMDIZMYS91DqJmy3lwpOUOmodManWthAY0/kICS09QIGGvuVvJzXfJvWwPdThxBzEXpjwEbAxBvuAO9nrfNeyQYqLirR63wxBX+gjJ5DpvcWtIyfdjoqIxgU5ye9N04HF9qQfj5h2yqvxaCPNwAmbeP5C+g2hiEAmm6OnMA3MoG3E5VKZcZ8cv29RP+CBj/FF2PjBLJMaePEYf+SNANnSag7k4dPfYVIcEKu35G2mdHxlD2Ka9PRjuOVqhhJXWmKSdlhpeV3u1TYiYt2YX6Lk/ieUi3yy5JQ35RrGtqYncNc6Lqkd4w== 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=/AmxtKfrrWCb7CnO3FCn9o2o0AouYFIz0f5+lqQ+M8g=; b=efW6RxCwsBaM6YqFRhtVdEvTEly51jPfKFLqNf6Qa0Y1sBD8QmwzOPwH8fmQ49gpl0xs1ZoJI35wOkJ50I3/W7svIPp0Zb2CHbua2+f5jeiSQ68lrYN+VQjak3UnGyrdlWqvudNywIsi2zK9qiTEUfXdwAkfSJnKs6kEv9Ee5P7zN6a+zozHfvcOjPmvjqG7X9TLor/u3tyImFP9dNNP9gp0T98ZuYA75Xi7SCIXhQHuMcJZ/JgW/5nmjUWVvDjT7zSx6R+OIy5f855LdiBaDsKnwI9gQpv+kleFRYiG+cwnyNz5aFfVVkz5t8Ng5lqq/WHRxXSsBYCdbq3GQqy4Rw== 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=/AmxtKfrrWCb7CnO3FCn9o2o0AouYFIz0f5+lqQ+M8g=; b=TJ3E1xQEUbsNzWqpk1XDSGcVGrXDYoIm/hUK4KheRYswLU87ZbdKO8c3CvX8wHImrKIr7heI/osr/BOYKAELFg6Jjd0ljRHjr0u1ityihNr3Un+NLBwyqBvDV2RepgnI+V3ngAbFMjGHmuSnldqZo8VSBVIknWsaN688jU/rDnM= 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 BYAPR10MB3653.namprd10.prod.outlook.com (2603:10b6:a03:11d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.28; Tue, 13 Apr 2021 23:07:08 +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.4020.022; Tue, 13 Apr 2021 23:07:08 +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 11/13] scsi: qedi: pass send_iscsi_tmf task to abort Date: Tue, 13 Apr 2021 18:06:46 -0500 Message-Id: <20210413230648.5593-12-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210413230648.5593-1-michael.christie@oracle.com> References: <20210413230648.5593-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DS7PR03CA0212.namprd03.prod.outlook.com (2603:10b6:5:3ba::7) 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 DS7PR03CA0212.namprd03.prod.outlook.com (2603:10b6:5:3ba::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Tue, 13 Apr 2021 23:07:07 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bb247e67-83b9-46fb-eb88-08d8fed0dcc0 X-MS-TrafficTypeDiagnostic: BYAPR10MB3653: 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: zw9u+ChkGAHUVc2wek7y3E4Yw2bqAWlFKHOWjI56cW/vNzOaIkOUCwXk00LeuwIal3Sb8nIyJiR1oT/8zzfQj3KfXMJozveXZfoSCbTVgxnOvDa+8HVwp9YorR0Q0YlLzYxIsxLhBhdN9a9YfcRH9TdhIp94e8rE9MiYERJ2BFAU+sl6/OrCnBy9vhypHzVLMa7njaFaEYrogmLFc5zxRZif5CnREN3MEGKPU/223dj2ocZuHfKUMtCmSHv6aPEK4omJUm6Yt8mx9t0LHv8I4AHecPz2JrSWvlkkASPU3fazg5jpdOBRVPmsOLXijko0124Ej4d9Xo27OCjXINl+nbRWeCUkcAJceqE2eCPz8qNzyAH3j97HoxmPq4vWSbg1N0zhv96nwjmxUxcXMQaYhln/VlWo5doe/xIsl7Hk+0DD5GPN4+9+rZfD+Ny6BEY+7PDUstijGUG166DhDMjZFZMSfl0hiBeexeQhp51qbZLuhSj0kTHTv/OBzyuh2JVSdnTYQA2cUUyUzIy6ukWny0LBrJ68iwTr6J5YkJb3JwVg10kwORxOp68FU1wIc+JLjKxG9vu1TuHlc9RBcQNpFcoWSeUs11Mh6tHhHl26LelZJ6Hr8Ib1fNTdk7E3gf1v4QLBlGYJoxuGp9zu2cqVKeDTIPaMixC6Kxvg2SXWud3O/63MMaQpRso2/o4g8a2N 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:(376002)(366004)(346002)(39860400002)(136003)(396003)(83380400001)(16526019)(66556008)(186003)(26005)(6486002)(38100700002)(8936002)(36756003)(8676002)(316002)(38350700002)(66476007)(66946007)(4326008)(6512007)(5660300002)(478600001)(2616005)(1076003)(86362001)(956004)(52116002)(2906002)(6506007)(107886003)(69590400012)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: PXvWeWmTT+Nf0W5/TCna7w9AIxrbPACQlRdRxAqrk7EiHdihoX8bP4isFqEQXXJRuYqSztNcxNmArPcb0LhVUzAJqi0qBFXLee+sPV/YhWFrE+YlK1Kcq1uq/qKTz2Npv0t+BAtk/jg6qUZK4AQsA0M+DG7+Ji+13bIFE2eZRgQiGlbX95doioAvCx35DoVRO2G3Zn1tvbLz9qj95FCaiNHPh+J76sJELzvfNDtmxY4W4kPh0A+Zla4X+75B1dIZqH0SrG5IUtNZ3XbwMCh1/GfLqzQ+J5l/tyNXd5jeY95j5uJR1/3+zUeVlVcfy4bqxIp+59pwwoAhsd/OGuZf7htlp+vhXoxe7DtPG3BhIGh1V9M6eIMVcL09KS02+zlobkG6QSOsGfgN7C6btT/f+NBfAX+iTTdjXm3q4Gomio36kBH+v62fcYZAPe/dHrc0qUF1cynea+cx/4GPmCYoRZVALFf42bpIoxU7vykuXIoVI7jj75voQUTjGxfDXVI0PkOFva0941dNtEEZuT7sJVM+ElkJgOGVVKOtYzMNy9N/lb//5Hx0vHmyUt5zVb6PzbRJhihQWn54u3yFBhnYoTViNVjLnqpXbtqHUejPafPA4FIxutD8IO9JKNEMeYKxrrKzZDIOIObMEhwKU0RDhxynmFlWCPkHsWf1nOhwMNG4bOhTVf0hMSuWR6mdknJxaUd2gEUA/uFz1U8Ie3ftjQXJ6mPr/HRLhgEpbBuWCe7hPK08GzqoFwP5BgLRHJ3xIxxt+VjACzOGeUuMw0EGcF6HXZOMkF1gH8nCPYXbkJEibG+hzzIjRiLEwFpogtdiNVgRELgJ6domVWEyq9M0CoWIYrGaVQgC4oOCs+P9ge4dsvjCL4gLKLgIy2BZbWcdH42r3D65aSWSNrztE0YZstQmY9Qsg6kRynfhfil/dMGLMmbZEOaiH3hb06J5Q51pOdTmwx/USNEEpvCJdVzbwEKomgxVaheU0UIkd1VIy1q0wnTkUAJxJJjXc5/81yBUIXsNYICN2oi9Jedt7sIdvv2ouMfXbiOUOBd9J0+KPxyt0EOzHZUXAYwQvX5ALlXmatQcYoPxkY2PW5cM11NEweZfowNeLtAoeZ8j5sDTNJHph3OgRWZ8QqG6YWju9xCj90i3ls+EHbaljqqXvMX36e6xgGZEU8co8Ypizh/BasvRvfCjINdagpfO9pMIBTMKl7xWbwUkosXuW5NT9Diu1JNnzJtvmYn0Y3Khy5jjuQrdZY6xo1erw3e/fpIVs5Q8w0VoXPsHGK2/FFm1n5IjyIRNrs2HSPilho472S63Pou0lK7RMq5XgpKDQ4KOMfIw X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: bb247e67-83b9-46fb-eb88-08d8fed0dcc0 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2021 23:07:08.5597 (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: BWz1CzlgUxnKggj0q89mteHI2nmQNtwMZOw3N+4xPPMEomyKu3ygwseTtnag0jiXIy1zn/tWvDqBN1l3LhYgLLVP6dDarFRahVipvFrOFs0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3653 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9953 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 malwarescore=0 spamscore=0 adultscore=0 phishscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104130148 X-Proofpoint-ORIG-GUID: WTl22rEFe8tbyDzTeC-OaCioLxs78Dx0 X-Proofpoint-GUID: WTl22rEFe8tbyDzTeC-OaCioLxs78Dx0 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9953 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 clxscore=1015 adultscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 spamscore=0 impostorscore=0 suspectscore=0 mlxscore=0 phishscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104130148 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. Signed-off-by: Mike Christie Reviewed-by: Manish Rangankar --- 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 f13f8af6d931..475cb7823cf1 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) { @@ -1425,7 +1425,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); @@ -1455,14 +1455,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; @@ -1502,12 +1501,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, @@ -1560,7 +1553,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 Tue Apr 13 23:06: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: 420553 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.7 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, URIBL_BLOCKED, 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 D2BC8C43461 for ; Tue, 13 Apr 2021 23:07:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AEF0B61242 for ; Tue, 13 Apr 2021 23:07:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348758AbhDMXHq (ORCPT ); Tue, 13 Apr 2021 19:07:46 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:49698 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348752AbhDMXHj (ORCPT ); Tue, 13 Apr 2021 19:07:39 -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 13DMjwAg130273; Tue, 13 Apr 2021 23:07:12 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=nC2/zbQ2sDMUrsZEo8x7eauZJWzwjzORF6HSCT3Dscc=; b=BafMFz76twZXNo+LYVF9BP7dHiWDTJI+N1j/qjVKEjr082Q/ZU97scPI5rrhChf9AlWo 65YKQF1RBSE2372D6FcT+3rHD5nf8nk6auAcWZV4BidPCbtq7ws0L0F+A5Z3SbjzzgQM ilFiiwWnN2Iu+Hss7GnFAeN8rw/lEjGPRSR/6SgEOXjUrpVxkB34zls1aPYRlVqlLVlK vVlzFtKgpBW0bNrntADkxcbdC7yqDDsbaBbV/XZkNRMzNM5+rxOF8IxzTJu8MAJ1ETA4 96akVTp51WmnKfrHqDWil3C1+sN0GWA0WekNtA9w7nJTm7Q55ysXrd3uA9Y6xoyOWPDw Cw== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2120.oracle.com with ESMTP id 37u3ymgn97-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Apr 2021 23:07:12 +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 13DMiLav064242; Tue, 13 Apr 2021 23:07:11 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2107.outbound.protection.outlook.com [104.47.70.107]) by userp3030.oracle.com with ESMTP id 37unxxgjba-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Apr 2021 23:07:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IWnE68wWt/jqQfF+UDT6u/45W+HDoQm1IKFxR5MDZQDlD/vzRdYZsSpfrg2AVVn5Q5g00UnFeMNCoqYl6VOTOcQaHMxMzLG/4wUvNbsqiUk6dD6js1IKDHrRgJLn3hknUfruEk4di9yi4wHXlvFrYFMCz+CqKC3pfiTOJUHVxW37Yfc72pP7RtgmUqGQ+NNh6ytGnJ/l3YppaLS4Q8mq1xU5krKLkIGm0VOJcjYT4oLdlKWge6I4+ynbXGsik43HCYD4V/lOHFn5MQiCaYEJ2nXgZ1Qp6S2q9UeUBiaEj4Lgq1VODxCyCK1dBK8Omf0L0yMf6rRp/ljcqFHsnVNmTw== 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=nC2/zbQ2sDMUrsZEo8x7eauZJWzwjzORF6HSCT3Dscc=; b=nG1SleuH6FCPoZGyrhEX2laMTJUVDgNA7/npgB9xDo3ivfGNy1lpfkFRbLl3ZoB+xs9CWpHDwsukahAXdhSYWjJmh3ETBy097syzQSKXjXpXIDsSdKg2R0xXAe4JaDsRufJrZsOtUIRvnMUc9TZJSi5Ey8ceeXSyBEHTN3/AjXN8GZ4fBHHoA5mI7qR5RL20RUwqETPpxm21VwU7Nin6LoOnwCmQJ48e1LUh6EMqU5m8mv6vJP5qf8aoljaYVQWz6BWVDVPGQCEQLlOeUnBpQJI2y4w0UeAFKx+4UU59SknARflg0Ck2gD83u5+wE6KxoekYPVjE5wDJKEypfGEYUA== 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=nC2/zbQ2sDMUrsZEo8x7eauZJWzwjzORF6HSCT3Dscc=; b=TjHO3/H3HeqSxt+bpiPI3VWWZMFhmDG8BJdPjAcaPD1i5DDuLEmllGC1HkRTQ934N+0NM848vnXCyNans105Rx0MucAHy2pOo6xwuJISCTVTTk3zQAQJwv5pnHX+VSFxcL7oiNOk8UGxEj7PYR6eGfTBRqBlDQa0POziHeJMFko= 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 BYAPR10MB3653.namprd10.prod.outlook.com (2603:10b6:a03:11d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.28; Tue, 13 Apr 2021 23:07:09 +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.4020.022; Tue, 13 Apr 2021 23:07:09 +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 12/13] scsi: qedi: make sure tmf works are done before disconnect Date: Tue, 13 Apr 2021 18:06:47 -0500 Message-Id: <20210413230648.5593-13-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210413230648.5593-1-michael.christie@oracle.com> References: <20210413230648.5593-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DS7PR03CA0212.namprd03.prod.outlook.com (2603:10b6:5:3ba::7) 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 DS7PR03CA0212.namprd03.prod.outlook.com (2603:10b6:5:3ba::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Tue, 13 Apr 2021 23:07:08 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 67224940-f587-41b6-7d44-08d8fed0dd5a X-MS-TrafficTypeDiagnostic: BYAPR10MB3653: 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: PXF5oqzUqPxKex2gs+NIsQfz1/ZqA93YeM4uIJHK/uf0gJf1QPLB66aX8SQGPtB8BntFNzucgQde8Rfj8efKOhMo+oy2ylt5FBXq0Z56x4PEuUQ7ka0QwD3/D5n0VS9VEP1XTZGDKnunn1ivRas68RPme9gk8zbLFgJI9ayPKBRTuVGoujb9ntrcNbgS/HfIFlf+kcEVAo4ydMOcFymXGOxn2ibLzYOETVP/7x/3oj+YvJBjNW4UvCet/MdZlQvOYd+oK/Z9sirMT2G/R7/X7xhsIWTgofWIaQ3o028G6D6yT3rGwinT4h95B2tS0dMvowuaHLK4wqkNiUuV5bdmDM4MFjOsYEo4pUAbV2HBZDi33UzOgu0kaj4of7KxlLEHmHSQT4RfPQNBSZmte3uVTmIEZeWpnl8+PhU/DExHNXE03kJ51Bjr/Cd1YTw5NdYED3GlZTt19tGXaqBuFnJh+VBJhKeq4rRafSs3Y9ikakCLR/8D3b8EpVk5mhrOULH49crxKPh6pKJKtzH+oygOa5Tp8VBQgQtpi1Rfj2IgAfw4/kCX2LaIPhC+zwTZAXz/sKGkZ7sHNOma4PqWmzHNKd/IfAX403iBchoC46TG6ybAGRAqYZRx1iGwFGpTAUZl9tcy1FFzqNFOA7EGpTI/l/dPNt5VFsK8UPJCM8avpi1tTjOlivxofcOPTMAcB/Q4 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:(376002)(366004)(346002)(39860400002)(136003)(396003)(83380400001)(16526019)(66556008)(186003)(26005)(6486002)(38100700002)(8936002)(36756003)(8676002)(316002)(38350700002)(66476007)(66946007)(4326008)(6512007)(5660300002)(478600001)(2616005)(1076003)(86362001)(956004)(52116002)(2906002)(6506007)(107886003)(69590400012)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: NS2Te2HYFj5lR6E7HJIOfwNn8pARfrhjpNdTBjPoKrQ0x3cyMQo6MS+Y2+4p//29u9efqMwp6jYpowYmUBad4sDkU0tZQa59AUAy4JIeA/HCvZYGCviguwmyRZTRBTjjHza8NMXXnWS639J1HsMiQ9D1i8oWqr+GRuiKCzrQAR/cuKTVdMrr+vGuFW3Rv2eWbrSLzKJSR/4T5q0gIvCX259pT/4z1POoY/BXOpX8FwxUHr/LhG1O6FLfQAfWg6X2VmY7Gr04ms/fSk0qyMrfva2E7WDc3TWkOTDvbxM/HJGl2kTMLHlJVWK5PbzxJzbi3S5lx0FJNekQ/IWjutbX1OYpRZvVqy7T7fH/FREfOjhNtN+JRGuUNVhnh3ZV2gh85UrzP9CPKOdsiBVVmlg+YciRYBjn+a60L4BctwYmBm9HzCcTHzAWCbevwaJVMs7mk04FRSCFtc/RWhQuENxXY4FcqvAJEthPF6GaH7rFswctd09AaLwyU9HC2bq9SkmqTD/6UbCOjv4ClgOzeGbT8k1uPBsAwkZfRAZZ0IP2G1GEjtfcurXw1+y7Wuc81JqFWGQNuJUFps2O7XrdepRwgF2Cpg+5Xznov0VgTPl2NFcvUitiKrhyZiXelV/EKQ9TKCqiuhBX4j2dB4dWNVrbZ0U6YU1sGkLy2E2yuSseDPcut/Cy/1WG58O2tqn5WecpXvqnk3gEmdMPHD4LB1pbaf2vy/mhVn37sy4nJUBIm+N9Q0wn2vIHE1qzvM/CYgdtVSHiOyBG824dFr9jgSfbEz/NxYhmAaolqvJk7iAZgmKsaVG9+RcQ20zIJ/zJnS9HDqaDtnG5u1jZtcVhietmGdr0oovhF0MllxIFxE4xQIAY5DGdFNhYWdTc7ww3Vl5q1mgI3ff55gBRu+qfwBURrA2q4KH1yFaJLhLJ/Sou1q6UrqD1iwLhuXLRtUEkEOGUWzF+rfvydlrVIgKpAEsIXPWOqbDgMfaxr9ufh26ewRx2rgzTb/DZdFP1vovvm0AMFrxqpGlLFgGrrXI8ttScTjbJWs3FjPhwfbHj2RW8/JohNUXQA6g854+vT1dPSNxYXIZgpHJn5HLJ0349Egg02s2TwkiGwQ++3NW0EnkxRSRvAL8d3YyolHD58yDdji9rm05ynPFIXiHsVKDFKqyJkCMhfWJ5s1pI0BFIVriWVycmhhRwV/oB+yjUDYFCc1PeV/GAS8L+i3Kg7ndvJFem/bfjJ5G/VdN0DTM5vBTQ1FDiUI5SNSz5RRDfngcapsy0mW1RAsPVwoEzX/nXNleffeQUVmyei9sQsG91BYaKS60bzGPrTOfZF6issSjW1s22 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 67224940-f587-41b6-7d44-08d8fed0dd5a X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2021 23:07:09.4901 (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: GDslOrShIQm8Qazr/VP6zNQhVv1AOWjYRPV6n/34UWTtCLP2zGcgN1Q5RTdh+Q/44PTPaAeBnZbVENvyoOJreFnmWErMMVKVTRSiceIGxYI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3653 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9953 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 malwarescore=0 spamscore=0 adultscore=0 phishscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104130148 X-Proofpoint-GUID: Wlncgm_f4XmzMDPqM7UR2xWRGnMCyuqf X-Proofpoint-ORIG-GUID: Wlncgm_f4XmzMDPqM7UR2xWRGnMCyuqf X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9953 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 mlxlogscore=999 spamscore=0 impostorscore=0 priorityscore=1501 lowpriorityscore=0 adultscore=0 bulkscore=0 phishscore=0 suspectscore=0 malwarescore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104130148 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 and adds a bool to prevent new works from starting from the completion path once a ep_disconnect starts. Signed-off-by: Mike Christie Reviewed-by: Manish Rangankar --- 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 475cb7823cf1..13dd06915d74 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); @@ -1361,7 +1372,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); @@ -1427,11 +1437,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); @@ -1449,10 +1455,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, @@ -1547,6 +1555,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 9a2d9a29fc01..17f1cbb376a4 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); @@ -1009,7 +1013,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; @@ -1027,13 +1030,19 @@ static void qedi_ep_disconnect(struct iscsi_endpoint *ep) iscsi_ep_prep_disconnect(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 Tue Apr 13 23:06: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: 421451 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.7 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, URIBL_BLOCKED, 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 619E9C433ED for ; Tue, 13 Apr 2021 23:07:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 43B176128E for ; Tue, 13 Apr 2021 23:07:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348757AbhDMXHq (ORCPT ); Tue, 13 Apr 2021 19:07:46 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:46418 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348751AbhDMXHi (ORCPT ); Tue, 13 Apr 2021 19:07:38 -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 13DMjbiP055607; Tue, 13 Apr 2021 23:07:12 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=ZM4/poIFL+++v55SULVeDUQFLXydEoTXfOiDX5KdoxY=; b=Y+fVZiSSW46EfpntMwQsKO0etbXCWGf38h2M192Rfsv7EEisVuLYAAabM7JHtWMkjM26 EIhj+W1Feh9pZpvl+0RGHUD5IpMYOmUeVpcbvGhtRrOj7ROYjhu9Mq8H5KY9BQCoxPis g0am7XbU8qO9wGZuJlvvZ2J8MtwqO+OTlY5jFgRpB23c7njd3+odvmOQ2mP6RO3qKCkm m7SM86Ap/9guUJCe0fdWvrFyVGZRsjq6ki+urUJI/X4rM0MsEXZ+qZ3lnkIfz1G1CEHt 4Kwtiuc5l7MN571SjYDcS3DbI2BDp2/OHr5RciLUCZo0sqW8u1gsxK4xA9BSb9A50bo0 9Q== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 37u4nngmyj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Apr 2021 23:07:12 +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 13DMiLaw064242; Tue, 13 Apr 2021 23:07:12 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2107.outbound.protection.outlook.com [104.47.70.107]) by userp3030.oracle.com with ESMTP id 37unxxgjba-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Apr 2021 23:07:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Va8X7Qsj+kRFoHWstEHCaw82UWzghlYuE1V7wjbWquWVnOrhsTyWsZc4R5yKAM6pA/4JFd/VBGrIjre6croBv2Yy9/5Wq+v2BZn+TN1C7V6O9z6/nNkAkzq874fuk2dWk5OGW/m3NQrTHubPrQMb0OqwNZdEM2e44XPXkvlsjeqGJzXL2GS9BTyPbNmwGgrrDZ2raPl/O4M+bM8cssU3gOOxyI4mrdaniOLryM+53wetdFl+GYvEWRiEWFGPQAPNQ/qTb5Lq3cv8QcnmpRWh80RNNm1H+kV7GCclLVSEK4uCjYKbNA5QwpjKGhKOhL+K0IBvmA0Wr+O82kdvUlpoCg== 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=ZM4/poIFL+++v55SULVeDUQFLXydEoTXfOiDX5KdoxY=; b=dsOriZV5lpnT/QL14/1QADMvZb0O3p+m1Rm31xpGOQ1BdRFmj7j2ZSgWIaFOTLoxmO0RiFSRrdK0SLbbICGoOB36fcLf4TiOmhI4LjS0GCmrErY9wgCkgStnHb2aU0W/n1yBytCuoYOJLobWGnwGGCbvV8VBQXmI+Wu1Dn7W2GFkAcTLWt65C56+iA4DIwdpYZlzyfhDAqPxfuPEzStu1BQeaJ9KBroD2/trce25XdzJNd+Q1VkIqfgPXb5KDGp0xpv5gOrjdPcT/Mb/W6o6lXMD/cYmF+x8DEGv/VdjeavrReqHYRGO79SG/hdzE+NsCKoHhFdudV2XmZppc80/pQ== 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=ZM4/poIFL+++v55SULVeDUQFLXydEoTXfOiDX5KdoxY=; b=XH7Wme1oM0WPCLyucN5SB+0DGIjKYtcpNPVylLcCkD5aDOEb2G3sNv+wL/QNhVOmQ/X9pQrZaLGuS8lVC/vd53txE5ac2uYBLpMHJ1eTZhoEau7MeFh2MAisme78OfBdvTZLtUciySggHB3uvVbn+aVQx4HZ3BXBDazOP7FUn8A= 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 BYAPR10MB3653.namprd10.prod.outlook.com (2603:10b6:a03:11d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.28; Tue, 13 Apr 2021 23:07:10 +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.4020.022; Tue, 13 Apr 2021 23:07:10 +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 13/13] scsi: qedi: always wake up if cmd_cleanup_req is set Date: Tue, 13 Apr 2021 18:06:48 -0500 Message-Id: <20210413230648.5593-14-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210413230648.5593-1-michael.christie@oracle.com> References: <20210413230648.5593-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DS7PR03CA0212.namprd03.prod.outlook.com (2603:10b6:5:3ba::7) 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 DS7PR03CA0212.namprd03.prod.outlook.com (2603:10b6:5:3ba::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Tue, 13 Apr 2021 23:07:09 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ab0d6188-71cb-4e4f-07f4-08d8fed0dddd X-MS-TrafficTypeDiagnostic: BYAPR10MB3653: 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: f/sJwJDpHj7c16E7N2ZZK0PaRztwAJREsDiEN7ISRWnz8G0lIodurtyneRo9aB2wxrRSBt8RpP+Mtqr2aQxwvSTD/gxGglknkj/NnwFMPCd3X7J70QpufJvc8XVV6wGhbDv9lQuHTSH+gF5hXEVTPsiRicp1hBRFyJLuTYRz6juStRLUS65vZtppfwQGXJHuzTS780es4+l3yXextBuRFST6HLOBDsurLhprDxMxNGZ6dC+/ZDunpcVJjPzB6Yg5hjDH/3F9C7ajVqSLT4lObspIObL5meXJmMzHMSMGjr/W/abX4mdt2TQJBDR9lkqGQVcCKchk3lEpaJzRvu05hee1tCP0eXfPKIo/REDh9xoX7XTUG4fxm0kpT/vwZBYAr/CR8OKc2m0DCT5nYI2vkjP5EScys/IQ+AMsbqaiR89JHT01gOQVaQwgYfPldlfD6AxI0K1MTniFxIjQtlkbKXg0dH+NplAqGT2hGnu8WKegCswrWa2789yvILjtijMY9hSIctob0gcjrBzPIqtjT0jSju2d5LcD7D07y86aXf++4F5lRAyQYGejIpQbrrm1AZ226wKydzxzbJox7HIWUB617vR/a/lyIpIf1Auy6tTEO08TzE6aPl+ZbYTMMS4YmIOURr9ueqpSOH99divgPi3+9ZNUcBUEDIl8HapHThF8KzvPdPvQxZddtZhPzuq9 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:(376002)(366004)(346002)(39860400002)(136003)(396003)(83380400001)(16526019)(66556008)(186003)(26005)(6486002)(38100700002)(8936002)(36756003)(8676002)(316002)(38350700002)(66476007)(66946007)(4326008)(6512007)(5660300002)(478600001)(2616005)(1076003)(86362001)(956004)(52116002)(2906002)(6506007)(107886003)(69590400012)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: dGnfKnQat3oN+SrGcZI3/yatonJECl/bpdZR0Ufm9H+E/WqgQoRsXEaw4Wd3wW9lNjFj1IRAOHBsvlnwg+yXgEbIj4fkpg/SPeJ6gsCOJr+gZfe6w6Q3pqok+VRfm0utpkuYwxHN/qUSMVAkzlYI8ypfeunBfKRB3HOfO4pP6QWTUFNMCkbp2Tjphls8r1LSArt5sMkQ4m1dk4mC8Bjw2qpmvarA+8thIreo1tagZLnYIGHtyKudMeWSz2nXXMIgGyPywHfxF6p/Z0Vri41ASUppjm+SvuVjQCwjH1FgV5dZrDfzt/JGLlaknbaF5dzVFeCBt2X1uGUJRuxggIb+VilDtlVguPn+vbY8fBzvAitFSziswA6CJuVwr7d9sFejLFsbuHc8TnHhFimGH3WXZ2lEX0nEmyd6wRnrEWN9DAZj8SqdJaJMTo6Rwj9JvBClcoHl4dGNy1OvOmTDHdZCtDyTFlT8bIr+7kYwNMkMO8GL/lsohTXCLTM5s6+fT7FwSN8aUZb3sp6odhZ0Nrf5j8x1uhYFcXo1XqH6ZlWyOVWpRrDhgpn3nAWt/WkBP3t3vGUKZzcYixoqKPbFi4xqvSpZX62PfAgEFJcVvBuy0UGtMUJc4qYW6ZFtnL41P9I6AkRBo2AjXKeDHUlF+vqK9KBs6mj7zVygiVzrJE6k5iH2IabmerA5lKLMaIS0f1rKchx02zPG6z2qs/ev7h0chPEG1vbphgzlzA2Pq8cjXHZXRCQwvpA6p4CyEqqY3bF3IIN0ShAH5kS5T7Vy2uTynVD//KQm1XM5GFlEtULvhKJIM0vPxhVL3huPmGKOwyAu7n7f/5zrf9zHgqWir2W8RCTg4rbGGNZc2ecp7SNkEQfT7O99JIkjnGbZzbySidHHOZijQRzcu2obdoHEcHUZZ6ByIDhf3L0KlP6RHxkbkLqrU7oypaijTJugi6cvJ0/0tN4NYDVjL5s8/1MyYD37YK2bGwQad7Y46Gr0hqk/jG6nHR4MKlIbZJuCJGYVMpVqzp5gAxHGhO5+6o0EIpRrWGkCG7hY+eJCkKj3w9gBpTh2UHcltFDvMBdq8MBStyrEyPr4GUFpd+2evR/DBXtA/XE7+Hw2WF1/7EuA5ZaZxsyDCYrNOoiAFjRM5veYcyIRbgKAjG5Pk/VAPhZX/wlIOsJ30uVDQ5zOVHZIszyCVElQUWwdxj+3uOmu9RfiAPFDszWaWLIvMtGuLOvUKcJxudUFCH9buNpFmCP3jm0SuXHeOY1XWp82R0IE9jdE4Q9sgHfUXpIi/KL565nJxT4Kc8W23EcSptERtKmCqOTPj6s96FivfNgkBxeLKUbD3bNM X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ab0d6188-71cb-4e4f-07f4-08d8fed0dddd X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2021 23:07:10.3756 (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: szuRe6ev+/OGovDlBDFYLsv0sozAKc9YI2ZjxxKp4DjhParstM9A3gc0wfjFcZCLP3sxXZGuV7wXSODTqKUR9ivdlgX6arz82XQgbSHNicU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB3653 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9953 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 malwarescore=0 spamscore=0 adultscore=0 phishscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104130148 X-Proofpoint-ORIG-GUID: Ro4cAaWabuIipXB2OhfvLAagvdId_T5L X-Proofpoint-GUID: Ro4cAaWabuIipXB2OhfvLAagvdId_T5L X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9953 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 phishscore=0 suspectscore=0 mlxlogscore=999 priorityscore=1501 clxscore=1015 lowpriorityscore=0 spamscore=0 impostorscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104130148 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. Signed-off-by: Mike Christie Reviewed-by: Manish Rangankar --- 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 13dd06915d74..13d1250951a6 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; @@ -823,37 +822,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); } }