From patchwork Sat Apr 24 22:17:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 427040 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 7875EC43461 for ; Sat, 24 Apr 2021 22:18:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5312E61462 for ; Sat, 24 Apr 2021 22:18:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232432AbhDXWTA (ORCPT ); Sat, 24 Apr 2021 18:19:00 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:35618 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231975AbhDXWS4 (ORCPT ); Sat, 24 Apr 2021 18:18:56 -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 13OMI8S3167844; Sat, 24 Apr 2021 22:18:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=yNeQUIdmaxsEFEYPv73q+fsHYITWeU7qxxIKAp14b1E=; b=S/ESETiyNoniOKjFGwZrWmvbwu3jrVWtQZnlaLQig2351zP/AZPjd+BMGmQtybnH2l4+ Ogm++2+4eCIDsP/yAjeigbIBl4v76zkQ6B5PPXScU2MDh+UGRUDsmko1HR5hP2zCGnh1 R3IB9qMfUEIyAGEl3E4eEGBtlf56YBX+R/aUA2Y0i9D2HDb24AL03b6HLYgJ2NGy3QED iIsTgE4HuLWeXXQnvPeCMcTvQKdI0PKZfwlAX4S+Ej5Ef4jPckvtlLZBa74baXiIKNAr 5MIrTsYhAzJESBnyeO66oVLdhPkxvyuTSjFf0RVLeA7xZdxHkqgfxakPIsh/sbuQdLtF gg== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 384ars0t4v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:18:07 +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 13OMAPi6148236; Sat, 24 Apr 2021 22:18:07 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2102.outbound.protection.outlook.com [104.47.55.102]) by userp3030.oracle.com with ESMTP id 3848et2ejm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:18:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ocYz9y+QFiT9JT2HzxHMJy1jPArbLA7x8uD3y8m60kKPXEPOg5PcEccbClydn8cUDAvP/ff9N8tbQuxiPMYOID8GKg7Ru7KQwCSbmZW+8lwnfGimroqmLmm34IYN7929So1dYsgHvWtOFnSNWEtRjNvdUccLUqNKro+PEL9FL6ojR7EhvHjH7c8ZLGPvMd47OTaQUwc8lWwU/cy9/hZfENWXcT/tE4mzW5o5cbLunJ8N2p+zSLO3mwVKVrd1+mK2HcUHumbwQzSwquZoNnkDGowTB106ua6grrLWwpNRkzoNhUmIYjQTL+KHTobAdynEN33cTU1DjZeSjhbc4znttw== 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=yNeQUIdmaxsEFEYPv73q+fsHYITWeU7qxxIKAp14b1E=; b=br7jJTg63p4EfJ2gfYB836zwBq06sZXBNr94pX2COZjHuncfhUF7XuxYpnZsRcLJONMZ6vOPxNEQJD8cMRvRDTO08IBTxPZi3mmgd3onLDLSofBp9NaPoRAuLYdWXoPA6IVs/fIAY/fBZ3CmOxk99ygdYOa5KnASN4hsMI/RnpjYcWrmWg+2sSB40C7Zz3OzXRb/oy3JtpWc1PDgddZ/uKRmmZf59dWJaS2FS2/9OHVmqkmtVRtiXvwssZJlj2iS1HOT3gtWP0UkcGxK5LCkKnyDTUKtuJjK53BHkfjo9dsiQ4MA/1OHhRumbJB9/gAzab0ns7C6mHdRI4xPiVeGaA== 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=yNeQUIdmaxsEFEYPv73q+fsHYITWeU7qxxIKAp14b1E=; b=oL9kg4iQtOOVWgJIZUQsOZ4JnxFOQCt8QDeZ8Tjx0WsR5Mn2DQErXyTqVjua59KTMv+gRbODIaZ1brxFlsHWaNcowjcCLC9IuMY4m4KJyfdza1BBpzW2QgyKMO3iXGF6bNzSPuPqlHBw77JzmEtg4ksevhnjeWaBxxjT01URoVw= Authentication-Results: google.com; dkim=none (message not signed) header.d=none; google.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BYAPR10MB2885.namprd10.prod.outlook.com (2603:10b6:a03:82::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.24; Sat, 24 Apr 2021 22:18:04 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4%7]) with mapi id 15.20.4065.021; Sat, 24 Apr 2021 22:18:04 +0000 From: Mike Christie To: khazhy@google.com, lduncan@suse.com, martin.petersen@oracle.com, rbharath@google.com, krisman@collabora.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH v3 1/6] scsi: iscsi: force immediate failure during shutdown Date: Sat, 24 Apr 2021 17:17:50 -0500 Message-Id: <20210424221755.124438-2-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210424221755.124438-1-michael.christie@oracle.com> References: <20210424221755.124438-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM3PR12CA0079.namprd12.prod.outlook.com (2603:10b6:0:57::23) 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 DM3PR12CA0079.namprd12.prod.outlook.com (2603:10b6:0:57::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.21 via Frontend Transport; Sat, 24 Apr 2021 22:18:03 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6ef40dc4-de74-4e02-9a37-08d9076ed464 X-MS-TrafficTypeDiagnostic: BYAPR10MB2885: 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: ro51wEBpx8oIeJIFtu6iQwV8wyuiouuXoJbUM+JskGOOtGu2HX2gm14CGKuwtBuOF7TggANOe8A60kLgqzNEfrk4rjpxaLMlV3/R8DIuFPZYJx5X73G1KL2vnTU7S/e55UmM9yFEnT6v/LzTv9hwG0L/T8rSRdym2d7pzcQyLq7Yjja+SlLRt9e7u9Y6v8lkTiGh7aQBVUiKx6kDjJS+l2ltVuMQlJ9537jQ0xSl87GxS/KLydekKQ7GT7mz2uIHuRaz2fbtIW3bap5FsTb8Q1vlP0Od7j1O7UZhVaqwvKS7Vhv10ABAgIrMbgPSVwP9a773rbwpuyUOoIpIolbxbxKRKeQT6F2qWIw4W7NoQt2+Yn44glTWFDvJqO/Kbm6c5howAPy0F8k/uK/dZwcPzJEinxNpIToocIGRSSW+jjr50treSB2yV3XrYl1tZSp3+SdftiJNyadz7adkUtN0TMLEtvK13WJFMtuqHoNJSZKhQ+LlzT797vqRLKRD14xcBKWiE1w/zIDPB0VUzRfV8desH5vqu1RgcEOj2mNixU5ufGN9PI/D7FBgeo/iBVgCRBv1rizF+2aQIXQNjF8/h9ijUwU7Yk8qh77Ledse3N5IYaj9v3O7IBdJ+L631l85ss0oXOUj/a3OLT4M4yrt+gRL15fE0mIaFNKUqS1Omf0zi4Z2J+op+vnHirDyLt3RkKo5bx5GlvD4HK/SV+Z3mw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR10MB3573.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(346002)(39860400002)(376002)(396003)(366004)(83380400001)(6486002)(66946007)(66556008)(5660300002)(66476007)(38100700002)(6666004)(4326008)(6506007)(478600001)(6512007)(107886003)(2616005)(186003)(316002)(36756003)(52116002)(26005)(86362001)(2906002)(1076003)(956004)(8936002)(8676002)(16526019)(38350700002)(69590400013)(14773001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: lnRFb23g8/Fzr4lZ/pXvd87SGZltBv9hc1JrQ+8SAS1UPBLdDtqsm8brd1oBYrgTydNPUsdJXCJ5CSBghBmoWA9NEUGJQG9RNMretGWqJitUt/MqgZFHNXpajku256xfJiFMVRj5EbuIzlSIAkBt/AiJRQPsX3LncOjW8gaKKmdSvk3//MdKxL9P4oq8sZnLh3iWQBD2J1Zf8sUbdz0ZksUSEPzok4lAAlQA+9NqCElECkmr6+vCWdNnd81YOmOdSZq6FBv1fqCizpWKQWYJKNEPuq8rCz2JGjIOW4w7QHrjavj0z3kYS90o3mw3bwk0fq4oQ5HCwHS7h1PggRQoZWpTTxjPTlVwHUa2gHzzKPMtCxNwp/PFVbQdadedkrBFlFWu5b8nd1Opje0zrmfHls2qXbN0uzJ5JCiHzFvaNdoP+4oi56/r4ER03v+unixd1Vcse7UF+r05QsXUHT4W2RwHXSRTpKbpJ1XOOVc+PAsWdz8RbaneSt7/aJl4kGj6N6ykUnCNTTxOZSyUB1WfrGR1+hnsk6csqG8sOv0gREVWGN5nanLrf7HzByYF9O8MzpbSaDdZz7U8MqDVZ7QnuAtfGYwi1fsXRGYkAwm4l0YaTLxd00BRMZNqYDUoRLLDv0CP3NFV9sGmdX5mnt6WS1FdkcY2WwTih7Ob3ON7kaFlimqA/+PS7/AbkeAeNXwCYBfxHvfSzk0u2XLsZioZraYpT1HOANmiDh9S2vac9wz1hpjjboqE3HjQBX0nNgcHM/qZ4Zwr/YLncDL2HCruTGi+bwVJuagxCJhpXXsYuZx0/j6XIVmNcUhjeWwVMZQyq+0dt14OiZQgDFMkSfMS+Ff7pvR3F9XBsWYtWku8hbUvQEmNoqjc6M8fYlb11YQuiacO+mdiC6MFb6kYAWwpgWbisll5PXjWIvDhwZz/2E1gKr79I2FExcP4XVkcVpH7UVyZSy6l0K2G+AmmtgaP6DDTd0LinkFdoCYYWn/Ec3eqiaMEM9E4vP5uQ2Sq835KBxxBUXvMZvsz6D7thvQw+Zg/Zwl+N3wOdQIbdLYxsW81vDNch4sfTuQPvaWEofxiBRVLfuXXzvWHioFgMJMIFr2tSB1Ps7+fi0L7XUsaNQXvMtcd+tYYNTftAgnkis2g9kfoRGpNtnmghxXfaw57TJEbDwdtguQ5TRIO78bp7qKN9TY2+lNRGp6eQA504H+1Ge39pKWQ4VOAofgiy/+TIQzq5EtgIZDKPQeAXgDEgbuZVyzYl8sJ5qTmRwRGDOp2iZ4e+RsHUrTnRVPb8hYEFw89vnPlhW0ueCGCCmOqeHauBLY/t5w+ozSAHGRfkC3y X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6ef40dc4-de74-4e02-9a37-08d9076ed464 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2021 22:18:04.2404 (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: ESaoi8tflgPfCb8XyZo30bNPK4P94OcYLdMQnzYm9XCUPVitCCv2UtTI4/pGfc5l+LQKkxCwSltXirLcwo0fxGVLJDeE2++y0g5qnRguYH0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB2885 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240169 X-Proofpoint-ORIG-GUID: H4GO3kwWmZkkGp2Ki7DIqqAr4KPTO_0O X-Proofpoint-GUID: H4GO3kwWmZkkGp2Ki7DIqqAr4KPTO_0O X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 impostorscore=0 adultscore=0 malwarescore=0 phishscore=0 mlxlogscore=999 suspectscore=0 priorityscore=1501 clxscore=1015 spamscore=0 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240169 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. Signed-off-by: Mike Christie Reviewed-by: Lee Duncan --- drivers/scsi/scsi_transport_iscsi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 82491343e94a..0cd9f2090993 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -2513,11 +2513,11 @@ static void stop_conn_work_fn(struct work_struct *work) session = iscsi_session_lookup(sid); if (session) { if (system_state != SYSTEM_RUNNING) { + /* Force recovery to fail immediately */ session->recovery_tmo = 0; - iscsi_if_stop_conn(conn, STOP_CONN_TERM); - } else { - iscsi_if_stop_conn(conn, STOP_CONN_RECOVER); } + + iscsi_if_stop_conn(conn, STOP_CONN_RECOVER); } list_del_init(&conn->conn_list_err); From patchwork Sat Apr 24 22:17:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 427400 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 DD392C433B4 for ; Sat, 24 Apr 2021 22:18:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B543B61462 for ; Sat, 24 Apr 2021 22:18:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232384AbhDXWS7 (ORCPT ); Sat, 24 Apr 2021 18:18:59 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:37412 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231911AbhDXWS5 (ORCPT ); Sat, 24 Apr 2021 18:18:57 -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 13OMFgC0020795; Sat, 24 Apr 2021 22:18:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=UEf71SpZ9KBLYTX4Ep6+i6fQMU3igzidcPyDnBOVGtk=; b=i5UD5PYD3A6ps93s75gvwGTS5ZIONRIqIfuzbqS3D16Z8A0MN8FDpMiQEBAxxF6CP5hS ZnQWgK9aFRgSv4RTp/EXkfNJ9XRDaHOEZSgidOAxE+7j9BDueByM5l9f3j4vRaFxM6sx Z2ZuDJphMeMlo/DT/oPs0Rb2YP/tEjm3bpf06q8BNn4ECX0MHbYR2KfXlwaia79b12Np sAu/SpO4BeSAtT1PIcOAhiLCNsrXoTtYnTOwD+zH7ZTA377TgZV6jjsI8inNakqb6y3B tSXqwSpj48XbaQ1vgBsm2zCTfildoyzfKcZnY39/uWK6gOlsbPYZkhEWahfrjTaGyfx+ Qw== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 384byp0rr0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:18:08 +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 13OMAPi8148236; Sat, 24 Apr 2021 22:18:08 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2102.outbound.protection.outlook.com [104.47.55.102]) by userp3030.oracle.com with ESMTP id 3848et2ejm-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:18:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AhQK7CKTf0QqvUNY0774bUgr34bH2sFeMtmSOzNiQE9RnytnLsQrZyfuV2ovVZ4UQZcprJyvMB2k5VHHicEHPGE45luBZzlLWGKmQJKT5mFiaex5cK2O4+9iE4Ecf99VFK5HXvH9sLJ4rRSRQ/qgUlvbL5owBRAJqO1Ch8oyrG15yYTOvCrFnE0PtC4Vj5Mqo2w3eHnuzje4wWJdotmwMiXkS0I+US4TuASMdScAUSadxlM0nDPQvJSHVf1U71PeO9XVMwPGk5eHaKe4mLiFx/8hhyN9uXRKx7iaj4ARdf8S3AYrRrMlkZ76xGtuW6BKv00nwUYcJjwJTIa73iPqHg== 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=UEf71SpZ9KBLYTX4Ep6+i6fQMU3igzidcPyDnBOVGtk=; b=ElAzXwCfZjXfk7laPNfKp/swufwMGA9+7rRDMn0E+Mc30RgXDPSDa+FA5ziJTTX+JrxBl5Gm8Q+xqYYp/Hg/rVzDdqvjC2Gj5EqHS1t/wqCrEfHd2nL6ow0tgZQuT3uy8DcG4usfrTyxlq7er/wQAVVmKyEOlG3RrRSD42nKRSdNB4SEFv+aKcbj+PXLA9dM5gSaxAytslu4adeywv0ZR05eqPZaTrGuRdp5/4EeNIS5syROv+PfIPz6xkDiYwpxTN7om/3KAkP455gVHP21AGgOXnFrHJz3CBrJrCBng9m2tqTUjSbDzlEuSPk37MFI6e+cLACJ65MKNSrUpfeKVg== 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=UEf71SpZ9KBLYTX4Ep6+i6fQMU3igzidcPyDnBOVGtk=; b=fVAhLUhEk2PUEWVFQLLv7LaeFbG6ZpzE1Qdjy5LrAsor3e6zpROdAVy45gKUzXzHP3NXyAq/S/bluln82xneV2vpzwT3/uoS7MXll+DwUBWMrOagt7U27LrBsbBzHC1UebuN1nWMADfUMzpHgnhOp4GBV1+pNlCksN9/rn4KKkw= Authentication-Results: google.com; dkim=none (message not signed) header.d=none; google.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BYAPR10MB2885.namprd10.prod.outlook.com (2603:10b6:a03:82::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.24; Sat, 24 Apr 2021 22:18:05 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4%7]) with mapi id 15.20.4065.021; Sat, 24 Apr 2021 22:18:05 +0000 From: Mike Christie To: khazhy@google.com, lduncan@suse.com, martin.petersen@oracle.com, rbharath@google.com, krisman@collabora.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH v3 2/6] scsi: iscsi: use system_unbound_wq for destroy_work Date: Sat, 24 Apr 2021 17:17:51 -0500 Message-Id: <20210424221755.124438-3-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210424221755.124438-1-michael.christie@oracle.com> References: <20210424221755.124438-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM3PR12CA0079.namprd12.prod.outlook.com (2603:10b6:0:57::23) 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 DM3PR12CA0079.namprd12.prod.outlook.com (2603:10b6:0:57::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.21 via Frontend Transport; Sat, 24 Apr 2021 22:18:04 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ffe7cf2b-bfc1-4879-944e-08d9076ed4fb X-MS-TrafficTypeDiagnostic: BYAPR10MB2885: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2399; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OJHndCU17huYqvllXmFwmEAat8cRJ7NKh++zlzBWl1L0oRAoQFxC8wkwRFAVbfRmy8jyiQKp74ovSAvXQYxV4x3XqrGdA+MLeOp24sghhjsLsf06/pS6jHGSAq2z/lmJi2iId7O04hHAhfT14iHd6Lf5IU71YkOcx4mr6KX1OPay+kGN+lm70jaaqkPx9sx7w3Xp37L3ifQ16iTRMfw2ZU6kzbv/QJX+PpIj1DeFAwI4I/eQdhbGuzfVjBn7z34lo2JwWB5TBnmE3iZc3yE9Vgt7BQbo+DkAfbj5nMBGZwEhoJfIerZArdAgEoEnasEZbCDBHh99YgvmR4aoqAfs3IyPgeIM+diRvRcyu7k30GErvJaELFaH2OCgIMWKzT/Xjb6I1Rtqs9bkG4CZ34ICw5aM9GBjLdFnBncA3ushdpHetwcvmq/5hUtoA/4AZUFsvVH/Xu9c/mcjKSbAOLRrvodgwF33oonVYOnoTpsVDOfaJ9ZgV1+5s82nlhkVbUbPylcDjqSw2TjWzR4LSB0CODtde+A0JeOtwSydEm4KLUHNPQps8RljMDkYlM7lljLsaEuEPL8JqsWBDb7bZ1VajLE2xUh8+NnwHFSXoF6K0kOE8tO4jMwlb+oV+dtAce+Gukesv9yClI0XJ3kXdA+tap9AVffjQGoyQRXHSatu+xS0Vp2b9iUihwQtA49ohr2A X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR10MB3573.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(346002)(39860400002)(376002)(396003)(366004)(83380400001)(6486002)(66946007)(66556008)(5660300002)(66476007)(38100700002)(6666004)(4326008)(6506007)(478600001)(6512007)(107886003)(2616005)(186003)(316002)(36756003)(52116002)(26005)(86362001)(2906002)(1076003)(956004)(8936002)(8676002)(16526019)(38350700002)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: nUKTTGkmxRBkwsTj6MCRSBkUXhilhmbkmXVSn/BEJJjiqCqo6StuDMmt8A6XPwtjN31TIFmxsrZOnFbZ2CX9sAJZ8V/Hh75m+CXSMUMXM9fuGgyUmkjoYyEo5lLwkGdJhQAlugWxfsbnqhIuHkbV01T2gdku3eHJuIGdpuYg408Jym7Z9HAE7VDLun/cqZl5hX/wvpBNSePqslUp/xKieIkAvIDQNTcr2YBirZBwbudxJC6V6nRutj2oY6hzScyAKWs8T9OCi+6EL2lSojUabl9K28YC8ML4Q/Sa1k1IV06LgnV2qsfZ76hpIgwBa9MSGzH+HLIumeEAs0WpC/HYJl9vAnKINQ5B7vQT4+rQDlwhYW4ytGBW7vFXY+HhYQxvSvLLrei4UseM9yZMoHu1TMOkXTKV1GvrDdLwbZNvJOP0gV66mAJ/0+KAsIiqNZJdi/rzItsTV3F7M/Oz8iDVsou6SJ+X/2AUoZrz4O7shgM2HCXePXgDvmnz9MdgOznWq3b4oEZhCd29qMynfdhcFBkqX+KJEghYhLpqn0uLZtItnJ+ZHCTmitPGfwp6Lt2zZQibgTYOW/BtGBLMzuDa/NVdQdj3JS5ZI3pP+QNB+XXdd6DiMLbGcKmwSj0CoRHtF3tm/vyQIHbhE7Kpl1KKCScgojTz0gYDRzJX4ZiMYkmIdmkQjUBf8IIHSq28xHQWjHh34GuyfZHZ2PQZgGn04a2f4JV+4u0vG1CaqruIZVc4a/pUcN20IZdD4cB5LZG4PIxzp1GMRpq69JKC2lwL0C2iTkv726v0xSLwGPvxXzzkMMpo4fkq4crr36gQHYTKLnuDaEf6NHIiuAVy4LDLLIssXyvnV3z3WZUMZnVJIlUtq+mqVtjPMaIJ+6RuyE9hTuELXrIRWHbm4alE2HsxKQtl1eSewrvVMS7/VBmaAvwM0k4UTvGzk5noopfNjElmC5wtN1FUcjFa9eQc6XQCpwc/grku/oMxEYcWyKDT5Uluo5q4sziJcTd7nGssixwwnFq9rXTDRrQ0LRfJmjinqirBtR2XFQyV0bksn5uPA8g35ZBehyhRMs943hE1pmOo3vrn7et3WiLZzXprTGQGmZxI9jX1xApwBmNqgmRpmmYtvhBSzgYtRce3jjfAx1ETbmhMAwTNlULgbXuHhDayfcMCludaUslJPqbIKwiyqGQe+AKmCawFbdjhsYPlrgQnsXrA7T/IU5H7/jLTwzz5BKf5gd4KfpIr4ilmVi3d7Rl+vR9B4weCe4Slmq6t3rEg85t7rR3Y0j5jDxu7JuJeJZBjo21aKFNucl/kTZcfyrsfymwV+tJajyAz6X3YBdED X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ffe7cf2b-bfc1-4879-944e-08d9076ed4fb X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2021 22:18:05.2129 (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: KUPSpb8FHfKKVKQmZ89x3lDvk3bywjSfnztEpYlLJ5ejZU5ZUXYS74bGag+QLq5J1lcgGP+dLbr1oVAKeK9G1BiGHa6ml36Ettapl1oD1tU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB2885 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240169 X-Proofpoint-ORIG-GUID: RfKTcVmDB0pqA5UNnDEHfsUKd3sfhAbx X-Proofpoint-GUID: RfKTcVmDB0pqA5UNnDEHfsUKd3sfhAbx X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 lowpriorityscore=0 adultscore=0 impostorscore=0 malwarescore=0 priorityscore=1501 mlxlogscore=999 suspectscore=0 clxscore=1015 mlxscore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240169 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Use the system_unbound_wq for async session destruction. We don't need a dedicated workqueue for async session destruction because: 1. perf does not seem to be an issue since we only allow 1 active work. 2. it does not have deps with other system works and we can run them in parallel with each other. Signed-off-by: Mike Christie Reviewed-by: Lee Duncan --- drivers/scsi/scsi_transport_iscsi.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 0cd9f2090993..a23fcf871ffd 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -95,8 +95,6 @@ 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_destroy_workq; - static DEFINE_IDA(iscsi_sess_ida); /* * list of registered transports and lock that must @@ -3718,7 +3716,7 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, uint32_t *group) list_del_init(&session->sess_list); spin_unlock_irqrestore(&sesslock, flags); - queue_work(iscsi_destroy_workq, &session->destroy_work); + queue_work(system_unbound_wq, &session->destroy_work); } break; case ISCSI_UEVENT_UNBIND_SESSION: @@ -4814,18 +4812,8 @@ static __init int iscsi_transport_init(void) goto release_nls; } - iscsi_destroy_workq = alloc_workqueue("%s", - WQ_SYSFS | __WQ_LEGACY | WQ_MEM_RECLAIM | WQ_UNBOUND, - 1, "iscsi_destroy"); - if (!iscsi_destroy_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: @@ -4847,7 +4835,6 @@ static __init int iscsi_transport_init(void) static void __exit iscsi_transport_exit(void) { - destroy_workqueue(iscsi_destroy_workq); destroy_workqueue(iscsi_eh_timer_workq); netlink_kernel_release(nls); bus_unregister(&iscsi_flashnode_bus); From patchwork Sat Apr 24 22:17:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 427041 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 627E9C433ED for ; Sat, 24 Apr 2021 22:18:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 42E3F61249 for ; Sat, 24 Apr 2021 22:18:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232382AbhDXWS6 (ORCPT ); Sat, 24 Apr 2021 18:18:58 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:57176 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229778AbhDXWSz (ORCPT ); Sat, 24 Apr 2021 18:18:55 -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 13OMGiHW140107; Sat, 24 Apr 2021 22:18:10 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=6DetpekqDgJCi3ymH6Ng8P28WB6UpVg2PM8ajAWGOBI=; b=t5KFh5T4ZIOHLjS7++WA+yGgZTNuBNwbklAto2OoGCB3TVyFkvX3tHoanQNTA2SvAfl7 0X0OnG67SaJvWzQc9u3fofd8wMz4vKP7QAEdJc3zNU0KNzW8cQViGsJwYD/XqnoSwi4Y LtfiLJyPz4HMxeuTfMYf+KiTTTLADWB6M6fXEBfvY3IoJ0TQ+xaKhTRZ2+fgbpkwH/fU hQvfFmeUAZ3JBPsswRFsz4ou2c2IfkNiBbhFY1+/58ePZFVSENtIQLWBNpXLqysmcCHA 203X8gvLsc93qlkKqs4AVKP9icj570ZiVT/5vm4MmStdwhwe8y9td+J6+VIjEDI6P/LH sg== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2120.oracle.com with ESMTP id 384b9n0snr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:18:09 +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 13OMAPi9148236; Sat, 24 Apr 2021 22:18:09 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2102.outbound.protection.outlook.com [104.47.55.102]) by userp3030.oracle.com with ESMTP id 3848et2ejm-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:18:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=la1Pt6/c9Sl17qCXK2V7TtL+DWKt/6/mtGIYsL7bMbwfMyU8yov7KxbA1O5bwULeNQrDmYmDg2Jfn4a4GdqwJGyl5P0x1lM3dDMXvSrLrcU33jqS2MH614zR5luAJqU/WUI3UObPKclwN2twBzp4a/yEvumoVcIWE2zaAlRSoaaieY44LVc82tGi/aRJ+gS6Py4y6Vs7hw82ohmVh/qv+/oXywHkEN2vzoRx6YN2t01Y2GdFfP20vM2YmC+dDSF+0trNmkZskI6iEDhYcJsoqKSloU4SUoQrcJBgMgluiVy7+Jwdm1dGdDN1+hqdQF3WDbKHRbuboLcFClweAUwb1g== 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=6DetpekqDgJCi3ymH6Ng8P28WB6UpVg2PM8ajAWGOBI=; b=bxtxSHiMgy6Av1hvTesQPGgcqpsp84WeY28ILdU2FylJZk6Zx41GfUCYBhW501C7nAbADNCNHXu8CEw02TAOYb5jGgzTJo36Hp1v/Ljakgey+/5Kc0anUqnEDyyE2RPkPDhTYBNOMp80fmbNMls8Vl9TNz2sW8a6gzPWxx2Clnc3whcKbcPCvuqXoEdp27Rq9cFBHpA7VoYrZbHyfxk2m1GQs5eZYwefNhtM4/IWigfj4XvyU/cbwBtfGPp2w4/G33HQKolqKIxzbk2iyEDhRi3bQHoxPclAoYDVrUI4m8wSMc9OLPmGNF6o/rs+KnGVcDe7PztD/Al78MqQPCaTCw== 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=6DetpekqDgJCi3ymH6Ng8P28WB6UpVg2PM8ajAWGOBI=; b=GfCr/WAsKvTRpX9ANHLhSQ7uWzBxUpxNyLA+Ctj/EbiHJsDx3rIj27UQAjWn0s8ZjolC9d3pCMh6T37pB4bQAqcj/AY3RbCKot7s3pHKOY2zXEQ3CIRR8p+Ia23hxn/StCBmwssNoeXndk1FiAeuhHsV6jrTX5MT/rlnwuGSjR0= Authentication-Results: google.com; dkim=none (message not signed) header.d=none; google.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BYAPR10MB2885.namprd10.prod.outlook.com (2603:10b6:a03:82::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.24; Sat, 24 Apr 2021 22:18:06 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4%7]) with mapi id 15.20.4065.021; Sat, 24 Apr 2021 22:18:06 +0000 From: Mike Christie To: khazhy@google.com, lduncan@suse.com, martin.petersen@oracle.com, rbharath@google.com, krisman@collabora.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH v3 3/6] scsi: iscsi: have callers do the put on iscsi_lookup_endpoint Date: Sat, 24 Apr 2021 17:17:52 -0500 Message-Id: <20210424221755.124438-4-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210424221755.124438-1-michael.christie@oracle.com> References: <20210424221755.124438-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM3PR12CA0079.namprd12.prod.outlook.com (2603:10b6:0:57::23) 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 DM3PR12CA0079.namprd12.prod.outlook.com (2603:10b6:0:57::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.21 via Frontend Transport; Sat, 24 Apr 2021 22:18:05 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1e2e6fcf-0f00-4fae-5f9d-08d9076ed584 X-MS-TrafficTypeDiagnostic: BYAPR10MB2885: 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: LVmhcHMeIrAmynzwnVMSjI13cTe7fst19yP/KArSE29T30++76eDMZvAeGr93c85avRnpsorF/I7BIZWYdAMn3Qdjp2+g+Aig0BEOLtUU1CqQMrIjG4W38xUKgaWeSI3s9mS0Dk5NJ4DAAyKQPslt5C2f8U41jqkYlQ1eMLQ5Z/vf7khQVKZyeIagIgCurfsHOU/iGEXW5iDQ78fACF9cYx87twOFkP7nAIJDxOd6bI9E2sgpOd6uDpd2U1sPM/v1JfKJdahPLmiH17RzIAoEh8A8EML6HREhCYaJTYp3MHDLj/TeXPN5TEm4EpfRQeAgEXBH2buhfAYcNYPigmM7XqIWFsoulWRp2JNrYwrx1UA4HVFKHG8+XdjpRElUPMQ1JZMEFrxxGYCDtgr6nM6mvKqiOUyUxyWuFxZ46VSrWA/VOf/xu0J55lkEO8s9XDcVugEeQC99GiDjEi8rkyhrDtpWp0s2Ht3eclz9OfSkhEsZAgz79d3Wwr/BGMXSlzzGLizR7mbYySGu9JkMM9S/ZxWqxbWrn1tXH4bKEDKifhiVRRIykhtM/hF78yDnVCmVFjov4dwv6oB1kszANJ3Ar1oXQwpADbDRyqk4Zbm6zMFiqWv4lI7MQWFSfqpc3Y2FY/FpWniELsvdww494DGRe29TC02b+IwHQFaiZVjvf4DbahiFGv/JOZjYR6TyXL2 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR10MB3573.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(346002)(39860400002)(376002)(396003)(366004)(83380400001)(6486002)(66946007)(66556008)(5660300002)(66476007)(38100700002)(6666004)(4326008)(6506007)(478600001)(6512007)(107886003)(2616005)(186003)(316002)(36756003)(52116002)(26005)(86362001)(2906002)(1076003)(956004)(8936002)(8676002)(16526019)(38350700002)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: b/X9Q0LpY7/mdvuHqe/CPUm0ebFFKf6JR1Eg6m9ViOSbXuxRYmomm9zEnTVCVOQYU6hep1kj78bDLV6CTE1F9XAFrsI2l8HCzFFqVCsE6mopihHcNnwTIb3FyzFc+Fjo5P/BVRO/ZAf2okQywI8ajMWuj/QKfPjB3ub2uuBDhlcUDm5Z7Esf7W4b9Fb4OYU0F4NGSBWMHV/Yrzh+hsWKGLJNl6DoYK9dWbR+2wDgkuuMrPInFqHubQSDj74CXEO5ItTKTFBVqN4qEaeCOqDHRv529/G8QwsF74jVOV2alZtx1meN47dTII2mSByWRZ2mAWEtcCK3RJ2HET66Yuw3EzOY0OQbaXhcwvMCe85gsSTrGrXLJT/9YwAhevMI7sJAEeqoqfuOqDC/VwzU+qJ/ZNxL9o7MXykAa5AgQCLSOIYtgxJWyxwtFEWDwfoLhj/KcLzSiHjpJuwiQKeqf0DDViShWRE/sUcXVi3hSwY8/JtWhJMETA4DyE7E3LdDwjcsqG0+yuDUyPySMugzyxjtJXoijyoVfLEwnoqxxCwyozDuVTLS7L8heD3Q07Whs8VXw8HjTIYjOrF+oLroP+UM1c+/EZYwqCIcercCSRfTEhLdAqXdQroKsUGih7G5i3YoIHKe5xy4LJjTusw//WijIiU2+fdPGFvok9OIuN0DQw8E9R+VDoJf4qJ5N7UHK90S4Gvj/lu9VB9hmrMYm1Jo31ZhIPUkGoLvPAroF7Mq2sGRIuKA4x7WxVLdN8mzhBrSMpjfoJ7vIXkNIIK9CbeC7XVZ5riPEt6Yj6hQoBGYYClcJXzWauFeGLeXTQva90xI27P3znBDfw32a+H8Ix1KTaE8k9vhVLbdILnHTVz8C9ko4RJt7c0xbSbcWWKRaaxNv40k2SKoJnCOWK38kYOhko+VX3Y/el8y6ZKpCgZWU7TIeP6LUuTVZDADhd1XEpfxJaIBElRjf8o5SHN/ASah8JvBYp7A/4lRStp4m9BiIMC0SC53bBXHbLoAN3i8AO+5PzCFX4E4aKh1ROuoiJjYxWbV3oh1h5i2ymXVzJw4Oe0FILoL9zV0EWWJ/wmgELV9gq1GZxIPqbyd3JFPSPR+4+ExOpMxNzlLDbUlaYQ5TXYe0/+f236Ed/jq0tiaQxB/RgXi2v1ErhwxCuDwF+kH3gdXpVYZ7VoUv2c1+7ZpmwSvFCa5PiA7tHJrrOaBEQ7lzCW4X9Q+fwFpDDeQxGfkv3FMy6jxOO4w0OJ3zfgg3Uw4Rjruk2N9NBg8XFrniyt4YokVyoPH+q8s0MT9oSRji8wTHsKnM+Gi8e+0niFcViENwb5BDWxIWqGdxjE1P6pS X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1e2e6fcf-0f00-4fae-5f9d-08d9076ed584 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2021 22:18:06.1344 (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: wpk+KFXiSNxjlirjQjI9Jtbd5Z4+6VkPdNqoic76ZNZVkrhigvVCLfkKHljA5ReVgA6AgHsAb/l5siMT2HOVJXnRy6jKlRoi+GVN/m/KoAM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB2885 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240169 X-Proofpoint-ORIG-GUID: 2J6vEPKikjaWd9sd9k84iifEVb-579VZ X-Proofpoint-GUID: 2J6vEPKikjaWd9sd9k84iifEVb-579VZ X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 lowpriorityscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 suspectscore=0 spamscore=0 priorityscore=1501 clxscore=1015 impostorscore=0 phishscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240169 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. Signed-off-by: Mike Christie Reviewed-by: Lee Duncan --- 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 a03d0ebc2312..0990b132d62b 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 25ff2bda077b..bf581ecea897 100644 --- a/drivers/scsi/qedi/qedi_iscsi.c +++ b/drivers/scsi/qedi/qedi_iscsi.c @@ -387,6 +387,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) @@ -394,11 +395,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; @@ -408,13 +414,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 ff663cb330c2..ea128da08537 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 a23fcf871ffd..a61a4f0fa83a 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); @@ -2984,6 +2989,7 @@ static int iscsi_if_ep_disconnect(struct iscsi_transport *transport, } transport->ep_disconnect(ep); + iscsi_put_endpoint(ep); return 0; } @@ -3009,6 +3015,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, @@ -3692,6 +3699,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); @@ -3763,6 +3771,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 Sat Apr 24 22:17:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 427398 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 F2E70C433B4 for ; Sat, 24 Apr 2021 22:18:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C971A61462 for ; Sat, 24 Apr 2021 22:18:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232876AbhDXWTC (ORCPT ); Sat, 24 Apr 2021 18:19:02 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:51950 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232363AbhDXWS5 (ORCPT ); Sat, 24 Apr 2021 18:18:57 -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 13OMEvPN066590; Sat, 24 Apr 2021 22:18:10 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=NuNmrEtx1BmIOYGr7HpCFTzFsJlV0MhQ8YoanYp6mMk=; b=pe1Kks8KFc31qF71I0PqUrOVVJYpJhTvLDFYhIZrlSBX2CF/J0WMTzO6b3HFM5mIK3CS h8Od+ztimu9Afgchz+TZw9B1JrqPtayiJOLLHKNSEiw2PKdPtFHob/qahZxPg+bi+uwT gHtTGf/YcSeg7yXoZ8yL+gxfMmTShMOUdJ7r2tWiwGzZI/5XBcJcokYlGw+5LNN5T6LU dUPX9ILtOtkYHBzCKGKAF3XU1sVge9s+fWCI3YNgEITT+kWoiSK76o+CLnHIpvL2koc1 IIhtD5SRPjaGsAg7Z39aY+8BHWZ0dWbljHgs+rXRK7y7MGmzcqI5fUBKAmoLa2h0qKWy KA== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2130.oracle.com with ESMTP id 3848ubrvj3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:18:10 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13OMAPiA148236; Sat, 24 Apr 2021 22:18:09 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2102.outbound.protection.outlook.com [104.47.55.102]) by userp3030.oracle.com with ESMTP id 3848et2ejm-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:18:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ScXzJvD4GusEAZVNA+sx1dN/EVbyhKe5p9sKyxbmp921A8CZYZehjq/3mF2VCnMTKOJc7HQDmCNet9P7mcM+B2pFw1i2xTvRL7OCpElS+LyRySyyZBf/XckviaqkB4FzLDhSXTf7TASEa/2QJQjEpna56xS7Pa7bM2rEK188Xu97R1YhP58OuKy6EJJY5t3VN4Xs+wvt4MubHLuaouSpIJUKRgnC/0/5u+C3HqMQ2sdLOXFqHQsXo/pfv0Lq/TVGw4xUSs/CXd5ZWLSRW5HRBE7f+HBqxkAzegaC+6jXEi+ytoYTnLgZuvsROWAqVJOIT9hR0p3Bmua1JyZyVVhewA== 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=NuNmrEtx1BmIOYGr7HpCFTzFsJlV0MhQ8YoanYp6mMk=; b=cdhVhfOy3WVpyinprbIbo7TqOlUklFeu8Qhl4kHhWx7FNxbwuWisd/pVhX3OHATOCt6ePS08X2+ELlg4o5IMwdTA6RVydoJerzFnDHEPk5RudGn+TvbdIoXr1X5pT3p5uFmoZw2QuGcKWqNdzYmphVqFvRDX7M2qGYmg+Ie1yerGii4eZyq/o/MlLwvehVPcTLAuHbC5tHkvLvdCVoiLI6DdxIhTXj/ts8LsVB8xq7gLb3+KmwakqoZutpw/L7pSwkHp20De8RHugATd0X33jG9A2TgrdgFBGCHqM0ZT6lq2aDP/GyDYIfNCXh7gwti+5wgKxjvSfu32M/S33fNIIQ== 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=NuNmrEtx1BmIOYGr7HpCFTzFsJlV0MhQ8YoanYp6mMk=; b=Jk+nBZZhic1crH+7iowcyQvvas1uqU1buDNB+7NIg4U4cwR9SPli5tnc2cXYJ5/Oat/QHtpvjkIyVkANEXJFWz4vb8a5v0sSF95q6tBwUjaGa9ukE6WH2PkJQU456I12wNoEfiE6fMhOcV5yUBJVajYODf6mwAY+vzIROnoVEyU= Authentication-Results: google.com; dkim=none (message not signed) header.d=none; google.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BYAPR10MB2885.namprd10.prod.outlook.com (2603:10b6:a03:82::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.24; Sat, 24 Apr 2021 22:18:07 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4%7]) with mapi id 15.20.4065.021; Sat, 24 Apr 2021 22:18:07 +0000 From: Mike Christie To: khazhy@google.com, lduncan@suse.com, martin.petersen@oracle.com, rbharath@google.com, krisman@collabora.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH v3 4/6] scsi: iscsi: fix in-kernel conn failure handling Date: Sat, 24 Apr 2021 17:17:53 -0500 Message-Id: <20210424221755.124438-5-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210424221755.124438-1-michael.christie@oracle.com> References: <20210424221755.124438-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM3PR12CA0079.namprd12.prod.outlook.com (2603:10b6:0:57::23) 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 DM3PR12CA0079.namprd12.prod.outlook.com (2603:10b6:0:57::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.21 via Frontend Transport; Sat, 24 Apr 2021 22:18:06 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4f78971a-bc39-4662-971b-08d9076ed611 X-MS-TrafficTypeDiagnostic: BYAPR10MB2885: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FO3Ku745JMjPKcgserdF/Q3kEagfQ7ccoasDncBT/T3dw87lnq+aajqIsboGE7FWlBpBP3B97aO4Sb+eoZ3gsLdvOE0mDxjFAKm6zGgfqpguExB+p+5kD1PNZcddooYt7lRDypBOJDIgEXwhZsv1lZt9VcGIiwBNN3JK82325+FX6xLD2GpRqjiAdzd96cZjdjZ4tHS0VO23vOlDWjqrLeBd9uBOHBizduAKzLGHOwtDbt/EpP4dUjYIQqk6zdL/H+wC9fYPlFepmW+kPvDUERkqbkq5MgpXfyNX08WhgmshWHF3MI0iXIJGGzvDMeZo9KJ6+K1yytfp95jkoyAsq2r6OonqibZuxejJ9HmKi3wGnJ2RKYFbvaKsfSVN8pCLK4StYXqyeTl+CBX5DFy/4jua3aaNgAT+A2JfgNRqtejXges75Z/JiMxzfqyJ4H4xNDRq1+cu+qTElykI9DrMqMDcrcWn46oDqX9UGPLImsb8MXnrLwSr2JAwehGcsy3GBzxyolrNqIyPbVOAfqXDOiCkXabQvTLiyu0eFVOklgjAIKxlqP/pdygAHU/5coiWHOc2UMCx2oxksmAQ70ykQz0jqN6GdAUuGmd5Yw59X5Z87zGJqWUe3vToTV2ACqxVp3McZNPJX20TBExHSMBNc0nOM4MkGQ0CGFaxPTlmLFOKDcf2gTfkX41D97f5yljV X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR10MB3573.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(346002)(39860400002)(376002)(396003)(366004)(83380400001)(6486002)(66946007)(66556008)(5660300002)(66476007)(38100700002)(6666004)(4326008)(6506007)(478600001)(6512007)(107886003)(2616005)(186003)(316002)(36756003)(52116002)(26005)(86362001)(2906002)(1076003)(956004)(30864003)(8936002)(8676002)(16526019)(38350700002)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: LbZxVK8RS50lAZkUfv1LNH1ThaE7IOqCCAsCnuoxwj5pTcPH2EIDOjBJwHcqKiP0gZOB9rTcKgFzRNmWhPht239S0PN5OduDqc447dzqEUvQ3ULjkvdFxDDDcmVQIx8vI9DjRL7nRhx8oyiPlcuqIgJoGLN5kpUSkAqwublogcKJSJC2XiXoV9GrybCUuS71T0kEAQ9lFHw+eG0nKl39y1vV7yk0VlYT6Kn8TrsrqsBdShNJ6nyDLtMisqa5fqsI/yVpMnML6QfaDR5evnapx1TRNwYufD69FLPas/w7/B+DybhAbNs/yuT3SR+jTyyC09le4cJn5V2NL654wun+L7ToWkuwce0uqPXfJbcyBD9P++qdaeXVwaFjoyVCeHxshXzFqM5jh8LFMgyJrHljwTIDy2qY72DuULWGxR5/1bBJG90skPWLEPXtC7XUGS3lnCVTEa8CqArBfyr41dRL+swTTykCwzUK6I9QbwoL23GF/3u1aoMZikdVXsygWA9DN09ABfxDrPAkeuaWuZB7lOwY1hKrF60thoPqAqEx0u0nbCAvhk5lvmcIVAPPN7MR+rD42tGI8gv99jqFy84+dmof5r+JDj+vvNw90dDpvR+dCuAwbhEuuGugs7EEXlStrzcld4Cvrtd5RoOvRbRUIi38Tw6O8rzVtZQz5qFPmCpmE4ENLS5dQynqKW8ZletkwvrSpqFyi2KKffWLAd+Z1l9RRqu810Z9Ur5YHxjZVKhtKuQg9IqWk/ElbRy9FbGYYLz783jmoNAetJ5MXIEVUE3cHwWOwjuqIrz6e7/m06zV4c/wfus7iPNo+/1paRnq/qBqRT17sOrOOq3r6/VEHpOesE32eRgglAlT5FCWbYBD25L71FWx8tyWDcBkPZD+ywsboorQYwvUTanwpWCmjH+MQtVEdFnTOtexCUCvIwX25uakkzBuQ+TK6Wg2OVzWAsooz0rZLAaC71Qs22jWUXEXmWb3AuMRLZ6nY0xP5ZGFA7VN/hljgIe50x/KciikuSu1VX6epVCiwK/xYZ22epxasdv0CJIFt/AGdcgNhuMptOBpw+DeYxsPL7RluR7E3Yjz7Q1MJrMADYzOBmBw3QKNzQAT9+wmPDiN88eLZitLGfme9++q+woz5mnR+OwPOU4Pi71UYyvH/K6MPDXFHoTOBGqiuREMY7KVM8eGyD6ngYcDk10JhEl2nlkTGcwdWjQiAMc73C0DYFm9Tq+W70ngh6saS9CuH23EpsPRsk09hIAoks/0+qNna2TyDTqx3i9TUALeivivwNBEKwlmczVH0R0rR7cmL+9oDtcu5t+n65+JsT39rRQAHRJ16n6b X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4f78971a-bc39-4662-971b-08d9076ed611 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2021 22:18:07.0728 (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: RWm2JK2UCOxmFRW4i6LNAOGhUc/+CdDtIY/9UdZ++Y4+wDbrKzvF8QKHTglhuzHv5BIcHUBHK5+w+1eyoX1GQqkR9NCfjivEs9bS/0JFpbE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB2885 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240169 X-Proofpoint-GUID: VO-wwCod-bS_nONCrA7lPa8sC0oOT0Vu X-Proofpoint-ORIG-GUID: VO-wwCod-bS_nONCrA7lPa8sC0oOT0Vu X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 priorityscore=1501 lowpriorityscore=0 suspectscore=0 mlxlogscore=999 phishscore=0 spamscore=0 adultscore=0 clxscore=1015 impostorscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240169 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") Signed-off-by: Mike Christie Reviewed-by: Lee Duncan --- drivers/scsi/scsi_transport_iscsi.c | 453 ++++++++++++++++------------ include/scsi/scsi_transport_iscsi.h | 10 +- 2 files changed, 271 insertions(+), 192 deletions(-) diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index a61a4f0fa83a..1453b033b5d8 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,106 @@ 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 void iscsi_if_stop_conn(struct iscsi_cls_conn *conn, int flag) +{ + 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"); +} + +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 = conn->ep; + + ISCSI_DBG_TRANS_CONN(conn, "disconnect ep.\n"); + conn->state = ISCSI_CONN_FAILED; + /* + * We may not be bound because: + * 1. Some drivers just loop over all sessions/conns and call + * iscsi_conn_error_event when they get a link down event. + * + * 2. iscsi_tcp does not uses eps and binds/unbinds in stop/bind_conn, + * and for old tools in destroy_conn. + */ + 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); + iscsi_ep_disconnect(conn, false); + + if (system_state != SYSTEM_RUNNING) { + /* + * userspace is not going to be able to reconnect so force + * recovery to fail immediately + */ + 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 +2374,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 +2431,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,77 +2545,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) { - /* Force recovery to fail immediately */ - 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; @@ -2534,12 +2552,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) @@ -2869,26 +2884,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; } @@ -2967,7 +2973,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; @@ -2978,17 +2984,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; } @@ -3019,8 +3038,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; @@ -3647,18 +3665,134 @@ 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); + } + + switch (nlh->nlmsg_type) { + case ISCSI_UEVENT_STOP_CONN: + conn = iscsi_conn_lookup(ev->u.stop_conn.sid, ev->u.stop_conn.cid); + break; + 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; + + if (nlh->nlmsg_type == ISCSI_UEVENT_STOP_CONN) { + iscsi_if_stop_conn(conn, ev->u.stop_conn.flag); + return 0; + } + + /* + * 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. + */ + 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)) @@ -3735,90 +3869,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); @@ -4821,8 +4881,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: @@ -4844,6 +4914,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 Sat Apr 24 22: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: 427399 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 7666CC433ED for ; Sat, 24 Apr 2021 22:18:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4E05B61249 for ; Sat, 24 Apr 2021 22:18:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232482AbhDXWTA (ORCPT ); Sat, 24 Apr 2021 18:19:00 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:51946 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232120AbhDXWS5 (ORCPT ); Sat, 24 Apr 2021 18:18:57 -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 13OMIBZt067995; Sat, 24 Apr 2021 22:18:11 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=r7lGCJ9gQ3/dwuXbOcD8imlS9kd14qZ2OmO7vMUWvBw=; b=KfaOJ4hbNHnlDV2Vho2lOJhvIJH3+9zEQ8xRCtrmbkXHtvsWWuMo1+nsWflzMlM1+eRP uH1jxoMIOXJCGa5TOGpz3b6XYCzWP9bJ6AGY/EbBcES+UKPG9s6287QucEryEEJ/BGUD +Z5gFZp1+bIUgJhlvpRYiygvjkWZq8l2Ln1+DwwI93hR9SEZop2fc6aujZfelJKEDBRf X4CUwjp+sr9dZ9rqyWICqLztqQDYQJ23YrakFtnoGw/uwO/3UZAjstQELZn2i/vaEfWB 2UKe/uOgvXiCg3iyH9UTwJX8tuMMgHdTCJTB5pUW8VsH3UAHsDnzoIZs3gW0bUwPKSyW eA== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2130.oracle.com with ESMTP id 3848ubrvj4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:18:11 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13OMAPiB148236; Sat, 24 Apr 2021 22:18:10 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2102.outbound.protection.outlook.com [104.47.55.102]) by userp3030.oracle.com with ESMTP id 3848et2ejm-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:18:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=csBsWWhocQUY3PV6wS3n2/1pY1ADc7O52wF14yb64slEvbfNHUxdBWt2/dz95geqJKzpk0dq9JWzHMEJVSK6MPe1oLUmVezQDH6O8yJcdWUE2V97D2t3QPr1BgRnUCBLTd+Mf0oCPys3J2fLhYtoQfOl5M1j5oOqlN4dafgcubQRC94nDlpEQ6RyCzDXf59Tt/wnvLBufI6WfAaFXpiAm6S2xdkIWzflCO7Lt5msc7p+MP3Z4tPSd7WyM88FS1gLMrWNTzU1OE381FvhGl1mXbhwSHYILJNST7/yNyKEYjY8ZbupqpAyLiOgclskTFJG9ALpS1Jbgp3eFSQHB4DYFQ== 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=r7lGCJ9gQ3/dwuXbOcD8imlS9kd14qZ2OmO7vMUWvBw=; b=Jm/FBuQIPmvJxXfO/LJRilOV1Z7jL+QHkBCxyIF3S79XHG492T7r+FoCZtoqXBwHmwZHQ3Qg7/cEi9qnS4s5E0jdkXPO098MH83M7CjXajeupwJgo6cVApXZjc9rJw/quxYQfkS75kp+qNwSRD5FhXKLSvt58zAmgNDZPp1fVPTE70Aqa53Mi9sJAQ1Q5Nk+6Nm/iNLX7XXb7LS6hMfMGEQ0dl81OA/E8d46nrpfsWdMyGpZeAG4F28ei/e9qR9+nAlI1uxM92gcWyzWu2HNtXvAH/JmgjfmC8iroxcxTkH13z9riYWFNH49KMzYkZPF7n+WJJJhLo6v+EYyhlGfgg== 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=r7lGCJ9gQ3/dwuXbOcD8imlS9kd14qZ2OmO7vMUWvBw=; b=ZtcR2k1O4aBHjB7P+pFrk6tgUbkeHx+tCQcsVvDTz2WDtqhKquHz+xg7DzWPQhR++oAV3o+3OTSrdm37mWoZvwLzvHji6moj5JJ7slHXTL251pCu9DHsMgaosAfXXe/ClIRFilR24hCV316W15myCRS/iaRd1lxu7/WeEOCMfyk= Authentication-Results: google.com; dkim=none (message not signed) header.d=none; google.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BYAPR10MB2885.namprd10.prod.outlook.com (2603:10b6:a03:82::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.24; Sat, 24 Apr 2021 22:18:08 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4%7]) with mapi id 15.20.4065.021; Sat, 24 Apr 2021 22:18:08 +0000 From: Mike Christie To: khazhy@google.com, lduncan@suse.com, martin.petersen@oracle.com, rbharath@google.com, krisman@collabora.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH v3 5/6] scsi: iscsi_tcp: set no linger Date: Sat, 24 Apr 2021 17:17:54 -0500 Message-Id: <20210424221755.124438-6-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210424221755.124438-1-michael.christie@oracle.com> References: <20210424221755.124438-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM3PR12CA0079.namprd12.prod.outlook.com (2603:10b6:0:57::23) 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 DM3PR12CA0079.namprd12.prod.outlook.com (2603:10b6:0:57::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.21 via Frontend Transport; Sat, 24 Apr 2021 22:18:07 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: be44218d-064b-4fc9-58db-08d9076ed6a7 X-MS-TrafficTypeDiagnostic: BYAPR10MB2885: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dLz08wwhhGkwn3V5wIMLGnLTJ9fXD63Mlb3yP2g4kI98MXphbHjIzYov/VfvWVfPNmZgE/87BbHCMLPIlIXJNgclpeDno/FIheLFSpn++1CGoWns+fXHtw5pVMD/ZVGxnyGXcTGp6QV/gNNo0LzGZ2Zrg6WWHDPT9+l3sSW7rGri2iC+xQASBBwXnqtfZvulj68xZEt3YM+ApQzLKKGlnmqy2q+eXc2rjge5ah9BQ0dYung5XALGE7/vqQ0YEH94rOpUP6/OdxcuPoxfXf3TmPhX/dGbVuWUuBrI/uFiqIBWKj46j/BdsAlYD1ZLpLSbWWUu9y35RO1W5fm36s12QqJnNWP3ZUOlxJgNUMLQGdm2vY5jczKCt/qPRWGOcjisBBUeyk5je2Ldkwg87YnbmoKYABUBP9FF00jTea0SBh+7VP697IODiayQ32Oo3BO90kkdfzOqrFiO+7pBpiquk8hvAgXUlTc81V1UXbNU8Xdda/1FhaKjg8vVACe6fOBW84YZcnMkPaFJzPjjCEnnJyqqtiBPwSpX7nG9MY51I0Z8mXFhODhm+dQXZpO/K5LWuJ1o7UkMuRGLV0RK7w5OsZrrAZRe10B/8Uy+31ygSiPq3QPc/owQoDNFkLy1Yigxg8iczJCiVH4f87IUUWtImjocEXPLbZyUftdRRsyIzawnxIzv1oMP2Wo7vgdfiKTg X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR10MB3573.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(346002)(39860400002)(376002)(396003)(366004)(83380400001)(6486002)(66946007)(66556008)(5660300002)(66476007)(38100700002)(6666004)(4326008)(6506007)(478600001)(6512007)(107886003)(2616005)(186003)(316002)(36756003)(52116002)(26005)(86362001)(2906002)(1076003)(956004)(8936002)(8676002)(16526019)(38350700002)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: x3v92Zo8uAPmpzB0jOqmJLlEFH7MK2n36X8NFpjPgNuySSgeoncNEvl8epYdLahiAYNzIDB8DvqzrB3Z4sS1zv4ub3l24KTvymmxHtGilpTnbNgj9rS0lfSwriqGHuvON7rPiyHFpdmALAUXz0Ui0HTye7Rz7UOlilY6GXhHYW/7CKqWYFqqE6BgL2vVpK+UWafEn6aoGYp/FE9eSPROmOcdAWXu9Mi5T02i/EqA2V9SAxdBu4rx6r3n3M1JKqJiG4yGmthj+oHCjHaqYkvn4xgPFZ0UJGB3mbBlmy5mPc6yaI8BWBhWbO6cmPBA3A4QfCAh0k1zQcXZaP5eyrzzETultS4gPHr1P9/qYv5dHQTS51aFH+YpIs8hCCnA9BcQqHng3jolaNHluSu8eZCSiVQ4pOVwU1J6Zt3hEDJ+pNw7x2tXerR1PDFRNUyI2ss5SP4YfYOm3LFJ8tpFbJT+vSOO/kCReEj6X89F+JJArUs/JPjqCI7SqmvsQfHiaaWDUG//eMwwVODoTPmWy3QIQFtuly+XkF2V4mkyFU4F7QAHNS6L8/OsGx2XnOfqW4OXwyiRoVnDZVTSttHlr92HCR9LZlKO+x/y1sKtaZbUDjsTeBVvj3lMTN1ywEHM9FPB8EGc3wq72lXlZMLwrb3W4Z789H94cxBZHeieVWWWrpA0STO+/9fTgAt3KBYsYMi34bf3qonYJrkd01/x7H//l7aZK7S9beWS+n0T5uZOwTvcduP1dopvxP4ETWTajaY93jVhA5UNsnfE7zJsih4840AJG52StbM2e/RuuwPDnHgWsGI0ITdsA108TFXDziuhczWs1iRW67muxnESEv/U+itT9lk9LeFpOiHG/cEFr6YzwMZu8u26eZTgIQp6x/pikhpDPJqzP+RvkMMuQ74ezQzxh0tB/bWs3ckW8ZhfnulJLBNpZnpkM1YSKRwe00XKsDnKLWU5L/xfUpbKA8tEbuYpGsflpC7+JQq37RSndaS9lKZ0tcnocNJrHz+0ft4zBc/WzNiFHs4WIwPdAvZ2alSWcXmNf3nNR7/paGs352jUFx2oIXM8UAyzV7sMsdd0d3BjXcRsLO1NE81PqcbPpJuJzBwJKVmKANRXKJhFAsmDO+6knL/ExkS/MR8N4kceR0BhHW3vD4HRM7gnkjX7ft1E8BLrUt3oU7C+JlljHaozmSCBMCKjGs07MU8/PVJnLtLl+lULecUFm51Uv3vHx1yT7EsV8mgUUjZmXMTf4VsHTCg/2PZDP5bar++ClUW/dLHq273FhJf2+PQZe8UDec2IaFTFEtcr6aIe439/F2N1xbNYnZe5wygYqHKUiKxQ X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: be44218d-064b-4fc9-58db-08d9076ed6a7 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2021 22:18:08.1132 (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: 7/6H+Z0+LYRLA+eo4vwflt+s+jW/zaufhfrzVKnTpmQwu6P36xX5/y3SQnCsj2rQkWf2qjnSUt3aacUqh2GRX0YRqTMPtkj15crQr993RIo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB2885 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240169 X-Proofpoint-GUID: -SV2iR1cCmtYIsyJ3xz3v-zUDWRW3Oyb X-Proofpoint-ORIG-GUID: -SV2iR1cCmtYIsyJ3xz3v-zUDWRW3Oyb X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 priorityscore=1501 lowpriorityscore=0 suspectscore=0 mlxlogscore=999 phishscore=0 spamscore=0 adultscore=0 clxscore=1015 impostorscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240169 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Userspace (open-iscsi based tools at least) sets no linger on the socket to prevent stale data from being sent. However, with the in kernel cleanup if userspace is not up the sockfd_put will release the socket without having set that sockopt. iscsid sets that opt at socket close time, but it seems ok to set this at setup time in the kernel for all tools. And, if we are only doing the in kernel cleanup initially because iscsid is down that sockopt gets used. Signed-off-by: Mike Christie Reviewed-by: Lee Duncan --- drivers/scsi/iscsi_tcp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index dd33ce0e3737..553e95ad6197 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -689,6 +689,7 @@ iscsi_sw_tcp_conn_bind(struct iscsi_cls_session *cls_session, sk->sk_sndtimeo = 15 * HZ; /* FIXME: make it configurable */ sk->sk_allocation = GFP_ATOMIC; sk_set_memalloc(sk); + sock_no_linger(sk); iscsi_sw_tcp_conn_set_callbacks(conn); tcp_sw_conn->sendpage = tcp_sw_conn->sock->ops->sendpage; From patchwork Sat Apr 24 22:17:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 427039 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 661D4C433ED for ; Sat, 24 Apr 2021 22:18:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4884E6128A for ; Sat, 24 Apr 2021 22:18:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232363AbhDXWTD (ORCPT ); Sat, 24 Apr 2021 18:19:03 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:51948 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232058AbhDXWS5 (ORCPT ); Sat, 24 Apr 2021 18:18:57 -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 13OMIBig068003; Sat, 24 Apr 2021 22:18:11 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=sZtKNpnhKUcmJnY0/M6obBbjXko1kEOYVNmLXouY9SY=; b=wyIOjkgpintem6wNN+swXJNBQ9olDvjsVIgWs7EBTqGWwKhhhiZh9Je/WrLEYilnnsUh dFh7scOyTL1Ls8SSMq7yPF56WFuutt8QZSD/PLK+XNcFeJS7BUpLzwSL3BmJTS28M83v lYySGrSpM913ft7bg/dsUk4S3qhJvzcDPaHib5KCDR9NA+1T1f2I27aB7QunX/4K01sw lO4WomhcC0ErdmtA4MiV3cUa3S0dID7eF1GPKAbIfUw40A8mX9i4a1IIxTagZWYaRkuf TwbT4GDH4GZUdA4OfoI/lIdmjbHxE9swEGsRJs8duu3NF461Lsu1uDstxblLsV/UCHeg eg== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2130.oracle.com with ESMTP id 3848ubrvj5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:18:11 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13OMAPiC148236; Sat, 24 Apr 2021 22:18:10 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2102.outbound.protection.outlook.com [104.47.55.102]) by userp3030.oracle.com with ESMTP id 3848et2ejm-7 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Apr 2021 22:18:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FEZKxvvpBu6hLyjABGCXM/Rd2KkGQYiR03J2yRSbLXyOf8jptJz//sCwtzd+UfQmTtH5mkmSZ01aH3cFJ5kPIOsirLVkO9h07kMV+idk7pVGTkl3c1CbaXwhyrJEg1v0svxqCKmGXrv/7mac+gR5eslRIkTCuZKYbecOy6RzsqHi7yPG0q//8vr9j4F52YYgdbQ4HIc7RIEqcQ2fQLE2EU3uqGVVloQMSPPOaBYS50B8EN1brG6dgIzzCEnuBI/nYpdE1lfJ2mg4cK+4pPOadvlzUqmRytIeyTzOb1g/F6aSTtC6OvTLqriEcKHUgmU67qiCGTUFqvgkVE6PWrAESg== 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=sZtKNpnhKUcmJnY0/M6obBbjXko1kEOYVNmLXouY9SY=; b=S5zZA5wnCj1Inqrb60hW3RIZn+y0ivj+qsep598ehIN/3oOE/J318SJ/3Kzrc5PP7MZvbbO+RbYh0DrwrfiD5wllqhzTMTijRjySx9cYuRBUkDA7ZtAHvhSOYZDU/CV2C8cif4n8c5n78Ze1V4VDpfBi7KhEYaIlqVD3uRKNLccEhbPdw8ktLMeL2X6H6llYzUQ1fgsl4B8YzVrmncfLKlJftCFlAgiDU1D4YbXP6n8Z8guNn6WeOig2x1wFf9YUFaz9uro9C78BeRDJHV0XyWXk2aJwGQb6VCtgsPiwmaKfarQLrnV7/ps0uI/iWmeh0fawO8PA0mOAYerSB/zDWw== 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=sZtKNpnhKUcmJnY0/M6obBbjXko1kEOYVNmLXouY9SY=; b=BUHK74ujcZUmU/1RO3E+AShOUfV8xrefu5yT93XVOvVZAzxzqwH4RnMrjCe6M3KajaPednLSpwEWVYPc75lfGftLTyGAW8GLjo5wtU+Qk905NFKPGJujnJLelPv1TxBnlMVfpx38ZJFndF22G+dx84rXlSuSWl6Hd8+ueY93jvg= Authentication-Results: google.com; dkim=none (message not signed) header.d=none; google.com; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3573.namprd10.prod.outlook.com (2603:10b6:a03:11e::32) by BYAPR10MB2885.namprd10.prod.outlook.com (2603:10b6:a03:82::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.24; Sat, 24 Apr 2021 22:18:09 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4%7]) with mapi id 15.20.4065.021; Sat, 24 Apr 2021 22:18:09 +0000 From: Mike Christie To: khazhy@google.com, lduncan@suse.com, martin.petersen@oracle.com, rbharath@google.com, krisman@collabora.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH v3 6/6] scsi: iscsi_tcp: start socket shutdown during conn stop Date: Sat, 24 Apr 2021 17:17:55 -0500 Message-Id: <20210424221755.124438-7-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210424221755.124438-1-michael.christie@oracle.com> References: <20210424221755.124438-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM3PR12CA0079.namprd12.prod.outlook.com (2603:10b6:0:57::23) 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 DM3PR12CA0079.namprd12.prod.outlook.com (2603:10b6:0:57::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.21 via Frontend Transport; Sat, 24 Apr 2021 22:18:08 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 55d5c9c9-032d-494f-9c8a-08d9076ed740 X-MS-TrafficTypeDiagnostic: BYAPR10MB2885: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:506; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 75/V4AEJudsx1On+2oUnnzagDzhuUm+r3+0ZWrPhtpZ5ucdBCV21NrI2Qg5A8W6BosuCR9MFv18ul+d+nifvvI/d3d2N+WKCnp/Mh4Tu2Fd/gNjxzNj396s0iJgTQnnUBXWvoIi+YXIdNTmL6xhXhX583lI6JpHpwFnl0nBK3VWnU81NAgjvJ+uvj0bUSYDA/sk9OVo5BYmZ61rGCo4N7K0T/IyiVxBUnM9QR8XV6C2BzVbNWM/sdMcMnmrjwnC7+7/cfZUWCRCyLUa5Uhz4bZlSKq4v19cATfy5p6PmakH3Op03vXxanaXVgvTh4Wh80OORmgjn3LOUlRtSO2CWvslqJWfF542hYeIer0XkevElRSXlalzefFnnwl3U8jb1TGNBnLTRjblL8o3DadbWf9P6N3IH6lPDXbltW3EPpdouMV8eukksHxLH5v6z2W0G0Xy5A+unWsIhRLP5cFOLQjCv5zMBnLIao4ROKPel6shPLRVC3q9JO088irmhdbIaJeTZ2eIHSWVxHtOJFXlQWNDHa3pPUXrsLLPQX1VwS7D8NFZ5yc7c88xier0OwO520UxT+MuVCd8ehmqFeEQBz++qqTspUN86HdamflGoHuEHsW80BrxXZxaAT/1G9QJfXiya5REDp9QOIMxQGX2CEeNNbCtGpDfq1GwF3OeOW3/0o82uHqgzROk+H7WIz4nF X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR10MB3573.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(346002)(39860400002)(376002)(396003)(366004)(83380400001)(6486002)(66946007)(66556008)(5660300002)(66476007)(38100700002)(6666004)(4326008)(6506007)(478600001)(6512007)(107886003)(2616005)(186003)(316002)(36756003)(52116002)(26005)(4744005)(86362001)(2906002)(1076003)(956004)(8936002)(8676002)(16526019)(38350700002)(69590400013); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: qqYbtJES+1hgnn3aMkAgTTRVfxJ9I8axdOG5IoNiIAKOCF0nvhwVLCz/qg53Ut3C7VVqgJVUM7ouo6CN/FQpA6GKYjees38DqGsCDkliiOeNS2gdNSRkuLr901DYB/iZBlRpqMGd9FVoFSUSUNGdTFM76VAmTeTjD3FpNx4O6Xdi2J/gN5vjE2JyMNgBLZaVBMYoP4kUvG+zrB2xr8iWSeDrYenYP9kAMVcgV1UX1DXuSbIhhqn5v1GpwEOnhICvYhxC0N0NcrJKsImy4YMN0AYgNz/0vFZUB41dICb42J58pqmooqzezJhwFkSRvdHLAdSbUTkmiTXS2tIMkKQj4ckLtkKvuZ+jjuUZdsKC69DvKKL/ZNK6Y10FGBb11wiD0/QMJswrMmgycUBVQEcxaoUW8zJORzp1f4Am5CFqSr18/MO9NBzdxwgKoQXossspokC23rqwuX5RTWZyMB71b0TvAgKS8ejModGnmofct6Q5B3XeI0LrWYnkYMSace9jnFIBmzLJ4FtYaOJL45eh2daOaZr9prXt1bW18GyM98Wmv0R864PXMp/reDDGU3O1AniLj/KG3rEOnj4EWinr9cSXMty1xZAW7wox4p85Pt5DWDrP0tUFubBYo08Nxni0C4+1a3kh5B6BWnX2vTQZzNPutCQcfrlS9zZPjfdTZRQpYkq2avVT9s58GTpvIB4ecCL/jK9XPXnje3H+zX7vLLykDYa/Ds1/uTBYm+CKS/OUmlJWZsnOWZcwGfxD9M7kgw6cDGwEchwow4bmc/SY/FMNjRX7lWKxOZNSAe/hhRkhqwDCxkP+Yn4/U/Z4+R8Q0QDQNPFYRpI77MhMPNQLlid8u1zdd34BQTwsziXM6HpM1mZyzHQdJfrROaNQ3vWoxhVB8jXlt1j7fwvrICbaGDXmHqYzDAEpOAmwAuRqDDs5ATno1FhV52BdZErD+nXiKrZT8MQY+kBwWyE0zgnd7ZEEuRSNHzOGr6/1MRtCRPTME3/yfjJZprs0EJ9PkkiaKI/HYUxVG9rMc6uEhM6aoRjqI10g0Yoq7kP4elNLKWTDxrlIGFdgsuhPik3EyexRoxKBVcAsNP1HECzn9BXPcJqJeWBNd6zKR30ZeCfGHWn6zRlM8/kxW8fUt1Tym1MmxbRUU9KNHNEEgAzGKq34xqRbhTo8ETQqiZxqBaXTMlrPXuXFtJmqm/aHFBwqXuhmbnTGd5+BeMtIA9tP70cvMXGVOJebUgYYsGit4lOQC5uD1hLBK3PN+E/EFY8qPBlkRUbRTtjuB3cnktjrlCZ1nraMRLgiDKdbF7FFmYJcugx3ijpMZlFubizS7P+SvI81 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 55d5c9c9-032d-494f-9c8a-08d9076ed740 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2021 22:18:09.1047 (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: 0MtjzyJriE+ZY6G9jVsLKSwcmska5jAfMxbWhG4XTuQZKu22PFFys+KDbgVjDaXcaU1SNIHcMBdBXhh//Vo6a2DefHWMwxasSqWjTRByPsg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB2885 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240169 X-Proofpoint-GUID: 7PTA6ndceTmvoBHbAitMVzfVZ3qfPBkd X-Proofpoint-ORIG-GUID: 7PTA6ndceTmvoBHbAitMVzfVZ3qfPBkd X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9964 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 priorityscore=1501 lowpriorityscore=0 suspectscore=0 mlxlogscore=999 phishscore=0 spamscore=0 adultscore=0 clxscore=1015 impostorscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104240169 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Make sure the conn socket shutdown starts before we start the timer to fail commands to upper layers. Signed-off-by: Mike Christie Reviewed-by: Khazhismel Kumykov Reviewed-by: Lee Duncan --- drivers/scsi/iscsi_tcp.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 553e95ad6197..1bc37593c88f 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -600,6 +600,12 @@ static void iscsi_sw_tcp_release_conn(struct iscsi_conn *conn) if (!sock) return; + /* + * Make sure we start socket shutdown now in case userspace is up + * but delayed in releasing the socket. + */ + kernel_sock_shutdown(sock, SHUT_RDWR); + sock_hold(sock->sk); iscsi_sw_tcp_conn_restore_callbacks(conn); sock_put(sock->sk);