From patchwork Tue May 25 18:17:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 447700 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 C63DCC2B9F8 for ; Tue, 25 May 2021 18:18:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A58F7613FA for ; Tue, 25 May 2021 18:18:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231707AbhEYSUL (ORCPT ); Tue, 25 May 2021 14:20:11 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:44030 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231300AbhEYSUJ (ORCPT ); Tue, 25 May 2021 14:20:09 -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 14PIEwqi124481; Tue, 25 May 2021 18:18:32 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=36nlTOlTLMTxpspKVCPpHxZS/J4B44QEijTKxwhPzsU=; b=LiFo2bGoCKuq8Dh7D4ypC2Ged7sE6SbtAoeoAJ5NJ0WMgacq0HwIWZjj7ZErLJueeKfF cNCBOChXqB27uSDW2/2gh0/j6YQRINVbm4lgiTV9syFm5m/k+vRGPHntnLb8s2mDpbSk DqKjMj+POny2PLe1rGI4q39RcNVi22Ovx2crb4Butn20yHoSUJT81+opZNGsLrwVAwHS qAbHpije++3rDwX1FCpHfUqR5h2vNuBMPn4AB4nXH6LprHU7aFzW0skthkTxsGk7LUXW 0+puX8GfXw1IGHejLjGryV7EkFN9mzwiEYrItkg31Lqu5dY5LYzrcJkMLHeWQoAG9uoJ BQ== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2130.oracle.com with ESMTP id 38pqfceyr9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 May 2021 18:18:32 +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 14PIEtmF166080; Tue, 25 May 2021 18:18:32 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2042.outbound.protection.outlook.com [104.47.66.42]) by aserp3020.oracle.com with ESMTP id 38rehaq4vh-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 May 2021 18:18:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z9x1u8YNmnKjeu4BoJ8tHV+ja+lzKcU0JYfeDvc43MfifXk4YVHA3VcgyYHpjZbZLtXKF5fcS+PEGEB1HJ+4jS4J8hJMtMtwUBxLCTur/Z8uTcto0ZaJfjoCztT5LuRvx8V4vifR4ff+PYP2yDOSFXmG+Emj/+cmletVOMK/AlFAipkfMxExnxG29ry1ATg7C3tN90ivW8023po3G/MLK14lJKvPBlwvIIbKXsCCkdDuGqfy7o6AFZROY5ayXGY8Dy1Lhmp0Vc31+fUpDuDVNyPn+2kCmQB/Yh/RaBHeQaiuhBlFM7UWGiTx86mShVsN6nAqK0Hjxq5HqdHVGkLPiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=36nlTOlTLMTxpspKVCPpHxZS/J4B44QEijTKxwhPzsU=; b=A2r4rUmPtHIwC2ARuXXLIuvpl43tUmOlB4xgntuJs6ueyKw2Shm71qrzB9mEARrfsoHvgGQ5PlrHFxPBSpzJFFaT+BOFCUgPCQOg9tCTbtMm6o/pRZZFrJwZ5zWXSaN58zZe7X4kFqm2Pd59LN8DSTAjlVLz/jRLWwhWiGTwHSozQWJG0zLfa716SU6mG7VhgFY85mEwiJFTo9hzQfVCOzmfHYDdmHvYwHf3XaBODNU7Q7QrqGV0NMkjGv6jDdoBRJel7gr9Tjy0fT4ub3m6ooup15BuWhvPVSkzx/5bQpSho8T2SIoonS2ICPVgr51XoPxabSLeLyt3atK6WTaVzA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=36nlTOlTLMTxpspKVCPpHxZS/J4B44QEijTKxwhPzsU=; b=xn/FyeRhrc/2/ypgDbSXebeq/QIvuuH/WLqaxFasqiLDT1F3WOWdunqI5ucRqvSMWmOQNA0MVAySmFDqaOOkmVWgLOA+DEle1+6x9nwkadN7Ricqu7Qf2hDmQOxIgfPpricFOZXKyuiIpUfAoO0t9HARrUMz4FoRZEq7OG8FMtw= 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 SJ0PR10MB4767.namprd10.prod.outlook.com (2603:10b6:a03:2d1::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.27; Tue, 25 May 2021 18:18:30 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::b09d:e36a:4258:d3d0]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::b09d:e36a:4258:d3d0%7]) with mapi id 15.20.4173.020; Tue, 25 May 2021 18:18:30 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, njavali@marvell.com, mrangankar@marvell.com, GR-QLogic-Storage-Upstream@marvell.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH v2 01/28] scsi: iscsi: Add task completion helper Date: Tue, 25 May 2021 13:17:54 -0500 Message-Id: <20210525181821.7617-2-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210525181821.7617-1-michael.christie@oracle.com> References: <20210525181821.7617-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM5PR21CA0003.namprd21.prod.outlook.com (2603:10b6:3:ac::13) 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 DM5PR21CA0003.namprd21.prod.outlook.com (2603:10b6:3:ac::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.2 via Frontend Transport; Tue, 25 May 2021 18:18:29 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 15958251-80c1-4f2a-bf91-08d91fa97fa4 X-MS-TrafficTypeDiagnostic: SJ0PR10MB4767: 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: lc9PQT8aMTvoFusloRPpFcBYpN1LJDJJ2Sv9EpOBGIFgu25Zfv29T32cTRGMzgfLOyYUqupz1LCI06s9ukItoFHXJrT3oSy15sg15gWmcjKGNXq5EDPmpTInYNtzTkhBBGFm5P2Lz47fQdxlDHBPxHC3aRf5ftNuNAhMLANsdJe20NOKOtfw+gj9BVpksVfFAFOqatU7zO98vcUTQvhQ5K3AHqkaWuwNegTWtV5MyCNBxCYQbYcy1EUXpwNBvKVDvRcIyPPsrDcAQSennzvpwHbSNdmvdL8owZRJml5kFbMKs94/BSNmPfwd+8OuR+gEo7iJ2NW5YGhoAN16QcxKYe1rqh2cbJj04/3W2RC/XOeufQByYgpAF8bqC+oSTBLTdWEfF1O1GA1WKX9UdwMvDQn+H/R5L0VQ3NTmugvm7DcfEzuehWAoqNeR5ea4oDWUJgTLiPzUuuaEiGLFpSOa+epV6SDnc496BhFmak6ACrL3uAGRBenK0rI2G+qqmHz6nxbT5321IKf328C+QIdww0e3dSSuWDCrsa/uVjGQZln+SbJC0UGo5nC8tss7WBp9TzJMjnSNrBSBcOLjcErv2vmw8giZLNQ0czSc9fw/sfyaj6DeCYseVz7MLXmG2cj+m2UG6lrvDdKQ+MA9O1DyP98YszYCjGiR3malh9ZOnWP5aFqdY9n8ap8no4S9TZIa 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)(39860400002)(396003)(346002)(136003)(366004)(38100700002)(83380400001)(4744005)(6512007)(26005)(1076003)(4326008)(5660300002)(956004)(6486002)(6666004)(2616005)(38350700002)(86362001)(107886003)(36756003)(8676002)(16526019)(8936002)(66476007)(2906002)(66946007)(52116002)(6506007)(316002)(66556008)(478600001)(186003)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: eUb+wjYKELEuY0rs25s6pHLsXD/4ys4eqcBKoZtNNsQe5lyN8r7c2nEOqN6P6S7rsyCkqjQepPAQW3JeFbbV+0ABwne3Gt6GrPYVBKeXDmVq4BA6yl0nKbw86SH8N7g9uWfzez7ZKPKuXBlcZ+8t2/vE4iPVRCjOb7o5gI4Cc9nyQY7Ucju1BslqyfC+ssFEBi4S2GjX8S6ZEO8n3ehsvRFFY9uou6a+FdvNsk/3xXLqui0FnOeH5tLdpQ4yCP+yexzmKVm1CJwvSPYMHyGXYuv/NeB2gLoCkZ4kJsbXMcsA8Gv/qX9aBX9hP4cGbnZS1iOBim3aMWQniyWHJeHrlwkQtsYs5JSEjYldc/GzCM4Tu5IZrzMVBawQs1Ij5XXnC0WESyUDmSW0Yq9rT/JRhOYvYhi1Arg0TYRGATTxVIt1A3C682p59Wt31xi2/Dspdt4amQ5xitgCohJ6zXyKXLwODJqlV5gzmaZYcjekWCYbm7+ZQKOwRUO2kuxW96Z6sHBAkclHzq1zGy86avtbVFn5g/oaSvlZ6sLuY2FW+VeHp80yA6Jm4W66H2BI4+Mk/wK8JBEd0NA+aruAvE04X2a1G6Go+KTjuSeIjwLgWH9RkjM0XNoutvacDIfXuAcOTHAo8y4sdqDEcdStKLyy+HHKaFtBGYk5zK5mcgqw+eLbNuwnE4JMcGPg0yW/xrf5RLy+LnCq7UQqL36A+9Immex04G4jfeIQXRqrhZsi3QnYoYAEKRIm2yT/AKDIn3MvGviRZLexJpySP8Uv1cLU+wYcaDzSKc2PrsBykUc2CkWYfINQ0bfUTFI6D7XJKUdCQXE9zrAMBFc7+FYWUIzVqk8LwBm+0tvcGUgzpT35M10YDb0D9QJwiFbfzrx1Rnd8JU9cLe73vUe6iKe9oy26kWJbN51v2VvPuMqt1/qOw/fis97Puz49INHARVo8wQ2rvG168UVieOP8n+MCBemt42AadOw9bj+JGHBsPaBKTl+a1C6jyQTPxc01EQjFJvFtzIDvZ8kISjuCaVfUTbj9ml2yLHm6lIEeazYYD6dJm2/c0Wh6MnQRmPB3tSg/Pf2UXfMh9Ok4Ea/oIQTsFMjRR3C1JFOWJrGP4OaG+GLs3bMIZ5LDAIXCDtMGP1O7kbJcbE2zA+pIPjEzUzuLjrquD6HAl31RqBHfsX7/fEQp0Fy0phheGMrJDBZ/VdP57tbkPgGthGZ7QBQPOak/OjcSqAscDHnNYhR9wS/OmXqsxF6f7XU5r5cvQzh3RpJkoYkGzxeqRBJP4IVJTI8f6unMohpfhJcWJvWmYIl1h9gdunXI24vDvrITqwapfdQRv7Vs X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 15958251-80c1-4f2a-bf91-08d91fa97fa4 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2021 18:18:30.2932 (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: 16mPC+xqkUbIaRuzju2LXXwHemSazoOOq0/uj2ilOAnQpQqmm/6He0E8ZFslpu8I4/845X/djaF4zfGGUzrdpgu395wuYREdYXULW30cBsM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4767 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 spamscore=0 adultscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250112 X-Proofpoint-ORIG-GUID: Y6UMOMO9qak2MBFQUXnsCqUw77JMsZ5i X-Proofpoint-GUID: Y6UMOMO9qak2MBFQUXnsCqUw77JMsZ5i X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 mlxscore=0 malwarescore=0 mlxlogscore=999 lowpriorityscore=0 impostorscore=0 adultscore=0 phishscore=0 priorityscore=1501 clxscore=1015 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250112 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This adds a helper to detect if a cmd has completed but not yet freed. Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- include/scsi/libiscsi.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index 02f966e9358f..8c6d358a8abc 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h @@ -145,6 +145,13 @@ static inline void* iscsi_next_hdr(struct iscsi_task *task) return (void*)task->hdr + task->hdr_len; } +static inline bool iscsi_task_is_completed(struct iscsi_task *task) +{ + return task->state == ISCSI_TASK_COMPLETED || + task->state == ISCSI_TASK_ABRT_TMF || + task->state == ISCSI_TASK_ABRT_SESS_RECOV; +} + /* Connection's states */ enum { ISCSI_CONN_INITIAL_STAGE, From patchwork Tue May 25 18:17:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 447699 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 C26F2C2B9F8 for ; Tue, 25 May 2021 18:18:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9D31A613FA for ; Tue, 25 May 2021 18:18:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231987AbhEYSUQ (ORCPT ); Tue, 25 May 2021 14:20:16 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:47044 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231871AbhEYSUM (ORCPT ); Tue, 25 May 2021 14:20:12 -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 14PIFHOh053070; Tue, 25 May 2021 18:18:35 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=2l1DiprDiu38Uih9amqDRzDE3/6lc/j7tTrKNilb6hw=; b=DdCBZe+nHUhmiKUyEbtMWr1WBKS5zJe8EtGPkL8sQB6DnKuWW7pky5GFQBAiUefP85bm 610gVBPxbcJWPhaT57ez5ELYM5sTkrbKB3+G9ttJo5qi/XC7yPpnFmF5DN7B9f8kHSCz IVUk5w2RExo0NHKqUN6svB9+oOa8Sfgg73D+7lHR6r2oXg6QXFCrYswNs9HhVFNJbqn+ YwvVqmytRJk4CDKXmvEUBuKyhdpIo5vcjLXZELsYy63cvKSrmb9ZCXTk0Byy9/K4ui8e lnYKfbixQAIh6Yo8dyI1Xk/LlQUngveEWMSL5jAiYMDZUov4teHqJiIKxMQjyGXfqllu nw== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 38rne42gu4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 May 2021 18:18:35 +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 14PIEtPt166079; Tue, 25 May 2021 18:18:34 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2045.outbound.protection.outlook.com [104.47.66.45]) by aserp3020.oracle.com with ESMTP id 38rehaq4xw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 May 2021 18:18:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jB4IwtcLwdsRWjQY3nKUHRMEenRLwGN8cmfdl1tKPNvW0oLt379ilgq0lTX9iZDIc/x4ZMm4EpQdHhrsDEPJoGVUvx0yVKwNnFx0g+8JSjO4ovGSRxnda83uDeMci61mPl65kESy3p3dvgvwNvuXpv0iXr8c4Z/z+mYzkjhfkXcslkqbbbIRuj4UkVfJkIdFfMBcYBCTXIfpKAXPUHXPH4tttW+E5jDTBOrzT5mA1JjFfcIulwYYqOJQt+wknBOsu24shjYgcBi/8VJy1/kyTAhMlwlln6u94OOPoswjC+4FPSIUonsN3RhkWf5fjPWbUajFHWouEj2nXWNq2V48Rw== 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=2l1DiprDiu38Uih9amqDRzDE3/6lc/j7tTrKNilb6hw=; b=mfYKI9n0AGZf2Mbv6C6M0BY3RzPpD0Y+3st91hUclQIPy80g51jhx0T6qr73uS3WNoeW0BYDUak/9SdKIqI2iSTcy7r45iaYpv/cvOZIgP9C7vL3+IDvIjuHHJ2XJAzZlV3GzIoAO2FhFpYfd7mfhJnOBGrR553lzOKnys7nKM4tnGlF2M6RGelYM5F52sBwl/u0xnsZSprJOQOdegzo4tsH1yOVqYXdgDbvesFsK5BFqEEGsfDSj0YHZA/6CjD9ogkGSr3DGRQUZJlJ0eqb8cSnTeHG5i8xJFopv8NoEKnhFd3xa/0fQxRLICSP6Or9/G9UbWACCVLMesWt8XkJuQ== 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=2l1DiprDiu38Uih9amqDRzDE3/6lc/j7tTrKNilb6hw=; b=G6OUS80hkiwefK6vqTtz/cMLvAVouZR7fyd9MVEqKu0LxHdpz7wWVEgjCW02hD5swvz50uuvV6oQDo9JTIEpe6FAZb0Ki5pBWUI+B3cMOZ98iLfwGaFZweJgeg0FNMObPHssHyU/D7LIJPHp1ef/jeXQr76MzlauOJCY07uiRsw= 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 SJ0PR10MB4767.namprd10.prod.outlook.com (2603:10b6:a03:2d1::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.27; Tue, 25 May 2021 18:18:32 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::b09d:e36a:4258:d3d0]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::b09d:e36a:4258:d3d0%7]) with mapi id 15.20.4173.020; Tue, 25 May 2021 18:18:32 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, njavali@marvell.com, mrangankar@marvell.com, GR-QLogic-Storage-Upstream@marvell.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH v2 03/28] scsi: iscsi: Drop suspend calls from ep_disconnect Date: Tue, 25 May 2021 13:17:56 -0500 Message-Id: <20210525181821.7617-4-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210525181821.7617-1-michael.christie@oracle.com> References: <20210525181821.7617-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM5PR21CA0003.namprd21.prod.outlook.com (2603:10b6:3:ac::13) 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 DM5PR21CA0003.namprd21.prod.outlook.com (2603:10b6:3:ac::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.2 via Frontend Transport; Tue, 25 May 2021 18:18:31 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cf6b8744-2322-4a86-690c-08d91fa980eb X-MS-TrafficTypeDiagnostic: SJ0PR10MB4767: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:663; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7vhztZHHfp43Cg8PRvjUyyuzf3EgdGyCHU9i1CndC20gm0RXTpeYbTYcmZPhi/20IXZzVyPmlQabBc5z1o8L3YkN1vdskq5oBVZh2QkSLtMoVah24mBz4vwTShCSwvKnR5TbFcu4CCNSjc+4jUZoGhAh4c4Z9znd/ggVVLU++tdvYsvc99xlz3zryvePIY1KyANbfP3PVIkyFxLPTiqyPb191mkP83muoMB5c7vHQntVbqieU983V23pGB20clwnz1tFJLeu/bOf+847HvwRDTQiritmK0y5CHiBc+6SWc8OLDNLuVx5R0UR+XlIgTPnhap8S1GXWgKVoqBAYdASCCXc3KPCNq+11opym0m8UaASlKjIm2USbQLCkM6VD+FRRQMlsdAumgA9fiBxgG9Cmh42i5VDvbcVACRwXkt4xWpGGyLGkISgMYstZWg5kWRbZEUHkMZL89P+bHtQfMZ4zi0fId7M5urvBj/uD527IEkpCHBEp7ojoEr1RLlHrCmSMEKZX9Dg9KxZfNu6mm7BtSHLO2U0wfda0ja3v0/J5C+IeTSEquOS49rlaZwMwx/12So7StTudULzeT9WGnQ74GjqGyqwD11of3h3MiuSuT5+3rtqr3jMPgG0H94x4HjS1M5X4sFi5ZGb762/S7XaqttScYutLJRMcVkhPeiVODI4XYwacN+s+gFiR6RXwYpn 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)(39860400002)(396003)(346002)(136003)(366004)(38100700002)(83380400001)(6512007)(26005)(1076003)(4326008)(5660300002)(956004)(6486002)(6666004)(2616005)(38350700002)(86362001)(15650500001)(107886003)(36756003)(8676002)(16526019)(8936002)(66476007)(2906002)(66946007)(52116002)(6506007)(316002)(66556008)(478600001)(186003)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: nPeVlzLbX9ciaugWgk0Vs4pxOFyIYCqoVBhRGYZkFyoQ+CVXr6psWIMSAObCUmWFd0HUWjQTh/xg4c17vSswgLWKIxoTWmEKE2L4qdsaRG+QK/Bg+ccQx9x4NjPINnTvBeuMy+AIAf9JXK+4f8SWQEW325lw8GwwzKEpkVwENvRty5XDyCjFTZTCSnsaQrf66SWxLk2PCfVpLi3oQRy+Vb82J9yjdrE/YAPKfVWFbg+CIRjz4I2h2lQMlXpgEz8K2UueW1G4BXWCJfYZGgQzwG8NOZaEF6aP/xfNrOKH1Po6Ru670sjJ4I/QqWNNQgO70oemB4TxlDXcrTdAZmbKuLl2LTUisS10N71knSosnd9CA0dr5nH4JE87O8rI2KuJZ0cM/RMi9r4tM2PEauVnJJ1n4tWEFR4Em1Gz4hsxUOypIzGu8orP3PIHcSpcKgzRibpyTnK6XX6Hj784nla1HCz2RU06sjsudGYE16Q6qSoiG3HpN7fSegmGmBsJPims0rxxaw7U2PhUH/RO+TJuymcYn6g+F9Wj8YiCiEdGkAGg8pQ407DH/G6ZDT9dpLWpKzEgfqNNQNiwaEcXUu5Y31sGuNy2XJgEStEFd++OF8+OaovDqa2os19p1TJ8b0EjIGoSV7kjOvV9yH6M+PXkb+FdnETWeXMO11XgpdR7CPkThkS8/nqVw8wpZoOoB1Ei/HknEwaE4uCWyaa6/xeW5HKeEXoNO0rnsUPTSKhYx/6XrtTUI7vK09lURpfvl2CkZBI2l1PbNTfIgtHP6F54fe1lLFLZ4KRrA7gHxVcrTFuCyx9BtANCoaQoyxaVCYDHNakt82HH/m8hZvpsmDk7f0/5CUSJCkLbaFfofhhl+58pkcJx3oUr5kuuz54saB/EishSM7VWo9o3OyMD15ZsyEsNiPuYKELcOYGM1fqFcgmIV3hjhccNR6+mNh7D2/8+16TQYD6hsENzMCHqb+E/AqyP5zBqKLKGD874kp/g1i8mjiKIg1UAbHFZfhltDTzQaVrddK6ouPHD/uEPqrLD9Jd+PY++JvlJc8JsBgOUCtkJUY9o9F7KSmpZhFtMbtx8WCuKbMU6mJg0A7TOGbcsXPvUf91TxA9a6J8lK5ag8a6VZHnT135/x4im3PEvA06tfYKt8v5C6B5IEw8igeyZ0392dZBBkERXx23l5wXn0bv+XfcXEu01eLsfE/SezHPciMDOeeyhS9EWd6Gi6YxFkpmdatYOj6Gs4y1NVlhETNAPsxVVaso2dqxo53/mIJTtSXHsw0CeT3i+WqUmlVFHgLfL3UUzuigq695I+NlFuEObFikleS3FyAhhpBUyMPR1 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: cf6b8744-2322-4a86-690c-08d91fa980eb X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2021 18:18:32.3850 (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: 2a312XsKxASXG0jTTKHQgD6loEvXWKbu5OLTpCBEnfD2vSuFe0IdSDp/EbQ0HPkTECiNxIE4U1B1DOf1ANG6ONJ35OpQqnAnsecbFUvJ3oc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4767 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 spamscore=0 adultscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250112 X-Proofpoint-ORIG-GUID: Qn_mqCGWfBjV2ID8FEpyEQDxH7ENF10V X-Proofpoint-GUID: Qn_mqCGWfBjV2ID8FEpyEQDxH7ENF10V X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 bulkscore=0 phishscore=0 mlxlogscore=999 spamscore=0 mlxscore=0 priorityscore=1501 lowpriorityscore=0 impostorscore=0 adultscore=0 clxscore=1015 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250112 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org libiscsi will now suspend the send/tx queue for the drivers so we can drop it from the drivers ep_disconnect. Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/be2iscsi/be_iscsi.c | 6 ------ drivers/scsi/bnx2i/bnx2i_iscsi.c | 6 +----- drivers/scsi/cxgbi/libcxgbi.c | 1 - drivers/scsi/qedi/qedi_iscsi.c | 8 ++++---- 4 files changed, 5 insertions(+), 16 deletions(-) diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c index 0e935c49b57b..51a7b19bfffe 100644 --- a/drivers/scsi/be2iscsi/be_iscsi.c +++ b/drivers/scsi/be2iscsi/be_iscsi.c @@ -1293,7 +1293,6 @@ static int beiscsi_conn_close(struct beiscsi_endpoint *beiscsi_ep) void beiscsi_ep_disconnect(struct iscsi_endpoint *ep) { struct beiscsi_endpoint *beiscsi_ep; - struct beiscsi_conn *beiscsi_conn; struct beiscsi_hba *phba; uint16_t cri_index; @@ -1312,11 +1311,6 @@ void beiscsi_ep_disconnect(struct iscsi_endpoint *ep) return; } - if (beiscsi_ep->conn) { - beiscsi_conn = beiscsi_ep->conn; - iscsi_suspend_queue(beiscsi_conn->conn); - } - if (!beiscsi_hba_is_online(phba)) { beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG, "BS_%d : HBA in error 0x%lx\n", phba->state); diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c index b6c1da46d582..9a4f4776a78a 100644 --- a/drivers/scsi/bnx2i/bnx2i_iscsi.c +++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c @@ -2113,7 +2113,6 @@ static void bnx2i_ep_disconnect(struct iscsi_endpoint *ep) { struct bnx2i_endpoint *bnx2i_ep; struct bnx2i_conn *bnx2i_conn = NULL; - struct iscsi_conn *conn = NULL; struct bnx2i_hba *hba; bnx2i_ep = ep->dd_data; @@ -2126,11 +2125,8 @@ static void bnx2i_ep_disconnect(struct iscsi_endpoint *ep) !time_after(jiffies, bnx2i_ep->timestamp + (12 * HZ))) msleep(250); - if (bnx2i_ep->conn) { + if (bnx2i_ep->conn) bnx2i_conn = bnx2i_ep->conn; - conn = bnx2i_conn->cls_conn->dd_data; - iscsi_suspend_queue(conn); - } hba = bnx2i_ep->hba; mutex_lock(&hba->net_dev_lock); diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c index f078b3c4e083..215dd0eb3f48 100644 --- a/drivers/scsi/cxgbi/libcxgbi.c +++ b/drivers/scsi/cxgbi/libcxgbi.c @@ -2968,7 +2968,6 @@ void cxgbi_ep_disconnect(struct iscsi_endpoint *ep) ep, cep, cconn, csk, csk->state, csk->flags); if (cconn && cconn->iconn) { - iscsi_suspend_tx(cconn->iconn); write_lock_bh(&csk->callback_lock); cep->csk->user_data = NULL; cconn->cep = NULL; diff --git a/drivers/scsi/qedi/qedi_iscsi.c b/drivers/scsi/qedi/qedi_iscsi.c index ef16537c523c..30dc345b011c 100644 --- a/drivers/scsi/qedi/qedi_iscsi.c +++ b/drivers/scsi/qedi/qedi_iscsi.c @@ -988,7 +988,6 @@ static void qedi_ep_disconnect(struct iscsi_endpoint *ep) { struct qedi_endpoint *qedi_ep; struct qedi_conn *qedi_conn = NULL; - struct iscsi_conn *conn = NULL; struct qedi_ctx *qedi; int ret = 0; int wait_delay; @@ -1007,8 +1006,6 @@ static void qedi_ep_disconnect(struct iscsi_endpoint *ep) if (qedi_ep->conn) { qedi_conn = qedi_ep->conn; - conn = qedi_conn->cls_conn->dd_data; - iscsi_suspend_queue(conn); abrt_conn = qedi_conn->abrt_conn; while (count--) { @@ -1621,8 +1618,11 @@ void qedi_clear_session_ctx(struct iscsi_cls_session *cls_sess) struct iscsi_conn *conn = session->leadconn; struct qedi_conn *qedi_conn = conn->dd_data; - if (iscsi_is_session_online(cls_sess)) + if (iscsi_is_session_online(cls_sess)) { + if (conn) + iscsi_suspend_queue(conn); qedi_ep_disconnect(qedi_conn->iscsi_ep); + } qedi_conn_destroy(qedi_conn->cls_conn); From patchwork Tue May 25 18:17:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 447698 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FC44C2B9F8 for ; Tue, 25 May 2021 18:18:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6F97761408 for ; Tue, 25 May 2021 18:18:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232119AbhEYSUU (ORCPT ); Tue, 25 May 2021 14:20:20 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:44056 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231624AbhEYSUM (ORCPT ); Tue, 25 May 2021 14:20:12 -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 14PIEaUA124412; Tue, 25 May 2021 18:18:36 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=LTahofXaYinObVRiw++DtKpb2JOGiS6YLPmcQ9nYYIs=; b=VACVO4cckYYFIm1VzFtHrMth7HE3NrNJUtRo+gVpdC1qS+lXHTLbUaQN/27nJu3nP1Yp +E5YjCBDl/YNfG8U6geimZy/f1fEpyJMq6V3+ht/3NchjN0lHBaqKmr6Cf11QhwLU4bq Rc6iwcdAWifex6uNupvuszOxkyZUACKgLoBPEfqvVDupW10riyMPl4gpGHaezs0V+ato Lj6nNzOhDK8/qQddfZHRLJnutAE5mZCYoWjHLOk8xcMtejHq/863P9VeN7auVuNR2JzD 0BoeMceuqh7oiRFsbv63bwx+EW9TzJepiDbXdxUGIVSvPo7/4dJvzIcIKdTGD6eWGx9h sQ== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2130.oracle.com with ESMTP id 38pqfceyra-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 May 2021 18:18:35 +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 14PIEtPu166079; Tue, 25 May 2021 18:18:35 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2045.outbound.protection.outlook.com [104.47.66.45]) by aserp3020.oracle.com with ESMTP id 38rehaq4xw-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 May 2021 18:18:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MoUx36kPXoSe9IexUCXU5r3P4XUR7op37M7h40TqFOoC09o/kjB8HUXe4llmZp0PE/ULKx1iP/akpGPslcGl9Q6AH8Nwj8Q6fJ2nU9M+k9H4orOO+KMg2pv15yshpxO+NZ1EHutTPg2+8WUQz7x8wxyA7gjIlJBA10ni1YPj5W7NBztH0huk0PEK9KKxZEN8s0qWixGYD86/nBLmdWopHl1djW7sqJRwACyW9vuib8WtIxS9GrVqP4LBpG4aGcOAET/47GNGcsOGRIP6vj5Cv1sSuuK38A5O+jRsmXofrNkaXM8tWiXrNSHJYh4dLFiQKzIZBtYMf3K3UjMyGVFKoA== 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=LTahofXaYinObVRiw++DtKpb2JOGiS6YLPmcQ9nYYIs=; b=HsNaJmJahXajHC67KOeL3O9CQz3wJxJTVB6EsHdb7VJhKZ9YeTtKFxFL75KsU+mriLratETBCOAIdnex1q3ioZuTZnuDDwEBJtLxY40AImetA3SyOVJgq1xWFSbR7K8pSah6H9HptMCkuu0Ez2k4+5dyaILylR/QMNAy1BNQ19gRGUqIxAwCEy8qpWwn1nRkwZhZ63UfvEpPSDi1rR6r0T7i6itzhKgDFlsYCxamjsyMDzwes6qPGiouEtiRue/QIoRAeYRt6hfZFU0yeEAfpzvdDAPVflxT0VtK3X9/4xzxM73YUf15A1jJHGQYYVl0HY4vVgsvT1+6X7B/EE7AZA== 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=LTahofXaYinObVRiw++DtKpb2JOGiS6YLPmcQ9nYYIs=; b=Tgw4QiYwxgGD0OlAEJpLbc87PDON1FbhiDnEpuUJSGFO33iIu91SSWQQV3iy5t2oU7WFTAXhFq06WiUZWJ4Pxh4gct3SSJPz6gsi+F5jsSnfxaxLkepHl3QALSft4BuGfxNNGoPk9KicygV0RJPifx7t5rJcn+I85K8SRF456Ds= 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 SJ0PR10MB4767.namprd10.prod.outlook.com (2603:10b6:a03:2d1::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.27; Tue, 25 May 2021 18:18:33 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::b09d:e36a:4258:d3d0]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::b09d:e36a:4258:d3d0%7]) with mapi id 15.20.4173.020; Tue, 25 May 2021 18:18:33 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, njavali@marvell.com, mrangankar@marvell.com, GR-QLogic-Storage-Upstream@marvell.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH v2 04/28] scsi: iscsi: Force immediate failure during shutdown Date: Tue, 25 May 2021 13:17:57 -0500 Message-Id: <20210525181821.7617-5-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210525181821.7617-1-michael.christie@oracle.com> References: <20210525181821.7617-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM5PR21CA0003.namprd21.prod.outlook.com (2603:10b6:3:ac::13) 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 DM5PR21CA0003.namprd21.prod.outlook.com (2603:10b6:3:ac::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.2 via Frontend Transport; Tue, 25 May 2021 18:18:32 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ee7856ab-4a4a-4d69-1dc0-08d91fa98187 X-MS-TrafficTypeDiagnostic: SJ0PR10MB4767: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Os41WPj24Zsx/9nqzKy1mFunBC+qIRBnv9uzfQL2PB3t1AtOUb6ZM7P87xu+TEKxe7OQDWsbhOlBpCTvYDSxbVIHt81RVlk9vhTAVt5wUljjptVD46wa0nrbX6h7/6SPf8m9+meCypV6llWej01WwuwMrTA9cigb1tii6LkAZxLTqJskXnskD00wKx9ZUm7FV33tKYyk18ownS8G37HyJZjYImr3HDYcAdtT/foRJkkqDQAgFdyO8BTQwZkANkDhCpAMKX6SnKuJnmgxf433R/w2jgeabPMp9EIUVEuc1exMiBEn+ZRRRgfV41WRgrZSYa9NLX0lrZgL5cIIIY6zee6D9dgoFTv43sH+3kOLFXGb33vYHhTXlJgrFq5bHu5Hge9EvHeep+Y8Uhbgz/3unQJtsQHGxqjeDC9tXAEWgwMwD1quq2SeHLr0RAiT36WBw6ELQQsMj3UahgVytlNO/hFvv6Njj+d4ZlYEJjbe+PsdAsfojFxZnBRJ0ozgLt9+1FBJ1FxvP3IiEi9+yQNoxes6/TZ31prigzcYsW2pJqrel4YKqZYJkw/TX5lgxqqPywWeR701BStBXU7Y784OvhbsKqAhb1DokM+Jj6yYAtIMFkP6gPo6KIEK1GK4DpFI/1L9idIlFazQd+pegcXbXsZfPk+b9mvtP7oQ05g/JWOncodo+w1Q3xU7aL0bPJRseTDhrYEIsymQLO3rgVikrQ== 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)(39860400002)(396003)(346002)(136003)(366004)(38100700002)(83380400001)(6512007)(26005)(1076003)(4326008)(5660300002)(956004)(6486002)(6666004)(2616005)(38350700002)(86362001)(107886003)(36756003)(8676002)(16526019)(8936002)(66476007)(2906002)(66946007)(52116002)(6506007)(316002)(66556008)(478600001)(186003)(69590400013)(14773001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: zj0N614fA59CfClGvvRs4LA1dSDTNq1q5V6hebWL0z5HXtnx0KO1A229KCzpgm6db/liG/DahL9yzcomer0KiUVxgEs1FOCxU/EboglqIX4R9Bopaw3380zDuk0mNfb4iIiNSM8690/MoOzpzvGLdfypBJNA7188z0w++/vp/wNIDR6V5SCNk3VlqM/TQ8dDtGu7V9JSmbS44ORjVtve3YKyyV7FTRWp8JWbyfmtlWD4i4TetC3aKDnV7BNBoKT7qIaEZCo6gu3QfL469k8MpJZeySzjn/Ri9iWgO0lmPLWuBxUyhewJ9wJ8SQsd4Udo4C5dpsqOvb610tOdcwvPylEaaiNJ+avnQqa+OJJR2v5/g1oHVMkcyzC78Hj7gdS4SIS+WxunmaxWYM+hhccTsWnn59P4hJhYbhppzPw0yitdjfd5qtKCw39uvno+PoH/R31O/Jkd2dxgAuHKIIyMnwns0HliU54eh8DMJgKc+9SL2AWRcYbusFr1OxBBKlDlhpsQOpViaf7pa5v0tviDbGrVlRE9VYqLkh9OfumA2vBVs9ynRJeRvfuJ0ScxOK3bDuUDxi+n/FFoCdwtv5ahNmqdrKm2Os3/g4shbWK86N3e3T+zZchih13VNkwgQbB+JW8w6oGeduWlZXQx2lNW5KlxQXTt26TLrVwMc6SUYwqfF2Vp3chdirPu4ZUsFcgNEk5xRZSW/rq8XwUQHSvcy+pq7CWtlOWMjhRlxYJd1txvZEvKyZ/cDA1+mBw6Y/+XgUFN32jjiOjVuhuudMt7e/1DuX8YsL6yUURln8Jrersdp53+tDNGHC9ulFo/bGPaD7ccB0Uk+SoKiME8ZtUIV0WlkBFOxsvOEDcih7fM8T7aXYMMP2eTFim0Y2Jo8JDfTPU+9QFsvb1bCcPXoidCTMy32xYhLnBQaerbt69JsdtK49V1l4gvyu0opSjXgMTnXUqsxKaDKZy6UFJ5fwJ8mg0ohSg8yWYMdD4bqAIeoH6kbQME4failc0plOjAL4xBTzDZ0WkajSVqoe4sTMfqi0CgHL5Gw3AlRIQWuJ415PR/BpjmF9XL5AkFWuh9Rz+Em4loi/Yd54CKjn9o140Eb2A32V5vExLz2HcINFC1CdHDwNPEhvySH4oCEpNVAEPZ6OAckHShQGSIj5C5IzLdwwVmcioITItDxUSS0ocoL7pumvXC8hv9HEHXVhtUyNhgFafC1ED8vQUF4qSLeL0HeaQd7Uu4oZ3Y9VP6LVCfm7Yvhv5xMsh+UyKm0ghaHZK3+trvj0DXDnVgDPKPSPyV9tXwq5dlnIR1GYfSq9m0ExLaAnCaqE7Yq9Wcg1NW4wQY X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ee7856ab-4a4a-4d69-1dc0-08d91fa98187 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2021 18:18:33.3965 (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: D/hp9scTPvADELRZ2d6aPUaI3zdWOx3XtofXHr/IhDKI2fxa1L9mjwUb6ETC1kh17G+20jpgQtjfJQ4+n9x385twgCsS24dxYUXxfmKdG+I= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4767 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 spamscore=0 adultscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250112 X-Proofpoint-ORIG-GUID: WdWj3zt3NBKM58DzxZL5fr2QpT_EKaPZ X-Proofpoint-GUID: WdWj3zt3NBKM58DzxZL5fr2QpT_EKaPZ X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 mlxscore=0 malwarescore=0 mlxlogscore=999 lowpriorityscore=0 impostorscore=0 adultscore=0 phishscore=0 priorityscore=1501 clxscore=1015 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250112 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If the system is not up, we can just fail immediately since iscsid is not going to ever answer our netlink events. We are already setting the recovery_tmo to 0, but by passing stop_conn STOP_CONN_TERM we never will block the session and start the recovery timer, because for that flag userspace will do the unbind and destroy events which would remove the devices and wake up and kill the eh. Since the conn is dead and the system is going dowm this just has us use STOP_CONN_RECOVER with recovery_tmo=0 so we fail immediately. However, if the user has set the recovery_tmo=-1 we let the system hang like they requested since they might have used that setting for specific reasons (one known reason is for buggy cluster software). Signed-off-by: Mike Christie --- drivers/scsi/scsi_transport_iscsi.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 82491343e94a..d134156d67f0 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -2513,11 +2513,17 @@ static void stop_conn_work_fn(struct work_struct *work) session = iscsi_session_lookup(sid); if (session) { if (system_state != SYSTEM_RUNNING) { - session->recovery_tmo = 0; - iscsi_if_stop_conn(conn, STOP_CONN_TERM); - } else { - iscsi_if_stop_conn(conn, STOP_CONN_RECOVER); + /* + * If the user has set up for the session to + * never timeout then hang like they wanted. + * For all other cases fail right away since + * userspace is not going to relogin. + */ + if (session->recovery_tmo > 0) + session->recovery_tmo = 0; } + + iscsi_if_stop_conn(conn, STOP_CONN_RECOVER); } list_del_init(&conn->conn_list_err); From patchwork Tue May 25 18:17:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 447697 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 05EDAC4707F for ; Tue, 25 May 2021 18:18:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D9B90613FA for ; Tue, 25 May 2021 18:18:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232168AbhEYSUW (ORCPT ); Tue, 25 May 2021 14:20:22 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:60760 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231968AbhEYSUQ (ORCPT ); Tue, 25 May 2021 14:20:16 -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 14PIGNhv122698; Tue, 25 May 2021 18:18:38 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=B2mP8b3Ak3kQ7jk6jUST18rXQme68Ec7MLUj4/2MPjQ=; b=tFqxxk/LUOgr7pcrgoPDC+GyqlLs8I1mztfApxHnfIOTImowEZu4i3R53EjqQPp+aDkG cWpgrhgilap6kWPQnKdc+yVsVOTl6B5LtUsv28BIodOUmkX/sMMqRCvipu/QS0XtRph9 CN541pxBNnKLe/oL/sJZIbRH2dgAwMJa779QTGfuNLfkv71iouX/bPSxT/31CBXu/j2D TWY1ppJe8KznFjs6GKZ0SNeJRwgbjEaWG+ub6bIcgGc5WkkRcCp3Qq75cIST2gQisbjq 442H7Glj9hQtnju6fuIkaQ7micktG4Erue21jqK6f4FalEFki85ZUgkDEYA9HTzeDNcm NQ== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 38q3q8xcv0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 May 2021 18:18:37 +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 14PIEtPw166079; Tue, 25 May 2021 18:18:36 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2045.outbound.protection.outlook.com [104.47.66.45]) by aserp3020.oracle.com with ESMTP id 38rehaq4xw-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 May 2021 18:18:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NIyJgL8MShto+rISGREt76GTLV+lFMuKbUGPsnZK4OjyRYW9sciZPTmK0BKeELh00ib0g3BPZ9QbURJxT4ZfjZEPEtRGoqJvAwy7dqTo98kXczYkPdYGTW6jZy9r2Rk9mh2sEoSgu+cfIYuOckcsI3NbpvzouaD+lj7Oc/gndVZrS5ZWsHsmDyObWWhnHmIhsajMz3MyzPynnuVVsRPm9ieKvDYckh11NYAIirNc8+SPgaFe2Op6SQTtiTYfRIGd2l26QNQnR2/pSuXzXxj4GQS8Cn2eMSiET9pBjyNZaCiEeSKvjz2JS8MqFrRX5zofki8zfUaablIXfhHzN3xmAg== 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=B2mP8b3Ak3kQ7jk6jUST18rXQme68Ec7MLUj4/2MPjQ=; b=m+f4kx825hFqGOph3ep1ErK1aoy/RpgzaxgxKCvKWpw8IscgoQs2xHfbpf3H5GU5OeaBq20TvfXmW/iqweay1Ne1HjKcMXEj3T4FwOYXpXZoqLxatn7SZkNsYaSinoqGhJL+3sz1LSo15+5/4YoTucyzS8EhK/YxsRKEN86NYtelXmnTfX2rxMaJS0TsLMIondYNp+n0jH6nAhOPSUpy3xBp2qLTBVnp35fpXKKsZ/NCrSJyMDsSR1Grs7wF/6JAGKHR7TehnkLWlr47EiPXmfvVliiuiCy15HMNzBU8jaIAxPjSN4JmdhFFgS8fb7UssLGUGcqXIqpxBwCOLpStKQ== 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=B2mP8b3Ak3kQ7jk6jUST18rXQme68Ec7MLUj4/2MPjQ=; b=m1l7nzbKG3ZSjcc05QRAW4Fsr+oYyANS7PmuYTTKW3jAqLZAm0041crkZJFibJ9IP6x86Jk7qUBlbteV/5BDzAaFBOX6cmUgXsrb81J8fJJDE7SE2cFUFiFdmFH529Vz1qUXrqxf2MHGpqJ0hPNN0UHgVyFIebSAg9XdjsjzodU= 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 SJ0PR10MB4767.namprd10.prod.outlook.com (2603:10b6:a03:2d1::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.27; Tue, 25 May 2021 18:18:35 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::b09d:e36a:4258:d3d0]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::b09d:e36a:4258:d3d0%7]) with mapi id 15.20.4173.020; Tue, 25 May 2021 18:18:35 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, njavali@marvell.com, mrangankar@marvell.com, GR-QLogic-Storage-Upstream@marvell.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH v2 06/28] scsi: iscsi: Rel ref after iscsi_lookup_endpoint Date: Tue, 25 May 2021 13:17:59 -0500 Message-Id: <20210525181821.7617-7-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210525181821.7617-1-michael.christie@oracle.com> References: <20210525181821.7617-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM5PR21CA0003.namprd21.prod.outlook.com (2603:10b6:3:ac::13) 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 DM5PR21CA0003.namprd21.prod.outlook.com (2603:10b6:3:ac::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.2 via Frontend Transport; Tue, 25 May 2021 18:18:34 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 45989e37-872a-4cc8-ae26-08d91fa982be X-MS-TrafficTypeDiagnostic: SJ0PR10MB4767: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3631; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 686oZC219gKIfvJT890VeLhMYLrRP6wsKTENKf19iX6R3Ml7MbD1k+69fyaVTQfF5J29u4njRs67yMWAB0VWsyN7ErFngokew6TZaejzRq3Dq8Z6DDMTweVCptE+emugoxwbHzpvLknMuyNBLzWuY9BBh971tTVmUSan/RZ5jfBY9g+iXhXUoiNOBeQ9jIOhgJyFiL8ZJ8F5wl+MUIzLl7IGc3sf0Sx62FW2AzHyh/REqJBQ2Rve8ZF553GuNLbarhZx0HZbQUJuEKsb0pVdB/yO/4nVqMN/fAQQaBJ0NLLVanZhURLveJVRZyUbsS6jsaxxAGJQZW2nOlU0hV1iJS2MojJ2dbim6W+Byf9Tp3KSfCXFyAvLR46o1NU/xh9eFuSILQplRaLEl/mnMlHHUfYkS0rVAGAtzphs9kwzxkwnL+6K6D2Ui6wXhs8BXcfT3UgcuSz4kdwQfEnk9jUPX7xCpM+wNRsfRhi414maQUkuBQZ86C/0HV1TmCl7tFkKV3itypIEeuJPkxy/BVsh/aKuo1JGaHzsFjBFmD24qPFbEd38rBW2BIfmo9uAzylOkSlhZQ9rWeaAHuOnSZ9ZXlE/TYTmA33ipGM83fJ1weAj2moVVHs3hmcM/1lnzqhdP4DzDTVw8yL2w1nY5+gwif3pOWB2WdyQAcpoCUpj2li98ENW3seImRDeg2sEKn1/ 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)(39860400002)(396003)(346002)(136003)(366004)(38100700002)(83380400001)(6512007)(26005)(1076003)(4326008)(5660300002)(956004)(6486002)(6666004)(2616005)(30864003)(38350700002)(86362001)(107886003)(36756003)(8676002)(16526019)(8936002)(66476007)(2906002)(66946007)(52116002)(6506007)(316002)(66556008)(478600001)(186003)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: /4KHWvkxorOQ0vszeAliyJACpHEp2SN0CeZQkVtL1YZGwGh/s12VSjkByDX+XWLDnJLbAi4cgg7CgyPHuD4PVEAXGCYOXaZWPMXF1ShyvLRXs8rd9neGhm9LZ65zpjyBaq/oRQ4rqsYckjLeZDHmliQ3AARGjQapDsHT0M5J3p1gmChqniL4l+BBA4Q2YIlWkOj8+BHhtXHQd7/wiPhomFTKG2fDRpH+IMYzVW71dOwgJ4k7LK7tOW5nwSeQwHCapNvlAfXRIgyXYWZD3wGzWEJQmyH4BjoKVe6aFLG8jL6nmT9P7t4C6saFc7u7cqJZVa5bUti351qeGmUvNsP+XWWdFfAZFI6ucPpKKC7sATj6txLgHb0YQ5bSlUtXq0MtDS9twSJYjio4+pTw1QBNI4ScFtNv55FwboIPYFeOaVJcrtSl+8tiHpHqdwheSHTYGO+OT4TWeFFjF0bcEPWNjmwjdFBoG9Z1x0WbQjp9D3fm87HSrFTG6TV3BVM0q+HrkuTeitdZb+8SSYlNzhtazlUVBGP/Vuy5tyiQIUz1eI92EPGIvqbpeV6LjlgNhyO+yzrwrgm8vwIHVhTBdjWm+IvWu5Ee9X1NwsKYcCdfPEV/bcL0b3kA8XTQMbF6/hCaTt5C3i6VFgz3a1j9RpOD8tQz1YZxX/UhpZF2/h+I5WpbCdHq4sEv2zyMBj1qF0jbCT5HcWzZRw+Tl9NVZJ4bNTh0Lj+dX1PPhtfVZxa0mWyaCIJvVEkwdzFFsqPRhjSalwWrFAPVGIRiju1bTPQDwLH0nyncJI+/o6XjnhN3CoHC1y8yOCfxKDXlGeOlxHi1HasTNK/VEixRWs+PbsRMI8UDw5v0NDcupWUbqDX4NxzP/Y0xiwayrItJPQyGVXxe+R2AcIPdq1ma8/OXIdHU/m4HXFn9IT1C90VDZ03/et3uJ6wOq/8vIeXx2/tTda2fg59HGT/Zpx9PxC/d8qVI7zn4r7N3C6CRT4+VCNj0fed1HxzL5te1al8LDVObzppdxe9l6Td9KXfbyWqcsk6xxKPHo0MvJdo/rrCIwQK8NAc6G8uHWoW4Y+9EDmTYyRsg++HU0ZHLlj6ZYBPg67f9nz6CzG2r9HycXGvXqQko1KszRTeGkocvXEitmEf6pqPS/17pjdybwS+Plg5KLQizls+cynkJg6iDldYloZ1W0vUYJWz56HRJPK6nHn65xInMdottLyL4qVt3MIClb3lK+pRKaIU5OeaMh9ZUb3RGeiovRuHTWTQdVmtx2IeaF51ehUjikLX7XIOBC+bagOESrCf/EdLhXjrBfEwmr8egnhsaBMKvDTIgNTLn3p8e4RKj X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 45989e37-872a-4cc8-ae26-08d91fa982be X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2021 18:18:35.4783 (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: nVL7pso+pSZRNnGZ13WeXPXcR13lpvVKmVMtqV1YIygv10UUtOatXZQuEQ700wEi52cLU57oi8Vo9Rh12ThSJdcXPoSiuby3NK+7Nf0YQM4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4767 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 spamscore=0 adultscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250112 X-Proofpoint-GUID: rhKpiDl5w9JtdPTVXxJN4GbC9VxokfnK X-Proofpoint-ORIG-GUID: rhKpiDl5w9JtdPTVXxJN4GbC9VxokfnK X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 clxscore=1015 malwarescore=0 bulkscore=0 impostorscore=0 phishscore=0 spamscore=0 adultscore=0 priorityscore=1501 mlxlogscore=999 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250112 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The next patches allow the kernel to do ep_disconnect. In that case we will have to get a proper refcount on the ep so one thread does not delete it from under another. Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/infiniband/ulp/iser/iscsi_iser.c | 1 + drivers/scsi/be2iscsi/be_iscsi.c | 19 ++++++++++++------ drivers/scsi/bnx2i/bnx2i_iscsi.c | 23 +++++++++++++++------- drivers/scsi/cxgbi/libcxgbi.c | 12 ++++++++---- drivers/scsi/qedi/qedi_iscsi.c | 25 +++++++++++++++++------- drivers/scsi/qla4xxx/ql4_os.c | 1 + drivers/scsi/scsi_transport_iscsi.c | 25 ++++++++++++++++-------- include/scsi/scsi_transport_iscsi.h | 1 + 8 files changed, 75 insertions(+), 32 deletions(-) diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c index 6baebcb6d14d..776e46ee95da 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.c +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c @@ -506,6 +506,7 @@ iscsi_iser_conn_bind(struct iscsi_cls_session *cls_session, iser_conn->iscsi_conn = conn; out: + iscsi_put_endpoint(ep); mutex_unlock(&iser_conn->state_mutex); return error; } diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c index 51a7b19bfffe..8aeaddc93b16 100644 --- a/drivers/scsi/be2iscsi/be_iscsi.c +++ b/drivers/scsi/be2iscsi/be_iscsi.c @@ -182,6 +182,7 @@ int beiscsi_conn_bind(struct iscsi_cls_session *cls_session, struct beiscsi_endpoint *beiscsi_ep; struct iscsi_endpoint *ep; uint16_t cri_index; + int rc = 0; ep = iscsi_lookup_endpoint(transport_fd); if (!ep) @@ -189,15 +190,17 @@ int beiscsi_conn_bind(struct iscsi_cls_session *cls_session, beiscsi_ep = ep->dd_data; - if (iscsi_conn_bind(cls_session, cls_conn, is_leading)) - return -EINVAL; + if (iscsi_conn_bind(cls_session, cls_conn, is_leading)) { + rc = -EINVAL; + goto put_ep; + } if (beiscsi_ep->phba != phba) { beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG, "BS_%d : beiscsi_ep->hba=%p not equal to phba=%p\n", beiscsi_ep->phba, phba); - - return -EEXIST; + rc = -EEXIST; + goto put_ep; } cri_index = BE_GET_CRI_FROM_CID(beiscsi_ep->ep_cid); if (phba->conn_table[cri_index]) { @@ -209,7 +212,8 @@ int beiscsi_conn_bind(struct iscsi_cls_session *cls_session, beiscsi_ep->ep_cid, beiscsi_conn, phba->conn_table[cri_index]); - return -EINVAL; + rc = -EINVAL; + goto put_ep; } } @@ -226,7 +230,10 @@ int beiscsi_conn_bind(struct iscsi_cls_session *cls_session, "BS_%d : cid %d phba->conn_table[%u]=%p\n", beiscsi_ep->ep_cid, cri_index, beiscsi_conn); phba->conn_table[cri_index] = beiscsi_conn; - return 0; + +put_ep: + iscsi_put_endpoint(ep); + return rc; } static int beiscsi_iface_create_ipv4(struct beiscsi_hba *phba) diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c index 9a4f4776a78a..26cb1c6536ce 100644 --- a/drivers/scsi/bnx2i/bnx2i_iscsi.c +++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c @@ -1420,17 +1420,23 @@ static int bnx2i_conn_bind(struct iscsi_cls_session *cls_session, * Forcefully terminate all in progress connection recovery at the * earliest, either in bind(), send_pdu(LOGIN), or conn_start() */ - if (bnx2i_adapter_ready(hba)) - return -EIO; + if (bnx2i_adapter_ready(hba)) { + ret_code = -EIO; + goto put_ep; + } bnx2i_ep = ep->dd_data; if ((bnx2i_ep->state == EP_STATE_TCP_FIN_RCVD) || - (bnx2i_ep->state == EP_STATE_TCP_RST_RCVD)) + (bnx2i_ep->state == EP_STATE_TCP_RST_RCVD)) { /* Peer disconnect via' FIN or RST */ - return -EINVAL; + ret_code = -EINVAL; + goto put_ep; + } - if (iscsi_conn_bind(cls_session, cls_conn, is_leading)) - return -EINVAL; + if (iscsi_conn_bind(cls_session, cls_conn, is_leading)) { + ret_code = -EINVAL; + goto put_ep; + } if (bnx2i_ep->hba != hba) { /* Error - TCP connection does not belong to this device @@ -1441,7 +1447,8 @@ static int bnx2i_conn_bind(struct iscsi_cls_session *cls_session, iscsi_conn_printk(KERN_ALERT, cls_conn->dd_data, "belong to hba (%s)\n", hba->netdev->name); - return -EEXIST; + ret_code = -EEXIST; + goto put_ep; } bnx2i_ep->conn = bnx2i_conn; bnx2i_conn->ep = bnx2i_ep; @@ -1458,6 +1465,8 @@ static int bnx2i_conn_bind(struct iscsi_cls_session *cls_session, bnx2i_put_rq_buf(bnx2i_conn, 0); bnx2i_arm_cq_event_coalescing(bnx2i_conn->ep, CNIC_ARM_CQE); +put_ep: + iscsi_put_endpoint(ep); return ret_code; } diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c index 215dd0eb3f48..dbe22a7136f3 100644 --- a/drivers/scsi/cxgbi/libcxgbi.c +++ b/drivers/scsi/cxgbi/libcxgbi.c @@ -2690,11 +2690,13 @@ int cxgbi_bind_conn(struct iscsi_cls_session *cls_session, err = csk->cdev->csk_ddp_setup_pgidx(csk, csk->tid, ppm->tformat.pgsz_idx_dflt); if (err < 0) - return err; + goto put_ep; err = iscsi_conn_bind(cls_session, cls_conn, is_leading); - if (err) - return -EINVAL; + if (err) { + err = -EINVAL; + goto put_ep; + } /* calculate the tag idx bits needed for this conn based on cmds_max */ cconn->task_idx_bits = (__ilog2_u32(conn->session->cmds_max - 1)) + 1; @@ -2715,7 +2717,9 @@ int cxgbi_bind_conn(struct iscsi_cls_session *cls_session, /* init recv engine */ iscsi_tcp_hdr_recv_prep(tcp_conn); - return 0; +put_ep: + iscsi_put_endpoint(ep); + return err; } EXPORT_SYMBOL_GPL(cxgbi_bind_conn); diff --git a/drivers/scsi/qedi/qedi_iscsi.c b/drivers/scsi/qedi/qedi_iscsi.c index 30dc345b011c..80f8d35b5900 100644 --- a/drivers/scsi/qedi/qedi_iscsi.c +++ b/drivers/scsi/qedi/qedi_iscsi.c @@ -377,6 +377,7 @@ static int qedi_conn_bind(struct iscsi_cls_session *cls_session, struct qedi_ctx *qedi = iscsi_host_priv(shost); struct qedi_endpoint *qedi_ep; struct iscsi_endpoint *ep; + int rc = 0; ep = iscsi_lookup_endpoint(transport_fd); if (!ep) @@ -384,11 +385,16 @@ static int qedi_conn_bind(struct iscsi_cls_session *cls_session, qedi_ep = ep->dd_data; if ((qedi_ep->state == EP_STATE_TCP_FIN_RCVD) || - (qedi_ep->state == EP_STATE_TCP_RST_RCVD)) - return -EINVAL; + (qedi_ep->state == EP_STATE_TCP_RST_RCVD)) { + rc = -EINVAL; + goto put_ep; + } + + if (iscsi_conn_bind(cls_session, cls_conn, is_leading)) { + rc = -EINVAL; + goto put_ep; + } - if (iscsi_conn_bind(cls_session, cls_conn, is_leading)) - return -EINVAL; qedi_ep->conn = qedi_conn; qedi_conn->ep = qedi_ep; @@ -398,13 +404,18 @@ static int qedi_conn_bind(struct iscsi_cls_session *cls_session, qedi_conn->cmd_cleanup_req = 0; qedi_conn->cmd_cleanup_cmpl = 0; - if (qedi_bind_conn_to_iscsi_cid(qedi, qedi_conn)) - return -EINVAL; + if (qedi_bind_conn_to_iscsi_cid(qedi, qedi_conn)) { + rc = -EINVAL; + goto put_ep; + } + spin_lock_init(&qedi_conn->tmf_work_lock); INIT_LIST_HEAD(&qedi_conn->tmf_work_list); init_waitqueue_head(&qedi_conn->wait_queue); - return 0; +put_ep: + iscsi_put_endpoint(ep); + return rc; } static int qedi_iscsi_update_conn(struct qedi_ctx *qedi, diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index 74d0d1bc208d..0e7a7e82e028 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c @@ -3235,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; + iscsi_put_endpoint(ep); return 0; } diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 2eb77f69fe0c..bab6654d8ee9 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -266,9 +266,20 @@ void iscsi_destroy_endpoint(struct iscsi_endpoint *ep) } EXPORT_SYMBOL_GPL(iscsi_destroy_endpoint); +void iscsi_put_endpoint(struct iscsi_endpoint *ep) +{ + put_device(&ep->dev); +} +EXPORT_SYMBOL_GPL(iscsi_put_endpoint); + +/** + * iscsi_lookup_endpoint - get ep from handle + * @handle: endpoint handle + * + * Caller must do a iscsi_put_endpoint. + */ struct iscsi_endpoint *iscsi_lookup_endpoint(u64 handle) { - struct iscsi_endpoint *ep; struct device *dev; dev = class_find_device(&iscsi_endpoint_class, NULL, &handle, @@ -276,13 +287,7 @@ struct iscsi_endpoint *iscsi_lookup_endpoint(u64 handle) if (!dev) return NULL; - ep = iscsi_dev_to_endpoint(dev); - /* - * we can drop this now because the interface will prevent - * removals and lookups from racing. - */ - put_device(dev); - return ep; + return iscsi_dev_to_endpoint(dev); } EXPORT_SYMBOL_GPL(iscsi_lookup_endpoint); @@ -2990,6 +2995,7 @@ static int iscsi_if_ep_disconnect(struct iscsi_transport *transport, } transport->ep_disconnect(ep); + iscsi_put_endpoint(ep); return 0; } @@ -3015,6 +3021,7 @@ iscsi_if_transport_ep(struct iscsi_transport *transport, ev->r.retcode = transport->ep_poll(ep, ev->u.ep_poll.timeout_ms); + iscsi_put_endpoint(ep); break; case ISCSI_UEVENT_TRANSPORT_EP_DISCONNECT: rc = iscsi_if_ep_disconnect(transport, @@ -3698,6 +3705,7 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group) ev->u.c_bound_session.initial_cmdsn, ev->u.c_bound_session.cmds_max, ev->u.c_bound_session.queue_depth); + iscsi_put_endpoint(ep); break; case ISCSI_UEVENT_DESTROY_SESSION: session = iscsi_session_lookup(ev->u.d_session.sid); @@ -3769,6 +3777,7 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group) mutex_lock(&conn->ep_mutex); conn->ep = ep; mutex_unlock(&conn->ep_mutex); + iscsi_put_endpoint(ep); } else iscsi_cls_conn_printk(KERN_ERR, conn, "Could not set ep conn " diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h index 8874016b3c9a..d36a72cf049f 100644 --- a/include/scsi/scsi_transport_iscsi.h +++ b/include/scsi/scsi_transport_iscsi.h @@ -442,6 +442,7 @@ extern int iscsi_scan_finished(struct Scsi_Host *shost, unsigned long time); extern struct iscsi_endpoint *iscsi_create_endpoint(int dd_size); extern void iscsi_destroy_endpoint(struct iscsi_endpoint *ep); extern struct iscsi_endpoint *iscsi_lookup_endpoint(u64 handle); +extern void iscsi_put_endpoint(struct iscsi_endpoint *ep); extern int iscsi_block_scsi_eh(struct scsi_cmnd *cmd); extern struct iscsi_iface *iscsi_create_iface(struct Scsi_Host *shost, struct iscsi_transport *t, From patchwork Tue May 25 18:18:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 447696 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 BC0C2C4707F for ; Tue, 25 May 2021 18:18:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9DEBC61408 for ; Tue, 25 May 2021 18:18:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231707AbhEYSU0 (ORCPT ); Tue, 25 May 2021 14:20:26 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:47080 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231663AbhEYSUS (ORCPT ); Tue, 25 May 2021 14:20:18 -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 14PIF6sc052980; Tue, 25 May 2021 18:18:40 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=NOgpDJ6Aw3GfqZAhTBEOzQc5bvcC5AaU5+1Stcp/swA=; b=SvgunPWLpgsH73VuCiOLEY+d8Msb3m6N5rxfVsVehgZf7DCEqnhTSfadu/HcBwX9wI/8 yVbV/dpdgvjl9QtV3XoQ+i8WfgDf55dUIbEF5Bgj6pk0VVpHfKkmFxxrT6X1webf10Di oG6nXQ0EBK0BqpWdh0yf1mFPPwPhZIgXb1cp+38sssxR2xaB34IEZsLvmAxDccqj+Qxx dA66MZ3pGTef5s3TSjpb0pt7jbJ7adXQ8YIjJje/e802qyxFPt2JT7yAXhECTod6K4ug T9vdIrJQkIhTk0ONbAcYEL0GfsjiTMuBhvon2O9v5ouUrbxwx3riSW4cpEXyYf/9Rdkb 1Q== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 38rne42guc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 May 2021 18:18:40 +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 14PIGD3I010875; Tue, 25 May 2021 18:18:39 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2049.outbound.protection.outlook.com [104.47.66.49]) by userp3020.oracle.com with ESMTP id 38qbqsggxf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 May 2021 18:18:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZMDpgh2nmFXLre+Y4fv0aw1CHr4DVtDZ2qbt4diY3CwMbGP9Ya+mZpv4nFTjTeZzX1h1jmnXaQK7J4W1E0mYm0gjEusQ1KxFdGXBBfB32pS9aWK616R6x7mXHecbGGXNIB1ENBs3hiNVDjFobPqKc5vl0awM6XT3hU8pI2Ru8r15wCYTu+jyEPD9J1gLbHC6MUMR1lQVSOAoK55yKLj7a2c9tbZ9w9JKIO2fM+9I9GVbagsMR/MbBaF/48RXljklpSe1LQGmPMuxfZnvY4kCLcTmlG2xD16x0jId9mcqAajYKWVBLrSIr3+epWc6NroLnGoDUdUs07sHSeK4tRAjtg== 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=NOgpDJ6Aw3GfqZAhTBEOzQc5bvcC5AaU5+1Stcp/swA=; b=jvPCil57yJqDYmASQozk1snyO51ghGSKF50TCbFPzaao7+ZdOJQ7kanmVlh+c2KKqQK2rnolHa9dRggGOs4nUTykLwNiMt8i/5Xo1LMmsN7mgUZEvxjzZX7kvKjMOwu1wEFlguETnLjmTKrhpi/M0WROyU0PiziQ7c1HgtIlwsGOikogM6LslYDCVntLkJsArKLj+9R41lF/UiTBovD3gGZ0y8N5b0cJOA7jYXJzYUvJn1LBB4JjAmVinRerUAu75RuGg1vRV7AVwOI7KV5Fr5GOCBpl/Cfxw/Zm9WqsVrgvvBKRUxWbHq4I5tqRGmZiPBPF91TC8dTG5dXFM7WO0w== 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=NOgpDJ6Aw3GfqZAhTBEOzQc5bvcC5AaU5+1Stcp/swA=; b=KD0mp21sOb+vtnrrvdOg095bcTL3k9P9OGnAhJnrdKmOPGJFfEd/55yiHL+0PBdvOa7NslAftQsqy4WevI1HUKoBceXHUf7vOK+JixsClNsyCV752fwc3dWi9RBOQTpgzah3nbpYUClf5m8DsDsBMBX16ciqYdzOoytYqKMd5Mg= 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 SJ0PR10MB4767.namprd10.prod.outlook.com (2603:10b6:a03:2d1::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.27; Tue, 25 May 2021 18:18:36 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::b09d:e36a:4258:d3d0]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::b09d:e36a:4258:d3d0%7]) with mapi id 15.20.4173.020; Tue, 25 May 2021 18:18:36 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, njavali@marvell.com, mrangankar@marvell.com, GR-QLogic-Storage-Upstream@marvell.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH v2 07/28] scsi: iscsi: Fix in-kernel conn failure handling Date: Tue, 25 May 2021 13:18:00 -0500 Message-Id: <20210525181821.7617-8-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210525181821.7617-1-michael.christie@oracle.com> References: <20210525181821.7617-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM5PR21CA0003.namprd21.prod.outlook.com (2603:10b6:3:ac::13) 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 DM5PR21CA0003.namprd21.prod.outlook.com (2603:10b6:3:ac::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.2 via Frontend Transport; Tue, 25 May 2021 18:18:35 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 86cd51ec-b19f-4c8a-bdbc-08d91fa9835d X-MS-TrafficTypeDiagnostic: SJ0PR10MB4767: 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: 4tzDLgbxRX0IbM4kZhCGaPYN9nAy1CS6r/Ms4TIkTtydI/AHDkHT2s2ABJIm3FnWJRCsbW5fd852MFEojQmjsb/WJajDZxCLCEzic1zyfOpvjg22l9luJzbLnRLLaBrvgFO+YQVzTiN3w6x4crvHlOF8dWjfY1U7iynLgMurx8hC2iqv8QvOeW5P3oxNwLU2nFieQOmUFnRtfKn9C61xndN3qM+91HGOEqNnb1BvKw/qq2IH3ttQf7YvLReoh4l5FVjb+Wx8lKbKBAu6ZnNJVEpxC69OWsIfGi+xjwLmHlkNemNZX+u+YwYaifil1iNQW9ruNmonYx25a/2jXXhe+tmZcgVA/f51tSNUdgNqQQdCIZY9QMPYJ3EunWLLBkrNjrt8dSpO5zIvQ9Zqw9GhZbpeg2rvtmSt1oIZvuTekUUoUbmqQI15Hxgz1Ko3PS93m3YiTLl39Y9dRRpuiYBF0nIIEuLXUF0w6bQaODph1gwo+ZDNIa/Ht14VAjzLtxWeZIFjIrszHACkYknqpZfGlvMKo5OliS09nX5HQYUg5bCSAz1phC5VLEZloDL/1J5lG19UgMfiH5iEDBXvaMTu53Ners0G6CcE2PqyJEGn1GGWk6x2oZm4iZQKYHQcbxJfvreOkc+V1JzG4xVaMMjAM7S+ciWvdqrJYwTfmW/S1MUH2jXaahtKMDI/GZGTpbTp 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)(39860400002)(396003)(346002)(136003)(366004)(38100700002)(83380400001)(6512007)(26005)(1076003)(4326008)(5660300002)(956004)(6486002)(6666004)(2616005)(30864003)(38350700002)(86362001)(107886003)(36756003)(8676002)(16526019)(8936002)(66476007)(2906002)(66946007)(52116002)(6506007)(316002)(66556008)(478600001)(186003)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: VgjDgxBn47YAUQcPQg8TTyHdv71ebdoRdh3xxHo6l2a4vd6bvJN0U7coqFpwUJg5/r/j2ep6O8DZPSiC1Ioj8PabNpgQ2mpPEfyPt7GrBl/EG6xghBv19TEz/JuCb54CncZYDhadzEZgJ4WIU+ymOqm6hT4eFrleV3xnoki7MCWwDGgtd/oLUCIviDVCAZH0NcHTk77iI2I/KBT2PEOVD9dmD56XmqnnkT4SvLVxmxShAmzl3xMOM7BI5aTgRA4DYPtOgWfb/VWdMUns3X0oJAJ2FygkO4NfFihIDYKUyj3s7GpFE9lE0Wi6x4Q+dFyc9DLyTjEfgqaO/EvNSSvwHs9I7l4rO19MgxcxTBYbn2ZbJg5bo/YcDZ06DDS4Y/6ggd/TMjxbDvznoGJTnrTWtVqcleLb+G4lF7ndKTDZ7A6R7FcjrUbWgPq9ZMI5V5pBZ+sU8Tkdjh3jR7WIJ1KNWXAbzpIk/gE56PVpWyZEX2+FGsR1xi09ZX6tNiJRVTDqx8vhiLQr0m/kj5fRBYpAJB4q8bKYV9daczU7jnyx3qpIImC1aKgN26NSAjb9ScNcJgSDwiADg759zuLRUmdTdiSE+EnL4X9MoJbJbXIGzSxSzmhggGHLNLcA540DqsIgII4iTe+B+vonR3DKCjW8AcYbnax2kYhJu9wM+0Plrlkp0/qg48LfdwnjmINM077OKrtr11Tcl0Ah60NDNHIwYrV4j3QHN64t++lxNCU6FjPTGuQY6o6gq1RRHsnDEqkkkWT8FGA0jujVW8uL15RQN4p7IC4Vjhw734jym92blV1/5NzWmlPt8MwvvrEtJo2HXM+nMnQjfysQ4WTGACiQa3r8KDqJkd5u4/7dI878YLsyMjdqhVquxrH6tKq+w3LRzPWf7cJgE5X0Cs+9/k2UQerNbITefajDVV42RXuY9U1nW6KYFhz1G8b5+I702IAoW08QpaY/w4SiDOtFLiu2/tGhuidozbPLz9U4uSKaOQbOX5f0R7yvIL9nX8sA18K/KX5JwLm3b7thsMLK3GlJPvUhSjZmJqNp/tkwRWwJcVrLAzH9S/B5gx/LcGokRkWzQQQX12xeggcEbGq5S8yc8W6WIo541fBideU480nPr4STjDGf2GV5aDNfMR63S/NbZtHqPxlKe8XbahF11OlZqNmUKYXaSW1PYerBnd+uRJ2Mws1tTPDS/CKeQbRLzI+9csjhANCvH5yBQ0BVixfOvofSW2gmxNb9tvQCkPlsJu7W58su/uIMABW1tMiC0vKqiOaiwEjYOgJw1iDoAie+GnTbFbJVQX3Kpei5Z9Iidj7Shgcr/BvS4lLH4123HOpx X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 86cd51ec-b19f-4c8a-bdbc-08d91fa9835d X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2021 18:18:36.5697 (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: DmDhq9pjsBqgQFbPY/bIhIPvBFU072au9SbbccSBoias9bqpG8mHuYGfRGKwRN0RFWcBVFpEznd/s9/HF3hJNeg1J4zgX/pbrjWyos+OLMk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4767 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250112 X-Proofpoint-ORIG-GUID: jD0PmOHX-FZ7wrW6V--j9KPEJplZKKXG X-Proofpoint-GUID: jD0PmOHX-FZ7wrW6V--j9KPEJplZKKXG X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 bulkscore=0 phishscore=0 mlxlogscore=999 spamscore=0 mlxscore=0 priorityscore=1501 lowpriorityscore=0 impostorscore=0 adultscore=0 clxscore=1015 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250112 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The commit 0ab710458da1 ("scsi: iscsi: Perform connection failure entirely in kernel space") has the following regressions/bugs that this patch fixes: 1. It can return cmds to upper layers like dm-multipath where that can retry them. After they are successful the fs/app can send new IO to the same sectors, but we've left the cmds running in FW or in the net layer. We need to be calling ep_disconnect if userspace is not up. This patch only fixes the issue for offload drivers. iscsi_tcp will be fixed in separate patch because it doesn't have a ep_disconnect call. 2. The drivers that implement ep_disconnect expect that it's called before conn_stop. Besides crashes, if the cleanup_task callout is called before ep_disconnect it might free up driver/card resources for session1 then they could be allocated for session2. But because the driver's ep_disconnect is not called it has not cleaned up the firmware so the card is still using the resources for the original cmd. 3. The stop_conn_work_fn can run after userspace has done it's recovery and we are happily using the session. We will then end up with various bugs depending on what is going on at the time. We may also run stop_conn_work_fn late after userspace has called stop_conn and ep_disconnect and is now going to call start/bind conn. If stop_conn_work_fn runs after bind but before start, we would leave the conn in a unbound but sort of started state where IO might be allowed even though the drivers have been set in a state where they no longer expect IO. 4. returning -EAGAIN in iscsi_if_destroy_conn if we haven't yet run the in kernel stop_conn function is breaking userspace. We should have been doing this for the caller. Fixes: 0ab710458da1 ("scsi: iscsi: Perform connection failure entirely in kernel space") Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/scsi_transport_iscsi.c | 471 ++++++++++++++++------------ include/scsi/scsi_transport_iscsi.h | 10 +- 2 files changed, 283 insertions(+), 198 deletions(-) diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index bab6654d8ee9..b8a93e607891 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -86,15 +86,11 @@ struct iscsi_internal { struct transport_container session_cont; }; -/* Worker to perform connection failure on unresponsive connections - * completely in kernel space. - */ -static void stop_conn_work_fn(struct work_struct *work); -static DECLARE_WORK(stop_conn_work, stop_conn_work_fn); - static atomic_t iscsi_session_nr; /* sysfs session id for next new session */ static struct workqueue_struct *iscsi_eh_timer_workq; +static struct workqueue_struct *iscsi_conn_cleanup_workq; + static DEFINE_IDA(iscsi_sess_ida); /* * list of registered transports and lock that must @@ -1623,12 +1619,6 @@ static DECLARE_TRANSPORT_CLASS(iscsi_connection_class, static struct sock *nls; static DEFINE_MUTEX(rx_queue_mutex); -/* - * conn_mutex protects the {start,bind,stop,destroy}_conn from racing - * against the kernel stop_connection recovery mechanism - */ -static DEFINE_MUTEX(conn_mutex); - static LIST_HEAD(sesslist); static DEFINE_SPINLOCK(sesslock); static LIST_HEAD(connlist); @@ -2245,6 +2235,123 @@ void iscsi_remove_session(struct iscsi_cls_session *session) } EXPORT_SYMBOL_GPL(iscsi_remove_session); +static void iscsi_stop_conn(struct iscsi_cls_conn *conn, int flag) +{ + ISCSI_DBG_TRANS_CONN(conn, "Stopping conn.\n"); + + switch (flag) { + case STOP_CONN_RECOVER: + conn->state = ISCSI_CONN_FAILED; + break; + case STOP_CONN_TERM: + conn->state = ISCSI_CONN_DOWN; + break; + default: + iscsi_cls_conn_printk(KERN_ERR, conn, "invalid stop flag %d\n", + flag); + return; + } + + conn->transport->stop_conn(conn, flag); + ISCSI_DBG_TRANS_CONN(conn, "Stopping conn done.\n"); +} + +static int iscsi_if_stop_conn(struct iscsi_transport *transport, + struct iscsi_uevent *ev) +{ + int flag = ev->u.stop_conn.flag; + struct iscsi_cls_conn *conn; + + conn = iscsi_conn_lookup(ev->u.stop_conn.sid, ev->u.stop_conn.cid); + if (!conn) + return -EINVAL; + + ISCSI_DBG_TRANS_CONN(conn, "iscsi if conn stop.\n"); + /* + * If this is a termination we have to call stop_conn with that flag + * so the correct states get set. If we haven't run the work yet try to + * avoid the extra run. + */ + if (flag == STOP_CONN_TERM) { + cancel_work_sync(&conn->cleanup_work); + iscsi_stop_conn(conn, flag); + } else { + /* + * Figure out if it was the kernel or userspace initiating this. + */ + if (!test_and_set_bit(ISCSI_CLS_CONN_BIT_CLEANUP, &conn->flags)) { + iscsi_stop_conn(conn, flag); + } else { + ISCSI_DBG_TRANS_CONN(conn, + "flush kernel conn cleanup.\n"); + flush_work(&conn->cleanup_work); + } + /* + * Only clear for recovery to avoid extra cleanup runs during + * termination. + */ + clear_bit(ISCSI_CLS_CONN_BIT_CLEANUP, &conn->flags); + } + ISCSI_DBG_TRANS_CONN(conn, "iscsi if conn stop done.\n"); + return 0; +} + +static void iscsi_ep_disconnect(struct iscsi_cls_conn *conn, bool is_active) +{ + struct iscsi_cls_session *session = iscsi_conn_to_session(conn); + struct iscsi_endpoint *ep; + + ISCSI_DBG_TRANS_CONN(conn, "disconnect ep.\n"); + conn->state = ISCSI_CONN_FAILED; + + if (!conn->ep || !session->transport->ep_disconnect) + return; + + ep = conn->ep; + conn->ep = NULL; + + session->transport->unbind_conn(conn, is_active); + session->transport->ep_disconnect(ep); + ISCSI_DBG_TRANS_CONN(conn, "disconnect ep done.\n"); +} + +static void iscsi_cleanup_conn_work_fn(struct work_struct *work) +{ + struct iscsi_cls_conn *conn = container_of(work, struct iscsi_cls_conn, + cleanup_work); + struct iscsi_cls_session *session = iscsi_conn_to_session(conn); + + mutex_lock(&conn->ep_mutex); + /* + * If we are not at least bound there is nothing for us to do. Userspace + * will do a ep_disconnect call if offload is used, but will not be + * doing a stop since there is nothing to clean up, so we have to clear + * the cleanup bit here. + */ + if (conn->state != ISCSI_CONN_BOUND && conn->state != ISCSI_CONN_UP) { + ISCSI_DBG_TRANS_CONN(conn, "Got error while conn is already failed. Ignoring.\n"); + clear_bit(ISCSI_CLS_CONN_BIT_CLEANUP, &conn->flags); + mutex_unlock(&conn->ep_mutex); + return; + } + + iscsi_ep_disconnect(conn, false); + + if (system_state != SYSTEM_RUNNING) { + /* + * If the user has set up for the session to never timeout + * then hang like they wanted. For all other cases fail right + * away since userspace is not going to relogin. + */ + if (session->recovery_tmo > 0) + session->recovery_tmo = 0; + } + + iscsi_stop_conn(conn, STOP_CONN_RECOVER); + mutex_unlock(&conn->ep_mutex); + ISCSI_DBG_TRANS_CONN(conn, "cleanup done.\n"); +} + void iscsi_free_session(struct iscsi_cls_session *session) { ISCSI_DBG_TRANS_SESSION(session, "Freeing session\n"); @@ -2284,7 +2391,7 @@ iscsi_create_conn(struct iscsi_cls_session *session, int dd_size, uint32_t cid) mutex_init(&conn->ep_mutex); INIT_LIST_HEAD(&conn->conn_list); - INIT_LIST_HEAD(&conn->conn_list_err); + INIT_WORK(&conn->cleanup_work, iscsi_cleanup_conn_work_fn); conn->transport = transport; conn->cid = cid; conn->state = ISCSI_CONN_DOWN; @@ -2341,7 +2448,6 @@ int iscsi_destroy_conn(struct iscsi_cls_conn *conn) spin_lock_irqsave(&connlock, flags); list_del(&conn->conn_list); - list_del(&conn->conn_list_err); spin_unlock_irqrestore(&connlock, flags); transport_unregister_device(&conn->dev); @@ -2456,83 +2562,6 @@ int iscsi_offload_mesg(struct Scsi_Host *shost, } EXPORT_SYMBOL_GPL(iscsi_offload_mesg); -/* - * This can be called without the rx_queue_mutex, if invoked by the kernel - * stop work. But, in that case, it is guaranteed not to race with - * iscsi_destroy by conn_mutex. - */ -static void iscsi_if_stop_conn(struct iscsi_cls_conn *conn, int flag) -{ - /* - * It is important that this path doesn't rely on - * rx_queue_mutex, otherwise, a thread doing allocation on a - * start_session/start_connection could sleep waiting on a - * writeback to a failed iscsi device, that cannot be recovered - * because the lock is held. If we don't hold it here, the - * kernel stop_conn_work_fn has a chance to stop the broken - * session and resolve the allocation. - * - * Still, the user invoked .stop_conn() needs to be serialized - * with stop_conn_work_fn by a private mutex. Not pretty, but - * it works. - */ - mutex_lock(&conn_mutex); - switch (flag) { - case STOP_CONN_RECOVER: - conn->state = ISCSI_CONN_FAILED; - break; - case STOP_CONN_TERM: - conn->state = ISCSI_CONN_DOWN; - break; - default: - iscsi_cls_conn_printk(KERN_ERR, conn, - "invalid stop flag %d\n", flag); - goto unlock; - } - - conn->transport->stop_conn(conn, flag); -unlock: - mutex_unlock(&conn_mutex); -} - -static void stop_conn_work_fn(struct work_struct *work) -{ - struct iscsi_cls_conn *conn, *tmp; - unsigned long flags; - LIST_HEAD(recovery_list); - - spin_lock_irqsave(&connlock, flags); - if (list_empty(&connlist_err)) { - spin_unlock_irqrestore(&connlock, flags); - return; - } - list_splice_init(&connlist_err, &recovery_list); - spin_unlock_irqrestore(&connlock, flags); - - list_for_each_entry_safe(conn, tmp, &recovery_list, conn_list_err) { - uint32_t sid = iscsi_conn_get_sid(conn); - struct iscsi_cls_session *session; - - session = iscsi_session_lookup(sid); - if (session) { - if (system_state != SYSTEM_RUNNING) { - /* - * If the user has set up for the session to - * never timeout then hang like they wanted. - * For all other cases fail right away since - * userspace is not going to relogin. - */ - if (session->recovery_tmo > 0) - session->recovery_tmo = 0; - } - - iscsi_if_stop_conn(conn, STOP_CONN_RECOVER); - } - - list_del_init(&conn->conn_list_err); - } -} - void iscsi_conn_error_event(struct iscsi_cls_conn *conn, enum iscsi_err error) { struct nlmsghdr *nlh; @@ -2540,12 +2569,9 @@ void iscsi_conn_error_event(struct iscsi_cls_conn *conn, enum iscsi_err error) struct iscsi_uevent *ev; struct iscsi_internal *priv; int len = nlmsg_total_size(sizeof(*ev)); - unsigned long flags; - spin_lock_irqsave(&connlock, flags); - list_add(&conn->conn_list_err, &connlist_err); - spin_unlock_irqrestore(&connlock, flags); - queue_work(system_unbound_wq, &stop_conn_work); + if (!test_and_set_bit(ISCSI_CLS_CONN_BIT_CLEANUP, &conn->flags)) + queue_work(iscsi_conn_cleanup_workq, &conn->cleanup_work); priv = iscsi_if_transport_lookup(conn->transport); if (!priv) @@ -2875,26 +2901,17 @@ static int iscsi_if_destroy_conn(struct iscsi_transport *transport, struct iscsi_uevent *ev) { struct iscsi_cls_conn *conn; - unsigned long flags; conn = iscsi_conn_lookup(ev->u.d_conn.sid, ev->u.d_conn.cid); if (!conn) return -EINVAL; - spin_lock_irqsave(&connlock, flags); - if (!list_empty(&conn->conn_list_err)) { - spin_unlock_irqrestore(&connlock, flags); - return -EAGAIN; - } - spin_unlock_irqrestore(&connlock, flags); - + ISCSI_DBG_TRANS_CONN(conn, "Flushing cleanup during destruction\n"); + flush_work(&conn->cleanup_work); ISCSI_DBG_TRANS_CONN(conn, "Destroying transport conn\n"); - mutex_lock(&conn_mutex); if (transport->destroy_conn) transport->destroy_conn(conn); - mutex_unlock(&conn_mutex); - return 0; } @@ -2973,7 +2990,7 @@ static int iscsi_if_ep_connect(struct iscsi_transport *transport, } static int iscsi_if_ep_disconnect(struct iscsi_transport *transport, - u64 ep_handle, bool is_active) + u64 ep_handle) { struct iscsi_cls_conn *conn; struct iscsi_endpoint *ep; @@ -2984,17 +3001,30 @@ static int iscsi_if_ep_disconnect(struct iscsi_transport *transport, ep = iscsi_lookup_endpoint(ep_handle); if (!ep) return -EINVAL; + conn = ep->conn; - if (conn) { - mutex_lock(&conn->ep_mutex); - conn->ep = NULL; + if (!conn) { + /* + * conn was not even bound yet, so we can't get iscsi conn + * failures yet. + */ + transport->ep_disconnect(ep); + goto put_ep; + } + + mutex_lock(&conn->ep_mutex); + /* Check if this was a conn error and the kernel took ownership */ + if (test_bit(ISCSI_CLS_CONN_BIT_CLEANUP, &conn->flags)) { + ISCSI_DBG_TRANS_CONN(conn, "flush kernel conn cleanup.\n"); mutex_unlock(&conn->ep_mutex); - conn->state = ISCSI_CONN_FAILED; - transport->unbind_conn(conn, is_active); + flush_work(&conn->cleanup_work); + goto put_ep; } - transport->ep_disconnect(ep); + iscsi_ep_disconnect(conn, false); + mutex_unlock(&conn->ep_mutex); +put_ep: iscsi_put_endpoint(ep); return 0; } @@ -3025,8 +3055,7 @@ iscsi_if_transport_ep(struct iscsi_transport *transport, break; case ISCSI_UEVENT_TRANSPORT_EP_DISCONNECT: rc = iscsi_if_ep_disconnect(transport, - ev->u.ep_disconnect.ep_handle, - false); + ev->u.ep_disconnect.ep_handle); break; } return rc; @@ -3653,18 +3682,129 @@ iscsi_get_host_stats(struct iscsi_transport *transport, struct nlmsghdr *nlh) return err; } +static int iscsi_if_transport_conn(struct iscsi_transport *transport, + struct nlmsghdr *nlh) +{ + struct iscsi_uevent *ev = nlmsg_data(nlh); + struct iscsi_cls_session *session; + struct iscsi_cls_conn *conn = NULL; + struct iscsi_endpoint *ep; + uint32_t pdu_len; + int err = 0; + + switch (nlh->nlmsg_type) { + case ISCSI_UEVENT_CREATE_CONN: + return iscsi_if_create_conn(transport, ev); + case ISCSI_UEVENT_DESTROY_CONN: + return iscsi_if_destroy_conn(transport, ev); + case ISCSI_UEVENT_STOP_CONN: + return iscsi_if_stop_conn(transport, ev); + } + + /* + * The following cmds need to be run under the ep_mutex so in kernel + * conn cleanup (ep_disconnect + unbind and conn) is not done while + * these are running. They also must not run if we have just run a conn + * cleanup because they would set the state in a way that might allow + * IO or send IO themselves. + */ + switch (nlh->nlmsg_type) { + case ISCSI_UEVENT_START_CONN: + conn = iscsi_conn_lookup(ev->u.start_conn.sid, + ev->u.start_conn.cid); + break; + case ISCSI_UEVENT_BIND_CONN: + conn = iscsi_conn_lookup(ev->u.b_conn.sid, ev->u.b_conn.cid); + break; + case ISCSI_UEVENT_SEND_PDU: + conn = iscsi_conn_lookup(ev->u.send_pdu.sid, ev->u.send_pdu.cid); + break; + } + + if (!conn) + return -EINVAL; + + mutex_lock(&conn->ep_mutex); + if (test_bit(ISCSI_CLS_CONN_BIT_CLEANUP, &conn->flags)) { + mutex_unlock(&conn->ep_mutex); + ev->r.retcode = -ENOTCONN; + return 0; + } + + switch (nlh->nlmsg_type) { + case ISCSI_UEVENT_BIND_CONN: + if (conn->ep) { + /* + * For offload boot support where iscsid is restarted + * during the pivot root stage, the ep will be intact + * here when the new iscsid instance starts up and + * reconnects. + */ + iscsi_ep_disconnect(conn, true); + } + + session = iscsi_session_lookup(ev->u.b_conn.sid); + if (!session) { + err = -EINVAL; + break; + } + + ev->r.retcode = transport->bind_conn(session, conn, + ev->u.b_conn.transport_eph, + ev->u.b_conn.is_leading); + if (!ev->r.retcode) + conn->state = ISCSI_CONN_BOUND; + + if (ev->r.retcode || !transport->ep_connect) + break; + + ep = iscsi_lookup_endpoint(ev->u.b_conn.transport_eph); + if (ep) { + ep->conn = conn; + conn->ep = ep; + iscsi_put_endpoint(ep); + } else { + err = -ENOTCONN; + iscsi_cls_conn_printk(KERN_ERR, conn, + "Could not set ep conn binding\n"); + } + break; + case ISCSI_UEVENT_START_CONN: + ev->r.retcode = transport->start_conn(conn); + if (!ev->r.retcode) + conn->state = ISCSI_CONN_UP; + break; + case ISCSI_UEVENT_SEND_PDU: + pdu_len = nlh->nlmsg_len - sizeof(*nlh) - sizeof(*ev); + + if ((ev->u.send_pdu.hdr_size > pdu_len) || + (ev->u.send_pdu.data_size > (pdu_len - ev->u.send_pdu.hdr_size))) { + err = -EINVAL; + break; + } + + ev->r.retcode = transport->send_pdu(conn, + (struct iscsi_hdr *)((char *)ev + sizeof(*ev)), + (char *)ev + sizeof(*ev) + ev->u.send_pdu.hdr_size, + ev->u.send_pdu.data_size); + break; + default: + err = -ENOSYS; + } + + mutex_unlock(&conn->ep_mutex); + return err; +} static int iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group) { int err = 0; u32 portid; - u32 pdu_len; struct iscsi_uevent *ev = nlmsg_data(nlh); struct iscsi_transport *transport = NULL; struct iscsi_internal *priv; struct iscsi_cls_session *session; - struct iscsi_cls_conn *conn; struct iscsi_endpoint *ep = NULL; if (!netlink_capable(skb, CAP_SYS_ADMIN)) @@ -3741,90 +3881,16 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group) else err = -EINVAL; break; - case ISCSI_UEVENT_CREATE_CONN: - err = iscsi_if_create_conn(transport, ev); - break; - case ISCSI_UEVENT_DESTROY_CONN: - err = iscsi_if_destroy_conn(transport, ev); - break; - case ISCSI_UEVENT_BIND_CONN: - session = iscsi_session_lookup(ev->u.b_conn.sid); - conn = iscsi_conn_lookup(ev->u.b_conn.sid, ev->u.b_conn.cid); - - if (conn && conn->ep) - iscsi_if_ep_disconnect(transport, conn->ep->id, true); - - if (!session || !conn) { - err = -EINVAL; - break; - } - - mutex_lock(&conn_mutex); - ev->r.retcode = transport->bind_conn(session, conn, - ev->u.b_conn.transport_eph, - ev->u.b_conn.is_leading); - if (!ev->r.retcode) - conn->state = ISCSI_CONN_BOUND; - mutex_unlock(&conn_mutex); - - if (ev->r.retcode || !transport->ep_connect) - break; - - ep = iscsi_lookup_endpoint(ev->u.b_conn.transport_eph); - if (ep) { - ep->conn = conn; - - mutex_lock(&conn->ep_mutex); - conn->ep = ep; - mutex_unlock(&conn->ep_mutex); - iscsi_put_endpoint(ep); - } else - iscsi_cls_conn_printk(KERN_ERR, conn, - "Could not set ep conn " - "binding\n"); - break; case ISCSI_UEVENT_SET_PARAM: err = iscsi_set_param(transport, ev); break; - case ISCSI_UEVENT_START_CONN: - conn = iscsi_conn_lookup(ev->u.start_conn.sid, ev->u.start_conn.cid); - if (conn) { - mutex_lock(&conn_mutex); - ev->r.retcode = transport->start_conn(conn); - if (!ev->r.retcode) - conn->state = ISCSI_CONN_UP; - mutex_unlock(&conn_mutex); - } - else - err = -EINVAL; - break; + case ISCSI_UEVENT_CREATE_CONN: + case ISCSI_UEVENT_DESTROY_CONN: case ISCSI_UEVENT_STOP_CONN: - conn = iscsi_conn_lookup(ev->u.stop_conn.sid, ev->u.stop_conn.cid); - if (conn) - iscsi_if_stop_conn(conn, ev->u.stop_conn.flag); - else - err = -EINVAL; - break; + case ISCSI_UEVENT_START_CONN: + case ISCSI_UEVENT_BIND_CONN: case ISCSI_UEVENT_SEND_PDU: - pdu_len = nlh->nlmsg_len - sizeof(*nlh) - sizeof(*ev); - - if ((ev->u.send_pdu.hdr_size > pdu_len) || - (ev->u.send_pdu.data_size > (pdu_len - ev->u.send_pdu.hdr_size))) { - err = -EINVAL; - break; - } - - conn = iscsi_conn_lookup(ev->u.send_pdu.sid, ev->u.send_pdu.cid); - if (conn) { - mutex_lock(&conn_mutex); - ev->r.retcode = transport->send_pdu(conn, - (struct iscsi_hdr*)((char*)ev + sizeof(*ev)), - (char*)ev + sizeof(*ev) + ev->u.send_pdu.hdr_size, - ev->u.send_pdu.data_size); - mutex_unlock(&conn_mutex); - } - else - err = -EINVAL; + err = iscsi_if_transport_conn(transport, nlh); break; case ISCSI_UEVENT_GET_STATS: err = iscsi_if_get_stats(transport, nlh); @@ -4827,8 +4893,18 @@ static __init int iscsi_transport_init(void) goto release_nls; } + iscsi_conn_cleanup_workq = alloc_workqueue("%s", + WQ_SYSFS | WQ_MEM_RECLAIM | WQ_UNBOUND, 0, + "iscsi_conn_cleanup"); + if (!iscsi_conn_cleanup_workq) { + err = -ENOMEM; + goto destroy_wq; + } + return 0; +destroy_wq: + destroy_workqueue(iscsi_eh_timer_workq); release_nls: netlink_kernel_release(nls); unregister_flashnode_bus: @@ -4850,6 +4926,7 @@ static __init int iscsi_transport_init(void) static void __exit iscsi_transport_exit(void) { + destroy_workqueue(iscsi_conn_cleanup_workq); destroy_workqueue(iscsi_eh_timer_workq); netlink_kernel_release(nls); bus_unregister(&iscsi_flashnode_bus); diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h index d36a72cf049f..3974329d4d02 100644 --- a/include/scsi/scsi_transport_iscsi.h +++ b/include/scsi/scsi_transport_iscsi.h @@ -197,15 +197,23 @@ enum iscsi_connection_state { ISCSI_CONN_BOUND, }; +#define ISCSI_CLS_CONN_BIT_CLEANUP 1 + struct iscsi_cls_conn { struct list_head conn_list; /* item in connlist */ - struct list_head conn_list_err; /* item in connlist_err */ void *dd_data; /* LLD private data */ struct iscsi_transport *transport; uint32_t cid; /* connection id */ + /* + * This protects the conn startup and binding/unbinding of the ep to + * the conn. Unbinding includes ep_disconnect and stop_conn. + */ struct mutex ep_mutex; struct iscsi_endpoint *ep; + unsigned long flags; + struct work_struct cleanup_work; + struct device dev; /* sysfs transport/container device */ enum iscsi_connection_state state; }; From patchwork Tue May 25 18:18:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 447695 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 D4D8AC47085 for ; Tue, 25 May 2021 18:18:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B956E6140E for ; Tue, 25 May 2021 18:18:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232122AbhEYSU2 (ORCPT ); Tue, 25 May 2021 14:20:28 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:44132 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232133AbhEYSUV (ORCPT ); Tue, 25 May 2021 14:20:21 -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 14PIF656124670; Tue, 25 May 2021 18:18:45 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=b33fZPkUhxi2Rc2f8T/6df2PrzHrbHiSccxFxs2G4tM=; b=mZTGyF4cCGQyjqtnw0evAFhvPfTGA1sf7qq5MW65JRE6JYpSVGcOiKmvRleVXMJF//SZ PY6V6TzlKVP6N/bw/R95aQh0J4HcdFrAKp+yANUTwBApIJLQRCLScwYvtA0vWw1saOVo KPz3CgpNp7R7sM10qdKXHLLCVcxNugQg7IZXBwL5GPEGXNo4+9U1XM9CCwRqdL1LUjED 8GmOKHXTwIMWws9Whb8QNXWh2VGigM98r433RD16uk2rmYv1OkYIRMr9NiZXG7xpolw8 8M1bkmyMOUa3UA01enwb2YpzUyHcBtNI1azD4mBVV/Ldm30N/21z6tTRuc7m/iE/jydi 5A== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2130.oracle.com with ESMTP id 38pqfceyrk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 May 2021 18:18:44 +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 14PIGD0p010935; Tue, 25 May 2021 18:18:44 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2049.outbound.protection.outlook.com [104.47.51.49]) by userp3020.oracle.com with ESMTP id 38qbqsggy9-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 May 2021 18:18:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I+r+vBk7/QQNOnqLjNkjpK8kOyZy8css6AdvbZ+5LdZjG7h/XtITGk0efcxdDR9t40pnNDE1z56w7p9FX6fqjfX6gqNCAD1OE5booGrlWztpCBCL6Jnki76pFZOY2Gc/tj/vTKNogbtmPGUEuKHKx4l2KIDdWKyBrPjwiCvA6MSSjqx2AvrKS2YUbsx5dkSEN2OAl85xPATqwanBCcfrrRADB5oeG8eWkL31KyUqkNZUr3nuw17RFz18aCX1Krpk7zIaJtf9AZhWfbicOZHFPZX9M/fEas9VjppC5fg3XreJUrAmKFTmT4jrfYjFlutHpW7gT9lmcYEq3nq44Oj0SA== 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=b33fZPkUhxi2Rc2f8T/6df2PrzHrbHiSccxFxs2G4tM=; b=HjTLRPiywJjpvn+y6WPTIIcGOPFs+0QhWl+gaQW5k/YCCfCe3yqoPqMVjqsZPvE/DGK+acL+2wuxenbJWljwOwUEuzNpEblIfdAK+ZjpVeBHtCfoKkub3GAqTi2qwrMlPv7BFvx6fVdJwMNPOWKgy6r4za5n2yHR1jvByF4ZJCFydqBcslMXsqfwr31XYANAlRFy1+CmWdbtY7xbpESpNjfO30yb5SyqDE1vfs4DpaUPdZSdgQTgM8Ab90slK+kEAAQzwrsAv+s+qAKXnumxXrTp/vMzuYkOnkfNUs8IPND0QfxD4NQCIXxRF7krwnoHtWgSbV07X7LizcCKtBQuCw== 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=b33fZPkUhxi2Rc2f8T/6df2PrzHrbHiSccxFxs2G4tM=; b=mdoCEI5oYR72+fOXu3T1joigG43UQvjz4MIoGRFGXxhjHNVG07C/qZcQV1//3hIVZHeJ9DnB4+r9WnclNLxRjF1fw/v/5pDGQMnl/nUizFgtCAay/RCYWlqXcuggSJEkBtXs3/TRlBglhs2R2k4Qr7zGl/Rb3I57Wtj4NeV9w9Y= 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 BY5PR10MB3891.namprd10.prod.outlook.com (2603:10b6:a03:1b3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.27; Tue, 25 May 2021 18:18:42 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::b09d:e36a:4258:d3d0]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::b09d:e36a:4258:d3d0%7]) with mapi id 15.20.4173.020; Tue, 25 May 2021 18:18:42 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, njavali@marvell.com, mrangankar@marvell.com, GR-QLogic-Storage-Upstream@marvell.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH v2 12/28] scsi: iscsi: Get ref to conn during reset handling Date: Tue, 25 May 2021 13:18:05 -0500 Message-Id: <20210525181821.7617-13-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210525181821.7617-1-michael.christie@oracle.com> References: <20210525181821.7617-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM5PR21CA0003.namprd21.prod.outlook.com (2603:10b6:3:ac::13) 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 DM5PR21CA0003.namprd21.prod.outlook.com (2603:10b6:3:ac::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.2 via Frontend Transport; Tue, 25 May 2021 18:18:41 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1a09aa72-970f-475b-0dbe-08d91fa9869b X-MS-TrafficTypeDiagnostic: BY5PR10MB3891: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: i3oD7n9iTS8Ijwzf85zI34CSR2Fua3ItA5JFdMkyGqBJPCq8CYHgjIJOrtE8Vtjk7TNSgQAFHlvTeg8hKrTyieWrda1Y1Yj5mJi28rjmnKSPSSGl2O0uRo/6DAcBcBD+bLuGpmXxqL+d5ycQAhnmzwiSI/E8N9KYsdediOjzHc3NF2Q4lUfesINXLQVIMaofXl3QTkpTjIwjK/8F8ZtdS3k3oLegsBUarvdgrvOMrPMkc+kcHuPeWPaPXiuQjrW4FgI+3uoFNGf5Ez+pFXdFQUoLaYRJjb3VSmpo/DjThn1nm6nJ/4RMiJ8Y2rYEa99RC6MxcMYHqndtigfwprYUmFXoJLUxJOcBJshLxxjzPlWsy0seQDq04dgPjHqG/oaktRMIkACv3IkDRqekUEIc87Dd4cgVHLBIrGICE2rCBLhUt9wnKj2PMSl9inqZOA2ZhVH5SYJ8DrhPpjRlCbqLAlwkgdnemw7V+kpMReKexGxZjFahOID1EoFU3P8Ws+IShhW1kKLFDlAXfUj5FeDPm2oAMYC/ihc0cUUq5GHPV/Hzqxcye/5wLHf67LyC8V6ZnaEiLe/JaX41Jj1q4DjioLUgILLEhXkRiiEuQETlOoBZTZlciBtqViDXbTEb9XA/QXtgK59LjIhQCe1N+juEjqkDZP5FnPmP7g88prBnzGS1pJ2xjuKEJ/NBxHomW6ac 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)(376002)(136003)(396003)(39860400002)(346002)(36756003)(83380400001)(6506007)(66556008)(186003)(16526019)(6666004)(52116002)(8676002)(66946007)(8936002)(4326008)(26005)(66476007)(478600001)(38100700002)(5660300002)(1076003)(956004)(86362001)(6486002)(2616005)(316002)(107886003)(38350700002)(2906002)(6512007)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: r4UEYqndDPtxT6KhhdTKvDT/c3qwa7u7gyUvwRm9KSrw99nnQKnViPOPArV1H9o6Dyx86EC2X9s2TOV4yVPRpL6JrwG0pL3qSBO6aNfRsNanMOszllrv8VV2fDthqC6cI39l5YOU1U4Z85H/8lpx+XNKo+sIuv933Qi+a+WNYksXpz9jTxTQnTnhRzedlS4oNxminzW5eGWby/d00888uQVUqsC8XKv8Hpga5oRMp/z+DlJK48lPMeNJAs1RH18JKOvdfAVMgj/vKJquHy6pwoLld33R3zH+r5JBnYfal3DekVoOgex1jSd7bBg/s6RXZAlVlM30Q++w4OaVD9sYf6ccPD7HV5R69CxgMVOWgqfJwmmLr1ag5LIry7lNhcgmfqAOJ+ANv4T6VYSF0yXxdVS3vinK2X82DbcR12/edQMM13iAOzU6Qb5WZWZ3URjN+A0BDrwESnWgBCjiGAb2lsf6LCMXg2aYOTWXXbulN3DLjAuhymjQsGxArMYYsp/CyOGWX14ZOiojPWmDHA4xzwhMigTPph2KW5nA0IChR9xZA3Yf97DPc5sP7L51vMFR3dL9Uz5m2nJXlWsTQV4JdzDp4QbjjUv19S0fh7cOrs+yF9kP171yNAdZfKhHgzpR8UqGLf8XG2nt5kEoNg7LEUqvFvcoKJNbzZEqgw2LD6p3dsMbor8fHFyCC6MhIPQqgaXd3mBQ2E/Ybz7SPQuFN1fL3lCTPXNvI6h9LKGdYN+UvEWZjXK/ywA1Z3Zp/uolXtDG4uKNY8Vcm7fUY09BFPYtZhCC9iv8HRCtUc61DNvQIMum/jIoc+FYKH9LaMGz4/yv9BGxkIFaspd8edh89OzP0ws+/KnxsGne3sHmqf5bJoFJk7yUSUxRgcN4dyOWpTQujJ6BYi58VDGd38OAFegz9/2U6yWhmDyG+nQI3Zf3lOaGxgS6qKrPBKNmEXsrSgr2frRjwa/H5YvDnBnlnRm9T1ZQtCkTf8tX1Af/625Vr8OS8+MPv1kMQCdgsgBYsPRQJ7+SHlpdYSkfsOyKj6Nb7TTnsWdRHdGotJrS/Hfl5Dr6xqL/sVSpmgkYVCwT4+UltYDdMESJ8LNyH9oMlROVKraD5htqpJTjsNRCCaJ9qoLrEx75j//j11P+jACTyzA/G8pTsY9v+DQyj0MMJYvxNq6alNesOEo7QdIfb2TTJz2fBLRBBsXYstk9wY6PDl3fLUUBSwmoSDAcJUMeKypAMX6qwvlfHs0x/ZfwT7+cIJVbUba+zxz0SojnQ5P3Mn2PnlWCcT0hqBNzp6cohmrwuUqucxI8EQgfn0yI4lP194YNV1qWeLUGKB5/BcFj X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1a09aa72-970f-475b-0dbe-08d91fa9869b X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2021 18:18:41.9707 (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: +1+f2ay1LsV1JoF+Vp6X3RVn6GMOk2qpAP0AcnU+uQgCSan/yuhJ/rNdwItd7okF58rEzU6CkK8Pl/QaLQCysX2I3uLAdFdMfG6YuYjfk8s= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB3891 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250112 X-Proofpoint-ORIG-GUID: mR6N0SJPSVnVDGQI4uk1tZN66V2GyfZ0 X-Proofpoint-GUID: mR6N0SJPSVnVDGQI4uk1tZN66V2GyfZ0 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 mlxscore=0 malwarescore=0 mlxlogscore=999 lowpriorityscore=0 impostorscore=0 adultscore=0 phishscore=0 priorityscore=1501 clxscore=1015 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250112 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The comment in iscsi_eh_session_reset is wrong and we don't wait for the EH to complete before tearing down the conn. This has us get a ref to the conn when we are not holding the eh_mutex/frwd_lock so it does not get freed from under us. Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/libiscsi.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 6ca3d35a3d11..b7445d9e99d6 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -2492,7 +2492,6 @@ int iscsi_eh_session_reset(struct scsi_cmnd *sc) cls_session = starget_to_session(scsi_target(sc->device)); session = cls_session->dd_data; - conn = session->leadconn; mutex_lock(&session->eh_mutex); spin_lock_bh(&session->frwd_lock); @@ -2507,13 +2506,14 @@ int iscsi_eh_session_reset(struct scsi_cmnd *sc) return FAILED; } + conn = session->leadconn; + iscsi_get_conn(conn->cls_conn); + spin_unlock_bh(&session->frwd_lock); mutex_unlock(&session->eh_mutex); - /* - * we drop the lock here but the leadconn cannot be destoyed while - * we are in the scsi eh - */ + iscsi_conn_failure(conn, ISCSI_ERR_SCSI_EH_SESSION_RST); + iscsi_put_conn(conn->cls_conn); ISCSI_DBG_EH(session, "wait for relogin\n"); wait_event_interruptible(conn->ehwait, From patchwork Tue May 25 18:18:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 447694 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 2F99EC2B9F8 for ; Tue, 25 May 2021 18:19:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 11E1B61404 for ; Tue, 25 May 2021 18:19:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232201AbhEYSUa (ORCPT ); Tue, 25 May 2021 14:20:30 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:47096 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231827AbhEYSUW (ORCPT ); Tue, 25 May 2021 14:20:22 -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 14PIF6se052980; Tue, 25 May 2021 18:18:45 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=ytq8Pd73E7sqXcLqXUVeHitld6tMEne7hQpeAlPIJo8=; b=u9qH/E1z1l8RbopfUhbJaXUOw0Xl6pxxIYarViyQjvKYOR7G7yfYl+hNvuTgSfpXYcGX 5X4IYG4ZsMKm5K6lYRvwZ0tv9o7lFb2EUMMlhI4EPSoH5pBflRMDf1fGnJQiIuy/s9Hf 87fY2L6yEcSuI6sasHrtLEvpmlFUOTLQbMRCiQKg7Gb/XH+465EljG8E2HXD4Jmixb6B O71U/t/zE06dw83mdlbNjjOtvOZHWyWUMnK9xI9ZaBn4juEchcdgo/56sc2PYJsHcZkw V0hsBEq9+Q9QW7A5mIoHq8EN50fYzS1w8kaHUF/KtVE8mptapUExgH3XxHVUlkAXCZTK Pg== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 38rne42gun-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 May 2021 18:18:45 +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 14PIGD0q010935; Tue, 25 May 2021 18:18:44 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2049.outbound.protection.outlook.com [104.47.51.49]) by userp3020.oracle.com with ESMTP id 38qbqsggy9-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 May 2021 18:18:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Mwe3+KasDtnK71GLlUVNdhwDzyirtbK1mCQE2UgCfTpb0AqTb+nRFKgri7IPt+IKMSjvt/WDgyYX/RyziF1wHxqE9Q42BaLKNtav5yjrl+4ilzKjnTLfjpA/FXb2/9MKIj/JqRBGidNMuWAFTKOlI7zb0CEju3C1DeoSTKUg+nxZ11vS4rztZlxDoYLg4lZ7tO6C9zZdPd28cavXb1wMErKjZcy1lBj9xYMpc3wDntIlZY3xcF29uYcdgz2Hw0BZTyUrrLMwhY2/qC0qgx8Mctm9W5AClIPHVr6D81kUxdXVQ8l9rEPJ+eADNaaQUAJyvlGfIWRQmEprKiYZHwMe4Q== 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=ytq8Pd73E7sqXcLqXUVeHitld6tMEne7hQpeAlPIJo8=; b=aS8rjYZulz0eIcTp9JOcgVv25bPXuBkf8SikJHEZ+DP9Ekl50av46cm1plPH79iy6/lAl4rAQzsNsgQ69mmfsNm6BlAE3zZpJbKJlZlDvSRnXKA5PvjBZ8qxtqtBg611YrIh8rMeb2oiIKWc+iswsqHgwh8I29JxmBS6YSfnS6kTWreNARC7utS4slgclswG9m0OQ/ePOKpBeIOLlsBeQgKqI1FR5ns9sCgYJZQdbtbverPxSYMsn76tILmZ7BJWrqIcXGNM4jfnSV2OaC7y8HemAJ98xQRl1NciyPI3lXns9VX40JMlJdvo/1/9rNMGSYW8RppKBshVRCRBx2RSLQ== 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=ytq8Pd73E7sqXcLqXUVeHitld6tMEne7hQpeAlPIJo8=; b=K9nHJGDgJx2i36cnpyAjFQ5XFP6u9kMVWrGLIc8wyzeXsVxmUCwzB4HrusGpaLtbsx/Di8NO7e6SFoZHb5tGyBX5ixp4+5eNt187aN6ncmv+EmT22AkxYFgEPgUnjENUb3crQMbwtfqGa7ftF+OVHrA7Q/CtQmBxw/d+5Y3Q+MU= 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 BY5PR10MB3891.namprd10.prod.outlook.com (2603:10b6:a03:1b3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.27; Tue, 25 May 2021 18:18:43 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::b09d:e36a:4258:d3d0]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::b09d:e36a:4258:d3d0%7]) with mapi id 15.20.4173.020; Tue, 25 May 2021 18:18:43 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, njavali@marvell.com, mrangankar@marvell.com, GR-QLogic-Storage-Upstream@marvell.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH v2 13/28] scsi: iscsi: Fix conn use after free during resets Date: Tue, 25 May 2021 13:18:06 -0500 Message-Id: <20210525181821.7617-14-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210525181821.7617-1-michael.christie@oracle.com> References: <20210525181821.7617-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM5PR21CA0003.namprd21.prod.outlook.com (2603:10b6:3:ac::13) 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 DM5PR21CA0003.namprd21.prod.outlook.com (2603:10b6:3:ac::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.2 via Frontend Transport; Tue, 25 May 2021 18:18:42 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c6facc7b-52a8-40de-d793-08d91fa9873e X-MS-TrafficTypeDiagnostic: BY5PR10MB3891: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:608; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KEa2Xj/9cGzhtO9M/cXtCd+3N19ZcWiF5U2jDJgrcLW+tEFUDIznmWfLMscWVYU+nyYZcBM+VnMfapZ5H5EKFCPN5KHrTw8/SbRYPWIFj94yireklpDng25W/Q+Fd1m4sijqH5tHs8htsgsQqyTCj4KSvkA3RMqyxnY+W0MkHDD+sfqeerrZnQJ43J29JT0+5UoYMu1wyDNanGmhX66+xVJSY8VcJMxo0WUtUzpneWPGRmF+FeLV5UvCm3JSjiwy42+DcC7Mq9THvE5p109ATwVZfmpQAnqmLD/tVMgd9kqPR0XCfzK9URgsVAvOlNaaQh00sJMHUf1y1LuJ+HMODmo35ZSytSpvZtEcrLR4+Evk4WSPjP9sRYfXEA3qtf0Ci+GbZY/XAbVpe3sjgFJAD5jHYP7ek3z5OP3G1hJigXMPxhGjfOoVJugzPp6tyviVn7Oxd//ZYjdOXF35KU9R2mc3TlmwH1qZtUFRuFuNTbpsupmOM7R/h6VY4wJ2lZZsYCnVqYDyxJ7QtaNV8cfUoRJmn/PDdmOdvBfI2rjv3+OvfuBg5//AQkI3q8Wau/juBNLdv6nPjAvZgMd5fh9T9mEOqv6HfBz3espmpfBQecpcDugP1POXkWzkWtdYzOoWe2gwQ7XyuUC95DjC69/gy9uf/spwwkJtCD3CgW5cOnbaYIG5DMjGdsKWUns/kLQL 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)(376002)(136003)(396003)(39860400002)(346002)(36756003)(83380400001)(6506007)(66556008)(186003)(16526019)(6666004)(52116002)(8676002)(66946007)(8936002)(4326008)(26005)(66476007)(30864003)(478600001)(38100700002)(5660300002)(1076003)(956004)(86362001)(6486002)(2616005)(316002)(107886003)(38350700002)(2906002)(6512007)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 5ScOjyclp4/eCMEesZsgrHmHU6gMaEv+D/QKKZkByyMAanzCkTVe9RoNe+SKF6Ich5hLUEz6/nPf8pwLIOCq9ZtUimhcAcrAYScDo1h5WBO/dDGRwEP4Ea7ADlnuFA1dAbqO6+ZGQcvsBFRRPhK4PsvtUXUUK/4QFRjQApq/hhX+yKOjw3ByLZJQRGB03cFWVUy4+fCII6DJ+E3VKAnFuK9gkhFfo8Sz/IsSYASTqJT0eLIU0d930LC7XOvrMZJfFj6IyD6U7/C1Ori72WC1MTXgmx4FpdfNcXxEEA0DccBaiDZ5Qp/KN1gI9vAEk9dXhAcDbEDu+pRkyhHp8J9m86OVuC1Dr9JDmQtEWutiljA6yqGhxLlbzo/llncU1rnnmPG1rPyNH0JLrHreCN3YDeziIhrCIaoCxbOmEcKgcCa59iKzM2gQFKOHdnUAmQ0sSxyHYkoRw1b2ZegGHaVPFbRW8NpgkEdr5qa0j78O8cWpwH8NSM4xGw32e7CbraJD1dwFtVSikFC4q0UtMjt6INsbTft1SYNHOCWcQSxclI+dTrmfinIrEWWYekMpt5SsdzUuPWvhjxlYhVJe6sWSvdQVPIPJLRHCiJ4j/pSjE74A0NiJdeDcyNLHLVD0Kum23Dw0vRJ7HYLrkKqj/+ZPXetVZmtAOfvrgH4f4cN9nY+mBO/mP1BkRVpVm/5ddhLdXqfX/WylG17BpE67CaaV1UnVvBsxa4Jl4kq3r6hwgQ4JhgCM02z+Vxs7HaVCwj538G1qni67fyezqSh0Ahw6yA6Lb+8XkKKi1vNRTMFldeYK/TOe17cXGBbFFKBd92jcUyfYCHt1es1KwLTvcjH/LjjKLuUa/Xj1+1KaDfIcTd9VPtXFfgyXhyMmOfeXHJ3cHnU7OVAyFVpUvuwTl/2xisuAbonDkbD4rS/tIvFAUIpG76jLJqRTOrbASbm3uJolhu4LCQreTvctD2oU8gBZF3Qj5LmEKGumdiBhB2kwUUef7+cYCwEGDs+60bu+hW16Xl3HmV1xSXEw/4+LC1h5LG+p1L1sycOJQsRruCVHcR2BMm/GPSZqYpV+NueG2J/RLoQ2b5XPGwJEioVxh0cmqTSRkLJUttSNW6YXhlSnNWasZYbRzl0y4C0vgSDktze3MvP3pPUZThEfv5QNgv83d0GT9lue6HUszaRBmR4Vf8SeNvqfpw4gJSDArRIrmDNtre82ezYazIaXGx6dTb7aqHBEIzzFOUL48aFaMKcAoz4dYss6qVVOYT/kKpeO6LLKYGJVgD+t5eCiJRvp7FYbiSE23uA4L3XJBODfLzE0KjO2wfTMc4cgNre1BWRiGEgH X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c6facc7b-52a8-40de-d793-08d91fa9873e X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2021 18:18:43.0731 (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: X/I4fo+zTtboPbUIlpFpNy7oj3zP4sTfr+AfczAhVHXS0AWWuNx1yUcEhJ7VIp2DeqPovu6RLHyOAmQptLHVZPc2xmjaxEo1L7HOPM8soxg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB3891 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250112 X-Proofpoint-ORIG-GUID: lLAN0EosNXVkZ3bSICaQPlNAqFFHMLuH X-Proofpoint-GUID: lLAN0EosNXVkZ3bSICaQPlNAqFFHMLuH X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 bulkscore=0 phishscore=0 mlxlogscore=999 spamscore=0 mlxscore=0 priorityscore=1501 lowpriorityscore=0 impostorscore=0 adultscore=0 clxscore=1015 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250112 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If we haven't done a unbind target call we can race where iscsi_conn_teardown wakes up the EH thread and then frees the conn while those threads are still accessing the conn ehwait. We can only do one TMF per session so this just moves the TMF fields from the conn to the session. We can then rely on the iscsi_session_teardown->iscsi_remove_session->__iscsi_unbind_session call to remove the target and it's devices, and know after that point there is no device or scsi-ml callout trying to access the session. Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/libiscsi.c | 115 +++++++++++++++++++--------------------- include/scsi/libiscsi.h | 11 ++-- 2 files changed, 60 insertions(+), 66 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index b7445d9e99d6..94abb093098d 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -230,11 +230,11 @@ static int iscsi_prep_ecdb_ahs(struct iscsi_task *task) */ static int iscsi_check_tmf_restrictions(struct iscsi_task *task, int opcode) { - struct iscsi_conn *conn = task->conn; - struct iscsi_tm *tmf = &conn->tmhdr; + struct iscsi_session *session = task->conn->session; + struct iscsi_tm *tmf = &session->tmhdr; u64 hdr_lun; - if (conn->tmf_state == TMF_INITIAL) + if (session->tmf_state == TMF_INITIAL) return 0; if ((tmf->opcode & ISCSI_OPCODE_MASK) != ISCSI_OP_SCSI_TMFUNC) @@ -254,24 +254,19 @@ static int iscsi_check_tmf_restrictions(struct iscsi_task *task, int opcode) * Fail all SCSI cmd PDUs */ if (opcode != ISCSI_OP_SCSI_DATA_OUT) { - iscsi_conn_printk(KERN_INFO, conn, - "task [op %x itt " - "0x%x/0x%x] " - "rejected.\n", - opcode, task->itt, - task->hdr_itt); + iscsi_session_printk(KERN_INFO, session, + "task [op %x itt 0x%x/0x%x] rejected.\n", + opcode, task->itt, task->hdr_itt); return -EACCES; } /* * And also all data-out PDUs in response to R2T * if fast_abort is set. */ - if (conn->session->fast_abort) { - iscsi_conn_printk(KERN_INFO, conn, - "task [op %x itt " - "0x%x/0x%x] fast abort.\n", - opcode, task->itt, - task->hdr_itt); + if (session->fast_abort) { + iscsi_session_printk(KERN_INFO, session, + "task [op %x itt 0x%x/0x%x] fast abort.\n", + opcode, task->itt, task->hdr_itt); return -EACCES; } break; @@ -284,7 +279,7 @@ static int iscsi_check_tmf_restrictions(struct iscsi_task *task, int opcode) */ if (opcode == ISCSI_OP_SCSI_DATA_OUT && task->hdr_itt == tmf->rtt) { - ISCSI_DBG_SESSION(conn->session, + ISCSI_DBG_SESSION(session, "Preventing task %x/%x from sending " "data-out due to abort task in " "progress\n", task->itt, @@ -936,20 +931,21 @@ iscsi_data_in_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr, static void iscsi_tmf_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr) { struct iscsi_tm_rsp *tmf = (struct iscsi_tm_rsp *)hdr; + struct iscsi_session *session = conn->session; conn->exp_statsn = be32_to_cpu(hdr->statsn) + 1; conn->tmfrsp_pdus_cnt++; - if (conn->tmf_state != TMF_QUEUED) + if (session->tmf_state != TMF_QUEUED) return; if (tmf->response == ISCSI_TMF_RSP_COMPLETE) - conn->tmf_state = TMF_SUCCESS; + session->tmf_state = TMF_SUCCESS; else if (tmf->response == ISCSI_TMF_RSP_NO_TASK) - conn->tmf_state = TMF_NOT_FOUND; + session->tmf_state = TMF_NOT_FOUND; else - conn->tmf_state = TMF_FAILED; - wake_up(&conn->ehwait); + session->tmf_state = TMF_FAILED; + wake_up(&session->ehwait); } static int iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin *rhdr) @@ -1826,15 +1822,14 @@ EXPORT_SYMBOL_GPL(iscsi_target_alloc); static void iscsi_tmf_timedout(struct timer_list *t) { - struct iscsi_conn *conn = from_timer(conn, t, tmf_timer); - struct iscsi_session *session = conn->session; + struct iscsi_session *session = from_timer(session, t, tmf_timer); spin_lock(&session->frwd_lock); - if (conn->tmf_state == TMF_QUEUED) { - conn->tmf_state = TMF_TIMEDOUT; + if (session->tmf_state == TMF_QUEUED) { + session->tmf_state = TMF_TIMEDOUT; ISCSI_DBG_EH(session, "tmf timedout\n"); /* unblock eh_abort() */ - wake_up(&conn->ehwait); + wake_up(&session->ehwait); } spin_unlock(&session->frwd_lock); } @@ -1857,8 +1852,8 @@ static int iscsi_exec_task_mgmt_fn(struct iscsi_conn *conn, return -EPERM; } conn->tmfcmd_pdus_cnt++; - conn->tmf_timer.expires = timeout * HZ + jiffies; - add_timer(&conn->tmf_timer); + session->tmf_timer.expires = timeout * HZ + jiffies; + add_timer(&session->tmf_timer); ISCSI_DBG_EH(session, "tmf set timeout\n"); spin_unlock_bh(&session->frwd_lock); @@ -1872,12 +1867,12 @@ static int iscsi_exec_task_mgmt_fn(struct iscsi_conn *conn, * 3) session is terminated or restarted or userspace has * given up on recovery */ - wait_event_interruptible(conn->ehwait, age != session->age || + wait_event_interruptible(session->ehwait, age != session->age || session->state != ISCSI_STATE_LOGGED_IN || - conn->tmf_state != TMF_QUEUED); + session->tmf_state != TMF_QUEUED); if (signal_pending(current)) flush_signals(current); - del_timer_sync(&conn->tmf_timer); + del_timer_sync(&session->tmf_timer); mutex_lock(&session->eh_mutex); spin_lock_bh(&session->frwd_lock); @@ -2308,17 +2303,17 @@ int iscsi_eh_abort(struct scsi_cmnd *sc) } /* only have one tmf outstanding at a time */ - if (conn->tmf_state != TMF_INITIAL) + if (session->tmf_state != TMF_INITIAL) goto failed; - conn->tmf_state = TMF_QUEUED; + session->tmf_state = TMF_QUEUED; - hdr = &conn->tmhdr; + hdr = &session->tmhdr; iscsi_prep_abort_task_pdu(task, hdr); if (iscsi_exec_task_mgmt_fn(conn, hdr, age, session->abort_timeout)) goto failed; - switch (conn->tmf_state) { + switch (session->tmf_state) { case TMF_SUCCESS: spin_unlock_bh(&session->frwd_lock); /* @@ -2333,7 +2328,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc) */ spin_lock_bh(&session->frwd_lock); fail_scsi_task(task, DID_ABORT); - conn->tmf_state = TMF_INITIAL; + session->tmf_state = TMF_INITIAL; memset(hdr, 0, sizeof(*hdr)); spin_unlock_bh(&session->frwd_lock); iscsi_start_tx(conn); @@ -2344,7 +2339,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc) goto failed_unlocked; case TMF_NOT_FOUND: if (!sc->SCp.ptr) { - conn->tmf_state = TMF_INITIAL; + session->tmf_state = TMF_INITIAL; memset(hdr, 0, sizeof(*hdr)); /* task completed before tmf abort response */ ISCSI_DBG_EH(session, "sc completed while abort in " @@ -2353,7 +2348,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc) } fallthrough; default: - conn->tmf_state = TMF_INITIAL; + session->tmf_state = TMF_INITIAL; goto failed; } @@ -2414,11 +2409,11 @@ int iscsi_eh_device_reset(struct scsi_cmnd *sc) conn = session->leadconn; /* only have one tmf outstanding at a time */ - if (conn->tmf_state != TMF_INITIAL) + if (session->tmf_state != TMF_INITIAL) goto unlock; - conn->tmf_state = TMF_QUEUED; + session->tmf_state = TMF_QUEUED; - hdr = &conn->tmhdr; + hdr = &session->tmhdr; iscsi_prep_lun_reset_pdu(sc, hdr); if (iscsi_exec_task_mgmt_fn(conn, hdr, session->age, @@ -2427,7 +2422,7 @@ int iscsi_eh_device_reset(struct scsi_cmnd *sc) goto unlock; } - switch (conn->tmf_state) { + switch (session->tmf_state) { case TMF_SUCCESS: break; case TMF_TIMEDOUT: @@ -2435,7 +2430,7 @@ int iscsi_eh_device_reset(struct scsi_cmnd *sc) iscsi_conn_failure(conn, ISCSI_ERR_SCSI_EH_SESSION_RST); goto done; default: - conn->tmf_state = TMF_INITIAL; + session->tmf_state = TMF_INITIAL; goto unlock; } @@ -2447,7 +2442,7 @@ int iscsi_eh_device_reset(struct scsi_cmnd *sc) spin_lock_bh(&session->frwd_lock); memset(hdr, 0, sizeof(*hdr)); fail_scsi_tasks(conn, sc->device->lun, DID_ERROR); - conn->tmf_state = TMF_INITIAL; + session->tmf_state = TMF_INITIAL; spin_unlock_bh(&session->frwd_lock); iscsi_start_tx(conn); @@ -2470,8 +2465,7 @@ void iscsi_session_recovery_timedout(struct iscsi_cls_session *cls_session) spin_lock_bh(&session->frwd_lock); if (session->state != ISCSI_STATE_LOGGED_IN) { session->state = ISCSI_STATE_RECOVERY_FAILED; - if (session->leadconn) - wake_up(&session->leadconn->ehwait); + wake_up(&session->ehwait); } spin_unlock_bh(&session->frwd_lock); } @@ -2516,7 +2510,7 @@ int iscsi_eh_session_reset(struct scsi_cmnd *sc) iscsi_put_conn(conn->cls_conn); ISCSI_DBG_EH(session, "wait for relogin\n"); - wait_event_interruptible(conn->ehwait, + wait_event_interruptible(session->ehwait, session->state == ISCSI_STATE_TERMINATE || session->state == ISCSI_STATE_LOGGED_IN || session->state == ISCSI_STATE_RECOVERY_FAILED); @@ -2577,11 +2571,11 @@ static int iscsi_eh_target_reset(struct scsi_cmnd *sc) conn = session->leadconn; /* only have one tmf outstanding at a time */ - if (conn->tmf_state != TMF_INITIAL) + if (session->tmf_state != TMF_INITIAL) goto unlock; - conn->tmf_state = TMF_QUEUED; + session->tmf_state = TMF_QUEUED; - hdr = &conn->tmhdr; + hdr = &session->tmhdr; iscsi_prep_tgt_reset_pdu(sc, hdr); if (iscsi_exec_task_mgmt_fn(conn, hdr, session->age, @@ -2590,7 +2584,7 @@ static int iscsi_eh_target_reset(struct scsi_cmnd *sc) goto unlock; } - switch (conn->tmf_state) { + switch (session->tmf_state) { case TMF_SUCCESS: break; case TMF_TIMEDOUT: @@ -2598,7 +2592,7 @@ static int iscsi_eh_target_reset(struct scsi_cmnd *sc) iscsi_conn_failure(conn, ISCSI_ERR_SCSI_EH_SESSION_RST); goto done; default: - conn->tmf_state = TMF_INITIAL; + session->tmf_state = TMF_INITIAL; goto unlock; } @@ -2610,7 +2604,7 @@ static int iscsi_eh_target_reset(struct scsi_cmnd *sc) spin_lock_bh(&session->frwd_lock); memset(hdr, 0, sizeof(*hdr)); fail_scsi_tasks(conn, -1, DID_ERROR); - conn->tmf_state = TMF_INITIAL; + session->tmf_state = TMF_INITIAL; spin_unlock_bh(&session->frwd_lock); iscsi_start_tx(conn); @@ -2940,7 +2934,10 @@ iscsi_session_setup(struct iscsi_transport *iscsit, struct Scsi_Host *shost, session->tt = iscsit; session->dd_data = cls_session->dd_data + sizeof(*session); + session->tmf_state = TMF_INITIAL; + timer_setup(&session->tmf_timer, iscsi_tmf_timedout, 0); mutex_init(&session->eh_mutex); + spin_lock_init(&session->frwd_lock); spin_lock_init(&session->back_lock); @@ -3044,7 +3041,6 @@ iscsi_conn_setup(struct iscsi_cls_session *cls_session, int dd_size, conn->c_stage = ISCSI_CONN_INITIAL_STAGE; conn->id = conn_idx; conn->exp_statsn = 0; - conn->tmf_state = TMF_INITIAL; timer_setup(&conn->transport_timer, iscsi_check_transport_timeouts, 0); @@ -3069,8 +3065,7 @@ iscsi_conn_setup(struct iscsi_cls_session *cls_session, int dd_size, goto login_task_data_alloc_fail; conn->login_task->data = conn->data = data; - timer_setup(&conn->tmf_timer, iscsi_tmf_timedout, 0); - init_waitqueue_head(&conn->ehwait); + init_waitqueue_head(&session->ehwait); return cls_conn; @@ -3105,7 +3100,7 @@ void iscsi_conn_teardown(struct iscsi_cls_conn *cls_conn) * leading connection? then give up on recovery. */ session->state = ISCSI_STATE_TERMINATE; - wake_up(&conn->ehwait); + wake_up(&session->ehwait); } spin_unlock_bh(&session->frwd_lock); @@ -3180,7 +3175,7 @@ int iscsi_conn_start(struct iscsi_cls_conn *cls_conn) * commands after successful recovery */ conn->stop_stage = 0; - conn->tmf_state = TMF_INITIAL; + session->tmf_state = TMF_INITIAL; session->age++; if (session->age == 16) session->age = 0; @@ -3194,7 +3189,7 @@ int iscsi_conn_start(struct iscsi_cls_conn *cls_conn) spin_unlock_bh(&session->frwd_lock); iscsi_unblock_session(session->cls_session); - wake_up(&conn->ehwait); + wake_up(&session->ehwait); return 0; } EXPORT_SYMBOL_GPL(iscsi_conn_start); @@ -3288,7 +3283,7 @@ void iscsi_conn_stop(struct iscsi_cls_conn *cls_conn, int flag) spin_lock_bh(&session->frwd_lock); fail_scsi_tasks(conn, -1, DID_TRANSPORT_DISRUPTED); fail_mgmt_tasks(session, conn); - memset(&conn->tmhdr, 0, sizeof(conn->tmhdr)); + memset(&session->tmhdr, 0, sizeof(session->tmhdr)); spin_unlock_bh(&session->frwd_lock); mutex_unlock(&session->eh_mutex); } diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index 13d413a0b8b6..9d7908265afe 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h @@ -202,12 +202,6 @@ struct iscsi_conn { unsigned long suspend_tx; /* suspend Tx */ unsigned long suspend_rx; /* suspend Rx */ - /* abort */ - wait_queue_head_t ehwait; /* used in eh_abort() */ - struct iscsi_tm tmhdr; - struct timer_list tmf_timer; - int tmf_state; /* see TMF_INITIAL, etc.*/ - /* negotiated params */ unsigned max_recv_dlength; /* initiator_max_recv_dsl*/ unsigned max_xmit_dlength; /* target_max_recv_dsl */ @@ -277,6 +271,11 @@ struct iscsi_session { * and recv lock. */ struct mutex eh_mutex; + /* abort */ + wait_queue_head_t ehwait; /* used in eh_abort() */ + struct iscsi_tm tmhdr; + struct timer_list tmf_timer; + int tmf_state; /* see TMF_INITIAL, etc.*/ /* iSCSI session-wide sequencing */ uint32_t cmdsn; From patchwork Tue May 25 18:18:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 447693 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 982F2C47085 for ; Tue, 25 May 2021 18:19:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6E24061408 for ; Tue, 25 May 2021 18:19:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232226AbhEYSUc (ORCPT ); Tue, 25 May 2021 14:20:32 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:44150 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232203AbhEYSUY (ORCPT ); Tue, 25 May 2021 14:20:24 -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 14PIFVht125090; Tue, 25 May 2021 18:18:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=OEMuAWAvBA/bJHR/aPTTEQUBCaFIm/HY9Zw0x26Y8jc=; b=YpoJbLaMIIeHlF+uVQecXCsyeFFlbolTc7zlF0mi7pBNEHSK0JI/Q1tTAE5lDj67dwQV 5E8hZZZLU924bUCPqaKgyk4T2OGlAcbzF8UOjGoLk5LXQIPNt8wDH9D/rGwj74MG6M70 L4OvXYLKUu2oVZhe2dh+DYLLzmm1A8sij/057ual7mpAczncj9WUM3lhtX7gnw+5sAEf 85pk9VuqQK4sWd5FervxtpmK4ytBeo1KTCCvHNWtRg39p6tboBIwoaK0M8DLePvmu+E6 4LLUU6m6/u3WOnY5tVcZGQq+sAXdohDQk0v5MbbBpgMCiL0nenyP/OxjCtFsXnMf8ETP pg== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2130.oracle.com with ESMTP id 38pqfceyrr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 May 2021 18:18:47 +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 14PIGDX5010869; Tue, 25 May 2021 18:18:46 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2045.outbound.protection.outlook.com [104.47.51.45]) by userp3020.oracle.com with ESMTP id 38qbqsgh0g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 May 2021 18:18:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZSJuBnU+5+d4PkfpWtQyLPLlsIL4PlhzpRQG0E//Qe9m3N//Y+y5IkoK4e07FpN9+Y0MRTdjC+EKXjOjfqLEt6jU4u3c+fnHOmKN0aFdGOohgDsxBb6UWUrsDIS7oY0Rw7oFAw1/XaX6LeuynhjbtkzeY4zi/4OcSK8rClXtQpxx3e700QkqQikAVcTaC6Hcaf42AVQL/c9z5Dqzo2AJIqZmr0SFC0YjZW2WKNBYMfsYr9/LnPKFODYRVFxn+zaPdJ+642y+QXTsMEsyzCCfBEdwZBUiY+gPtGMtnTp9fRuhCtObihSa2ztHTtzfvw/OSixjHYbwSsrBAYNQvww2Eg== 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=OEMuAWAvBA/bJHR/aPTTEQUBCaFIm/HY9Zw0x26Y8jc=; b=ikV427tLenA/CwJmQkMpqqElVYyo+XSJhM4AuVDyGTyd3DQt6peDLdTdXvSZC/TTmVT6ZjvOytYmG1KLzNR8xnpdnPlHDCcDaWETSLxgLk70n5JTyvJ36Jfg1BjNnuGU0xV6YJxkNA5tGoezdVGN9dwiYfpqFVb+KgddXkY1YrYecXlinZ0Bih0qe4H4LRLFk0YrbMkUpmGdF2msno9PAUJDWXgpY3RkdCMgUtpr0cgyg6iAzFuMMMzRhdcJZhwHnBYLedXXrFPt/fxmanBFxCVR96WWlrPEWw5U04UrbSgU+kvOjNGJSGA4/6ZfqDBgN9P7D2KPSukVOEdrWkbxSQ== 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=OEMuAWAvBA/bJHR/aPTTEQUBCaFIm/HY9Zw0x26Y8jc=; b=bmBEF3OekZy5+fQ+b4qeNDwvey53ke3Hzko/Lh9M7aQ+tDFx5RqAG+n/5L0GoLqKsxi/QGdwIaKpHx1xWe8swRX6ecrtuFV0iFrx/vUcluftZaRzLxjd/xs99y0KPQWXcM+oNiBDdrWJYQgEPBdEhcaaSv+0d1pW8bIuvFmzCuU= 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 BY5PR10MB3891.namprd10.prod.outlook.com (2603:10b6:a03:1b3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.27; Tue, 25 May 2021 18:18:44 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::b09d:e36a:4258:d3d0]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::b09d:e36a:4258:d3d0%7]) with mapi id 15.20.4173.020; Tue, 25 May 2021 18:18:44 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, njavali@marvell.com, mrangankar@marvell.com, GR-QLogic-Storage-Upstream@marvell.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH v2 14/28] scsi: iscsi: Fix shost->max_id use Date: Tue, 25 May 2021 13:18:07 -0500 Message-Id: <20210525181821.7617-15-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210525181821.7617-1-michael.christie@oracle.com> References: <20210525181821.7617-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM5PR21CA0003.namprd21.prod.outlook.com (2603:10b6:3:ac::13) 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 DM5PR21CA0003.namprd21.prod.outlook.com (2603:10b6:3:ac::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.2 via Frontend Transport; Tue, 25 May 2021 18:18:43 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 75fd3701-5214-4513-3027-08d91fa987e9 X-MS-TrafficTypeDiagnostic: BY5PR10MB3891: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eLBJSqWDmD0UyOl8ew7POyJqLRLr5kRRtRLGqu1eNQWn9RARkFCAyOyKz0C98rwxIAF1FMTUK66BxdqEK3p0QMRQtvytiX4T2MZNqyPv3wo0oq5wJ+1R+52NGRtFMy+LCmJ9hWcuXcFPsCI7fkCXsN0OfchsjuMkIHrrayd7YoShre1j9agETgzf2doibvKrh2Y22BH0rwaCA+XwSVqI2n+Bdk7MA9KvTQysq8+lSxJIY9lakVD1SpiOuzN5Z92K3zXTZcDVopOueoYwQQjdpcmkGMNuJz/AF7uksnx1wmJx4rdzEAGEBUX3BSIMEqm6H2tvdAZPfSoifo6Pth5NSDH+yLeCN9g6TzSPqg7rGgwBlFlxOIKV3o9O22NT1dtVQx67EU/XKSCbs9vjPjwVqCqyH2crh0/J4ujYiGVkqyIJdKzqQE59sAU3f8Wy+LYVLjwXhOqU/23T9KfyX7vRhYq1sGvspTRiZOF+lVcB145p40eTL7PdUQD3DOr3TLe1imtVw8ptK5Gjaer9jrkMjm1l/kfRfnOP1YuRaj1infOdCvqqm0Bvsk2pYauIQG6mVA+f2NxdoBDqU/XHHaxl1sBJJsYNvsMgtjfn6OLuOgNWZkcKVbA1g00xQTZsX+EP4TTTd071/uVri+9uSPx66XmHKuf3OzwMUw4YON84qkZY0jKJyCMu3nQ2MxFG1Icj 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)(376002)(136003)(396003)(39860400002)(346002)(36756003)(83380400001)(6506007)(66556008)(186003)(16526019)(6666004)(52116002)(8676002)(66946007)(8936002)(4326008)(26005)(66476007)(478600001)(38100700002)(5660300002)(1076003)(956004)(86362001)(6486002)(2616005)(316002)(107886003)(38350700002)(2906002)(6512007)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: pPwB5U7+HQI4M5+Au7rjUGqkOmSJuaDuB3rJz25V2hk0YqDU4oGNBu5Nu2a0TP224vQcvpcTDUNubHXeuq4O6vqwEvxxBi1M8D6tY6knkRprnnl68l+Hi5n1eYiEbuvhGTQ2USsXO9chTsj/2m7P96T4cty6DqngFOR5ukHwsX7EX0+QMkxCYKmKPp+Bj3u6dCqDFFO7sl3O7Wd+pfkAKQsscjJHN4a7qvNmI4D06EYaclBLCSDe1jiQXh872UxQW4uKBzPX+KrqCiRfVLD3CAz+89dp1wqZNzFKQ6LIgUjtjzlbQRU3R4lfbXby3zqeC/yuLSoAk53PQI8VACq45jkZ9thwia3KxY+zGXLpwiQGDqpvMvU/OVgh97DG9j2GnHsE3E4s3InHN8ycyWVpKRluOoyMn2d0bo0ts9ypqTGCfbBCi1IwwRghJ6kVDINBzfraCRmWxHjofpN25Ojutjt4LafT16qJ/i66P4Eo2MOxovyA5VxvABGpJFuJ2e+6Q25QFiIOtHwh+m2Mqm/vecrnXbvoPrt+1WaqY/99fz4Fpoy1CNmry+SyOluHCmW32tNDyxllsDsEkaUKLpHRK//ra51PQJislVTfMIDuY9Ii3mxK0Nn4W80v636IVhCqVu6NJ2a5PVfggkgzLperCAaV8osCBbwxCx81dEVBgML79cKuFotKcH5qKwwjdlJff6gsRtRp06XSkJcImOQDcFtnm3xC+82kCV1GoA9O379wgHbV3JgSrBCeBvEgbOKu+rZph+iqFbPGO1ARZkOBdlwn/n0vRY7GE5rY+9oumApwHy5qllXDPf8fKknmlqGQYMksME0yH+jtDZZjKDO6NDGdAUhUbwn9ahXX1u0jfTTpuRMU/3Y2FKsVpQSWP45FddonMWTnoqrU5AgBwH2sImb5CD0lF4pRaEb7SUC7VS9GOzcoHQWYIWPl+U4h7f8+ZTFNCv9o5Tc8wdVeqKSSqqyjQsHL9hyBe4fZRsziNL6VRwg9rL4jv3hI+rMZ9sqQKVWD/gCtD4MDQfaEwQZBXNzrVowTRbHA0p0rH1CKTp7TS1N4cIVbyjcIKC9dCBkkXbn4W5toawlnNMMpV9sBCj5HEL2GD/wld/Ggwt8ZoIVW7sNAKURCSy3VqWL4/oq/JYA7jWTmYQs2Zxnqh6lpVfL0ru6mq0N8f0Lb9+lP4Qz/f3/GWNFnuB10105lBJ7t3uq6MFc2KbaS/eX3dYIpMBuoEiripLNmZrFHOVlwVozXOmlMx6XnomaI+NfiOSc0YwldKa3udNIhXea12i+njt2jHJtqv9++n/XyyaEb5WVBGsrSPX3qcjquvqRmanOd X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 75fd3701-5214-4513-3027-08d91fa987e9 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2021 18:18:44.1295 (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: nRxMgo0WsDAYW/y20aOusd1VFO2JSy9NJug3wxf3EdwBQ4cmq++V5vdG/owuVpZOacZvlhM927+gZLwivzcABRdwO7aGVLA9XIhlb+TK7jY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB3891 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250112 X-Proofpoint-ORIG-GUID: f_oK4dcDRZC6qY1QqOEnNiudEV3miHC3 X-Proofpoint-GUID: f_oK4dcDRZC6qY1QqOEnNiudEV3miHC3 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 mlxscore=0 malwarescore=0 mlxlogscore=999 lowpriorityscore=0 impostorscore=0 adultscore=0 phishscore=0 priorityscore=1501 clxscore=1015 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250112 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The iscsi offload drivers are setting the shost->max_id to the max number of sessions they support. The problem is that max_id is not the max number of targets but the highest identifier the targets can have. To use it to limit the number of targets we need to set it to max sessions - 1, or we can end up with a session we might not have preallocated resources for. Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/be2iscsi/be_main.c | 4 ++-- drivers/scsi/bnx2i/bnx2i_iscsi.c | 2 +- drivers/scsi/cxgbi/libcxgbi.c | 4 ++-- drivers/scsi/qedi/qedi_main.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c index 27c4f1598f76..d941e1561527 100644 --- a/drivers/scsi/be2iscsi/be_main.c +++ b/drivers/scsi/be2iscsi/be_main.c @@ -416,7 +416,7 @@ static struct beiscsi_hba *beiscsi_hba_alloc(struct pci_dev *pcidev) "beiscsi_hba_alloc - iscsi_host_alloc failed\n"); return NULL; } - shost->max_id = BE2_MAX_SESSIONS; + shost->max_id = BE2_MAX_SESSIONS - 1; shost->max_channel = 0; shost->max_cmd_len = BEISCSI_MAX_CMD_LEN; shost->max_lun = BEISCSI_NUM_MAX_LUN; @@ -5318,7 +5318,7 @@ static int beiscsi_enable_port(struct beiscsi_hba *phba) /* Re-enable UER. If different TPE occurs then it is recoverable. */ beiscsi_set_uer_feature(phba); - phba->shost->max_id = phba->params.cxns_per_ctrl; + phba->shost->max_id = phba->params.cxns_per_ctrl - 1; phba->shost->can_queue = phba->params.ios_per_ctrl; ret = beiscsi_init_port(phba); if (ret < 0) { diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c index 26cb1c6536ce..1b5f3e143f07 100644 --- a/drivers/scsi/bnx2i/bnx2i_iscsi.c +++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c @@ -791,7 +791,7 @@ struct bnx2i_hba *bnx2i_alloc_hba(struct cnic_dev *cnic) return NULL; shost->dma_boundary = cnic->pcidev->dma_mask; shost->transportt = bnx2i_scsi_xport_template; - shost->max_id = ISCSI_MAX_CONNS_PER_HBA; + shost->max_id = ISCSI_MAX_CONNS_PER_HBA - 1; shost->max_channel = 0; shost->max_lun = 512; shost->max_cmd_len = 16; diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c index dbe22a7136f3..8c7d4dda4cf2 100644 --- a/drivers/scsi/cxgbi/libcxgbi.c +++ b/drivers/scsi/cxgbi/libcxgbi.c @@ -337,7 +337,7 @@ void cxgbi_hbas_remove(struct cxgbi_device *cdev) EXPORT_SYMBOL_GPL(cxgbi_hbas_remove); int cxgbi_hbas_add(struct cxgbi_device *cdev, u64 max_lun, - unsigned int max_id, struct scsi_host_template *sht, + unsigned int max_conns, struct scsi_host_template *sht, struct scsi_transport_template *stt) { struct cxgbi_hba *chba; @@ -357,7 +357,7 @@ int cxgbi_hbas_add(struct cxgbi_device *cdev, u64 max_lun, shost->transportt = stt; shost->max_lun = max_lun; - shost->max_id = max_id; + shost->max_id = max_conns - 1; shost->max_channel = 0; shost->max_cmd_len = SCSI_MAX_VARLEN_CDB_SIZE; diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c index 2455d1448a7e..edf915432704 100644 --- a/drivers/scsi/qedi/qedi_main.c +++ b/drivers/scsi/qedi/qedi_main.c @@ -640,7 +640,7 @@ static struct qedi_ctx *qedi_host_alloc(struct pci_dev *pdev) goto exit_setup_shost; } - shost->max_id = QEDI_MAX_ISCSI_CONNS_PER_HBA; + shost->max_id = QEDI_MAX_ISCSI_CONNS_PER_HBA - 1; shost->max_channel = 0; shost->max_lun = ~0; shost->max_cmd_len = 16; From patchwork Tue May 25 18:18:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 447691 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 07262C4707F for ; Tue, 25 May 2021 18:19:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DC9A661404 for ; Tue, 25 May 2021 18:19:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232206AbhEYSUg (ORCPT ); Tue, 25 May 2021 14:20:36 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:60862 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232224AbhEYSUc (ORCPT ); Tue, 25 May 2021 14:20:32 -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 14PIG6ME122195; Tue, 25 May 2021 18:18:48 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=qtsXpH1jK3OfE+VxUDxHasXwkBuyw7plPs2MoHHogV0=; b=Hzay13a8BDpUHUnRB4+VLU23rsK/FH0lBdnpGSx+f1jE061Dx2bcu8XhB/zSslzNWT25 frajIj6vZZCSpyoWTVxV/Pr7AEqTEceH2Ib4DN4aeGAr3B8ium98jpVIe29GANXNNREQ WYjIu3qaEkHhCzFBZ1kAB/rFv6zDVXYWX+e6xn9Ua2UPF3iDDDTMvK0YKSiN3kE1tEZK yOEBnipp1oQyFU2a8GVOjLZydJCIUvsgHI3HHOLHceshzv/vl2eu9vkdmjdZZunqg4z2 q6scCjXaU7qAVPWeq8LvFOi5cTconojwrzL8v5mq/GWqy3Nrj4ZrnYrydY2InD1kGhfq zA== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 38q3q8xcva-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 May 2021 18:18:48 +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 14PIGDX7010869; Tue, 25 May 2021 18:18:48 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2045.outbound.protection.outlook.com [104.47.51.45]) by userp3020.oracle.com with ESMTP id 38qbqsgh0g-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 May 2021 18:18:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MDlAJaEjn11jNKfB5qhtSLUPbVoDjzT9YgeYLVeaDeeugG6v2JMjqAr9dYbL4mJ+9AgbY9MN2NZpqMoLvSMRgkdC1wmOKxfJe4R/TNWO8C0WHk4qEFj/g+ASKaKtGK1EXBeuOQjJJhi0S8t4qu3LDGTu5mL1LxKOOKU+LLJqmTjZsKz9+2ljVnn8uHr6toCqywtUcnUxk9aH0LLkZepTRqc5S6KGgnrbuZroOfzbWlrYrvKKWS8aTjK274EMVa2vvr9ZEA5nFIrBZocBxfg7z6m8nTWhm2bcab+oP0D+GnorExwgy4yW6QWWvZQP4pbt4MAYbDOtvEz7q7yccEYzPw== 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=qtsXpH1jK3OfE+VxUDxHasXwkBuyw7plPs2MoHHogV0=; b=ex4LlimC11BF/gNq7tKKD9RzpMj1LfUUPCCBRiFg3liYc4agE7kvU+XJb4OLnh2afKtqdSYy6u2yOuMPraaEi7vRlT/bd1GoCl9ny6eZUksjQjRpGis0w5QkCSsDYa0JuF56qS3sXbpJmVfL3TjlD8qEfpJQ4cGDVT6+JLarsAKyhvzifzNCJUWabyk2N4RE8x9FqNqQxiyOM8g2XZEE6BlkEgYDk2ePkKaRL1nBvVx9o4h4NGfbQEPIKiPxqMPBCvIGkCj0EeSWuZvZ0qoFfReyHvQCSrg0Js05nPJWAkx6txS48WNK9F+gIiEpWkyM8n+ApzL6a6OzFE8qDUF6Mw== 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=qtsXpH1jK3OfE+VxUDxHasXwkBuyw7plPs2MoHHogV0=; b=NXwo5k7IIsPb1NoWBSRQiII/2I1v93k0jEj/miXXDsYVntcqyr6lKjvbBklqCUY+vwYP3gvKL3uzc//c0vTR2PelzUK2irsVZo146mf9FqEbJozTGqWubDZAB13P+d4m/jRkIyi+ccw8rV9jZPKuQv0dMJsV7BV4T3uuRFbDPFI= 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 BY5PR10MB3891.namprd10.prod.outlook.com (2603:10b6:a03:1b3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.27; Tue, 25 May 2021 18:18:46 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::b09d:e36a:4258:d3d0]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::b09d:e36a:4258:d3d0%7]) with mapi id 15.20.4173.020; Tue, 25 May 2021 18:18:46 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, njavali@marvell.com, mrangankar@marvell.com, GR-QLogic-Storage-Upstream@marvell.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH v2 16/28] scsi: iscsi: Flush block work before unblock Date: Tue, 25 May 2021 13:18:09 -0500 Message-Id: <20210525181821.7617-17-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210525181821.7617-1-michael.christie@oracle.com> References: <20210525181821.7617-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM5PR21CA0003.namprd21.prod.outlook.com (2603:10b6:3:ac::13) 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 DM5PR21CA0003.namprd21.prod.outlook.com (2603:10b6:3:ac::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.2 via Frontend Transport; Tue, 25 May 2021 18:18:45 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 495e6e76-0d24-4f30-7a3b-08d91fa9892e X-MS-TrafficTypeDiagnostic: BY5PR10MB3891: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cRv2+9CRUrtrltXIO+1wEidLlJb8d5+uxv5FxVKj/HHyXpTxIEn2mifhnuni0cW3YQ4y7NxsZ++lMMsEtGmDSx/hlQdvcZl3fR6NWFKo8J9L96D4goILfhZWRYsuA0WZcoxs4FMZPYs3WBsfXTbxOQZ4EUxXZflxiC4LjcsnP8Smj9I6GZe5RlsJIfgo2Omy1e0n+wjL0uzyjrghe89iFouYrub7MU3uNQN/dmaqUQPv8XliJbgHEioQZkJxmmpsqsExv1c1ZX2tjWi5LzxGMvCARX1yxvyma6XsF2YFz/tqUtiV5jgd/XQXqLGIeVbQVrLPl7w224G8ooP1TPYK4688b71BLHwc2YdrkXj5ABU0NE6omMAhf/KL9+1RdlGbvuDvuKy4C+ZmrMhIY7GGueDtz6y6JS+A81tllXlRpaoNwmonz2opYm1AwHz+v/ptnSsSaHaZtIefoc9rSZkDxAn8x2WYfChGrtSxU25JVsFVJp9BoMAhfQVVWC2A4DNwYMSORIxm7fWq9x0iWGTYRlE3bmt/JNnndoqubJa8T8HBgA5YOfSvMkRPJk2pVwF9QSBZEz2BUVQ4jdC/HMNPaYXscI/6mlbhB8a1Q8MpekZisPkSw8VhiheM2pjKawY7Dy68vE8eWJN3EErTbKh8OEyYN1xUbZ/EYFvpSDtFUoCxiJRcW26gNSytoohn7rkk 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)(376002)(136003)(396003)(39860400002)(346002)(36756003)(83380400001)(6506007)(66556008)(186003)(16526019)(6666004)(52116002)(8676002)(66946007)(8936002)(4326008)(26005)(66476007)(478600001)(38100700002)(5660300002)(1076003)(956004)(86362001)(6486002)(2616005)(316002)(107886003)(38350700002)(2906002)(6512007)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 5QAnSkn2hix+fGOjGuN2aJF26WjoLcyu5Ll5UTTdYBdRumPFjoZcGsPmLUBbsgxTT5pZyDHGQQuOQdD55LeJCMS3wxKE7LxEaB8CimuSdtrACOiCKGYTYB1Fw4eR5kSc7VQ1PcHhB74nzIdDAZFRHF+g7kj+HoEnMhHQWeUtnE6LxSuOz6xBM/k0Z1zMmIySDCzrfX1mx2Pk4oBoseCGGxsb89i3yHEvBrPV2ngcm6qE4F95PsfXfbxQ8fpjfRQH6SpnxkkItJ/GvblClRsc6qI8AiKjNz0qLN/rwUU33gPK+0YPrCRV6a64x1zBqikEqgSlztaGWmz0/zku8C/xlG1lcoMhW3ns71l6ghQTqxS4nl7iRdHdpMp/p30lfdqxp82RF5iMdPaHIMdS6vtgsIcEDQqylkuuMOnBA2yv0jmctpTdGKU06XAt5j1hMZFIUI+NQsa9BuufPPX7Zs5SvLPguk51osSPFgHBNKPxK99qeGFIH9HziuhcTtD9ef1JQItk4efXOzQ8P6bT2UKOL+V8i2r3txGwF4/QJ7vgcTeQFzYi7g31JRto/UarlKOBDvrmhqrjRJecgrFzS47Dn9yzHcfuLE1d6Qw+f+maAU/VO4B+Uk33loE7S6nv6haYIkfvRj82f12SQdINd6yOqh9Z1ZmB3orVJiugO0/A5+KnQzsBpxxO79GAIAnXKMTeW0GoOiICH7kctvfb/P2GMcG1FJmaukejtRK76A0i1dNqv6cFOkNkEI493ua7g2B5PxLzIgJypi/FqCBdiTPZQB2HEI/Z3bTRkgUls1K8KTGLrzzfQdzqYNwsU0Zy31o5uQ7XELCNmqxn1U7louL4nXPNn9lI2vjGQKUW6T6furwFCo+eTvqCRzET4pAdvG2A4yvHL7LOGLakQYqHkgZoD4DoV995dCSA9jy9mRyP4/yzgzkyG22wNSdSdBvsjLzLpuL6wFfpE9fZ+leWwmLGc6HJHX5p0xukskrsgA+HpFV1dRVPPeBPXs7jOHR6aCGf6xArl4gGYw3sKObXb9mqri62QYyIBkSS6LuasgkRNPY4VxTpOtoYF5RGes+784iOP7omWo6TPk9VXXYD6Rrc08b30KLOFIz5r+1Dpy+TVkS3yGEO0s05wZnBPzlpXb+I1Z0o8z9zs9t1s+WgACtKxJe3jZyIZNnQX2LeRGhTxUdpPjQTWhyBs/zVIw0mt9Ns6GoPAsiGrK+Y9OJ6VibrhLGzyCCP0/KSplc8G5E9xs7PMmc2HpqfONKwj6rWafhJeRsH0hwdEWA72/7ZHMG7+5klT5nlUa26kfT9OT+sNILYPEKjc5K7XL8AqPZIs4fl X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 495e6e76-0d24-4f30-7a3b-08d91fa9892e X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2021 18:18:46.3033 (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: M0JZ3avI8bCdVJhDU3gcDPoS4swF022KT0jzEsAIaqDPdJOeWiunBBjOjqBrM6hyq0v6d3kqrh3mLdPxWv3rWgAQN99A3N408uxydtCSang= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB3891 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250112 X-Proofpoint-GUID: 6Y2Sw0XYL0FWFKL9NpKgcVKzviltGoWi X-Proofpoint-ORIG-GUID: 6Y2Sw0XYL0FWFKL9NpKgcVKzviltGoWi X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 clxscore=1015 malwarescore=0 bulkscore=0 impostorscore=0 phishscore=0 spamscore=0 adultscore=0 priorityscore=1501 mlxlogscore=999 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250112 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org We set the max_active iSCSI EH works to 1, so all work is going to execute in order by default. However, userspace can now override this in sysfs. If max_active > 1, we can end up with the block_work on CPU1 and iscsi_unblock_session running the unblock_work on CPU2 and the session and target/device state will end up out of sync with each other. This adds a flush of the block_work in iscsi_unblock_session. Fixes: 1d726aa6ef57 ("scsi: iscsi: Optimize work queue flush use") Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/scsi_transport_iscsi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 909134b9c313..b07105ae7c91 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -1969,6 +1969,8 @@ static void __iscsi_unblock_session(struct work_struct *work) */ void iscsi_unblock_session(struct iscsi_cls_session *session) { + flush_work(&session->block_work); + queue_work(iscsi_eh_timer_workq, &session->unblock_work); /* * Blocking the session can be done from any context so we only From patchwork Tue May 25 18:18:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 447692 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 B3604C4707F for ; Tue, 25 May 2021 18:19:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9360F61404 for ; Tue, 25 May 2021 18:19:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232231AbhEYSUd (ORCPT ); Tue, 25 May 2021 14:20:33 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:47116 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231663AbhEYSU0 (ORCPT ); Tue, 25 May 2021 14:20:26 -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 14PIFh8L053208; Tue, 25 May 2021 18:18:49 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=fmbFLZd9kiQinVQTk7K1kpThqTEVbVxFQglg3R2ObPU=; b=oMcUBrTMQpjqul0QQH536fNaxaqhLHYpRL7JlA1vKrhlZpu2BnpsHwb+9moKMCB5FljT 0/92IdqMKx9oHVaf1c3BTgnzj0mtUOqjUjH6HJoGIjLhJDcA8d+X+OudDaFpSn4hZstP g6gBToIYbS+O9Hj+PtvPlSGSIQ1NVd08q5WTWKjpvokmo0ldkQC8g/rmlLCPv5gQhPJG 65UEkInhRV4dlkLn77vVB2Pl6a9w+rLY/cb3S1mcYs0sAHCNeXjLqh+kqzB4T17ZUPCE aASdj07m4rGen54JcM66Ef/ZjF6TSDrlufH61CUauluHdDsTiEHpWx4kHJCL1Jkp8v4m MQ== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 38rne42guq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 May 2021 18:18:49 +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 14PIGDX8010869; Tue, 25 May 2021 18:18:48 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2045.outbound.protection.outlook.com [104.47.51.45]) by userp3020.oracle.com with ESMTP id 38qbqsgh0g-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 May 2021 18:18:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LhNZbLToBO3RnwCER0XCCiYh5UcOY/opo0SmjG3uSmCwkyGmn7BSDBk4tUCAJUU3Xnq93sW37bRKYX/kL7UznP5bYOXb7GNxEwnXdbxFuo2DOMS+Nb9aXvpolLkPZxiDeWZ77hOfTH35LwlW11dykfgKdPUwEGwWXYwhXOJvdnGl8EofXBlsreBpGFixPbwVWqR1EXJ++wA1JkrvHJ7GS6tkO76q7O+KBk1uauHEEaYnbCf9kzV5Z8rmAF7lOV7fdj9Ix/Rb0UTo2ZaHB6YGsVi17SGU2I6r2p0ZowqVEPBGDmJGsCNYgfNdRuZFGnGu2LI2CAvrYEqP7hc9Wy9WwA== 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=fmbFLZd9kiQinVQTk7K1kpThqTEVbVxFQglg3R2ObPU=; b=ghAF874D6HfrUyKeBcaifeU4VxeLSuVKp2itqnRZK6Isv2fmXtdRmDgcg3RQEEKMWvaqJ64JJgdBSwrMeRtee1aPZrnkmvCqMlpaLqVfe5EqDoF5zMI8V5bcurcX4Lprlwct7ykasly7OLIv9kozla6XuPXvI4oEBzzmT4ucC2TQzfqIw4p9o2cMPQVqiZkHVKpTG651I7TRR1hFpOSgv5IpcFVEHekKsFt/26g/4cXuXNhLyQjoLWL1+nbnOFbVv3Id/SmIQ2GyIubTNYy7Tv1QcESRn1R/hTAHUL7irNZ97DYxi5676t0W6J8IAGDXZw1MGPSqNgJD7jvLvuyjbA== 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=fmbFLZd9kiQinVQTk7K1kpThqTEVbVxFQglg3R2ObPU=; b=k6l64Q4kt/ODoCMGU/qVY+1GAsvQ29MnQK3IwXvoU5xKD6qEjnwnhV5XSBV82bC3R/jAEWGBfDbXtelTAuFnB4EDiC7zugihdV5ql8xyofKQUx09lu9P5Vns/0wzE2fTJY20zHvDYcpj24R3W2jYPFy4ZLkiEqhckyt71IQMl/U= 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 BY5PR10MB3891.namprd10.prod.outlook.com (2603:10b6:a03:1b3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.27; Tue, 25 May 2021 18:18:47 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::b09d:e36a:4258:d3d0]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::b09d:e36a:4258:d3d0%7]) with mapi id 15.20.4173.020; Tue, 25 May 2021 18:18:47 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, njavali@marvell.com, mrangankar@marvell.com, GR-QLogic-Storage-Upstream@marvell.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH v2 17/28] scsi: iscsi: Hold task ref during TMF timeout handling Date: Tue, 25 May 2021 13:18:10 -0500 Message-Id: <20210525181821.7617-18-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210525181821.7617-1-michael.christie@oracle.com> References: <20210525181821.7617-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM5PR21CA0003.namprd21.prod.outlook.com (2603:10b6:3:ac::13) 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 DM5PR21CA0003.namprd21.prod.outlook.com (2603:10b6:3:ac::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.2 via Frontend Transport; Tue, 25 May 2021 18:18:46 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1eb41ce4-4637-415c-b928-08d91fa989d2 X-MS-TrafficTypeDiagnostic: BY5PR10MB3891: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fRZq1n70q7FFDOK3ZcCnxV9dYNp6Yaoqrri2AYdL+g6oxLypCSQ/70sc6k8fWRHCdlvf+Zv4MM/bO46DQILkz9RqHSNZyA9wJkl31fG16VnOGKa21tq4Jjk80MN2iwHP0gCTXEAYpp3Nm5NYdAbGiiuZi1pwIIZBn3uF4dCoesu3WZRUtSTosU1KxTdQsF2BufrK9TNGccC1jIMWwOqzAKNbRk8jEg/L4H+mN6InjY5htvZtYySrtPqgA7xcq7fk8DrLTOqqL/1dagASBPBq7r0HSzwxx6FDmd34CfQ1oaCVo4ONJWhF1VYufaKE8LbLN5981FiZbX012E/r+9zixiBy/BqCBzAKILWwFOMZTXw6cbmWvGf5iVeDwaduwifowXzS5u0UVovRT7V3WRYCkJAUFRY85m7rMVbJtdMWiSYSfAfkX1Rcim6fOTeUqufby7S9elx6gsvaQ0kOO+jWXYLOOfVjz4KuKEb86+gCZpTPXGobcn6QvFKOZrL6BkbzVpJ0E8nsLfCBlm6Ktv1vvydCer4mZAZ31pmQBbiYdMbc+lNbGDhV9LifidVFO+CfBvequ1px86ZOdzYAsMrhBf9v1ZUUhumEd5SDV9BPs9yojo/XXlD+fHxLn44UapiMg4NoT9X4ElY8GRygIJEdBodxeNmJnA/rO3TpBV7O6rp0bWK2LVbPwWO8+13QDKR4 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)(376002)(136003)(396003)(39860400002)(346002)(36756003)(83380400001)(6506007)(66556008)(186003)(16526019)(6666004)(52116002)(8676002)(66946007)(8936002)(4326008)(26005)(66476007)(478600001)(38100700002)(5660300002)(1076003)(956004)(86362001)(6486002)(2616005)(316002)(107886003)(38350700002)(2906002)(6512007)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: penktxftFt6BbC4NDlra8ZMCtc2/mZ2H60bSHEYzNRPB+YaMQ2umMlgRuWlK4210OPyUGIkUwiYsxoixEDMKcBmDIRvUT3eG5Xohabpc9Omk4SY3982BGTDtJWthQJWI+sEZmXt8nHT1aDREkWzT4r6+9Y9D7W/wxlOCkytK8mXIaTKi97pwnbboooheIDGHcaDKq3sKgo9AjLqDgL2eaQsvH0lmC1jQSrijUBCYbYFXNyYNb88B6uO+rj98isPLwwnBaWSzIr2DxZPLGJLg8cMlXIOr4qZgj8A+eATNMaL2ga0sPAr6r8QXotsgbMY2NsjxM7soIY1vhYm5kFkXrD+MmZp1uM0YK8pwOWiLTXnaZC4klkCVvpdvsTt5fujnJFvrnQ5Rxw9URdcbxeRyBxqKIh4YCM7dgWgNHlp9jYV6Dyjkde8xG1QSuwKq3xx9XCVSzrS3BdQGhFU1FQKBK1K4kjfdgCnHhO4SoNgadTATviPwtiViGaSuTTfvwrKN8uGaN6y5mbHSIm4v1EWAuKlMRTYgeymugqYRt1qBGq74E963/hYBJnUHF7z6L4bqHdq9N6Mx0Rcy4uXPVZZC/FPWJpodniWwN7fzQfqsVUYp5wyLSdbhlaEd+djGYiALMRURqeOLvjgQ5b83KLgXRs0S5B+DjtG+iIAVT/7ChHMoAgNwjPc0NAMrIDuncMKIsUKsc8+sULwhDZqvAx9Ssg81ltaUPqkBcH0QplcdNipLUl7lN/QeRYQzajbPA/EOM21nRhbRqz54A8RqNZ3ePI7bpUSzcsQg7xwYSFxivhCcjBdIDmm5LNXynZKT/aXOUCA7xjO9hqSt55W0GlERZQst5wZz8pV1W2MRxJVPyPoNnJW3a6aloyXGIGRn2cFUp/sgV3wNPz20eOaHQXuqN3E/xwexRSH9IC0mZHtRMDEtHeNGR5bNoUjfSbggtb4IxeeraAc8ZvpZMjNW2vKlFvJ7n7A+jzKlB2eEI5KA1/55zUf/lq1H8uYUT3Em+2uDmmwKC7R8nfLva3IUMNG/O6xpqsc/MxJYZxCtgOEleNdNTMGLaH1neqdD+74Mk8zmZgS3rE3kSTlLJSvjvJRnmEiCpPwPUV+unS+1jH7zAqBzK6JLntMXpVioSpmybADBndVBzDoXQjBZsyyNdk6wGquQ9cs/kiotcuchahYX90q7itdScq29aoc3lpbSA1BPGIFuofa8EbUfTrTcGr8rkYPrvwSYuud+/gO2X30QRutogXJ1sAdt5fN1sYrzJs1+Imh+ziQAboInSJkQlPj9Ao8VB9UYTuANKSdO80Pwh/NYDefeVr49Vvzp9uiSle6Z X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1eb41ce4-4637-415c-b928-08d91fa989d2 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2021 18:18:47.3557 (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: mdjN6S2ivU1q21osZKN8DF4auKHuyXywZFfp31P/IxG4c1ytRaxBNhfVlZfA3mLIBNtwMid5HTaioGfEYfRLZ8GwAD49O/7/YOdyQKyi+fs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB3891 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250112 X-Proofpoint-ORIG-GUID: pLQ0p_LfeccK1HCw9ExzYNvpfJvHO0qD X-Proofpoint-GUID: pLQ0p_LfeccK1HCw9ExzYNvpfJvHO0qD X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 bulkscore=0 phishscore=0 mlxlogscore=999 spamscore=0 mlxscore=0 priorityscore=1501 lowpriorityscore=0 impostorscore=0 adultscore=0 clxscore=1015 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250112 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org For aborts, qedi needs to cleanup the FW then send the TMF from a worker thread. While it's doing these the cmd could complete normally and the TMF could time out. libiscsi would then complete the iscsi_task which will call into the driver to cleanup the driver level resources while it still might be accessing them for the cleanup/abort. This has iscsi_eh_abort keep the iscsi_task ref if the TMF times out, so qedi does not have to worry about if the task is being freed while in use and does not need to get its own ref. Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/libiscsi.c | 15 ++++++++++++++- include/scsi/libiscsi.h | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 8222db4f8fef..e57d6355e7c7 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -573,6 +573,11 @@ static bool cleanup_queued_task(struct iscsi_task *task) __iscsi_put_task(task); } + if (conn->session->running_aborted_task == task) { + conn->session->running_aborted_task = NULL; + __iscsi_put_task(task); + } + if (conn->task == task) { conn->task = NULL; __iscsi_put_task(task); @@ -2334,6 +2339,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc) iscsi_start_tx(conn); goto success_unlocked; case TMF_TIMEDOUT: + session->running_aborted_task = task; spin_unlock_bh(&session->frwd_lock); iscsi_conn_failure(conn, ISCSI_ERR_SCSI_EH_SESSION_RST); goto failed_unlocked; @@ -2367,7 +2373,14 @@ int iscsi_eh_abort(struct scsi_cmnd *sc) failed_unlocked: ISCSI_DBG_EH(session, "abort failed [sc %p itt 0x%x]\n", sc, task ? task->itt : 0); - iscsi_put_task(task); + /* + * The driver might be accessing the task so hold the ref. The conn + * stop cleanup will drop the ref after ep_disconnect so we know the + * driver's no longer touching the task. + */ + if (!session->running_aborted_task) + iscsi_put_task(task); + iscsi_put_conn(conn->cls_conn); mutex_unlock(&session->eh_mutex); return FAILED; diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index 9d7908265afe..4ee233e5a6ff 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h @@ -276,6 +276,7 @@ struct iscsi_session { struct iscsi_tm tmhdr; struct timer_list tmf_timer; int tmf_state; /* see TMF_INITIAL, etc.*/ + struct iscsi_task *running_aborted_task; /* iSCSI session-wide sequencing */ uint32_t cmdsn; From patchwork Tue May 25 18:18:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 447690 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 AD99DC4707F for ; Tue, 25 May 2021 18:19:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8C7FA6140E for ; Tue, 25 May 2021 18:19:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232168AbhEYSUi (ORCPT ); Tue, 25 May 2021 14:20:38 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:44258 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231663AbhEYSUe (ORCPT ); Tue, 25 May 2021 14:20:34 -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 14PIF657124670; Tue, 25 May 2021 18:18:57 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=j/4EsnZfW0heAm92Pw5JPuZaTL/JoOg54DIcYalCQ4s=; b=bgCU8Vh53VMgd5FpxLOv5h6fefvsGUZ7Qbg5c9Vwo19dCRtJaJu74E6y1BZPURmO5+vU BZIgZo3GaQ7cKaCOW5UEQKJeUMD7SmczFBzFRSRuJ07Mqv2m2FcKXKOcn2JxdkGnhSyk nwrNKeLTRH0ZtCpe7pHeHE8KwApUgNGi9hMFUbna6GBm0mWRIjP2dnIjVVd+LGHOJZBc 5sQHfU3QdJmfhRapnK/SKOlFoPtHmV7WrZvqKymZTMipzn4utTSaQjaTm0ZvUt7VFooq Gi8oOFC+Gj91zQli3mQlpZqwrxRhz8lO0n6fWU9usw5aHdmTpluPWInWKobHsfQLHNZ3 SA== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2130.oracle.com with ESMTP id 38pqfceys6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 May 2021 18:18:57 +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 14PIEulh166263; Tue, 25 May 2021 18:18:56 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2045.outbound.protection.outlook.com [104.47.51.45]) by aserp3020.oracle.com with ESMTP id 38rehaq64q-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 May 2021 18:18:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Wa6Zf0n9csw/GZ9KW0ZRYSdmZ6XmqjNF59gZ6G5wm8AJzjXwMGVCGVjpz2AUHfPnI8Mq0b9OvZJbGWL3sAqHiyfCqhsCQMazegzDYP+rW6ivvjC2Zoq//jnEKXllmheWGmEEkpvXlWam7+PVfTH7BCJA3kvH7g3SZiO22uioJYbn0rwJ+e4qgR/F5n+EYDvEn7HaktbFKO2BXD5R2njfk2JjzkSeaHeGXDbbP9MJzshGx7+rYZMR1FXLLlk3xzy7ugQ/XmlxYNebRYtFCm/ThZyKOHci/UJhU+tBZLnWO82OL8Ku+ExCnTBS0QOyK02dlqsm/dCsbrw6ZYD+TvWIZg== 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=j/4EsnZfW0heAm92Pw5JPuZaTL/JoOg54DIcYalCQ4s=; b=BoNIU1KNaPLWwN+4wDMXTao93Ery/oDPolPd6vroG7l3f5b5YPK4nzLs3Xpt9Dh6yNDgxMaByzHVQlOQPz4quHPXdGvRyp+ETm3ErV0QJ5MF8WENlUs/X032DgXAzijUJn6shFgDdfl26P8KoZMvzXm45TH85GjymLq7IJ4KBnDCJ4ffBuUlUGEM7HA+OfPSJIcUyKud0jqqHDxFTf7WCqYrR9Lz3X0mq7TBbvcBNS8w7EPdp5iGEq5Craki39H/L/AB+tqUyeUIIkNuBjHQaEni/eDegdniIoTIryIR07RMFcvCWs6zwQDFX4NQqGJc8SsqsYT2FEu1zYiAJQu/hw== 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=j/4EsnZfW0heAm92Pw5JPuZaTL/JoOg54DIcYalCQ4s=; b=q3D8WxRg4DLDjjZmSPBfAoGjChkUDWnyBFdHf0+NXiGyITQ5sumMImoMeyv227m70TSPwyDjkQt/EhxdCE4fQ1dNr5bC2prSbGIThhupm9UkrzCIuwGLi2ub6Xz4i0/BakCCuXYk8+0GBwZX6oM/lhHlryJuJCyp+OdmleR06zU= 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 BY5PR10MB3891.namprd10.prod.outlook.com (2603:10b6:a03:1b3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.27; Tue, 25 May 2021 18:18:50 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::b09d:e36a:4258:d3d0]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::b09d:e36a:4258:d3d0%7]) with mapi id 15.20.4173.020; Tue, 25 May 2021 18:18:50 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, njavali@marvell.com, mrangankar@marvell.com, GR-QLogic-Storage-Upstream@marvell.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH v2 20/28] scsi: qedi: Fix race during abort timeouts Date: Tue, 25 May 2021 13:18:13 -0500 Message-Id: <20210525181821.7617-21-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210525181821.7617-1-michael.christie@oracle.com> References: <20210525181821.7617-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM5PR21CA0003.namprd21.prod.outlook.com (2603:10b6:3:ac::13) 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 DM5PR21CA0003.namprd21.prod.outlook.com (2603:10b6:3:ac::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.2 via Frontend Transport; Tue, 25 May 2021 18:18:49 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e0be358c-6e37-44f8-d8aa-08d91fa98bd0 X-MS-TrafficTypeDiagnostic: BY5PR10MB3891: 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: SvgBEsO8RYyhX4Z4uN0cumgU0P5ts/qMr1j0Eu7tnz5yhpHsRWmBlIikIHrK3bUGdownvsxEiljTMF8eVc9mCada/YAqRuEXK7EOSzU5QVHYywPYtgzCAMIBlEbPtd1vvxkW9eCLDV2YS7GKq1/W4jekrtTYXah/bv5zzpoS0vByCVZJTLSqr+Ly9zA09muBc68m4Qjhio5aHrv0xv6+8izF/KWMe9XWfp4z5c96KnVIg2iC4F89ENpHw+ouYNiXm/Ratvjs0a/5R0ornZsKuOJSKfqUo+In8OrNxA3pU7bOtVl28kUhDPBTJUONM2TW7b9O2ogh1hMODSsTOt2d+nSaw8SNPfv35yfxmGhF3LRsbQvVYZ0/EMV5voGTfxf9qnHTa+YkeP6jHS6Sdb8B+oiJEV62cBLifY2oEbft5/Vu/B5aoR3xDzv6a1nI/OZf/a9zp8yqrNaaVkyL/EoXdsXdrqyVEZjKdT3znYgXHgG0Dgq7ppB1cKVykkzHXrymkrSnkV97kajaEvJWzommWwPoPvmvf6vMReO1VR+hjbbKUrLyEZQlb5T8AfRKJBRDvRkR43hT1atrjw+N5gMzU1yazgfVOjLEI8xiLoB1zJz468b4glxdXT7siEZsHHiTpZjEt0+h6xuxYPiuL6qT7ZiZ3yJaIaje+SgC6Fs2HWAurmJax7llG8UWMFS42jV/ 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)(376002)(136003)(396003)(39860400002)(346002)(36756003)(83380400001)(6506007)(66556008)(186003)(16526019)(6666004)(52116002)(8676002)(66946007)(8936002)(4326008)(26005)(66476007)(478600001)(38100700002)(5660300002)(1076003)(956004)(86362001)(6486002)(2616005)(316002)(107886003)(38350700002)(2906002)(6512007)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: U6qrMII3HvNxrlHVEyrwdahRtczphxR1+t8nSGT9frne+Yh8YlwTEXscCpuNH/9Ea/DEL3X4wnJB8TrT5CSOwLiHZ/9wCObQfjSUv7mKbff9ahDSr/W0pnt/aXEbfhso4Xuq8z1RGnkbTms1qWkq9pllewHX4bp04mS8judUl6mkQka5Wih4z8mL5qv4dPjagic8ojTa/U3zYLGnDRv2nTzBMYxt7JM2eXLMkph1CYqu72HooVzPH7XonTjwp4xnhKcQMOGARXWzh+zb/TnwC3lc9aS1/qYSyr/T4kfPMB1P0N8r0wfmX+RDoX6AqmmpZZxbHZERpGsnO4hLJR14lNNB31P8+ffcwFtAJ1tIuZpJL6qLxT5BlRTEg7COd+C4JFYStA5DgacCWG0zcbXvTPPuqKBiM26nglloRQnA4dKMNsxusFxcw0VdC/e2AH7tNk1DQHH6Occ0NGojWlMttbeZmzYo0GkIF3f4nTV+1QsHNvRgi0XOEMc2+fu9ObMrYkLITT73bGrSgz5P24zXNJr/dzwVza/YlA5xjINEMFeXvsqDb+YK9JNGmBldiM3yZ9iSb4VlZ8bSoLv6yKMAoDgKupFIofXZPWWLs5nJMfH970im9L1d+cgNvPd2Eb31qfR/bdIL26/l+3WdzFYpS2RNaaVU1LAMPvE3U4Bth/bBWmQRrECMKfIlpiatUKhsuiNKsv34IOpb/bWbhD8o5/ePrFF9iAYZmHr2QIajGtTFi7idHOW2VXTXCqVyoarBSBEXC1AG7DJdm9t2yFA9nDh/d0J4pUuKtD8cbUhGvWe4khk7/M27dEb3XxaIoCQwZA46+DQCGFPiCnJry9QcQkJV73C0h25owe3mX7WoNZ0xtd2N/NN1nXNGp0pHEFJWsSdfIBEOLoGiUi0opzC90sFm+7pvQnI5wuGCkjN6lXBvdIbd95rIq28lMNWo2sppSd0IJZdS/1pY0qsisrGUWKLa66RkBHDmjtDSVOVFaYiNpTIGfRgOVi8NL8PItcCJt49JEgZysI6E15HQshT5xV4f1nVRBS+H07/dKcCOc9/h/Nl5yC3tw/yke4ZxIy3o+UE2RudpNRgyRJ5sAvfHQnoJ6cOB8CH0vRk95HIoZRdbxKzyaZqSFgx7x2fNyb8md528/tsRwRDO+bty56bd5yvvkl5HzTtA59ZUniVWYYmXcts+5yF8WKTPN0um9YhoTFxeCLegejazbX+i8kdeYmNIw+pXp/FMDfETxc5TqTuHhJE20Q10Z4p1s6TsxrgujmWVgT79g1KKr8lhy74JadbKC6rveuSfVTX8jzjs+eaiWi3ScoNROBfscv4J5ogf X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e0be358c-6e37-44f8-d8aa-08d91fa98bd0 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2021 18:18:50.6699 (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: tK6gkXbMD+WBn6lDsRy7B0sFF5Cc8Vvhv2bonxO+lng5unQ2O2wxqy7Ay1oFWVDUB9y8z8GCUMi+BbRotY6aIGc7u+N8aDgjy39wcRcbCv0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB3891 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 spamscore=0 adultscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250112 X-Proofpoint-ORIG-GUID: pWZzclpLr0XQGDxZjXTk0LtyFbip1yqK X-Proofpoint-GUID: pWZzclpLr0XQGDxZjXTk0LtyFbip1yqK X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 mlxscore=0 malwarescore=0 mlxlogscore=999 lowpriorityscore=0 impostorscore=0 adultscore=0 phishscore=0 priorityscore=1501 clxscore=1015 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250112 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If the SCSI cmd completes after qedi_tmf_work calls iscsi_itt_to_task then the qedi qedi_cmd->task_id could be freed and used for another cmd. If we then call qedi_iscsi_cleanup_task with that task_id we will be cleaning up the wrong cmd. This patch has us wait to release the task_id until the last put has been done on the iscsi_task. Because libiscsi grabs a ref to the task when sending the abort, we know that for the non abort timeout case that the task_id we are referencing is for the cmd that was supposed to be aborted. The next patch will fix the case where the abort timesout while we are running qedi_tmf_work. Reviewed-by: Manish Rangankar Signed-off-by: Mike Christie --- drivers/scsi/qedi/qedi_fw.c | 15 --------------- drivers/scsi/qedi/qedi_iscsi.c | 20 +++++++++++++++++--- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/drivers/scsi/qedi/qedi_fw.c b/drivers/scsi/qedi/qedi_fw.c index cf57b4e49700..c12bb2dd5ff9 100644 --- a/drivers/scsi/qedi/qedi_fw.c +++ b/drivers/scsi/qedi/qedi_fw.c @@ -73,7 +73,6 @@ static void qedi_process_logout_resp(struct qedi_ctx *qedi, spin_unlock(&qedi_conn->list_lock); cmd->state = RESPONSE_RECEIVED; - qedi_clear_task_idx(qedi, cmd->task_id); __iscsi_complete_pdu(conn, (struct iscsi_hdr *)resp_hdr, NULL, 0); spin_unlock(&session->back_lock); @@ -138,7 +137,6 @@ static void qedi_process_text_resp(struct qedi_ctx *qedi, spin_unlock(&qedi_conn->list_lock); cmd->state = RESPONSE_RECEIVED; - qedi_clear_task_idx(qedi, cmd->task_id); __iscsi_complete_pdu(conn, (struct iscsi_hdr *)resp_hdr_ptr, qedi_conn->gen_pdu.resp_buf, @@ -164,13 +162,11 @@ static void qedi_tmf_resp_work(struct work_struct *work) iscsi_block_session(session->cls_session); rval = qedi_cleanup_all_io(qedi, qedi_conn, qedi_cmd->task, true); if (rval) { - qedi_clear_task_idx(qedi, qedi_cmd->task_id); iscsi_unblock_session(session->cls_session); goto exit_tmf_resp; } iscsi_unblock_session(session->cls_session); - qedi_clear_task_idx(qedi, qedi_cmd->task_id); spin_lock(&session->back_lock); __iscsi_complete_pdu(conn, (struct iscsi_hdr *)resp_hdr_ptr, NULL, 0); @@ -245,8 +241,6 @@ static void qedi_process_tmf_resp(struct qedi_ctx *qedi, goto unblock_sess; } - qedi_clear_task_idx(qedi, qedi_cmd->task_id); - __iscsi_complete_pdu(conn, (struct iscsi_hdr *)resp_hdr_ptr, NULL, 0); kfree(resp_hdr_ptr); @@ -314,7 +308,6 @@ static void qedi_process_login_resp(struct qedi_ctx *qedi, "Freeing tid=0x%x for cid=0x%x\n", cmd->task_id, qedi_conn->iscsi_conn_id); cmd->state = RESPONSE_RECEIVED; - qedi_clear_task_idx(qedi, cmd->task_id); } static void qedi_get_rq_bdq_buf(struct qedi_ctx *qedi, @@ -468,7 +461,6 @@ static int qedi_process_nopin_mesg(struct qedi_ctx *qedi, } spin_unlock(&qedi_conn->list_lock); - qedi_clear_task_idx(qedi, cmd->task_id); } done: @@ -673,7 +665,6 @@ static void qedi_scsi_completion(struct qedi_ctx *qedi, if (qedi_io_tracing) qedi_trace_io(qedi, task, cmd->task_id, QEDI_IO_TRACE_RSP); - qedi_clear_task_idx(qedi, cmd->task_id); __iscsi_complete_pdu(conn, (struct iscsi_hdr *)hdr, conn->data, datalen); error: @@ -730,7 +721,6 @@ static void qedi_process_nopin_local_cmpl(struct qedi_ctx *qedi, cqe->itid, cmd->task_id); cmd->state = RESPONSE_RECEIVED; - qedi_clear_task_idx(qedi, cmd->task_id); spin_lock_bh(&session->back_lock); __iscsi_put_task(task); @@ -748,7 +738,6 @@ static void qedi_process_cmd_cleanup_resp(struct qedi_ctx *qedi, itt_t protoitt = 0; int found = 0; struct qedi_cmd *qedi_cmd = NULL; - u32 rtid = 0; u32 iscsi_cid; struct qedi_conn *qedi_conn; struct qedi_cmd *dbg_cmd; @@ -779,7 +768,6 @@ static void qedi_process_cmd_cleanup_resp(struct qedi_ctx *qedi, found = 1; mtask = qedi_cmd->task; tmf_hdr = (struct iscsi_tm *)mtask->hdr; - rtid = work->rtid; list_del_init(&work->list); kfree(work); @@ -821,8 +809,6 @@ static void qedi_process_cmd_cleanup_resp(struct qedi_ctx *qedi, if (qedi_cmd->state == CLEANUP_WAIT_FAILED) qedi_cmd->state = CLEANUP_RECV; - qedi_clear_task_idx(qedi_conn->qedi, rtid); - spin_lock(&qedi_conn->list_lock); if (likely(dbg_cmd->io_cmd_in_list)) { dbg_cmd->io_cmd_in_list = false; @@ -856,7 +842,6 @@ static void qedi_process_cmd_cleanup_resp(struct qedi_ctx *qedi, QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_TID, "Freeing tid=0x%x for cid=0x%x\n", cqe->itid, qedi_conn->iscsi_conn_id); - qedi_clear_task_idx(qedi_conn->qedi, cqe->itid); } else { qedi_get_proto_itt(qedi, cqe->itid, &ptmp_itt); diff --git a/drivers/scsi/qedi/qedi_iscsi.c b/drivers/scsi/qedi/qedi_iscsi.c index 80f8d35b5900..5304a028db0a 100644 --- a/drivers/scsi/qedi/qedi_iscsi.c +++ b/drivers/scsi/qedi/qedi_iscsi.c @@ -783,7 +783,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); } @@ -794,6 +793,10 @@ static int qedi_task_xmit(struct iscsi_task *task) struct qedi_cmd *cmd = task->dd_data; struct scsi_cmnd *sc = task->sc; + /* Clear now so in cleanup_task we know it didn't make it */ + cmd->scsi_cmd = NULL; + cmd->task_id = U16_MAX; + if (test_bit(QEDI_IN_SHUTDOWN, &qedi_conn->qedi->flags)) return -ENODEV; @@ -1391,13 +1394,24 @@ static umode_t qedi_attr_is_visible(int param_type, int param) static void qedi_cleanup_task(struct iscsi_task *task) { - if (!task->sc || task->state == ISCSI_TASK_PENDING) { + struct qedi_cmd *cmd; + + if (task->state == ISCSI_TASK_PENDING) { QEDI_INFO(NULL, QEDI_LOG_IO, "Returning ref_cnt=%d\n", refcount_read(&task->refcount)); return; } - qedi_iscsi_unmap_sg_list(task->dd_data); + if (task->sc) + qedi_iscsi_unmap_sg_list(task->dd_data); + + cmd = task->dd_data; + if (cmd->task_id != U16_MAX) + qedi_clear_task_idx(iscsi_host_priv(task->conn->session->host), + cmd->task_id); + + cmd->task_id = U16_MAX; + cmd->scsi_cmd = NULL; } struct iscsi_transport qedi_iscsi_transport = { From patchwork Tue May 25 18:18:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 447689 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 B9C0EC47084 for ; Tue, 25 May 2021 18:19:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A632C61404 for ; Tue, 25 May 2021 18:19:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232294AbhEYSUl (ORCPT ); Tue, 25 May 2021 14:20:41 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:44274 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231827AbhEYSUg (ORCPT ); Tue, 25 May 2021 14:20: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 14PIEtld124461; Tue, 25 May 2021 18:19:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=6TT9MKGyAYjEnfdOdUJ/rY8NH+1aB2ZDLGKA4BgqzpU=; b=oitjl34B9NrYx83qBwBgXJSCF6H7lpQVABqy/6ssG6PEbfHiWKBeqczGUGc/rt98FdR1 Rdx0v7SzJV2XEYQlUnC1gOgTK2g+VX+AU9562VXAGb9Y49/xlla48NFjYTTcUBA7e0ik bR2TTESuSYX90Foe8NOuhsF6d5/uSUcHXWO+BX2bwnTSmtj5MTmNxxSRXDNVWzUT6HhS 1xnUDeEofakKTjUDpWNBWTJyRNpNIOel+57TgnTRV0U/zhN+YHT9qFMvnS15+08OX6U3 M2HIFvfMDbPOmFZMM9LIA5jgbmNs2QjEd8+gEWWGrj3dEBWKCts6+T1Snh8KPlrXrh8B WQ== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2130.oracle.com with ESMTP id 38pqfceysb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 May 2021 18:18:59 +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 14PIEulo166263; Tue, 25 May 2021 18:18:59 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2045.outbound.protection.outlook.com [104.47.51.45]) by aserp3020.oracle.com with ESMTP id 38rehaq64q-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 May 2021 18:18:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Spj7XtOVr5yw3VjwP/GZVHumpMO7M7FcNF1aBJABa3JjKT7J0UBZ87Qz58BGJTJi398KWZLfxGYiwEsLxfDkUacg5F1nVVQQmSRfr6b4kV2CNrnqnflsvKm4K71UEQsEDpwCAnwovjmY34anIOBefIzOppnUMpKvcwcKzKnR19utNC061f0OMi2uF1k1xgAQ3yLZUESNDZojwiU4dQ7wl3naYLnjdz3UGTjPhnGX8kANJtnsQevDgH/W1fe2M25+F/u1BmkBL9jWafUbTw4+vRWQSQtue2OjjfagShLGw+Hz/l5wJuaSAw5h1wGnNlWELfelGEGAWEKGUgF0X6Wp5A== 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=6TT9MKGyAYjEnfdOdUJ/rY8NH+1aB2ZDLGKA4BgqzpU=; b=HUlE1eGFR2yTBAsb3/aV4NvvgNwi0Bx8TbKD6PrL1Y/3Nt9E4OZjljOtG9qsd6vgv51N3+m1nJEpMRRQU3tFlrcGFK4aYcnTS9jh1Bf4Q+i3ZQYhOcvyagl94PEtOL3qQD5LYntAz/oQOtQBTP1of5mwSG0GMUcHbzRip7PRW5aXl/77qjFM8jzQxk99jXWibZD2veEre22subJUTapNQNt5LPTc0eLdYpF3TdAqVrHczESpqEndkOAVW4Z6iIbbE5X6e/uXmWzdZehMl4+I8vDqlOwx3vfhFjOb+OVtpC+9EOCUDNJdotPl39106Vsnivfls8WoOHJh36YNHOQJqA== 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=6TT9MKGyAYjEnfdOdUJ/rY8NH+1aB2ZDLGKA4BgqzpU=; b=OpZPk1OWeM+3tKzmS5JG9Ib6YGQqfwZRXYTlxU3WXa8nS4NleebaGa2YR7esQWNsXNS9LvKZFnk90X5+c8/SaL4hPnwQPG8QVWUZIh06R8QQfCH2M0x+KExl3JctGn6i6hBlBs8m8+IVIZ4XDB6AZXm/XTCG+lpRPeBVzBG/L0k= 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 BY5PR10MB3891.namprd10.prod.outlook.com (2603:10b6:a03:1b3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.27; Tue, 25 May 2021 18:18:54 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::b09d:e36a:4258:d3d0]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::b09d:e36a:4258:d3d0%7]) with mapi id 15.20.4173.020; Tue, 25 May 2021 18:18:54 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, njavali@marvell.com, mrangankar@marvell.com, GR-QLogic-Storage-Upstream@marvell.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH v2 23/28] scsi: qedi: Use GFP_NOIO for TMF allocation Date: Tue, 25 May 2021 13:18:16 -0500 Message-Id: <20210525181821.7617-24-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210525181821.7617-1-michael.christie@oracle.com> References: <20210525181821.7617-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM5PR21CA0003.namprd21.prod.outlook.com (2603:10b6:3:ac::13) 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 DM5PR21CA0003.namprd21.prod.outlook.com (2603:10b6:3:ac::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.2 via Frontend Transport; Tue, 25 May 2021 18:18:53 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d40a1beb-4a2f-47af-e987-08d91fa98de6 X-MS-TrafficTypeDiagnostic: BY5PR10MB3891: 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: a46k7o0sPdRLSY/O+FcjsQWzMC2YHXx383aHISZgT0Of/q5g8uSX5a1tzho3HgmN1D+xjpLwKR0LGdNseFdzZuCYGI6wvNzt1a5R0Pk6DOQDW/JKQz17ToSIcoBksSp4mk5b876m/+BISr0tdVRYnwN10FXmrAKvP9EI/CDwlAYrn0oRVGno73ZDc5f5QK7iRrOVgIvTbOPEgkPzod/2ebIQJ0YTuePqYGKPjNcYK8FRNX/E+LPzkzyB+Hg5EMQW5bieFo1BApOomG5dlxx+I7xi9QoCiiN3HdWk9DWO9PtQZq0ihFyFnUGCYkRVU9chht/cRoHrWH63snm7O5Q+dadIrPMd6PB8kqlO7jtDVhWfZm3mzSmAg55Cw9v3/eFCFiEzAZc7YGl9AoIu2EDduJFo8xRSUpv9iixcz/cAIuPvv/uHN4MOunmjpWrAc2iK/5ObldnwezyFSLF2XjvjCIsR/0T9Semm6fSbHeiooSdkpxjmvieqJtj2RklKbX/j9QT343hyzMB4oD2wT0715Jq8SlLwl01ty4AlqIYZuH02kC0OLT+O20pwacSKPTxedigPUaYbuT64xOnzQugdbOkOHJ9OUapOb2LWFlCjT9jp7IMVoh52YaGNXv4g0yA9rMxqXLShQMt37BC5exs1fPNZ8a/33cv3mEWaQwoAsaTVHIKJ3KX13APlFvkGeTyg 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)(376002)(136003)(396003)(39860400002)(346002)(36756003)(83380400001)(6506007)(66556008)(186003)(16526019)(6666004)(52116002)(8676002)(66946007)(8936002)(4326008)(26005)(66476007)(478600001)(38100700002)(5660300002)(1076003)(4744005)(956004)(86362001)(6486002)(2616005)(316002)(107886003)(38350700002)(2906002)(6512007)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: B1g5s+jFp86WlQHEKTuixTuteZ39bevX6AUY+y7q5TM5VKN4MEnpBS6PAnP333RKxMVinWrsmuCzIR5MXe8Qs/nIaVWWBrM/geoSxve/fxesqcHiHvyxbwk0fz9B5zZYw5N+99VpT3U6KnDjAEbiXozHw7Z8bunL0aB7JyordpF6NOJLBwLQKOj5L7XpzltEkkFXqOFYuYEG11hsFTWNltAfOXVJcGOUZZXFOY9qPbJ1QnodLzH261yeH8HE/1cv5uok8TzksLL0eUusS+1DXPLlMxs6xl5nssoV5S8sKgiF+zG3oJ89ytvqyQTcWOPB+4NsVThHIifSrjhfJkvqUu16/DyT7aZLsWtYZCgXShthvXToKVPg8Bgwc1Dd0v9vjvlQZKJhjoK7QXwEs6hr8VVfs2cc2Ts/MbonXzMLO8A+KGO5DgopeWOS5IeHWmhQ2HuibNhDY9rL/o57P9VomR1HZkUt2V4nUTKZHqexTgHTpZrhuioEnhOqvdyBpWUgdulNV8ANpmfZMVd92LKNLl+2d7ijPJRWqzkkB0UqbFo52GD/UbIdhPdMIIRxykIW2lyLvECml9KzMSTXoeKrPD9A7+H7IH5lubwQmTxu1gGVbpOHT/Y37KzD12iSl/+m7QMD0OoAnZAUC6LYCM7C5zi6fUPOlAPeHkGvchyKkTFTX1Ut048FRsuFLWU03oK0nfcxAhHueJcob9WlEcQC+Qies7ObU4Y1z2fqvQYJDIb5sP4B2U2LaDPFuYvscBll6TZRHhMLgHT70KgWhuN40TaebqZgWsKOdIoz+dkDYE3DDwsN4zin9bV1pkDN+cYtfP6E6k0fOa8JivQ+pi3QzbWEyt0Y3gsMdsyryCdbF61zQn0VaKN1yTWieonFn4F3P7R8lTqiJKFMTHMT33Aa9jQsRl9+3Kl8qzA7vCyNKomuMEHpbmE8jpkobV0Irp3wHFgBKgNp9won0lQzKlvKEhtqEopi3QYFjQhulhTVNCvtpSjrN+h5GKSdCTuQA84ziqkG0HThSbe47otCTJBsi//mLJqfy973HabzDLzNRCx2FLtXI8Gq1Z+lPfP4hHQpfyBy75Uvmjt84skFltwAVEMGkBZeN/E7h/GnptJSUkTPHXYOsyxAuX515LZp89r4rYEaRYcfNgSLVBcvogon3EQFgFdGjuWCdLpV3WRxIcHYCQOv9gnvyzdt5N9hqQjwHJatLhBozIhHs6aXu4VGGeOMXdCFWirgYkGk7Md738cSkbh+LxGwerPC8XDdp9ysxn0vUXwnI5od3a2V2jun7XzSSwpJr+oQ6o3IstohDDF46YSCglhiIbrjIYq+1TpG X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d40a1beb-4a2f-47af-e987-08d91fa98de6 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2021 18:18:54.2539 (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: arWAgU08B9P4YucK4MhqXcuGbrN8PUzXbMtDC8s0cvzT294DEtMH7kIqe1QamG1MtVWlmAfHSGTp+trQdtxmybTUX7K9kAqEqEQ4wSWotr8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB3891 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 spamscore=0 adultscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250112 X-Proofpoint-ORIG-GUID: KG8AXo3hSB-cVde1RXANSjOpnDPSSWhz X-Proofpoint-GUID: KG8AXo3hSB-cVde1RXANSjOpnDPSSWhz X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 mlxscore=0 malwarescore=0 mlxlogscore=999 lowpriorityscore=0 impostorscore=0 adultscore=0 phishscore=0 priorityscore=1501 clxscore=1015 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250112 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org We run from a workqueue with no locks held so use GFP_NOIO. Reviewed-by: Manish Rangankar Signed-off-by: Mike Christie --- drivers/scsi/qedi/qedi_fw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/qedi/qedi_fw.c b/drivers/scsi/qedi/qedi_fw.c index 6812dc023def..e82c68f660f8 100644 --- a/drivers/scsi/qedi/qedi_fw.c +++ b/drivers/scsi/qedi/qedi_fw.c @@ -1398,7 +1398,7 @@ static void qedi_abort_work(struct work_struct *work) goto clear_cleanup; } - 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 clear_cleanup; From patchwork Tue May 25 18:18:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 447688 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, 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 C2A47C2B9F8 for ; Tue, 25 May 2021 18:19:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9F4DD6140E for ; Tue, 25 May 2021 18:19:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232345AbhEYSUx (ORCPT ); Tue, 25 May 2021 14:20:53 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:60918 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232270AbhEYSUk (ORCPT ); Tue, 25 May 2021 14:20:40 -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 14PIG1qm122166; Tue, 25 May 2021 18:19: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=75cFGpSkp4kTZYhKnpulbxl+qmSwsO7M25rHfB3ci1I=; b=bn2CoLCgqqsGg2QpxA+GKze7xkk1+t0///UubtXlD4J26yecl1pyOz0QLRPWmSG8umTF PwEd5QR6r+d3PHzOSuOG0MJw922mcb+xohXfD7P5jCz6HO+di3J4DCMpzyfrbdnO6ocy YjQ3cojhkQJAQLOvm8hyJF6b5bdyZK2XDM33XPCNc09BMTUTuX7mQ73HpwjLhz09pVDM +Ge75EoS6YKzDUKiBbUcgwj0OfLYAIXrhVsPtyNaxbgSZTeQmJdrWLJffYbX+wKfaKWT XSEvh96h214dhPrRWUgm9MD2BQJldWFsvuKO8i6tEhQP8i6Lc9Pd+IoifyCaP89BqRY1 Ng== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 38q3q8xcw1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 May 2021 18:19:02 +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 14PIFGMm104688; Tue, 25 May 2021 18:19:02 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2044.outbound.protection.outlook.com [104.47.51.44]) by userp3030.oracle.com with ESMTP id 38pq2ufk67-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 May 2021 18:19:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LX+wgMFL2DX0QJFskcFPTu9N6eypJMNr2ORPPNM4oXXaC5ELECvLYhZMw8pFA39bzoRlA9HQ2NdAsuICcxgcck9yZMQkq0sYbdnZ1coUNR11MJSTb3pCMUMISvvj8aXW3dFErZ+lOStoW3cj4JMfWboNh7zcLSe6kAnyXyOkWdOnTuHV3MbRD6BvQcvlBgSQVZyjVYhYGwRM8Agb2BJMoKfuTbmTfhXVG1Z8L6u9Oy8R0SnfIr97Gp1JWw70bqN4erp3Y42hp3ZwEeUhFHYfcM0Sp+PFugqLMemZ7StwSBrLvTr1JFa66c4zrwo/sBvaEyrxD5XAmZBxbwLkMXwsbQ== 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=75cFGpSkp4kTZYhKnpulbxl+qmSwsO7M25rHfB3ci1I=; b=Gn1H5rAcgpgO00I+cBlMEz3yvh0o3Gu1rfLvffmX4EeZmTi26MlrUQUzg13x1JNc5EvfiYWb4uOepO6JDYHZwe9QgPt6BdpC2qciEPTw9LCmEtrfAOfiJcixqiN+BT1qG2zOlQ9lchAa0+cNkrBkfJkP72hx7CMUrvvRygiBW+yoDy7/xDUhSja0qAZ6eCpnejN2XTO+grVF1Wipnr9R37JInye0WPM/QswNf5HG1niFcSzS0Eab3uouOA9uDpwwdygXfstL6zS1z6GRDbVZlVRGWhr6rlZ7naMI9ik1Oydc0nbim2h+Pwty2pEbwPeS0xQeA8JLJRBxbINgvvpskA== 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=75cFGpSkp4kTZYhKnpulbxl+qmSwsO7M25rHfB3ci1I=; b=WEVgnSVCCTDN4ALeqCPKUm3grTKk2S6MyrJUfNt2B+KN+NVqnDUx/NRd3MWaCOgFEKNC4jO3wbudQmx8Gn5s+1DxAUqzZ9FPUusT42+gmeNB4lZNlxnVODEWHs+T7CCXBIGr3D20iEzRzCn+CXRRAkOknf+f5CWM3E5+uPU/+o0= 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 BY5PR10MB3891.namprd10.prod.outlook.com (2603:10b6:a03:1b3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.27; Tue, 25 May 2021 18:18:55 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::b09d:e36a:4258:d3d0]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::b09d:e36a:4258:d3d0%7]) with mapi id 15.20.4173.020; Tue, 25 May 2021 18:18:55 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, njavali@marvell.com, mrangankar@marvell.com, GR-QLogic-Storage-Upstream@marvell.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH v2 24/28] scsi: qedi: Fix TMF session block/unblock use Date: Tue, 25 May 2021 13:18:17 -0500 Message-Id: <20210525181821.7617-25-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210525181821.7617-1-michael.christie@oracle.com> References: <20210525181821.7617-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM5PR21CA0003.namprd21.prod.outlook.com (2603:10b6:3:ac::13) 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 DM5PR21CA0003.namprd21.prod.outlook.com (2603:10b6:3:ac::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.2 via Frontend Transport; Tue, 25 May 2021 18:18:54 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8f5f1c75-60bc-4b2c-949f-08d91fa98e8f X-MS-TrafficTypeDiagnostic: BY5PR10MB3891: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4714; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: thnU2Py+oNhDUdGvQOgruuc56OQmKeRa5ow1eXZzNOGdOWuILhJ5YFsgXOsZgAOcALnWwAdAi5eG9UL75kqpUXDfZ9hrVX7Koy2qI9ydVEPCHqt0l0vE08uTmfJypEruKe5BGQVOPOpNE41oTG1ZTAR0R8etSzg+M8VdLFJ27AfwvkfIzmAg/ejqPr+vvyLKrsJtCVnGq1IVtpxyoZ7uEG0IJEH61SNlDoBQ0bUdPpRXtD8lqtGpLFDQ7rxbQjjmKpmIMdcbOlIdxdEE9qZ/F6LlF3cHaW1EPCKIKBKMWlUWZZCEAs9rTkgLMuptt0eSIx8hMRUnBuk8mQsyoHnuwDeQc8NoEL2HwY84DRgrft0ARocjTFNogHCpUCsO68EIdmHs0jsxGjDt/yB6wPy9ZKYc6TD4urkmmz4IVjtzLwKoNB5VDThMs9D/wxgKLGR+jBK11On79QN9sCSTF5VL06oHEdqGZR5cGShg2NKwndtmtCvC3myMPIdV+U25konj+N4QWOG0i5chIoRa8DHhJSA9onFzmR/pwntqW230Z2V/ibADV7Tg9LZXDetO8uoUWd5AP7ZeTdX8RJW1oKbiY8H5HCPG87nxe/lJ7mILgQBzZwRkZj5bKszroKvvKHY1OoxkuRkW8WF418TuAs08dec1sZE2Lc9We172excs1cpDn3CX8kjBuGUo1Cal6bra 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)(376002)(136003)(396003)(39860400002)(346002)(36756003)(83380400001)(6506007)(66556008)(186003)(16526019)(6666004)(52116002)(8676002)(66946007)(8936002)(4326008)(26005)(66476007)(478600001)(38100700002)(5660300002)(1076003)(956004)(86362001)(6486002)(2616005)(316002)(107886003)(38350700002)(2906002)(6512007)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 4JrsyVlTkzxPf7M1guA1ihDJDNF96oU+uMgZ7AiqeyLlLNZhtY8XXNJOjU7JydCmW5DFB4H16gqRUKNTp/kFVKvcpPVkJ/EjXNhZT1CFkkIweRFdc1M0DCtmU1ymGayuH+ku5h22c3aPE49nk4cPcpZ8UKcMJBAsNEOjgO9CBJZJZs/fuJuDfn57mlU1zBapoZbcVzD+TbN4dC91nm4wuBmPJ3oQGIcgek1qJNf+6Uq8O14Dic+szSxA75SprG+7sl9khlyh6a9OAIXBqlIxHekc+ZhUOJnA/A0ZErToWmEM8JUYyyDcrpKbcnbqfuq5KbAZTJEWbLbn0CHvaNCdwMihdQbZ1Bn1tBXor9B0X1/maOweG24SvfHrTSEKq9lLVztkro/SnzzrxJMuUBajpRVuFmIl9Us0Zi6BD6poXqmgeLbDXtNNJRoOKq9iAaxcL8TBeJTWkZoE6OZxMUb+EKzzQwMjTGePMaWLiAoAjifWHZaevR1cCYbYTWsQv/6PbFRUxkKLgx726HxGS7VCA5ceDuurwXAdAMOJUgNjYEjpFunNEUyH4KkI5GcJBNGB+W5QQLxq782ASBc1YqBJEgTRken11z/zbPvjzKbW/E7ihRs1pbfbPEAw3xcvCgdiZ5GnSRHPuow8l9BjWdRu/2dKDO4p9Q8vJJuj1t63eTeCMg8k9KZgWP9n/mpKdEdzze7Q+ZjD+aSWJ31q78TzwcHoEKXI/o9YT7DpTEXTVpAlaEOMT5DgrfZeXw+1CO83IxBftUZq8NqKI2VyItKlIUI62zXeujy8wDJpOqi42nbwFRfjeLwefQjtUm5LJqrbXreNV1JGRG774lvgalQwIhzLtzBo1NIBsTzGMXEVNPp8+1mQdg184LtpS4OJFZdFPHKDRvwyRMAcMwcuedtFGe2wf6BTjuRRJfDq7Iyx0YntftABNSSFMzr2+9krs4KSY4bfVMfIsoqCo0pY20cNmvelbE7SqTgMPz/as/cXPg4uKgt/0MbyIZ9/Z5ULkbsBWucJ3FZWb98loe7fHHXi6Ps5H8Y3XjuPrQkbRMQ/Pb5tULVk1HEAJKx/omk+v0B6VQnDu+/Eaio3dxwTN2zDyX/s+mbR/De4Y/ZquDipGoQ4ww3/UFw7lCzsjhGjoYkvBWVc6IBkCJ+XH0XwOEN1S69Kbo0W5qTEao/ogYFQbbxo1GSGcyRftoCKETtIWCRqBqzlXrl7kAScvKwq1biwivEyXzfNDFzoU/JScfBUd4JqFvl5eWXl1d3e8peprgwnIO93Eyn/3NKGn8SmqmeWCh+Wkmemqaq/Rt1WRN72kQhCNArKrsqWpczJIKQ5p2R5 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8f5f1c75-60bc-4b2c-949f-08d91fa98e8f X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2021 18:18:55.3183 (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: dM67XH0dDjMSnx1eOYa9f4Jw4OPsKUxsNGsskntkvmpu3eUwdQ93CHGmYv/UekfZH4cH6AEFfHTDHb2EvNTaWGeTAGY6CrBfAu3/NCTMNyc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB3891 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 spamscore=0 adultscore=0 bulkscore=0 mlxlogscore=999 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250112 X-Proofpoint-GUID: wYMU4dohyxXSaXIxkObq_Mxdm2CYYhSL X-Proofpoint-ORIG-GUID: wYMU4dohyxXSaXIxkObq_Mxdm2CYYhSL X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 clxscore=1015 malwarescore=0 bulkscore=0 impostorscore=0 phishscore=0 spamscore=0 adultscore=0 priorityscore=1501 mlxlogscore=999 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250112 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. iscsi_queuecommand's call to iscsi_prep_scsi_cmd_pdu-> iscsi_check_tmf_restrictions will prevent new cmds from being sent to qedi after we've started handling a TMF. So we don't need to try and block it in the driver, and we can remove these block calls. Reviewed-by: Manish Rangankar Signed-off-by: Mike Christie --- drivers/scsi/qedi/qedi_fw.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/scsi/qedi/qedi_fw.c b/drivers/scsi/qedi/qedi_fw.c index e82c68f660f8..f08fe967bcfe 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 May 25 18:18:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 447687 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, 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 C7580C2B9F8 for ; Tue, 25 May 2021 18:19:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A057D61404 for ; Tue, 25 May 2021 18:19:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232410AbhEYSVA (ORCPT ); Tue, 25 May 2021 14:21:00 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:47190 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232301AbhEYSUl (ORCPT ); Tue, 25 May 2021 14:20:41 -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 14PIGHb7053628; Tue, 25 May 2021 18:19:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=/b0Y6QfZM5snDlg/YJiM0Da+Gu+sEC+KOLn7VIp1KCY=; b=B4Vgsi7iQjT2CqQrllWwzvY/QqN5XtD0FPV67820XVP/eqHv62+4rN5Nxx/ub0DwHXPJ 4CcHqnq/9k/JXFMYRfxRbZYARlKUMGoQ8hxdgMvA09W/YI1qWMmykf7bq7u6AyAhk8Hf dEXBJ8vd0ahQhGPuqCcGB1jXHctJ3XqvMmmqeJBUreCoEHjjSlM20cYnTJQK2VsSLokC P04AyVK+yhFdM5q4FTlOjkiQQmUjX4Kg25/jpIA6CQb5zd/UR9Ggterkd2q2/vtOi9FY 3y8W9SUNortU7Y58lxmA0le6EchcuwZmXnWsCNKEEs4boO8TqBxI31mWF/oD6iB8KUvc Dg== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2120.oracle.com with ESMTP id 38rne42gv3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 May 2021 18:19:04 +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 14PIFGMo104688; Tue, 25 May 2021 18:19:03 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2044.outbound.protection.outlook.com [104.47.51.44]) by userp3030.oracle.com with ESMTP id 38pq2ufk67-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 May 2021 18:19:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Pz+XSb0m3m+vcFdw6wajT2yPQ+1v1fMLt+DU3MExnz8lC/JW0jCBR+QwDjK+MMPaFoBEDi0EbmKwXSRizWGp4BlCwOwMgS5/H0wMjJyFzJiUOBfFceo9lmb7hxYBT4iPH3xBBUlEWTcrN0y9+kg8HpOEivpBYNweJmS3HIENUdPIMXvd5y3sQnSEvalotUKz41VqFAby62YVXgOUl/JBSumwRkKxUE5X0R5raW78sV0fVtdsjutvTMcBfXChKgJLNi9lTgEYUhXMLzRXQB7ql58aMnLEjRtBoO3AB3Cjgwgd0By4V5kokO+Qe8tvjxvYgi5eLEFvw9vopYMekJuQeg== 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=/b0Y6QfZM5snDlg/YJiM0Da+Gu+sEC+KOLn7VIp1KCY=; b=XDg6Y8rCzMD2j4f9EFzFx8iii4SNblSh0RZ/sQNwMd7nRDJqMy63Me/QtWcyF7Dhqig9zmCnZwFC4U3btR4hXKcTa8MhDVh74jBvsxx6oS00hdlAKB0s+g6CjxFRxJfnVB/Vhr7UiQE86hVEtJ99kly4jXUwP8VjTjpos2/wMHuO7SyjfH6ygUTUcZUHzhnmBi0PMwbxgdDlc/uA4HsDAt44mSgOt9vhlYoLEWROaCia1zjJqGkd8VcWMxnyucpLFtqY74rpiwJf8oPoxsxktmxzKUJPo1qxmUHDkybNSGGdjxf8s8Myx9u+GP0tHciMA04A95snX4PF8svGXya+1Q== 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=/b0Y6QfZM5snDlg/YJiM0Da+Gu+sEC+KOLn7VIp1KCY=; b=MRXaxjg53G1x4w6dXTw3V0BLAop3YWLe8kwW+ECpawOuHwjmH4QkLvgfUUWiTyVYADBj5VXEoNVuTJ7ATRwN97QwhwFDTQyoxrX3iEdNtlQSPvUirkyIZTVer+5PKMMNkWV6aTbt5P8yNmC4MaO2I2Pl5xQkTqUzvuY52VSfnRk= 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 BY5PR10MB3891.namprd10.prod.outlook.com (2603:10b6:a03:1b3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.27; Tue, 25 May 2021 18:18:57 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::b09d:e36a:4258:d3d0]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::b09d:e36a:4258:d3d0%7]) with mapi id 15.20.4173.020; Tue, 25 May 2021 18:18:57 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, njavali@marvell.com, mrangankar@marvell.com, GR-QLogic-Storage-Upstream@marvell.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH v2 26/28] scsi: qedi: Pass send_iscsi_tmf task to abort Date: Tue, 25 May 2021 13:18:19 -0500 Message-Id: <20210525181821.7617-27-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210525181821.7617-1-michael.christie@oracle.com> References: <20210525181821.7617-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM5PR21CA0003.namprd21.prod.outlook.com (2603:10b6:3:ac::13) 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 DM5PR21CA0003.namprd21.prod.outlook.com (2603:10b6:3:ac::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.2 via Frontend Transport; Tue, 25 May 2021 18:18:56 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a3b5fc7e-6fb7-4bfd-912a-08d91fa98fcb X-MS-TrafficTypeDiagnostic: BY5PR10MB3891: 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: wBFzGhvDB3NjfZx10pPK+yhnvJT/BpCRIjsH7CT709+W2LmJaqy48dU8ROGx3MWFJ4iwwYy1sH7ebNvL9c8u6NjeDB80pBZS7qDsOLFA3Pnb8F2utSYZzBBkAu96wJ4cWfcrDDFlL19fjcrAWQZjWFKbm2UUf5bAssyaigzfxRkev9anFXwzeTW0OSHwcLxj/yE5GBetCIw5aOkrSR/JtG5zp/tIrqvbpLCWAki8aINOgC1w4bqh/kSJGVhYg2bxkO9ykjoHzkJkM4LO50G7RG5taMQvgq2b6eOiMuXCpg2HJ45w7LC5ck4BJmkbUzZOn3ZMzjLQtpe+9xzpWyoc7PkSFi+MuGKTTQEC2gbtTnKHw4LaxdLMeYFg36bC3JSBvJNQMHXd2BwL8+gCiKDp8OjlLnBa+7wHRJtt1mPQuIDqCNyALjSEUjeMDS7kpMIDyznKl2AjMi+xBbn3nVktQ75aq/mGAjfGm5M/UoRFwxGd7TS4AzF0GRjCSj3L7rjolRU3I9SR+HaPYYxskJ0aXnY44V9Hel2MtphctpVMmvxBhOHtKQLtCXjcjMf02xYQFxMR5vUn2advvauX4tzwMVnSdfKyHNj5uWG1PGm4Aqtf7g5fulm1d5mB5NVvrrIBlqI4folYJAFybK6aFLMCLao4TuVRZe3m9DcfMde7O2uQn9uwWATR2UIEB8ALV6ja 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)(376002)(136003)(396003)(39860400002)(346002)(36756003)(83380400001)(6506007)(66556008)(186003)(16526019)(6666004)(52116002)(8676002)(66946007)(8936002)(4326008)(26005)(66476007)(478600001)(38100700002)(5660300002)(1076003)(956004)(86362001)(6486002)(2616005)(316002)(107886003)(38350700002)(2906002)(6512007)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: dRlza5i4gmdyXzBxCE6IhGUpnr7Pp4YSZ4rXIMcfK2G1Ev96UXcGE8F2MwBCoANnLpAEPREjPMyaftmYKPcU1XTfcVJHHhKWKpiU1o7T5mDzzVHnoZjJfRgOPqsNSnkEOc+wbXe7bONGX94kLz8AbAq8Hz8VBLlxxuFUJm4m8BqgsgeI793VOybIMz1owLDfigxPWUepmoz8IRCSZ0w0Uu6Yeztsj7s65nZJZ2PQoQTi3kH3CpqGyROvzShoMKAcgsLT00dAj6ecK+ORhDNObAsj4ghwdMBl1v7eaQtZ+yRXlgL29O45AWn6nH/eNc2mUHGcwOgT60DY+wscB/iKLlAHoEzbn3tB8yoE0wg0ibqTM7FK6kWGf4220Fs0NPIc/XXcpuXqOH5dKMIoCmcM84Orq+BovqSKUSBiCb95AnDVW7Su4W4kXbUI/KCjvAwUvgAE1FvAW6JlhZuK1O11kq1ECdve8p49mfgo1gA+SQTl3AJvHltlzQ/CFFKNkvCuj7Q1/IS67Q7FasPjwVRY7U42DMn6tzQK7AX3hPI4hAbQlfUM4Jj8dHVa6BbmgYV+aIm2sUo8DrWhQWAJA6lCLnavxDPLsqS+ctH70fTmmJoqLE76Mr80We7itECFQhPDJGxRRRvq5MhCzRW/Knub7zode5anuToELvSnmu0d/bFc4ndWX88DwaBGC+RDQVCdeOXxe4WUNUwPGmCjl1QXBlmwjAL947PWcyDxe3Q25YqdKo+FLL35W3rI/KMlOKr9hpI2iLNfpIUzneuVPYcU/ooqGJIJXMSYkd4W7k/MmObm4Z+zRTaLfoGlt/83bi4OnPbE97vx/fZfGzc5CkeXREtMgERSFbcqE9jUQTu+odqNxNMbr1l+iJM9KPpzvgeyLA3AT2PjW2nVbFcYunE2N9XuidBFF2eqEoKptsdYHOlnzwNU2clh2FFEolltAUJMWxMzimXXdD5oPXnzwEk5DWzPAAbmWyaOBsmkw+YVyfeX8AmfLWd5687gKJmJJWOWqr+1H1hkAKeGvgLsjnG+4PE8f1RegX/lmi3/7cY7xP2HRah07X7Fnz3mTbHebZzpLubbEkX1RsH3DT9d3r6pwifFZVDOXBtzhgj7YYtFr5hJx2iWzmOr1GOniiwsdRi/Wu2tuMVUdQpQDyYI8jRor42bPKK/kZYORz0C/kgDLiDmLNDs+v4b3UH2RNCC1+gVY6opjk41cOGQY3JciBopVAzHqzk1+G6dlIde2pIHXpf+79zMb0VAgtX2F9DT6j6+ZwoqByzlbIYMIFUCn44wXBYTh7vARIgqlwX4ymCTRdaqXdJ/GqpcI0GJsb6lRbQl X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a3b5fc7e-6fb7-4bfd-912a-08d91fa98fcb X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2021 18:18:57.3362 (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: 2DymknDpjIQAs8jXlRalNygR/fd4GmoRExtCACKAUBX9B/9a1OjFDHRXqEpJ0hl7rgj6XvCZ1LUgHEkOP4sYCv7PEU2cawDo5LVo4Hfw8zc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB3891 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 spamscore=0 adultscore=0 bulkscore=0 mlxlogscore=999 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250112 X-Proofpoint-ORIG-GUID: WivseLJ1MsaHG9tM-nOTtt2rh3ZaQvTq X-Proofpoint-GUID: WivseLJ1MsaHG9tM-nOTtt2rh3ZaQvTq X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 bulkscore=0 phishscore=0 mlxlogscore=999 spamscore=0 mlxscore=0 priorityscore=1501 lowpriorityscore=0 impostorscore=0 adultscore=0 clxscore=1015 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250112 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org qedi_abort_work knows what task to abort so just pass it to send_iscsi_tmf. Reviewed-by: Manish Rangankar Signed-off-by: Mike Christie --- drivers/scsi/qedi/qedi_fw.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/qedi/qedi_fw.c b/drivers/scsi/qedi/qedi_fw.c index f08fe967bcfe..4ee1ce1dcdef 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) { @@ -1428,7 +1428,7 @@ static void qedi_abort_work(struct work_struct *work) } send_tmf: - send_iscsi_tmf(qedi_conn, qedi_cmd->task); + send_iscsi_tmf(qedi_conn, qedi_cmd->task, ctask); clear_cleanup: clear_bit(QEDI_CONN_FW_CLEANUP, &qedi_conn->flags); @@ -1454,14 +1454,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; @@ -1501,12 +1500,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, @@ -1559,7 +1552,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 May 25 18:18:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 447686 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, 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 85878C4707F for ; Tue, 25 May 2021 18:19:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6CC9161404 for ; Tue, 25 May 2021 18:19:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232419AbhEYSVC (ORCPT ); Tue, 25 May 2021 14:21:02 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:56034 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232157AbhEYSUn (ORCPT ); Tue, 25 May 2021 14:20:43 -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 14PIG1sA074924; Tue, 25 May 2021 18:19: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=XHUZVJZLbKxexs2JQozxMaBq5DpLnfmYpG19Op+JHuI=; b=BllpPgKjrsVT/RVx90295xaL6G1QoJrQwBXIAmICP9u273MIqZxVmusRwvMvEkwcGO5r HQkLWiWLE1+7Il+uptUWMnh4QzXsAz4625D7sRJa/xovq0LrUT5uEZjND1oCczX9JtzG CileUJ0U3WjTjR0BcVla600q5gSbwGdR5inH0ohCZdWkqftrxxeF07Bmvz0ZDDT+lYkx SS1SRw/2nYqkkBCwZeWS7k8Z9KtLqpdqHYCkyOPD2RvDAu5+vjSEzNggQADDC1mRYI/E xcKWP4+kPTqfYcgG9dqDB75qt4BWuieFIiQrxSKKc3AWQoS4YyHRD7Oq6JVHBvYOnzKs hg== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 38ptkp6vmu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 May 2021 18:19:04 +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 14PIFGMp104688; Tue, 25 May 2021 18:19:04 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2044.outbound.protection.outlook.com [104.47.51.44]) by userp3030.oracle.com with ESMTP id 38pq2ufk67-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 May 2021 18:19:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jnwFDB+XHJ0o9gvLofJZ426ZrJE2/Pb6MADv6DQnXvJjmmY7g7bGdNSUUe5tLRS/30fuhJfiWyDDGTXozoxI8CPgeDydgrCbcPm806sGgDQVjGJBRFyJJ6pUCwHpvUu6st/ByG5sN8KTJaQKfg1b3klJOurmtJ1uZzJ8aPg3DFrs0g8Vl7a66CXIWcttZNS6fEY0ER4TWHYa2E8uN66f94XNvxMZIuo5X4HTf1i5B4HctjZTeOokg+193CSI1hZj9TCrds4pARBD1YY0Uj9WswOTKUPUrnd77srbiOg4B54YRGgDfoHRXFsSwyx8njDKtCUZNaw2pg2bPrqsbfvqDA== 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=XHUZVJZLbKxexs2JQozxMaBq5DpLnfmYpG19Op+JHuI=; b=QTlb/z99WcsC4SxDH9QT4LGPFw1xGgTXomJQCyXKss2TWUHvFqPsesZVlR+sXm2/E4ysCDDOT/q+VEuj6Jpp+WK6lcysdQJp1Txv7c5weiJ8vqMxI0VIdbQqgkEEPe2sSKdb4baE0M9iKt/nlEGMGoNWwPAWNm///fnw9M51iDs/dOUD1xgP1csDFvR4t8BbhShTXOv2pV1do7itJDnSyJZYPDVV3UPclxPviNeAT5VFxP0QjfjEExS/U/SZVGLg1bw83AF9q/TgROVerB5lDli258zJcvmW+hmxuzYekuSZcT+FSQCh4W7yqFrqAsODMTMyMxD3DU1HC6T2smXUsA== 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=XHUZVJZLbKxexs2JQozxMaBq5DpLnfmYpG19Op+JHuI=; b=dhX08iOW9Rj6h5caiF25MoJuR/KV4sns/g2QkmuKeMbaSKRWxV9BOxY+N5MRrR2s35H7st3WtaxM4+VLxaQTpLyayXa/YQvQp4CptQ2qC0TnnLRUGm1DIKq2CNJj1iZFwXFSbrDMBMvgCnEEKTY0Na3mMmH6mWFLRntMWcPiJQE= 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 BY5PR10MB3891.namprd10.prod.outlook.com (2603:10b6:a03:1b3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.27; Tue, 25 May 2021 18:18:58 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::b09d:e36a:4258:d3d0]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::b09d:e36a:4258:d3d0%7]) with mapi id 15.20.4173.020; Tue, 25 May 2021 18:18:58 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, njavali@marvell.com, mrangankar@marvell.com, GR-QLogic-Storage-Upstream@marvell.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH v2 27/28] scsi: qedi: Complete TMF works before disconnect Date: Tue, 25 May 2021 13:18:20 -0500 Message-Id: <20210525181821.7617-28-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210525181821.7617-1-michael.christie@oracle.com> References: <20210525181821.7617-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM5PR21CA0003.namprd21.prod.outlook.com (2603:10b6:3:ac::13) 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 DM5PR21CA0003.namprd21.prod.outlook.com (2603:10b6:3:ac::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.2 via Frontend Transport; Tue, 25 May 2021 18:18:57 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ee1ba30e-e010-4653-1a48-08d91fa99069 X-MS-TrafficTypeDiagnostic: BY5PR10MB3891: 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: 30nisDwybucBnCReXQfh9DZSPaQWV/luDbW2nWXckPrltvavsLUYXMsvAFR8VpbWup7mdOY05xP+kd2mgDX1caDtjDxPdyHDvvZ4bxWV9S92slmmKfYAkgvOZFj64RtgoU7Qtn/ccsgR3ktukhntS9sA79a63j4KSPAx+PEpR/KFCIXI/5c2EH69uJiE685j69qa1uqSPUVc8Dre1VHC2A1/qrgw0eWwTOy795poji93iPBW2PRkDnRi6xG6OO3Cb/ZEDhFi8lfgxQzRhUOa/nrIt9TvxCkOHxYHCN4Wt+emGAjlXZNKmuo8ajDfwaEnpebJF8K1zv2s5nXc7Tj1NXqXEDTuBxNudKGnRYZCfDgNC+r3Z6hIziUApwVa3PBERVaAPTRdN31PHf8/3YtGFEfCPZPx3RRTdw4hf5nc6tqOoTEqNHIu03EduWH5QFfQKGV1XMYyBRBUpvFiUddGxQLARRv4b47O2DPwi2gbUtx3ewbQamaTz8bZ3ml5XrUtR5P62a0ghY1giJe2ACnWOkcdqJaRTbQR5KhrfN7Lx7B5vjUPmX+qUXuqmZGdqk6eUbZ9J6TBkXPLz1ChCzv0voXir7nmCqm9Ddyn7lPpBlBI1Bf5XaMwQadrd1ORZlfSV9bfHXGN6oTwDE8Rqn5r3c+intY79+IVEXVOAY0fdIIMSr7d+D9+uPRO7XpPyZpF 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)(376002)(136003)(396003)(39860400002)(346002)(36756003)(83380400001)(6506007)(66556008)(186003)(16526019)(6666004)(52116002)(8676002)(66946007)(8936002)(4326008)(26005)(66476007)(478600001)(38100700002)(5660300002)(1076003)(956004)(86362001)(6486002)(2616005)(316002)(107886003)(38350700002)(2906002)(6512007)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: w0FGI/pkyrY5DqD4MugUhi0znK9JtRjVLX552oCR1sVSohjpHkb0ucFEWLLQpvl0fvd5Ri7nALwRHDx1RFjYZe8xRREdwICVbPkOTgODUPNZs0V2EtVmeRDGX3vTgPqy1nYC84AkQGrBey2xio/FtkvfLMRGnWQPWRxwDdPlZNsLu+gvUScmzHqJIoQ/CXa/GZoDReuEM/1o8CElYPqOQCgEWIxJN1cnam0wRxEGlmkwV9hKeFHgm1f7M63zta6ODdgqLvI3okOERCpeGVJ7sGKpk/+qR/ZxOzjvnSXQfgonm2QQlHy3/6Xp+9LlvH/5FFhlCNqNfVBKRDU325rthnyQJXiCd9vOHvdtjRXwK/CJM3FvZOXZiBVTOGp9GCygd/i7f1aB9fTzt+Fq22wrU2PHrHn+76FxUyKaDtTk8sy8YHkXd6mtRtBBpB8bguUoIUzYaBTUqXs/U5RmFxLmp9Mew4uXQYrkPX1ZKWGcz7pfB2iKd6/x7R0eATOcFUKw9Ccj7PCNNNf595SqDeVS8Xz96+fFhdmi5xue7H5mMhm7YYw+xk02pClr6GI1+AS36Qtxc595G/puofm/4Y8l+9nC1P4Q4L1jLnfnz1ZCfw1SM4rstq97eQBmn8aa5lgZkyKUcFkTkaGMQa8/H5sgsrpBzqAcwjZFr05ZBlfwxWnhTlzdkgQ928agRF+VSSz/Im+akZ++I9sOaJ9mjKOJJsDb0b25RBNwedzTYfA96yRq8+SiO0kWIEueJfULsk/gwRysjFrUZKyBzVyAZOR2BP3ySxmv70oFzmIG0oR7PeBTNqiFdHeILUit0Y1T6aY/NtP6hibPt7DfZ9sjGrVwcp60lMjBqm8CsJqCa+yI170wNcgkDwJAvk77ybhwH8Ry2UwS8nBrx1+EQGYVohnmKa4pDcegWHjJlf46nA5KtsiVe02+cPW1tlupyvch5TLnZc+Z4yxp1eZpqsm6E0GRzBT/EAt8BObilcOegH4kFalVyIiIi3s6WLPSAlJnNfRcWZXSjvkG4Hf2SRI2WI355H35noZ0dVpA7eluYsLuzblZ8YM7vjbnc2+N1omqfLUFB91jiSr/H5hdCetUVFnWLHrbhlkpHbKqiqW6vsh/W82pOEK5HWMm7FV2ukAt6I/vQEukPm55cUETm+7aTBnAnJ/9ZvRugU94dLi15vaIxAEyjzY8jbSRku/0vCt7AkIpPeTj/kVn3/yI+PwfA6rrtiw0YIf4tDmALflY/Au4jFg+nNhnYxLHrSD/p5xT1HN2Ksg4AY3rpc0hC6pIXQn4X87HbftiIlyWhQf6aFGykzJAYJ4XJuj4ErQHTSiy9fSJ X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ee1ba30e-e010-4653-1a48-08d91fa99069 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2021 18:18:58.3966 (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: ghbR7l2tvWNWHcjYTTl2RWfhfash10oDnpHjCJmv8mmctDOyxPcqkW/t68HIKkTUNWLy3yvxd4VkjqzYSBflb4z3EnXkwFdRYPpd1pVLs/8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB3891 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 spamscore=0 adultscore=0 bulkscore=0 mlxlogscore=999 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250112 X-Proofpoint-GUID: d5_2ivffnFRa1vxRJMXDkJk-zUeNzXDY X-Proofpoint-ORIG-GUID: d5_2ivffnFRa1vxRJMXDkJk-zUeNzXDY X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9995 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 impostorscore=0 mlxscore=0 suspectscore=0 bulkscore=0 adultscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 clxscore=1015 lowpriorityscore=0 spamscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105250112 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org We need to make sure that abort and reset completion work has completed before ep_disconnect returns. After ep_disconnect we can't manipulate cmds because libiscsi will call conn_stop and take onwership. We are trying to make sure abort work and reset completion work has completed before we do the cmd clean up in ep_disconnect. The problem is that: 1. the work function sets the QEDI_CONN_FW_CLEANUP bit, so if the work was still pending we would not see the bit set. We need to do this before the work is queued. 2. If we had multiple works queued then we could break from the loop in qedi_ep_disconnect early because when abort work 1 completes it could clear QEDI_CONN_FW_CLEANUP. qedi_ep_disconnect could then see that before work 2 has run. 3. A TMF reset completion work could run after ep_disconnect starts cleaning up cmds via qedi_clearsq. ep_disconnect's call to qedi_clearsq -> qedi_cleanup_all_io would might think it's done cleaning up cmds, but the reset completion work could still be running. We then return from ep_disconnect while still doing cleanup. This replaces the bit with a counter to track the number of queued TMF works, and adds a bool to prevent new works from starting from the completion path once a ep_disconnect starts. Reviewed-by: Manish Rangankar Signed-off-by: Mike Christie --- drivers/scsi/qedi/qedi_fw.c | 42 ++++++++++++++++++++++------------ drivers/scsi/qedi/qedi_iscsi.c | 23 +++++++++++++------ drivers/scsi/qedi/qedi_iscsi.h | 4 ++-- 3 files changed, 46 insertions(+), 23 deletions(-) diff --git a/drivers/scsi/qedi/qedi_fw.c b/drivers/scsi/qedi/qedi_fw.c index 4ee1ce1dcdef..3de1422ce80b 100644 --- a/drivers/scsi/qedi/qedi_fw.c +++ b/drivers/scsi/qedi/qedi_fw.c @@ -156,7 +156,6 @@ static void qedi_tmf_resp_work(struct work_struct *work) struct iscsi_tm_rsp *resp_hdr_ptr; int rval = 0; - set_bit(QEDI_CONN_FW_CLEANUP, &qedi_conn->flags); resp_hdr_ptr = (struct iscsi_tm_rsp *)qedi_cmd->tmf_resp_buf; rval = qedi_cleanup_all_io(qedi, qedi_conn, qedi_cmd->task, true); @@ -169,7 +168,10 @@ static void qedi_tmf_resp_work(struct work_struct *work) exit_tmf_resp: kfree(resp_hdr_ptr); - clear_bit(QEDI_CONN_FW_CLEANUP, &qedi_conn->flags); + + spin_lock(&qedi_conn->tmf_work_lock); + qedi_conn->fw_cleanup_works--; + spin_unlock(&qedi_conn->tmf_work_lock); } static void qedi_process_tmf_resp(struct qedi_ctx *qedi, @@ -225,16 +227,25 @@ static void qedi_process_tmf_resp(struct qedi_ctx *qedi, } spin_unlock(&qedi_conn->list_lock); - if (((tmf_hdr->flags & ISCSI_FLAG_TM_FUNC_MASK) == - ISCSI_TM_FUNC_LOGICAL_UNIT_RESET) || - ((tmf_hdr->flags & ISCSI_FLAG_TM_FUNC_MASK) == - ISCSI_TM_FUNC_TARGET_WARM_RESET) || - ((tmf_hdr->flags & ISCSI_FLAG_TM_FUNC_MASK) == - ISCSI_TM_FUNC_TARGET_COLD_RESET)) { + spin_lock(&qedi_conn->tmf_work_lock); + switch (tmf_hdr->flags & ISCSI_FLAG_TM_FUNC_MASK) { + case ISCSI_TM_FUNC_LOGICAL_UNIT_RESET: + case ISCSI_TM_FUNC_TARGET_WARM_RESET: + case ISCSI_TM_FUNC_TARGET_COLD_RESET: + if (qedi_conn->ep_disconnect_starting) { + /* Session is down so ep_disconnect will clean up */ + spin_unlock(&qedi_conn->tmf_work_lock); + goto unblock_sess; + } + + qedi_conn->fw_cleanup_works++; + spin_unlock(&qedi_conn->tmf_work_lock); + INIT_WORK(&qedi_cmd->tmf_work, qedi_tmf_resp_work); queue_work(qedi->tmf_thread, &qedi_cmd->tmf_work); goto unblock_sess; } + spin_unlock(&qedi_conn->tmf_work_lock); __iscsi_complete_pdu(conn, (struct iscsi_hdr *)resp_hdr_ptr, NULL, 0); kfree(resp_hdr_ptr); @@ -1359,7 +1370,6 @@ static void qedi_abort_work(struct work_struct *work) mtask = qedi_cmd->task; tmf_hdr = (struct iscsi_tm *)mtask->hdr; - set_bit(QEDI_CONN_FW_CLEANUP, &qedi_conn->flags); spin_lock_bh(&conn->session->back_lock); ctask = iscsi_itt_to_ctask(conn, tmf_hdr->rtt); @@ -1429,10 +1439,7 @@ static void qedi_abort_work(struct work_struct *work) send_tmf: send_iscsi_tmf(qedi_conn, qedi_cmd->task, ctask); - -clear_cleanup: - clear_bit(QEDI_CONN_FW_CLEANUP, &qedi_conn->flags); - return; + goto clear_cleanup; ldel_exit: spin_lock_bh(&qedi_conn->tmf_work_lock); @@ -1451,7 +1458,10 @@ static void qedi_abort_work(struct work_struct *work) } spin_unlock(&qedi_conn->list_lock); - 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, @@ -1546,6 +1556,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 ddb47784eb4a..bf581ecea897 100644 --- a/drivers/scsi/qedi/qedi_iscsi.c +++ b/drivers/scsi/qedi/qedi_iscsi.c @@ -603,7 +603,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); @@ -1019,7 +1023,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; @@ -1035,13 +1038,19 @@ static void qedi_ep_disconnect(struct iscsi_endpoint *ep) qedi_conn = qedi_ep->conn; abrt_conn = qedi_conn->abrt_conn; - while (count--) { - if (!test_bit(QEDI_CONN_FW_CLEANUP, - &qedi_conn->flags)) { - break; - } + QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO, + "cid=0x%x qedi_ep=%p waiting for %d tmfs\n", + qedi_ep->iscsi_cid, qedi_ep, + qedi_conn->fw_cleanup_works); + + spin_lock(&qedi_conn->tmf_work_lock); + qedi_conn->ep_disconnect_starting = true; + while (qedi_conn->fw_cleanup_works > 0) { + spin_unlock(&qedi_conn->tmf_work_lock); msleep(1000); + spin_lock(&qedi_conn->tmf_work_lock); } + spin_unlock(&qedi_conn->tmf_work_lock); if (test_bit(QEDI_IN_RECOVERY, &qedi->flags)) { if (qedi_do_not_recover) { diff --git a/drivers/scsi/qedi/qedi_iscsi.h b/drivers/scsi/qedi/qedi_iscsi.h index 68ef519f5480..758735209e15 100644 --- a/drivers/scsi/qedi/qedi_iscsi.h +++ b/drivers/scsi/qedi/qedi_iscsi.h @@ -169,8 +169,8 @@ struct qedi_conn { struct list_head tmf_work_list; wait_queue_head_t wait_queue; spinlock_t tmf_work_lock; /* tmf work lock */ - unsigned long flags; -#define QEDI_CONN_FW_CLEANUP 1 + bool ep_disconnect_starting; + int fw_cleanup_works; }; struct qedi_cmd {