From patchwork Mon Apr 12 00:50:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 419771 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 A5291C43461 for ; Mon, 12 Apr 2021 00:51:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 803796120A for ; Mon, 12 Apr 2021 00:51:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236186AbhDLAva (ORCPT ); Sun, 11 Apr 2021 20:51:30 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:47230 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236115AbhDLAv1 (ORCPT ); Sun, 11 Apr 2021 20:51:27 -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 13C0lmZq137482; Mon, 12 Apr 2021 00:50:56 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=rTVY5gwUSmjiV+mMIv3DACwgKheeUkYWLyJhX6pOGaM=; b=KZZu0gdB7KWvTDfoeWb3LMus6EesaDigwKpLur4t5bQMM33tN/N5yYPMyNRIbfWm1swG 75AgQZWDSyTWCYUhNzJyNpjchIVZgslijE8W5rCALE+kITcFSbMYqK9cfKYMeh2JgBeH Nz06vRuSLBO9iivA/1svllcucFCPxaF0eUYRcauhgJh/q2ZBnlJrMiAo6WGRH3fKZ++I UZYJEYq9xfjM4rg8xLuqYbPFISCUybCWy8buoK+wo4kYAlsQ1z0OORLqBuWX0PR0veFt 4iEoFjistdpv1dtvjaOB5dnBqL4skqDka1nR37r0arscvcmi1RoaGsv/YEN63tpfrFG3 /w== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 37u3era14d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Apr 2021 00:50:56 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13C0aNP9051826; Mon, 12 Apr 2021 00:50:55 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2107.outbound.protection.outlook.com [104.47.70.107]) by aserp3030.oracle.com with ESMTP id 37unkmf7xe-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Apr 2021 00:50:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mOxQWI1l8k3uLSPUCx3dKyLgPF/nRbMpPvI04KXrwgQSlFGI2Zg6bUXfZEezx6jqdPKbuKghhpHn1C6V+S1lYfkKNyW3iyFALQAltQKNHdrcjJZBtFl/7GEgb0FNP9nCDEvIPODseaYUrVYcIuuFhU295hS6ACE2uowe1Kojaa6IzG6fSYXoq8OdBOLx2x7IwPPU3WKORjrKd+Xoykv3R88xG3HZN38ULKRMQfPB8u6gcZ7NwO/UC8RqGxAvObYHhoGnv7ezyAnQwzI4tX9I2/uY9nHBlFZ/DBNgijGz3ebIHwpI01RERhtVUYbu+NORJbvj6Ti0Tc3Oo42owVEEeg== 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=rTVY5gwUSmjiV+mMIv3DACwgKheeUkYWLyJhX6pOGaM=; b=djwhdVYtRU9I68skNvqR5Zct/vC8vsX9ldVJTX/oPmqovcZQJQPpQKcuUsIcYFEEUIzF03qqpKvLpgCP8xGxn9A0S3am1sxhnGBpDqmZdbQdShsgjdkOMT05RoC15mj7QaSqko7XSVIoYqcMFfNKPSS0Y3GTJpdDj1xxLSzdtFVllEG1Qm45nEOFP77CtUGfzygWuV2XkDAnpWGl8Xntzq8z647dP/4qRgOlEtXL/peGCxRXQQ73B3AKEnpy6rZejvgWJxo4Vz2rcoKV/dSHUTmzoAtjY3XPs+OiTUsvwRl55vgu8LUwwb76oGe2q2XrUge0S43bftAYImVGhA/CqQ== 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=rTVY5gwUSmjiV+mMIv3DACwgKheeUkYWLyJhX6pOGaM=; b=PGUgvKupyDvUfR7Jgo/V3htzoC3CNE/agTybWrD9FMvkyubGrjv+ZeohEzIsN5fWuKpyyD2l2mM5hE3UidjmXv01amOppQ+cxQkAopPu73wqmFq9eDA7aw5xSWd4MAK5tHE9BXK6E1tJ35DOni/De1hItG/chKA7kcsEJXriBg0= 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 BY5PR10MB4307.namprd10.prod.outlook.com (2603:10b6:a03:212::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.21; Mon, 12 Apr 2021 00:50:53 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4%7]) with mapi id 15.20.4020.018; Mon, 12 Apr 2021 00:50:53 +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 , Gulam Mohamed Subject: [RFC v2 1/7] scsi: iscsi: fix iscsi cls conn state Date: Sun, 11 Apr 2021 19:50:37 -0500 Message-Id: <20210412005043.5121-2-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210412005043.5121-1-michael.christie@oracle.com> References: <20210412005043.5121-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM6PR06CA0062.namprd06.prod.outlook.com (2603:10b6:5:54::39) 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 DM6PR06CA0062.namprd06.prod.outlook.com (2603:10b6:5:54::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Mon, 12 Apr 2021 00:50:52 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6031438b-b1d9-4228-ce72-08d8fd4d0656 X-MS-TrafficTypeDiagnostic: BY5PR10MB4307: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:67; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BPyDa7/m41eTtERtZu5tWWoGLM9TgIkFpyab30U4s94ENbCCF6RcIT3RZG+7NWyPPZ9nuVoyXUOmJfQTRdK0gWHT8K5GJl6UVH5vLuIETs4IZ82vWI/ji2U4cTwEp45gFCpvmo9XpenLpI29Wyg0NkUfJGxVmq2qSIH4JZ6+tBlHfXikIpDi8+HHf99HUEEDc63FXvuViqnY8lYQMaGimKB2svUvjV6e4l5esEdxGdoAbiomqntQZ0GiXB3FJrRmJHU0xDKEEIFbFqy8EeKwr12348ZIJPc+L5jzk2j98ckLD1rU2J46jp6gVTTVhuYdMBaxfobvC0n4TARtbLFqHvYIF3G+KDZ1vqrzPKiKXTaoorqyrLYSp1YsLBiOQoiXJkUp6dVJ4dQtmOnTXn++gl4UhMB3q7Rre+cniMpndH+S4kREXcfEL00WnUljMkdM8Cm/sEvctJfArnnDq8IuGIukXN1jyKxeyGoMxAY3MlRvD4Gx4SosEZ+19zCcTtPMhKuHlUe+475XddwkVznx6TUiOq9rjqhr/1lkVyTQQiAHVxb1mjowSJH4wUXCNM8JbaWjhKCw3GWHG1EmeWgW90Jn2DXlCJH5qsa4TGnfcrx+RkZvT+jr6CfqpAm7uOXloEX/gHU7JNSMQ34HCoAINy7lxm01Ey/C/HiDLAbVPIdkGoNIUL4tSrYuShEflCWV 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:(346002)(136003)(376002)(396003)(366004)(39860400002)(26005)(316002)(186003)(16526019)(2906002)(86362001)(83380400001)(54906003)(1076003)(4326008)(107886003)(956004)(66556008)(478600001)(8676002)(38100700002)(8936002)(69590400012)(2616005)(66946007)(5660300002)(6506007)(6486002)(38350700002)(6512007)(6666004)(36756003)(52116002)(66476007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: ufcxOV9ECStvDGeeCrLbvRqBZMSnAcQ+n8gjAzP/GM51c6y409DDX8ECjSe9lt5Y+8HxC1AIg6CaLWZq31hc8tIIVBBsn4NaSCySM1Fyhbxf+KK0WlYhz8K86btiP417q6k0fJo/Yfd4Un1jz+fwOSKdSVeqbtB6ixNmVNDlAWN4dUAnlD6okyPXC/5mvrYACWPcGJbL2ZCD0XDkq1dLb7WiaNDvUjKHmLL4XkT0/nj/ZUs1vnLp8ODWr6NIlBKuAdRXySJ4O2JmhHKPVRKDXfRCEefMxJFNtt5jlun5THWXocAkLQ/Hy1w1uJ47d5MVoGB71u3DGdTFUVUbOVv+53CxHAfQu1yIQ1QjFBQ4LGczouPqwTWFMgMK4wzMPQOFSQHcZJtWagFFNcOcZl/91i4wL0JNF2rp0fkVrnU95s6kN2wECttMgpSiKbqnwaOJKwJsCR34cl2UqR5Z6AzR0e3PmRlZkIsIV8dSgg0GT7KvVyWzAjHNAB7/d7P2TjWXLIXc1IF9C8wy93UgfA2MDtA8sDdGPuJQfJ+6tVRpJK8jS2V5/XHHdZo2ZMWXVchyOOyVrmt+q9EadMZcVPziJoSKF8jlxEVuXudJ2PMn/tZUBgTEJQ9SZMvz3EEdUTLI9lGh2b71nbhm+im3hU75xYQrPFPKuINWUl8wyP05iuHmdy1P9bEUwnVsqI4bpnqMsf3YCqEDgIzcQqBoREG3Mssw1ayMEPPXuVzaUEoXu3foyu0mSD98tDaqkPc+BCb9IbLpiw8KMwV6eoCJi/Z+FwlyZGhg22zFK3QAlxIW3UYspzJCf1MzEnAReexZGRl6QgCHXDG/XQaPxxPFAYx/zK1wpSOY8//SSqj9FY23u84XDGzU4tbLRCDAOJhci9egMR9FulB2MhDOisA7AXrouqiwuaJdLpebFzBfLkIY1DdALQnpN03OSQzKbIP8QAKakmkIrgeiggSikSF3MKRIJ2dLb3pF8Yawe5ZQQAk5jTOVQolcNfIKcuGkwt6R9fIW+4XV1xblrp9NAC2jeyKbN4gupbPf/sndUtG1SwNqwfTAfuErgKQ0Xr5uTI3xGGlcIghFom3tR7531cZxZ4ZymDoBKGHf9eZ3zIGB+tS0OzVEvyjIqqfQzlDAeY4LEY5eLEjNKNYxtrFaFci2/omiqKiPW3wlZvgsWaFl9ELrAyHaJhXU1ssX0H0/7uvn/KxAZyqFOaonNfONfPjdzzpPSmG0bxmvPBvpdBwW1oAownHNYTzGmEShVNzhspjczdz5fyXlExLiXWx1fDAx/msMXoQK3/CEtDqMJfw1rR1eFpP7R+7ybF3KH6k9tgn6nt67 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6031438b-b1d9-4228-ce72-08d8fd4d0656 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2021 00:50:53.6255 (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: xdx7StArFsaJjJt0KqYljNmS+zrw/2vPzvBXM1fXHqtJby2LnA8+RyuZd4+PsrgFSxRZzAcCZJ4M5Laf/mHfxAJRHewv/1ZWC7/x5zy3VOw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4307 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9951 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 adultscore=0 phishscore=0 malwarescore=0 mlxscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104120001 X-Proofpoint-ORIG-GUID: avkV_IU7iM53GXqfRzJKF-7x1I90B-o2 X-Proofpoint-GUID: avkV_IU7iM53GXqfRzJKF-7x1I90B-o2 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9951 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 clxscore=1015 adultscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 spamscore=0 impostorscore=0 suspectscore=0 mlxscore=0 phishscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104120001 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org In commit 9e67600ed6b8 ("scsi: iscsi: Fix race condition between login and sync thread") I missed that libiscsi was now setting the iscsi class state, and that patch ended up resetting the state during conn stoppage and using the wrong state value during ep_disconnect. This patch moves the setting of the class state to the class module and then fixes the two issues above. Fixes: 9e67600ed6b8 ("scsi: iscsi: Fix race condition between login and sync thread") Cc: Gulam Mohamed Reviewed-by: Mike Christie Signed-off-by: Mike Christie --- drivers/scsi/libiscsi.c | 26 +++----------------------- drivers/scsi/scsi_transport_iscsi.c | 18 +++++++++++++++--- 2 files changed, 18 insertions(+), 26 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 04633e5157e9..4834219497ee 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -3179,9 +3179,10 @@ fail_mgmt_tasks(struct iscsi_session *session, struct iscsi_conn *conn) } } -static void iscsi_start_session_recovery(struct iscsi_session *session, - struct iscsi_conn *conn, int flag) +void iscsi_conn_stop(struct iscsi_cls_conn *cls_conn, int flag) { + struct iscsi_conn *conn = cls_conn->dd_data; + struct iscsi_session *session = conn->session; int old_stop_stage; mutex_lock(&session->eh_mutex); @@ -3239,27 +3240,6 @@ static void iscsi_start_session_recovery(struct iscsi_session *session, spin_unlock_bh(&session->frwd_lock); mutex_unlock(&session->eh_mutex); } - -void iscsi_conn_stop(struct iscsi_cls_conn *cls_conn, int flag) -{ - struct iscsi_conn *conn = cls_conn->dd_data; - struct iscsi_session *session = conn->session; - - switch (flag) { - case STOP_CONN_RECOVER: - cls_conn->state = ISCSI_CONN_FAILED; - break; - case STOP_CONN_TERM: - cls_conn->state = ISCSI_CONN_DOWN; - break; - default: - iscsi_conn_printk(KERN_ERR, conn, - "invalid stop flag %d\n", flag); - return; - } - - iscsi_start_session_recovery(session, conn, flag); -} EXPORT_SYMBOL_GPL(iscsi_conn_stop); int iscsi_conn_bind(struct iscsi_cls_session *cls_session, diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index f4bf62b007a0..441f0152193f 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -2474,10 +2474,22 @@ static void iscsi_if_stop_conn(struct iscsi_cls_conn *conn, int flag) * 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); - conn->state = ISCSI_CONN_DOWN; +unlock: mutex_unlock(&conn_mutex); - } static void stop_conn_work_fn(struct work_struct *work) @@ -2968,7 +2980,7 @@ static int iscsi_if_ep_disconnect(struct iscsi_transport *transport, mutex_lock(&conn->ep_mutex); conn->ep = NULL; mutex_unlock(&conn->ep_mutex); - conn->state = ISCSI_CONN_DOWN; + conn->state = ISCSI_CONN_FAILED; } transport->ep_disconnect(ep); From patchwork Mon Apr 12 00:50:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 419772 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 CA43DC433ED for ; Mon, 12 Apr 2021 00:51:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9BB816120A for ; Mon, 12 Apr 2021 00:51:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236139AbhDLAv2 (ORCPT ); Sun, 11 Apr 2021 20:51:28 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:42512 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235323AbhDLAv1 (ORCPT ); Sun, 11 Apr 2021 20:51:27 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13C0ouFY065721; Mon, 12 Apr 2021 00:50:56 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=xPgGNTPZv8tVFH2XfDVKdMvUvcfXMspj1YtoOj7Lzrw=; b=jhyustRw6hhgs48jg3Q9QLohM/Ne3EMZZr7icANcpj7GXmiXaRiwWk56HToidi7nhz6d 6Q7rLe63w/1RULgnH2o9pVQ8MmNGH93WWkUqh0Fr/Tq3oi/ZW1rYqdozIFeDQIsaohOa Ngi5j6Uca8q6I2ZvMYaZNQd+Qlff19VlQsp5X4XA8E553ls1P6EXQG57jpM7aAh2W9Au Voijgaz/2E7Bu1HhcgM7nK2aTYwr7GSBSobfMVBYT7T2agB5aAe2vpd1fVpFm6JLd4WY LeDwjmrvmN17nJR9UqxPLwkp/Ddbo/fr558Gbi3+NXQZ+tQmuzeeM4vjCN9gsqa8KcTv NA== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2130.oracle.com with ESMTP id 37u1hba3u1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Apr 2021 00:50:56 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13C0aNPA051826; Mon, 12 Apr 2021 00:50:56 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2107.outbound.protection.outlook.com [104.47.70.107]) by aserp3030.oracle.com with ESMTP id 37unkmf7xe-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Apr 2021 00:50:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DNyIpPWNPWpBzn6YuRnJDHiiqZcg3XHPFlSMzDGwf2GwTyxjFwwjLnsIOIs64KEYx8vSNEaNU19JPrNSGUWwoC1nTKSlWoZjriJ0fRKG4ykM0zy+HC2R7G13+8FI1AnFzSK1DXwthv5deb2yVXStxBedQEQCpW0t3NvFqa/to1g9RAcFwUsSvv9xsg77kr0CS27vG6new/LclSqhY6LAbDh32Y+jRBU3E4JuDXMYFU/UOLsuije0qBSLjGhFHe92MbyT34+YGM3KjjFbjeHKhJq9ymegauxFW69fGIOWr4D6iw4iMNDSP5jJhW3zVmSJb6Rb4yTyhDMTNlOEflIPAQ== 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=xPgGNTPZv8tVFH2XfDVKdMvUvcfXMspj1YtoOj7Lzrw=; b=dWnnGs75QoF7AVAtPNAra12SMA5hcsq+WhzNoqCZpLZWB/f84Dv7paM71nANBLvjz7gAFO3ZPthAYXMTdAg/h69yOZjtymEmEq7mTLYv8RA8/GSm3Vc1iOOGUb785dQRtzb5BS9/UX4UgOKODAVNE/dyuXXocM0aUghsn/myixkbvxgiyZRBM+p8v+QWAL40soBdwHIX8OXO9kPPl0TMYq5rHDIFEX35q3Ixui4VcjhM2OgCBdPhIfN11fkhixcD9ON3h0gGNkktP+Bs4hHd7VkS0OE0pBqLVbmsgijcmbd6O5g28BrdFcgHn+ie/3IhQZh4gJu670q2hqE9zBP2Mw== 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=xPgGNTPZv8tVFH2XfDVKdMvUvcfXMspj1YtoOj7Lzrw=; b=O20Ix0JaR6o7UgefDC69cO6/hJq9dXEErYLaJxr20P3nQcpvcc8sWx3hn+ImtwW/nw2Kt7zoheHqLDxb2DSsifNI53v+UizjFIHAsm32mYZFT0vUU9RhTnTE1QtfEN8pcqpgX1teDATLegmcwav//gUYhkNQZNa2MV7AQEBX560= 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 BY5PR10MB4307.namprd10.prod.outlook.com (2603:10b6:a03:212::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.21; Mon, 12 Apr 2021 00:50:54 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4%7]) with mapi id 15.20.4020.018; Mon, 12 Apr 2021 00:50:54 +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: [RFC v2 2/7] scsi: iscsi: force immediate failure during shutdown Date: Sun, 11 Apr 2021 19:50:38 -0500 Message-Id: <20210412005043.5121-3-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210412005043.5121-1-michael.christie@oracle.com> References: <20210412005043.5121-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM6PR06CA0062.namprd06.prod.outlook.com (2603:10b6:5:54::39) 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 DM6PR06CA0062.namprd06.prod.outlook.com (2603:10b6:5:54::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Mon, 12 Apr 2021 00:50:53 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1820a55a-8fca-4e5c-bef2-08d8fd4d06fa X-MS-TrafficTypeDiagnostic: BY5PR10MB4307: 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: T54IDnxsEyrRoEjU+feeuTT37JUbw16yPmY1C/4p73JEs95wZFN0JfFtDvH+ieLUj1KuCvBAuj0XkdwDUs94IEQlwVOjKUpmmfPySf6M37iLsn3p9WA0dBMN/hMcJGCBZDtGXdXhl4Ac/X4LYPRG/dWTxHtsegnCxiAxPizzc8ZCJoW/l5tzgHqQ83CTDSbeXhWLBPDbIAF0lSb/QAt9swBpj6utpFLGCVYXo4z6KSJuaiOsYZ0bfMD+5BVUEygxHyo8pk8QzN440GkkwCDiWbgPdWXMyMuMJjuiN8nSkamYYQ+IRXYis2PBOB3CU2nUP1xV08RJyXTbZuxdpDYNJop5sxGrf0GVmHrLkU5uI0OJN3GtHCxjIjZ+EgZB21XFEN2tOpZMs2d0NunSEctftXFNK91+0b2zNRtPHnzFsLcPzSov6l/wC9ug0iAyN9Pk8RVJuzsIDD0I0njMHJKf9PTNo3NSv/SThubNzRyEkXByYv/BffLKR7qkpO3+UMgR4j1Tq4YksnJgXCKeg4rdBpbt8QlZ56DFTri30igyvYXWYsr0qywBP0xSfRKtED38fK+tmEBidA2fAjNSWObW7gSkRDBpig6DoK2SD2oZkodevQ/3Z8lXChswhEJa1WG7lOcCWzFX66EHWgI6RLffKOCtiFNWqo0Y2f2ItamsNlGvkT4ubpsD0/0YoaAevD12DXGXWKQdH/j6ST8i71W+eg== 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:(346002)(136003)(376002)(396003)(366004)(39860400002)(26005)(316002)(186003)(16526019)(2906002)(86362001)(83380400001)(1076003)(4326008)(107886003)(956004)(66556008)(478600001)(8676002)(38100700002)(8936002)(69590400012)(2616005)(66946007)(5660300002)(6506007)(6486002)(38350700002)(6512007)(6666004)(36756003)(52116002)(66476007)(14773001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: KJ6Jlc5O+hssvJYSJR0fGj2JaOPVE7bbrCFdlrPo7qkwjyGoci8K3IsuUcgiNy7SePxk7OOPFv+1NZqVajJA4rzgelBy0P6ypr6lvuV8bZ/gYxrhSc9++fFoYyeZdOG4nJ0g4eeSUZ6MfKmw3NVy11KXuIst2YzOBNSamA6VYjUmKgpS8IN+K5fbDsKMJ7YcLBZBCq2Bqi9nAL+RXhOb+onanx/tTFpBwKUZRDF2jdCRytsXuPJOw+TbW3cfAvnmS+UPpr4VtUpq5jmZgzxeda5ubwBQfKkugyGpGlqR9fKCWjenTidz3az40mM2fptC3huDM+hR/emFpUMQ1Tzrm1k/apcxjYNBaQvwLikO06hevGYdn8KaWfeR7RQD1XYtniOmceefs4Kzv24NC8GswzvzUAeIhVd1RY3T3ZocQ0etCa+WsSHyzoWxtQ2YVsk8LRDBpM8q6os/Mmnac01691MVPwPL+/XALfisdX1wNBqOgbwGHxvELCb5HMnO3jIvx7KWJ+hEPnr9y6f0yQPIDpSgsuXNzGk0PDXly+/rhQZM1Hhzy58wSfKnjfeGfj22z6QSEvqFbaa3f+BLwDNRwO/FQ/ebkRiOdudy9x1CflngAUCximJrPwWqOOVrP6iZGjzNOll/HIQc1CH+r1as5GIH7HRujcGez+Hf3RAML0ibF4KZwpIFqr16Hj0Zh49INooTG21xWZ+rHxxpJTmuN6sSy9T7F42/6KwyYeEHRQSgFaKa9zOOiPVoCuZbkNQlQJL0e/YO5NLjW0kI0gVr+/WkNmZg1mjziPE5yEoWXrLKrZJOVIkbNayAqSnzTc3UfUwGH7+9qvZL3gPxBFxyrAuzdmAC2WcOJr2lfJ/OgHzTVbWGkAr79To7iKY9SsBYs+xWNC2QuL8NUA63RfUh/FU3CqO3j3B0DFFApybIXasTEXAIuG+GcZbvLXiE6J1dGswHorCAn0bGNz2SyWimqrFu5EgfjSQ9IiFhzcfs7vsoQewwTW+uqJk0P43vV7u0tExAm3FFBzCaZ82NlOtUI3fEf+BSOZ79/2fEFEXZHeSAdv3nWjH6f//UJ6vx2WtPQtm+bDtIl7TqBuHhv1Fs9q81/JkkiDgwUKfiVzGt3b6oPj27iv+WIc64I6xcuDlEKwUn3ORQfr6FKedAE/yNvSjGa8JP/Mbd3t+ZV3RyoG8N49YbwjdmI4sUcRQbsfVKvyhM953YNYrR2N/3V7+v4n9KPPLPeuE8b9LPh/RK/uVFF+TYcU6JuhV8+r3cl+mEi45qzHNBIUzGn76TN34C0iMmGJ7nueRmohsve6mYgB0SLDmMqcTs9Cy1TCiAR948 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1820a55a-8fca-4e5c-bef2-08d8fd4d06fa X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2021 00:50:54.5779 (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: fl+8T7pltbsflSM/Td7g2TAAEffC2r73VZb/5e3v2fiIbuk+pAylNdvbdRzrAfSySqLGFz40hpXAEp5NrZwVHpq1Vot7S68dOyf7Vy4aqnk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4307 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9951 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 adultscore=0 phishscore=0 malwarescore=0 mlxscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104120001 X-Proofpoint-GUID: 0juR5ZvpIVy1Mbln3pVBlwhcC6bqqB7d X-Proofpoint-ORIG-GUID: 0juR5ZvpIVy1Mbln3pVBlwhcC6bqqB7d X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9951 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 priorityscore=1501 clxscore=1015 adultscore=0 mlxlogscore=999 impostorscore=0 malwarescore=0 lowpriorityscore=0 spamscore=0 phishscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104120001 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 --- 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 441f0152193f..168953cc0ff9 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 Mon Apr 12 00:50:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 420591 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 E8087C433ED for ; Mon, 12 Apr 2021 00:51:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A36696120A for ; Mon, 12 Apr 2021 00:51:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236073AbhDLAvW (ORCPT ); Sun, 11 Apr 2021 20:51:22 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:47202 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235323AbhDLAvW (ORCPT ); Sun, 11 Apr 2021 20:51:22 -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 13C0YBhp119565; Mon, 12 Apr 2021 00:50:57 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=AdrLeK6jS8cVeWXrn6bZE5v/0JnyCRbGcv1sxBaB2lY=; b=Egxx62Mpunb07fdLSx2Df90eb0Wwh6Zu9lM0psaOLMXBH0DZnUzHKfXwAlnm3k/63x+d ImPJItyZSMFqO/3GmsaJm26skmA22TNOzq2oCG+pWdnPTQKkb3a1e/eVdUFwcxMEeAs4 qYDTjGKwsMDoD5dfzBsyk+b+gE9LlvTdOE4ZryWXmV2XSTUkWzRNnlP9kb+TjkLOLGOf GqBTu2FxLD4nQc9w2vOb89OmhP6il6ivRfq5TiiC6IgtGVJ12I0afzm62KCkAOlDkKf7 xY/dtaxQnoEgvIddv8K1rbjsogrSduosc5A+D4uMr6uW+TfyJt5i/lw0GsTYyszLiYxK Vg== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 37u3era14f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Apr 2021 00:50:57 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13C0aNPB051826; Mon, 12 Apr 2021 00:50:56 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2107.outbound.protection.outlook.com [104.47.70.107]) by aserp3030.oracle.com with ESMTP id 37unkmf7xe-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Apr 2021 00:50:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Zj/eG2IGw3QdyKZWVkRPy8Nqfrd4U11o0ybhClSHrfvD/QSIuBLqqGSdA36ZgKgFSPNpfY4XQxw32VnMo+L/ZYlLuI1yhJ8MBlxBcFj6HxUOdtCxs4Jptz3umjnB69z21dgS8CHrnBzDq+h7sUuxF4CzkpeHdf49rjgJgpssMYT331KtK7Wu4fsVsuejLe5REc4FQPuni3XQb9jWHV5NeV3bavKfwZYZ7/EhIXAAcv2OVikyFqXwWkKq8O2DCP8UCiH5lSUJuVlHwit/67Kag1U2ot4f0tUMfTL2MSme4g6dOHbjkBgzYZI/q+HpqNWgtnAgitp98+17JkryCZ0aHg== 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=AdrLeK6jS8cVeWXrn6bZE5v/0JnyCRbGcv1sxBaB2lY=; b=c8g4z5xGiEXEagUNX16sFbmcIbQUdb6GIPkhJvzBH/Qcy+RgNYWKg1mhh/ZX+xq+Q6r+UMSm1aM/xqjUIl3kCXnjMEfgDhHCrGbBkQbUp2VbNtT9Cbp5jBkqCHIMZHsv3Tpws8WYpzNJsIZD6ZxdEwpPLOCrMzaU91QzukGcMgmQU+9JiADHTIwejxFSDf+iiIjGWuEXO5DOL6SbNdtqxxAyJJsAU+fxmnkCN2IqTQZnDJTJlH2iMRPx/yBq0NSCVavUE7jgfcP/yeh5q7lS/47uTgdMCCTMI3Q7jQjsq4dEaK7edcmvamG+dQjopShjkTVbrfZNTQQjrbHq6PZh9w== 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=AdrLeK6jS8cVeWXrn6bZE5v/0JnyCRbGcv1sxBaB2lY=; b=tC9kxz0z/RwalNmDxZmZJoDPOOd66YkPLPUrZ9xX/aZxLFHPtEfqrChprefufRSlObgwyqGKLgbWNJMzcVMMohWZmByJvHZprGey5kNN+y3ekY8jT0Lyu2PMuQqo2wJHjtOmWFWRee1OlZOMA13fBXWpY1jReI8Jx33Cv/fUbd4= 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 BY5PR10MB4307.namprd10.prod.outlook.com (2603:10b6:a03:212::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.21; Mon, 12 Apr 2021 00:50:55 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4%7]) with mapi id 15.20.4020.018; Mon, 12 Apr 2021 00:50:55 +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: [RFC v2 3/7] scsi: iscsi: make iscsi_eh_timer wq generic Date: Sun, 11 Apr 2021 19:50:39 -0500 Message-Id: <20210412005043.5121-4-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210412005043.5121-1-michael.christie@oracle.com> References: <20210412005043.5121-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM6PR06CA0062.namprd06.prod.outlook.com (2603:10b6:5:54::39) 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 DM6PR06CA0062.namprd06.prod.outlook.com (2603:10b6:5:54::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Mon, 12 Apr 2021 00:50:54 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bbca2c0a-4004-457d-4cd1-08d8fd4d078d X-MS-TrafficTypeDiagnostic: BY5PR10MB4307: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1079; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VOwKYuFB+eKA+mfiUnSWXv9rYuXJ1FkUUTsJdqCBHTaTbLBWdmEN4Iufu//PMCLrMQfiJjUey2MhJ8StNDiirT4DxboMpG2m/E8V+GWBbHqtlLfnjyEhMyfkqf7HHYYmaDahB4YPANJBlgp6rvGD9SAxyVDhKMrueC5lkfIInMkWLdm3LrjOddRCSx7cwpRv+KiftBLdo/wDh6qegCWKIpBka1DMuhvlke3hSiIY54cU1Bbzs0p/DJsNvYetdFhRM3Rp3UWb166xEgli3crMjK4MQmMCRUjeZgfnBnQ94HbU+yr5htpmzIQtDQ7JIU7o39qLyQ7i9P6U6OLPOeEI0lw7MPcBTO7IrcC115DRHGth2zUnRg0d0L1hbdnwk6ttFPQueZX+iNUTpdyqZnLkNcT+cBDz7NGVBJ067DR70bkQUt1BCtEH38+wXym5y/92wxNBrV3J9FrQMoJCdJ9cgRO0V+N9NGPa/S1RXEHnCFv8y2QIAGnNo57/S77rGcVaqhLqP+lkr2X2YeoGDSqSHXPYiQYD8o1Uxy9Ue5bBu3on4A343tjj0EZupFh6mSv4niR6CE1IeknMrCPjyep93jyM912Gh2BgZpwZTJdqTxFVMLqB/c6P3SryakSao0PLDjBSd+KFqZRSUpotiy8edjeEhuwdcRZsBt/O9PkfNeTLg6FbHQWeDts6VYi8z+UN2awV1denRHBPNhgSFUwoQA== 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:(346002)(136003)(376002)(396003)(366004)(39860400002)(26005)(316002)(186003)(16526019)(2906002)(86362001)(83380400001)(1076003)(4326008)(107886003)(956004)(66556008)(478600001)(8676002)(38100700002)(8936002)(69590400012)(2616005)(66946007)(5660300002)(6506007)(6486002)(38350700002)(6512007)(6666004)(36756003)(52116002)(66476007)(41533002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Yz+otmEog1EH+to5BD9d7BWKFsM/Td0eSnXerRMiuYHGfai+pOkND09h0oV9mu/KqWT9BFXvDQPfCV95yswnrVFJAXSwpm7PVFGxAm5pUEfkSNhn/pMnKPHEMtuPINHbe/fXG3tWgtDlGkQa1MLcwGu5ci23wrojM7myOkrTMWLmXkerIM1Tz49xiL+9Wt/vOpUkdBguYODteM2jAf8HjfZffGEiKV832IWtbybaMZGmKl495isr2WHuR9AXhjOaLOKhKUuQa2ImcyyJNV32nXCQDoJ9qknrjffQyq5pAl2NXmbtr2Z2Gx/KZBf9hWgjPsGres4B8rD0salwPDrbzmTa2Y4rqy3M8nC4hzfYJiFos5nfYqgYyZRIMQuLifN+5hqC/eciBef8MmmvJVoG7FNxencso3RrSeGNNmHfCKTk2YJMKy7ayprlI/6c1eagNMkmrzeIB41T2VypY7/u2LkxbQK6fdWY+Z/PhXHtkatvvW0/cFY/bgjQihk8a3oWMbPjc9zWbZMxaE7nDcFDDVeB+HknmyxBMG6K4l4n9gifMa9LLZQoKb9zjegBuQZbMNkIb1liBQSWyrxoO9dqvKN+EZQpucqfFDzl2TY68tJE959s4sDg03QmUln/mdFPI3wiamjh1bFzu/Vl3aDxLexZEvAVl19KXYs8lzHvTlRSADQqcSt63q4fB4RlTgISXU7Jlmf+gnE2z6K3IiMiT/pMwOLiFM+nybUdAG2S2tLDZMAFdcUt+6drsMpD54u04pqYIdtEx8qB63MMZFznjJJYcKgii9knb+o88bbQNu1BvP+umT2L9Av//Y8pNvo6da6icAYxl861EEIVfX2KZuOeA36rhAMSl+msizph1crfDtsUkkjYG3wNSwAtml05JauoTja/dhxu/fdbepIX1UJls9BaabJxZsdVc2+5DNWuOToBHQM5zsmPXxhTgvQkEAeSBBLYanvqwS7EUqiD7r/rKDSEWDlQELKMnNNjv3S2oYm2dT9kTvMt08sbEvFW1WRLfKTjf8NXA7thVO2NeQQjWcu/YD680gz8VI3fY24/Vzryfmp1ziQsnEgygUHPohx3kihO5AQCYgkccajr8E00PKqFa9CtJbMfzR5KzGguETOXnaBZfTSsZoM5oyYK+/agt+0UxPE7GmOoN2F9JJ5ibDiPBh4HhxbbII0DnMtGjB2brYAC4c9ACmLbakeIBwvK92uDUBjnSQDdjfccCYxzjRo0C+hqKO80PtIAmW6wHGOEa1AS4o30KymrXKm7/LHTSHdKQC63pD2QYj67GlrUCbByOOY6ufvEzs0W/39IL0FjTEUIM0VxM707QqFV X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: bbca2c0a-4004-457d-4cd1-08d8fd4d078d X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2021 00:50:55.5594 (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: DHF/8eQvSXM4nT7fFZv3XlaUI9vNOks+umwSA2UKvkSisD0qAkCZ+06n+e+WXxb4/eo0rt8KX6pzhe7y4Ji6ZHIlWxQ/pOZ7DdSe+Vl1kIE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4307 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9951 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 adultscore=0 phishscore=0 malwarescore=0 mlxscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104120001 X-Proofpoint-ORIG-GUID: HGdMF1CL8hdNekaJLbglaIarxyEVieKy X-Proofpoint-GUID: HGdMF1CL8hdNekaJLbglaIarxyEVieKy X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9951 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 clxscore=1015 adultscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 spamscore=0 impostorscore=0 suspectscore=0 mlxscore=0 phishscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104120001 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The next patches add more management related works for operations like conn stop and ep disconnect so this patch makes the iscsi_eh_timer workqueue more generic so we don't have to add another one. This patch does: - Allows more than 1 work to be running. There is no need to limit this because each operation will flush/cancel operations it has conflicts with. For example the unblock flushes the block which sync cancels the recovery. - Renames the wq to reflect it can be used for any management operation. Signed-off-by: Mike Christie --- drivers/scsi/scsi_transport_iscsi.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 168953cc0ff9..0ea8ed288f54 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -93,7 +93,7 @@ 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_mgmt_workq; static struct workqueue_struct *iscsi_destroy_workq; @@ -1976,7 +1976,7 @@ static void __iscsi_unblock_session(struct work_struct *work) */ void iscsi_unblock_session(struct iscsi_cls_session *session) { - queue_work(iscsi_eh_timer_workq, &session->unblock_work); + queue_work(iscsi_mgmt_workq, &session->unblock_work); /* * Blocking the session can be done from any context so we only * queue the block work. Make sure the unblock work has completed @@ -2000,14 +2000,14 @@ static void __iscsi_block_session(struct work_struct *work) scsi_target_block(&session->dev); ISCSI_DBG_TRANS_SESSION(session, "Completed SCSI target blocking\n"); if (session->recovery_tmo >= 0) - queue_delayed_work(iscsi_eh_timer_workq, + queue_delayed_work(iscsi_mgmt_workq, &session->recovery_work, session->recovery_tmo * HZ); } void iscsi_block_session(struct iscsi_cls_session *session) { - queue_work(iscsi_eh_timer_workq, &session->block_work); + queue_work(iscsi_mgmt_workq, &session->block_work); } EXPORT_SYMBOL_GPL(iscsi_block_session); @@ -4802,10 +4802,10 @@ static __init int iscsi_transport_init(void) goto unregister_flashnode_bus; } - iscsi_eh_timer_workq = alloc_workqueue("%s", + iscsi_mgmt_workq = alloc_workqueue("%s", WQ_SYSFS | __WQ_LEGACY | WQ_MEM_RECLAIM | WQ_UNBOUND, - 1, "iscsi_eh"); - if (!iscsi_eh_timer_workq) { + 0, "iscsi_mgmt"); + if (!iscsi_mgmt_workq) { err = -ENOMEM; goto release_nls; } @@ -4821,7 +4821,7 @@ static __init int iscsi_transport_init(void) return 0; destroy_wq: - destroy_workqueue(iscsi_eh_timer_workq); + destroy_workqueue(iscsi_mgmt_workq); release_nls: netlink_kernel_release(nls); unregister_flashnode_bus: @@ -4844,7 +4844,7 @@ 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); + destroy_workqueue(iscsi_mgmt_workq); netlink_kernel_release(nls); bus_unregister(&iscsi_flashnode_bus); transport_class_unregister(&iscsi_connection_class); From patchwork Mon Apr 12 00:50:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 420589 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 7452DC43460 for ; Mon, 12 Apr 2021 00:51:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 418E66120A for ; Mon, 12 Apr 2021 00:51:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236199AbhDLAva (ORCPT ); Sun, 11 Apr 2021 20:51:30 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:47358 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236191AbhDLAv3 (ORCPT ); Sun, 11 Apr 2021 20:51:29 -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 13C0hvTl125226; Mon, 12 Apr 2021 00:50:59 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=05pUn6y81TJ+Z5O1EOahcdiXgWzFShidFYYhkG6fB1U=; b=b49hVe/HMaDnUZat9u7kAPDHyCzHngyxEp3xgAH88zxd3kMl2wni8ZL4uFjdPuBheEXy B0o4oJa4faJD+2z/+TWkOFw4iFqZwMmXUChedxQd/4zEdcoruxzZg1wCoLlYx2vNKBjK +b1RV8lJNYeqhy+5hKBPGZUNeFWBLCzlEMSirobQwrsxEJ8StAMOqqQZmKyle4rivS79 z9QQhNRqHrFBvU2wvLyADUpv46WKkAuE+Q/e6OtjxeGOMBSotQUNrLa4FTaqQ2S9B+DU Nl8u4+AeoPVGW5jApK8S4j5actY6JuRQhnLmKLeC8jfEtf2Ko5oaUbeuMD9mq477dYPu 5g== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 37u3era14g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Apr 2021 00:50:59 +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 13C0aGvF037388; Mon, 12 Apr 2021 00:50:59 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2100.outbound.protection.outlook.com [104.47.70.100]) by userp3030.oracle.com with ESMTP id 37unxur477-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Apr 2021 00:50:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OzN/RgzO1K0DidFQERChddfPEgipeXLlNa9Qn9Wnyerwmsy5GYfgItPSo0mAqM5sY82Zl3us667fa1SekYkNnfIywLOsHVhlREbof+IzJK5Zc3z49V6Iqk0/yp1JQSDQx0vQRTlIH60NKqiy0hV27RIbgK4Mrt0Z1uaUCSO0aZPnroT+ECf0ndKTGLCAA99KPlfr6fm9wToloh9FxEluk67nm4QJPB8C4iEv+MOOS9qrNev6k2Qf8A+H+if1/LQgzGXnhZXxm0sxcENMz8p5HyC59BpSrClzy8D0/EUwpgxoi/G9hk+kDuabObhNnn798CTBAsltR38+4piInMByng== 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=05pUn6y81TJ+Z5O1EOahcdiXgWzFShidFYYhkG6fB1U=; b=MmEpMgCD4LorinqpgtNFSeX3Ipmg7ti+hE4njyqOp9MLeEbE0VRxK8tMqMVgYxcpKgZ6gij7M/p75lTSQtSdhbqueFDD/vEYoA60EpD9cwfAkk0olAePJQ4uL1GXDIg03ce8pAq9C3QJXxxD3CJryec7RtOisTWc71kNhijQm6N1Cvxs8/9qGDGLjP44Ic00LtdVnB/b9I0RLtlSv3AaamKOOdn0VjA5sAkSmVfDL2YP7DwqexrFfzGP93fqS2BuPMUofQJUDXMpgehrkczX8Zk1wDHwkO/HYyLONX1X8Bduiir5Sa+XL6ymKyocexin0sSxTssabb3741HbNhSPWg== 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=05pUn6y81TJ+Z5O1EOahcdiXgWzFShidFYYhkG6fB1U=; b=seNb07EEW2KZQ3puakKVPDEfnucY7gdDyEIh9mHipxyPuMk7PydJ0L0raEpDOHTRfJU30t3Rqn19R/XBrFtUUlBATrMMWC8K6htOUq34JOrpxXy+nc7cFXOsRoeSB+SjpmKX29WP7vL0Bwwy3tLnNrXv5Y9mEhe8VeJRkXgMHjM= 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 BY5PR10MB4307.namprd10.prod.outlook.com (2603:10b6:a03:212::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.21; Mon, 12 Apr 2021 00:50:56 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4%7]) with mapi id 15.20.4020.018; Mon, 12 Apr 2021 00:50:56 +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: [RFC v2 4/7] scsi: iscsi: have callers do the put on iscsi_lookup_endpoint Date: Sun, 11 Apr 2021 19:50:40 -0500 Message-Id: <20210412005043.5121-5-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210412005043.5121-1-michael.christie@oracle.com> References: <20210412005043.5121-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM6PR06CA0062.namprd06.prod.outlook.com (2603:10b6:5:54::39) 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 DM6PR06CA0062.namprd06.prod.outlook.com (2603:10b6:5:54::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Mon, 12 Apr 2021 00:50:55 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fd80b366-e76d-4435-9de6-08d8fd4d0820 X-MS-TrafficTypeDiagnostic: BY5PR10MB4307: 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: D8oTST8IU5WCDo5ZGE+gqq1aB1iz7qISZfhPLuZzpik9pCg9Fv/yGEdPVolzw5zjd6xG6GHHJHniivYEVHRud92iqHp8sjHH80gJ9YCMEaF1+4QO7ap41IUTuo0I3QRBfDozoxxzoSebbBx8N24BDMszahDA9joZwtU2jo7pinX9af7JJyeuHayjjSoxBSs02InR0qEb/KyShAkmMWVDhYf1la9LswGuWzOUCS08YgbT/5KNIm9eRQDaJcvCrAzVzAvDuwLo3ajew+LJpO9+BD3YXOMR7G80AJarwEtMrzkvMsIL+W7tFnYHlBduQgs1p7CUu6nBwS+Fy6Ytx2y2gxINdAIJAvLFeWz3A3s04nqbRtPOyuDeENxGeCov4k+YDOup2xzudXmxqsF2Bfh7QuG8CdlsvJ4uP04ylMqsbDgMkijBu5LFdEV69XIOerSXhXN4JjRnYC6fI6Yb9NKiURI+x26bZE8xg6/wuts7Jlx4ZG7ldo1M8/kfJsnqKrKQmblB/1+jSYySbimcdV9cljWq9unG5tZ/6bDMEN4cG8sPFuJHT5AuLI7GQO9mlvJs+eVEzN2470beePUsR1oVAbafdFvanJJd9NmJMyKWt3Hkq4r2g9SWw7uWmjI0bDauleT3OVtT2nrLWmflrhcIO4oH2kLyNb5836XXAzWSPCLPTl2Q5RQuLXFPn/hvJ5TR 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:(346002)(136003)(376002)(396003)(366004)(39860400002)(26005)(316002)(186003)(16526019)(2906002)(86362001)(83380400001)(1076003)(4326008)(107886003)(956004)(66556008)(478600001)(8676002)(38100700002)(8936002)(69590400012)(2616005)(66946007)(5660300002)(6506007)(6486002)(38350700002)(6512007)(6666004)(36756003)(52116002)(66476007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: kY68G739JH7RRExrvrOfp7OCqqm0iIyw50Moo5zfQTki6XaUQ8TKTf6ZuveZH+dCsm0rL2UfBcc0ooD1Q3/DXVmkFsDjI8QgMJLSehuIkWQsrxkwWRPpkdvROhsQWCCY26ZKl/wrs0+8N7wluDnJbRpRSEPfpbQWHS1s+6QgXyrywJ+SSo2OzGTTXLRhztyM9THOuAVuhulHDm1GoTMYQvbbwImc+ibhrV0UKCoWl334KFmX5O/udvW/1EmILe2u89M3KGhWpQ0ten4RZqEPeL3Q/PrwHirb6VSMl3WU1BY1AUuzHO6ncEvmUFJv4aB+xvfWMjWIfxt/wQ5P57fLSQHsxad7wpNypLrZ/AP0DKFvwYGJAkzTJUpQiRwLJwyF/rM+bR9sL6ViGrT6/iuTJwPhwdkHTMHwypSVEAXA/m2NKHUJAO4hNu4NH5NqQX+TUa3z5zbuQhDAFjijsnuC86SWERGa4QvptZa58/1AN0c0BOLmd3/x96oKX2GfllSZkT6ceUpeKGWR6o6za7tZEemwcYRPIsm6TdGIK+Uk/Fj4yL2Fi4NQEws2CiMh+g7znIce46Pp041VsdlJA3z2yVdzNFu8aQ6UTbbX5RNg2X7XnUQT4QYiGew3fjiIa4YK9E6ihW2COac1Xh1IfcgAAPwwnyZRh9FuT8kqa88ARhNQ3nHs/rX0dKkYONr5bzzQg8rvxTqmcgkXe0+VCvEZ+bh0tvcYm7086IsFc/JV5aB1Q6155wigcaaLxjt2chF/PAy8myH4CfB1GQkGlogBfPgMUwtk4/yvJPX3n7s0GWcnU8dHJiwK8p9z383VWAOPGaaq3xF+OqsapgdUN/JWg889XOiqq/MiE5p7x3ALE72cLQMTQolfAn4BBckH2RNaDJ0JUbrC4QUJaBhjlbVM2RvfX9u1fV10lh4gPi5m+myQ81Qr+Rk76HA16SCYRPqWseeDqLDT7Z8cn7p/siY41fxrO0iihbqXGBLVWAOgaAzuC/iMI+AEFYPIcN8kPlZB0IE32QAVmXTPu/5LGXAnTLJ5ZeSv3koPLEhJkY/8b3NZ4eJicAmmtc/vzcq0fZM0Y4qVGf8f1awBWOHDLX0kVmkVsjawqqDLT2UgMpVHLdlzH9JvTQE6Hj9wbpqJf5sb858TaMgXPUa8B6XTehMRYOMUPUOhtVUuFvhiJxIqvqq5caJbuJbVc7CXoyE49tsRoUJvBgBmeHjkzsKefMufAWeK6PNvJLA+gaQPaqikqaPE7plblGJuRPB821Qva/j3zgsEOcyxUNsNeKGP5L8sw8NsGx5zRE8zPan7NZRYJK8Iz0OwjLvbYnwwXTUE4J4j X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: fd80b366-e76d-4435-9de6-08d8fd4d0820 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2021 00:50:56.5178 (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: bBEZn449z4MHGsUWWAgXqvzac/OG2EWkSdXVxI7K15+X9y6e1SxXeOqVQnAgMiN1zINHlge9JdU7TPXAGDY7YGqzQGy5WSJksHzO9XAUplw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4307 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9951 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 malwarescore=0 spamscore=0 adultscore=0 phishscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104120001 X-Proofpoint-ORIG-GUID: MVLwFkGLSbVqBRyyoVdTpg4ifad8B6t4 X-Proofpoint-GUID: MVLwFkGLSbVqBRyyoVdTpg4ifad8B6t4 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9951 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 clxscore=1015 adultscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 spamscore=0 impostorscore=0 suspectscore=0 mlxscore=0 phishscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104120001 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 --- 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 8fcaa1136f2c..54d756e5c033 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 a13c203ef7a9..c4881657a807 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 1e6d8f62ea3c..b119285cfa8d 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 f078b3c4e083..f6bcae829c29 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 08c05403cd72..76d40c79e6ef 100644 --- a/drivers/scsi/qedi/qedi_iscsi.c +++ b/drivers/scsi/qedi/qedi_iscsi.c @@ -377,6 +377,7 @@ static int qedi_conn_bind(struct iscsi_cls_session *cls_session, struct qedi_ctx *qedi = iscsi_host_priv(shost); struct qedi_endpoint *qedi_ep; struct iscsi_endpoint *ep; + int rc = 0; ep = iscsi_lookup_endpoint(transport_fd); if (!ep) @@ -384,11 +385,16 @@ static int qedi_conn_bind(struct iscsi_cls_session *cls_session, qedi_ep = ep->dd_data; if ((qedi_ep->state == EP_STATE_TCP_FIN_RCVD) || - (qedi_ep->state == EP_STATE_TCP_RST_RCVD)) - return -EINVAL; + (qedi_ep->state == EP_STATE_TCP_RST_RCVD)) { + rc = -EINVAL; + goto put_ep; + } + + if (iscsi_conn_bind(cls_session, cls_conn, is_leading)) { + rc = -EINVAL; + goto put_ep; + } - if (iscsi_conn_bind(cls_session, cls_conn, is_leading)) - return -EINVAL; qedi_ep->conn = qedi_conn; qedi_conn->ep = qedi_ep; @@ -398,13 +404,18 @@ static int qedi_conn_bind(struct iscsi_cls_session *cls_session, qedi_conn->cmd_cleanup_req = 0; qedi_conn->cmd_cleanup_cmpl = 0; - if (qedi_bind_conn_to_iscsi_cid(qedi, qedi_conn)) - return -EINVAL; + if (qedi_bind_conn_to_iscsi_cid(qedi, qedi_conn)) { + rc = -EINVAL; + goto put_ep; + } + spin_lock_init(&qedi_conn->tmf_work_lock); INIT_LIST_HEAD(&qedi_conn->tmf_work_list); init_waitqueue_head(&qedi_conn->wait_queue); - return 0; +put_ep: + iscsi_put_endpoint(ep); + return rc; } static int qedi_iscsi_update_conn(struct qedi_ctx *qedi, diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index 7bd9a4a04ad5..18d63a0af14c 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c @@ -3234,6 +3234,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 0ea8ed288f54..036486310260 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -268,9 +268,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, @@ -278,13 +289,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, @@ -3691,6 +3698,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); @@ -3762,6 +3770,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 fc5a39839b4b..165e629fba02 100644 --- a/include/scsi/scsi_transport_iscsi.h +++ b/include/scsi/scsi_transport_iscsi.h @@ -441,6 +441,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 Mon Apr 12 00:50:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 419769 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 68229C433B4 for ; Mon, 12 Apr 2021 00:51:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 377866120A for ; Mon, 12 Apr 2021 00:51:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236212AbhDLAvd (ORCPT ); Sun, 11 Apr 2021 20:51:33 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:50470 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236197AbhDLAvb (ORCPT ); Sun, 11 Apr 2021 20:51:31 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13C0ifBQ070028; Mon, 12 Apr 2021 00:51:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=JN0ziAYtAIe6D+srvcyzf/NJ1jiroPgBih9e/KGSKE0=; b=Y5mb+jDbRj3XiOpmvVNi+DoUlBr0TFH8hIZGVr6rv0otYAq2tGFT1TcqPWdG/kSo9rdz AUdaXxdlpw+/mZHSpBBWdPb38hQLvhZLIVWRtsFRWOJPdFdBDlUnoaZT35xlFU78zQsI +xYv5dd6WC+SJEAyo8s4NYtfXBYZhPbMUFxCJutUhruqHXISZjmLWfCkUE4ALkVN3PRq VG7e+wc3cCfLapmoGunSBgijjHl8RtrnKmNTN1C6UseogfsGxvVWaMtxkh+7xF5IvQfk 3MEAakw0RI4CZYzbnFaWmlXMM4nJGyRFee+cHNgHC1QvjaSF/iPpF7RXtnOsg9V8onL1 Rw== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 37u4nn9ypj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Apr 2021 00:51:00 +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 13C0aGvG037388; Mon, 12 Apr 2021 00:51:00 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2100.outbound.protection.outlook.com [104.47.70.100]) by userp3030.oracle.com with ESMTP id 37unxur477-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Apr 2021 00:50:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qw/IQOWuyLDVU7HX4VP2c2cKF2V1s4PCnDxFz02oto0moRnUaXiySme93mnGnfA4A4++LMgGSCbsmqHCouPd96amv+zKcp9BeOdxykl9xPAyxnGlrKsrAfSoMFnTCLloLQyJdFmnnoOG/PadCfdZY76ciS/1wdpwUBlIt5IrgT1ef2w0xTXAPtalSIIW5NDOjnMyy0zw1/1si8d8o3GB8FHMXcIcC+VddPr+N5BiOk6DsWbgeMp10Luok6dEipXw9bAdU8nsacliST60lf+YIebRcYeVQ3M42zoKUicXrwlQEUOige6AB5Z60kZ62ITzSXVoEwK81j3QKOKGhasOfw== 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=JN0ziAYtAIe6D+srvcyzf/NJ1jiroPgBih9e/KGSKE0=; b=FwoO/FuYOIcvf+/My6+SY73miztG1gHte9Di7qkY50tE0zdytczcb2h3y6TnnLBjCJTrZHoOcOdQlWc249dO9yaDctrF+IqWlFtnnDMnM2RBZSItpU+yu/z6DAf6BsxU4nUFffnw5Wk6jXgAJ1nZHYRyE9JZjwgC9WnD/CLHeqOdGDjYoQsSwWAd47qQkcuVJrfDF78mAM7ZfMPBnzMGe/HW+eQtO3oF/KqC+jPy5rHHL6i2TPXj3bh19Mu9/cy+1f2Sect+OMmkv8UplIbovsaTY2cvXCyZ/LkHLtr00voEX57a7fNbeUDviDZ/0xn0V64ak69yfBG9gMheL42oSw== 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=JN0ziAYtAIe6D+srvcyzf/NJ1jiroPgBih9e/KGSKE0=; b=JMCwsfVadzNTMabjWEXsuBog+SDDPDuPsXe3txALgLEmbNaQReWBRicCx9q4G9R8sDfpvO3qOdzuBpCzZxo5XM31ZkGVWbONks3MtwGGwITxNk4hBa/UyQHsidszyYLm5HOZRlHCXiwWVNkU5IKnwoU3tWxrVWiWr+SRNAs+61s= 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 BY5PR10MB4307.namprd10.prod.outlook.com (2603:10b6:a03:212::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.21; Mon, 12 Apr 2021 00:50:57 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4%7]) with mapi id 15.20.4020.018; Mon, 12 Apr 2021 00:50:57 +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: [RFC v2 5/7] scsi: iscsi: fix some of the bugs with Perform connection failure entirely in kernel space Date: Sun, 11 Apr 2021 19:50:41 -0500 Message-Id: <20210412005043.5121-6-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210412005043.5121-1-michael.christie@oracle.com> References: <20210412005043.5121-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM6PR06CA0062.namprd06.prod.outlook.com (2603:10b6:5:54::39) 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 DM6PR06CA0062.namprd06.prod.outlook.com (2603:10b6:5:54::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Mon, 12 Apr 2021 00:50:56 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2559200f-7d3d-490d-a4c4-08d8fd4d08ba X-MS-TrafficTypeDiagnostic: BY5PR10MB4307: 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: ZyZfEb/wEd9yW3SWT14F8cqPHnVXF0no7ulgDwh6OFmHt/uSBbgnsLmKWHk+95qQnFh7LrSirHwmoplOSdDeAB+8p9VQfqbOeAnu12CfqL4joH61A+oM7Dk7xi1UH1a/AtQxEjkwMWZPRmdO35nhjDM+1QIQrIV7dawa9gZUS0vVlAfHrCKXTJJhxYpn2xhRi9UpDuBUDBdtJj9oAU+d3oUzTzXyuhJjIq6P7zxhVoXjGh8IGP9kZEmJLfpqhSQ5w+KMXXrg6HqewK/JdM2Q/SFHCGNhjWCCnNgGaUSGe3MCsKicZ419oCERWvtvNq97vKJNwYwixiBSNpPFIxZ0YkU86IgY9z0NKazxLLOvSovbqmjNUtEkdM6pl4lYyb6CdCiDvWjyJLrz15NpZscAdeGsnQm9g/sYiqlZuej9d9KRqUyTEyYh1p6ey7NY0FEMFUrgO7Fi2HNJ/Yj61wfDF5DOQS7riWfumZsEjWq0AHFAmcXdQ8trwRLrIR6ZhBHzkcoVNpwbsCS7I85ItmnGdvV0KRvGn+3NNrdHu+d8EoYApelt+dJBNseWTdwWhFtg90guFeKV+4OowFWD4x1bl+lnX1lfIoaHTDrYpcMMNu3L8Ds75eeYtAFFUDBroxCgJx2M1oW3xaM9/gsyp4wqrGaTXDytTSDwrRneZy5NBlJv9PiGowBAnzic3NHvxWqU 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:(346002)(136003)(376002)(396003)(366004)(39860400002)(26005)(316002)(186003)(16526019)(2906002)(30864003)(86362001)(83380400001)(1076003)(4326008)(107886003)(956004)(66556008)(478600001)(8676002)(38100700002)(8936002)(69590400012)(2616005)(66946007)(5660300002)(6506007)(6486002)(38350700002)(6512007)(6666004)(36756003)(52116002)(66476007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: OxuWrC8uH9ks7dMvBg2VzVMowKIURSFtO7BnCeq0fa2gNS1EJbtF1DMLgYyVUfV5+j4udijJUho3D97aFHxNN9aaldYB/UI/EFQpegZ5E748PelutwoxImGWxp8dkNtIcL/YQevSSSiW0TV/ftXovbMG9Q/VI1jAb2IzkXvuLzAuPxXFW3bmaI4rr84hMCVx/rENGs9Rni3FSazuMRsEO9MQrX5BhsdjVx+SZL6PLsxMDiEXKVG+yMCrpiH8axlZzeYVBUXHEm0AlNO985ULGFcsR4TpVugR8a3Woj7aCIxAmX7hdW04POiJZTFxFmds28CdFPZnryszK6o+mlOQ45kOhL5I/wmNbNqUZTSxx/8NQp7JLQG0lAPoAULxAcG9irC8Ehw/3TjNhLEc4gIfhU5H5CCQk6VBMEGQEV4cS3TsXSxoRMyfvyI0x1lQSFYEnQJR/Qg1+iqCsv4d2Vn+8/58ULSMXtQjFtdcPtekeRoEVkFlbge94R4p6QrpZU2oQAvv67f9dvHUH1IVH4f/5Ro4h6r+CR8im3u4bhgQo4iwsBswDStbCf3Ap/wqYfkvUYr0v7WV+IbCh5eHTmAKhqT1Fx9Cxu2jul7TI5dMSOKH1zJ/DFcg/wK7l/gUJIiFGD6FXRdl+867p9TW6xWQY4CqD3tgPuPnQ9vVS+6OK2inzK4jv2UdmoMgNrIPzQ38e4gm+7pZTVdDqZF1TOB/VGl31cbfDC6gepddAIVM2jvFA6k8irHsjqREpdsN+9SQRoRHxknO/OzhnSq1ZeXxmKkTE5rPk2iaEWCnrd2wJ3qI5ESM8EzBdsWsjMVsQMIsD+0PvSa//uwnBmALd/2TlqibUg9ZYdshKCtz23vM4YntctXVN4JpsLXbFbP6Ia0rhTmXK4qi6hUOgacT8dLUWjkZZ7RaoWIVYjEKNNhoufrtbR3s6yE0Je9ehXylASJ1GIVBzxo/Ky+jf3qQLEPSerf8I5C9+GwhgMrJdwtX59xZQRrt+yeNna6RzTgxdXuVeaNnQVCJFwUxlp4QUQTou/wNscrR6dD81ouiMhTF1nh5htXTfB/TNyDSXlNz5J5fuTNkpM7sLhDFaQDLUdS9gNeML74rwBD7lM7uu86uPNNKgDXuLeyTFO1CoW6kAnZfheoXEpVGQwpe7h6HbGcU0kgo3LGVzpDXWzoJilxSUiTJuF+L4+r7eNkSjeCa62HZJ3rD84yki2TMblYV28uQ6OsFS5MSUuSen4yz/QH3jas5WaTBOJAzgLq2SAAIBp5CRXEEHxoQ2pM4vmar4t/ffIP8uctkxGgXTEJQHv0zTWz7OcNx+3mxVRXpouzcfCbR X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2559200f-7d3d-490d-a4c4-08d8fd4d08ba X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2021 00:50:57.6032 (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: FH+pgpG35iS362DeBBrflJcOpvCTpgrBb4iXmnrE0l1uX7nS4/kOnJ9FcgwRiidLMvMd1CpPrNi4+ztmfHMcG8qY30GKTs/l6dfdkHPLZvo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4307 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9951 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 malwarescore=0 spamscore=0 adultscore=0 phishscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104120001 X-Proofpoint-ORIG-GUID: wGo2HI4k4_GhYB5SbZiQUFNJG8Z0R5c7 X-Proofpoint-GUID: wGo2HI4k4_GhYB5SbZiQUFNJG8Z0R5c7 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9951 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 phishscore=0 suspectscore=0 mlxlogscore=999 priorityscore=1501 clxscore=1015 lowpriorityscore=0 spamscore=0 impostorscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104120001 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 --- drivers/scsi/scsi_transport_iscsi.c | 440 ++++++++++++++++------------ include/scsi/scsi_transport_iscsi.h | 10 +- 2 files changed, 261 insertions(+), 189 deletions(-) diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 036486310260..54be1e9a845b 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -86,12 +86,6 @@ 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_mgmt_workq; @@ -1625,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); @@ -2247,6 +2235,105 @@ 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_RECOVER) { + cancel_work_sync(&conn->unbind_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_UNBIND, &conn->flags)) { + iscsi_stop_conn(conn, flag); + } else { + ISCSI_DBG_TRANS_CONN(conn, + "flush kernel conn unbind.\n"); + flush_work(&conn->unbind_work); + } + /* + * Only clear for recovery to avoid extra unbind runs during + * termination. + */ + clear_bit(ISCSI_CLS_CONN_BIT_UNBIND, &conn->flags); + } + ISCSI_DBG_TRANS_CONN(conn, "iscsi if conn stop done.\n"); +} + +static void iscsi_ep_disconnect(struct iscsi_cls_conn *conn) +{ + 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->ep_disconnect(ep); + ISCSI_DBG_TRANS_CONN(conn, "disconnect ep done.\n"); +} + +static void iscsi_unbind_conn_work_fn(struct work_struct *work) +{ + struct iscsi_cls_conn *conn = container_of(work, struct iscsi_cls_conn, + unbind_work); + struct iscsi_cls_session *session = iscsi_conn_to_session(conn); + + mutex_lock(&conn->ep_mutex); + iscsi_ep_disconnect(conn); + + 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, "unbind done.\n"); +} + void iscsi_free_session(struct iscsi_cls_session *session) { ISCSI_DBG_TRANS_SESSION(session, "Freeing session\n"); @@ -2286,7 +2373,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->unbind_work, iscsi_unbind_conn_work_fn); conn->transport = transport; conn->cid = cid; conn->state = ISCSI_CONN_DOWN; @@ -2343,7 +2430,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); @@ -2458,77 +2544,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; @@ -2536,12 +2551,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_UNBIND, &conn->flags)) + queue_work(iscsi_mgmt_workq, &conn->unbind_work); priv = iscsi_if_transport_lookup(conn->transport); if (!priv) @@ -2871,26 +2883,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 ubbind during destruction\n"); + flush_work(&conn->unbind_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; } @@ -2980,16 +2983,31 @@ 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); + iscsi_put_endpoint(ep); + return 0; + } + iscsi_put_endpoint(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_UNBIND, &conn->flags)) { + ISCSI_DBG_TRANS_CONN(conn, "flush kernel conn unbind.\n"); mutex_unlock(&conn->ep_mutex); - conn->state = ISCSI_CONN_FAILED; + + flush_work(&conn->unbind_work); + return 0; } - transport->ep_disconnect(ep); - iscsi_put_endpoint(ep); + iscsi_ep_disconnect(conn); + mutex_unlock(&conn->ep_mutex); return 0; } @@ -3646,18 +3664,138 @@ 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 unbinding (ep_disconnect + stop_conn) is not done while these + * are running. They also must not run if we have just run a conn + * unbinding 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_UNBIND, &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) { + u64 ep_handle = conn->ep->id; + + /* + * For offload boot support where iscsid is restarted + * during the pivot root stage, the ep will be instact + * here when the new iscsid instance starts up and + * reconnects. + */ + mutex_unlock(&conn->ep_mutex); + iscsi_if_ep_disconnect(transport, ep_handle); + mutex_lock(&conn->ep_mutex); + } + + 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)) @@ -3734,90 +3872,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); - - 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); diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h index 165e629fba02..16efa4c6534c 100644 --- a/include/scsi/scsi_transport_iscsi.h +++ b/include/scsi/scsi_transport_iscsi.h @@ -196,15 +196,23 @@ enum iscsi_connection_state { ISCSI_CONN_BOUND, }; +#define ISCSI_CLS_CONN_BIT_UNBIND 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 unbind_work; + struct device dev; /* sysfs transport/container device */ enum iscsi_connection_state state; }; From patchwork Mon Apr 12 00:50:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 419770 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 11F0FC433ED for ; Mon, 12 Apr 2021 00:51:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E17CB6120A for ; Mon, 12 Apr 2021 00:51:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236213AbhDLAvd (ORCPT ); Sun, 11 Apr 2021 20:51:33 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:50474 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236200AbhDLAvb (ORCPT ); Sun, 11 Apr 2021 20:51:31 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13C0nfRp072820; Mon, 12 Apr 2021 00:51:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=r7lGCJ9gQ3/dwuXbOcD8imlS9kd14qZ2OmO7vMUWvBw=; b=HKcogu7YQiYjDA1WsOu4I3boKIQ34iVg2P3JViMNZ1tz/3gcvR1O00YCJZLeJzfHtyUQ a2of96PlQRbJ+dJpgbwqgjxB/c/A5LbLHofZmsmN6WhbFhw9KO0c+M5yroFvcyaFqFSw sUeuxmKpSiMeuPweT8zoiUpb4q/N4HVV+uPzs097tIBjBGflXReJtyrWRFherbeTmUlG sSwQwRu8boskYnMqTnmpCNsjycWLgi92Kn7HmOmkIup+MEhUWxWK4djhJ7YipzJKhQIA 0fACaAVqUIjIqhGC8MnIRIuMLqX0Y2tZkGhs4I93DsK74CD8GM27eT2LKKS5AcKQTsMQ CQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 37u4nn9ypm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Apr 2021 00:51:01 +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 13C0aGvH037388; Mon, 12 Apr 2021 00:51:00 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2100.outbound.protection.outlook.com [104.47.70.100]) by userp3030.oracle.com with ESMTP id 37unxur477-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Apr 2021 00:51:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F3Am1PIYbs5n+Rt0v03VTIxmreWwnNr3PzsUslcLL+35VL/BpZGi1pQfZ5G1AunzuM5ZEyJ5pX3hhiE5DbiTnqdX7OVKZACwxOYbZptlt9s09SfMw38KD5f6ctpWnyNZbrlGpp43ogxjJyeyGQgsH+ZErrKSF1Gj6bR4uqQTUm7Lgmt8m3QkyjOtO0mPqBsGkl10S/TW98A9EU0k92n+j7MvCSMunX0X5f2B/2TQwO0f9VQU6kwHVgLgPbo0RffJcCQkEDjmP1ljR2u/K+uUTfNogKtbqra9J2aEzqqqmYveHgVI8m8Ku720nYoTg3IUaGuRcGh/zWWSTCXW52B9Dw== 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=YGFjQDgYw9EeH+O/P+4UzwIYokZBFAkRMxM7PWSLrGWKy9rNXfrCJrC0cCgdIoI4p4E7FC0bE6p3UxZzjQPa3INvlMgbCmXFm6gqcXmhAAGY5bVADN8jWMs7LiE8aYA+mdPYOMHx/bbsJ3RHPOlVrbeoaw46mZDm8Zvp8x+I8HljOqM/oBdqTL0F4BNw9uwMByJr95TXLfXn2lzirEE1EIsbqrg/E+iqVWG95yb3xrjiIpZK+Cva9HmugbIgiBAwSpm89KRb4t5psQpv4hx31jIRdja7OF1vR9dha4vwJpc2KNO4uZ7nVLazXlGA0luhyT15O8Z5zVgMJZ7Wr2Sq9A== 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=SlB77GEbTQsl7m3K7q3oSPaCVo9uiu9gfRZlNduYznTPZZT5SNymmhC8WgCB+gAsekZjKCZk4gkgoah0o8zyPHGGjkRCpPlIA3rydkv3AGPfZKD1lqbtRQHMr/0gNpKB9UXyPYtMy0ysJHUkUvR5cgOAmW/hT0dpyDmXSmK1PeU= 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 BY5PR10MB4307.namprd10.prod.outlook.com (2603:10b6:a03:212::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.21; Mon, 12 Apr 2021 00:50:58 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4%7]) with mapi id 15.20.4020.018; Mon, 12 Apr 2021 00:50:58 +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: [RFC v2 6/7] scsi: iscsi_tcp: set no linger Date: Sun, 11 Apr 2021 19:50:42 -0500 Message-Id: <20210412005043.5121-7-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210412005043.5121-1-michael.christie@oracle.com> References: <20210412005043.5121-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM6PR06CA0062.namprd06.prod.outlook.com (2603:10b6:5:54::39) 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 DM6PR06CA0062.namprd06.prod.outlook.com (2603:10b6:5:54::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Mon, 12 Apr 2021 00:50:57 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4a220f3f-6829-43de-24a0-08d8fd4d095c X-MS-TrafficTypeDiagnostic: BY5PR10MB4307: 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: 4YD3OpamTGA2QAsTsxMKAm1xTJyoel8Z8LAZymudKn1ETDfrYHdYYe4DgwW60cXoTnuZEZlYxGhmjfL/8VN5b3ZG6AAfL2Z8Bkk5d0+Cv2iDgsj2qbJ3HHWuOIMe1IXhasQEbAY5g5c6XAcysx0wBCCTUMIUqbRXAaZz9HvywlqGcBx3Tp2ni1vCXwPpNI6ycjC67E+Mrl/DN1/pLv3NV0zdcWPyy4qYXFqTBN4wN0b51MPCTMdpJ5Jccsn+jXbkpZ7ykU8QH3Uffs67i0TREwKirK5CJpJGmFqN4npqLhgLT5W8m5GTXcLxyykntq0APsTJxeTO63DD1/ycIFFzpuNtKUmyV2ywYCLOJIK2qKJs2H9JvPJN0UGgfT4Sqf0rQCDBwDpzWb64osJpoTa5xtgw1ST6HiWBel9QO4VdxSkQpZ6eLrPXEQOPtSwTBP+AzsVIiL9HK1lQMh0iv46d2g1yDAxLZo9NuxfB1F8XuSSIAHObx20bmGIzdHYZOCNQ+55csFa46Hty5kohjGdLuftq4qjSuhz7G2uLVApllMoXb+3+U9BU4oqq6sEIPQ3gMh7OY7jLi/1U/jaV58GP+sdfCrkqZoCAO5kLag8VSHs+QYhagYkB68LntendjiItKU4aIjWUwmMH+UOCALk+7xzplYKzJmKU68wUOF3QydW42JFF2C1XIjvWjvQw4/6v 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:(346002)(136003)(376002)(396003)(366004)(39860400002)(26005)(316002)(186003)(16526019)(2906002)(86362001)(83380400001)(1076003)(4326008)(107886003)(956004)(66556008)(478600001)(8676002)(38100700002)(8936002)(69590400012)(2616005)(66946007)(5660300002)(6506007)(6486002)(38350700002)(6512007)(6666004)(36756003)(52116002)(66476007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: v6uRFHMtvDpGg1wBWorPnLRtMrnb6MOoov6qgaE7A6FdUg1YmYwQIQ9716AhG3dGMST3hlmIRq4V6uzCGCUuquxem6uVrgPHPGDXAs1qBBkx/1lbtjaJ/vZuO2k9dFlRILKwokZxUtRZcmrL8/LQNABeTWRB//lwPHwcXETsIWRfCN5ocEtWq0VKrDaz3+reK+XjVrcPqZY1YDj3Ux5z6LT+Bdn2rlwCG5iIH64ZTlIfzJEAi/dbC69TjVrUd2UJaEHVp7IDpr8xKiJA1md4iwJeahRWH5fFJXH9bnluJW0Pyv55NBZw6Xajq6T3cMauhB67DzGZO+ltI2ZcJs0fUovTHEVOv+NzdvhGmzqEn2vHTHPpWXnv0K2ulB++8s7QP24+MpnHPohrdQ2QZ2lSC5s4ZfSb8JwgIWed63MfKjnMJOyDcYMIABnvaQFqQT6oeEdHk2Yu5DReUWa3FpCRo1ZetOmMeLqeN1o33iEvnm/DMATnnTLtwPoJnNtZyqknNrImyhJG+lKqKRUrq+CDVzGrRisF3d4ubzxFCSTTjPuMTacaTMGggs8bAEp/NrHDKMsU9B6IeewuNUrr/BT+lFF9vFjcZBPcA1+ILfPhW1LDeiWbO7hmkMDb6pF/aBUYCbKYyrSnrZukMQbOn1B9hEJBs0JYJSu4B2nTHE0uyCK09uJ55GOUSPCifZGJHFE8KfhU5A80mQmtavnk3POcXX0mCDU5t9kQxH2aZ50EaSZ47KaKM2WxcJPIeGg5TcM1KUpIIeFmizQYdgzrNPpm3T8vgE0e2h94j3iA12PNeMSb8fm5l+B578yvODWLJ/cMaaQ8H+S+OTAfDhYc0KIZjvKpUwUlEUEjG29u/iKd+5pwMSNfAVXlhJWwwWyVwU+EryH1S1mfDyhQTNJbB3vIbnxTcNQHI5+L2OrM0sY61t3mysXdeHvjlS6KlMyELSgpWxRS8Z5+CoUE/JC2vE7K1nlOyOkvpzOGMn5t5S+GRTysCRzX+PF197KD4bXr7+8rZksBUSQXkP+kZ7TWhUUy/b0j/9eGuEf2tyYdUYKC/y/h4LTXBsW1jA3ZUtfMSqnOQ6Z72Ovjki5paet+WQBGCNG0C0AiKwnD6KjNaLu5g6HsKDzwQsEz6bRr9eHMQBH6rd6HFJeQhePW3RUnaxQWFnPMny4Tg0ksMp3dDqAzrTdHpG3w11/Uc3/p9YT2htch+pPE5Wubq7Qt8aqcDcnz+ZGzTLOK3YJ3sajsoqhuWqWxwv+u1eknqNMB0bYGTDD3GogZiuFbeXWVuGtNejsLJFUx93Kgt96Tr1OMvBalhuvvIlL6dnIpPw1R+2rU1No9 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4a220f3f-6829-43de-24a0-08d8fd4d095c X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2021 00:50:58.6196 (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: tZ3jRBVy3EOw6EwGOUUWckyxP3FOqgp08QTLnUE1zFsbF7V2Ar/eR5gMnep9IVNI943i9MrPMfV4FBZIcyhWVz8r68a/74aBrqOO5ehKc+s= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4307 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9951 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 malwarescore=0 spamscore=0 adultscore=0 phishscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104120001 X-Proofpoint-ORIG-GUID: PTgZFlMiCakx8zdJB0oLQJzdbNOEKi4U X-Proofpoint-GUID: PTgZFlMiCakx8zdJB0oLQJzdbNOEKi4U X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9951 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 phishscore=0 suspectscore=0 mlxlogscore=999 priorityscore=1501 clxscore=1015 lowpriorityscore=0 spamscore=0 impostorscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104120001 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 --- 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 Mon Apr 12 00:50:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 420588 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 C8AE1C43460 for ; Mon, 12 Apr 2021 00:51:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A05606120B for ; Mon, 12 Apr 2021 00:51:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236216AbhDLAve (ORCPT ); Sun, 11 Apr 2021 20:51:34 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:53020 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236191AbhDLAvc (ORCPT ); Sun, 11 Apr 2021 20:51:32 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13C0p2sc018777; Mon, 12 Apr 2021 00:51:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2020-01-29; bh=sZtKNpnhKUcmJnY0/M6obBbjXko1kEOYVNmLXouY9SY=; b=V3CoXgMhrwLDxYvae32Dv2CwvUlt6ALSUJabpY//XeupYmOhjQnGzsZLNww4okkv5NMa 1N3IRMltwiYAnA1wV+xdEcmuL5HC3FAFwKlnz1vmtLIH398k7FirRBlaBAeZtrRRtyaU iJhnLmizLu3h1Zh+z3InMMhdjLFIFLvOkK+H0RD9G7HczR2yqmhnRuHkBQWNbWBQ9jSH kUVR2TG7puU12SstOrh0/qvlTxLhAuNGAi7qmzBi/4dl2pRoOhPnl1BPW6dZOETej8Ko zHBxrSd6bUSfmIxc3jl+rDs+LwUUIiwN8VCZPOFoe0JgoV4sf91YygPVVvhB21bTJbUT aw== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2120.oracle.com with ESMTP id 37u3ym9ywh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Apr 2021 00:51:02 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 13C0aGvI037388; Mon, 12 Apr 2021 00:51:01 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2100.outbound.protection.outlook.com [104.47.70.100]) by userp3030.oracle.com with ESMTP id 37unxur477-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Apr 2021 00:51:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fXAAIei9msD1bgnbF0S17MKlTFaGpU34yMyHnmGcfYG+oRdU3YS/a3jMHyKSVdqBjg6Swx64393zbBKkkEcBhDc/nhS+BYAjoxWN9iy4T0KhLF7Mpbdy3qWdmMRJfifNM9rkX6lXSAY91XTOHmkfbOngltghjHeybgNARufIPAiHJaEwoL6YPYUYpzhWmkoT14YIPXYbOxg4cWUtl4r7Zz9i5SWQ3SGnXQVlNcODi8wRtkr0Nyt/IixBAI1ICZtaKEblV60rEcOdGLaEnrQyrNToTbQ2THc4mZdjEigoboUs7rbinkCU2R5YZS6AsI+vxqEE1HBGpvft5e9xf8nDXg== 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=GJzZw3h4FIMCFGjJXxPSxryPzVUWKXDKMxiBbXxJlolxC0G74eTvNmeUeuMHxvrqYGs4ybDOOoukvqkeLGyv5UUh0gN+Q0+r5QWxtvEnrej32W4UJ0XJN+iyz4R8UMqACyvCh3XqfXgtXnq07s060BM6QFkrYwf83sGX6RYqZLmEulWj12dPROO4Sa9T7Hs9iAD70+79qg31/mj6v9A0d4msnEGYDOiAOFjDLUuYDcM2Pm2B+Mebg+HHwQ9jmKzy7GjHolUT1C8Anuo8aSYPO5D7JuLJUunkJobwUM5j5VWQHgymRjZqFmWdUNW+PbEwUFGosprBMpNqP5uStrrXxQ== 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=OtOpLEiEyzESpmyJE89b4bgkAXvjGRp3Tb7aeoM24thEQFfmwzPjB+XlFu9hDZUbD3ICR4Zfcse7ZUeaTapKBGqmitEZKNuVrrzNiarVfwoW2Xm7Bugr3w3FPZxoec7xejyc7pXxulCfkBtH8WxdRBv3mxa3NfxuH/j8xENgNwU= 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 BY5PR10MB4307.namprd10.prod.outlook.com (2603:10b6:a03:212::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.21; Mon, 12 Apr 2021 00:50:59 +0000 Received: from BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4]) by BYAPR10MB3573.namprd10.prod.outlook.com ([fe80::50bb:7b66:35ee:4a4%7]) with mapi id 15.20.4020.018; Mon, 12 Apr 2021 00:50:59 +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: [RFC v2 7/7] scsi: iscsi_tcp: start socket shutdown during conn stop Date: Sun, 11 Apr 2021 19:50:43 -0500 Message-Id: <20210412005043.5121-8-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210412005043.5121-1-michael.christie@oracle.com> References: <20210412005043.5121-1-michael.christie@oracle.com> X-Originating-IP: [73.88.28.6] X-ClientProxiedBy: DM6PR06CA0062.namprd06.prod.outlook.com (2603:10b6:5:54::39) 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 DM6PR06CA0062.namprd06.prod.outlook.com (2603:10b6:5:54::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Mon, 12 Apr 2021 00:50:58 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3b8db375-af10-4b89-3c2c-08d8fd4d0a00 X-MS-TrafficTypeDiagnostic: BY5PR10MB4307: 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: n4YSzRzFNQ9uQUAdySaZZ/+owY6TFYxxFFWYr0o093VGy+/upAFC//P3lJEZYDEhoyLLGBs5hgw8Hl/5BR3NHHTcHqRUhMwDsk/tgYy99FfBd/MaXaDdW/RQ5OTkyQRZXidG1Qto5O/QJMr/Tmy3J1uikxQL1I+GsbLP+gwfUULDHNPCoF9CybOwJnke9scyFy9Fz1u+yFWVq8RscIBBnmHpVbdTGBnQFA9eFOZpGEY3ZmrP0muvPw5AXfQSq97V1WEaDMgxdwvFGw/jNTZZXnNcDvYtTzuEs7XarUw8XnxIOnhIjwBuvTc1jRA1/zWrqpSlLqBZ6V8SyTgtv7NqcHBoP00s+WaUrww3EkDe7uPpILSTtXoDpn7lcI94iw5otK7+AzhRB7dEyxsRlxOcoCLMW4Zc/kF/S0X4GuB+uVVtsDcexxtxBzHa5k/EYO27Ggp1dCztGfQQNFw3Biukkzx2KEdSjvaQ01xk5VMbcQIwTKY1cdCODleuSCsJ6veyTSEEiwl5pkGot/wXkb2k0HHaPxYnBITcNNdxrPLenw0Y3sLV3sm847MBu4LjvGIxG6U4qMwnbB0T/WmuLUEEBAynvetnLGaWzcjNBFtYj93GZ/SrE4+zUSwfHc8vkSGZIyLpvZWPP1gvvg43iTG6hw40gYje0r1kKbY/2eb2SDEAYVe2x1p2Z/sxASTWbTP+ 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:(346002)(136003)(376002)(396003)(366004)(39860400002)(26005)(316002)(186003)(16526019)(2906002)(86362001)(83380400001)(1076003)(4326008)(107886003)(956004)(66556008)(478600001)(8676002)(38100700002)(8936002)(69590400012)(2616005)(66946007)(5660300002)(6506007)(6486002)(38350700002)(6512007)(6666004)(36756003)(52116002)(66476007)(4744005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 6/ar9TEDSOncqWKDQSLN6BmUMIlNPcHWIbX8DoIXCRpDUz7KCQNWeLNiFDOtLw8SY585B2p/uMeXqSYEkZ7L1kTJaCBC16XRe1i8lqMOmOtmUe7onChvHxfZz9aDH8XIfhQxF1sJGiUZGjHOFcFGOWslzZ9cejAUguFSnA2iFuGMsLxtfUTDMSc7l/wCkyJdySyhpCiQ16GBPkpgZQwwjNs5bgsP2gPaSU+rsPu8hytJDTdozbj+vV3Ez4HmYy0fC7v63acVdThkcPd/w7hQp1mS0iuh9TcOeLQicH2+P/37RLOnX2tQJAyPRlPZ6XV11x9TbngCAm0aF5gErlqb6vaPKxPvI1pymr13NOgX3ArTzANWW7RaXrY1N7nLvEUoUwKWVC8u9eHfEudG9ZZPKsoGkP2yOs5LpgDAiSLoHiXEsix/65ikHHIUA0oAgbC8SlPZ35nPl+uG7YAJD7n5mW/jSzJwTV97YUALeezdKpg1Q+arBHPku7D5+3VjosRs/hubLE6Hdabt01NKItEtqcnPbaTODRzkEhCFCnZlRbu0KwF4Xufug/W6y6D+SDtGlT//eWSgUtx10Gbd7/ctJVURAtFqn1wXAhX3FQOkWmRmBGi/qFnA+vUgQQYniGgjtCcAsdYm3ClYrPA9QKRi357k18G74FpXlvAjRlrgPsbyuBMgoCuuRUGZ8jm4H/DgJd2BB7geENS/34sKBJUIOz2IXS1x7MwYFuM6eO2MROv/yLIY8HmmwhAMbj3oPcII7AaIQUJ2+6xNRD0ynTL8akFQE04qApjHE6yaSHM8iBb3/kHbab+vkwkNzlcdaRTlcyqnako6Lta8+bde0X9CYg/Xex9v9d28ie0MZ1KgiaYN0IQlHlx+Qz4OirSItgREA3mGuWgvup5XMdr7JkT+76nYoK0TW5reakCs9kx7OUq6gJFp0za0xr+lvw+BGkXe08hnxzam/vkaRBMExtwBmYvTQBp81S7VgR7UkJ5XnYKZdjk8AD0Yird+x+mJ2vkiJR8DpFfWAqoe6smEyYctXqdBKd1ZDsgFVWn+RY/Ca+lwjDy8zp76itYFvyEPbDV6nOsMxdud2ELo6QqKiwhIQbP2pBT/VvqZTuFfK/jxS0Sjma6Vsj802reE8HEX3nGSkzqh2b+i6yvUh4m3zsDJzJg6mLuGWIKHGtpEY3pdmmB+UADe/+JHnFiRpdOQBzh2FuEnLjldnUpKUQwyZ+f5uxUsajtMh7bQsK3Twrp2QBc2x013gYEsW0k/PjU8SqTI+HNWR418qgKJV0EFMmCZcVKtf9JgTR3x17w5wBebTyezPac5AKzp8agOFfV/ZCTt X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3b8db375-af10-4b89-3c2c-08d8fd4d0a00 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3573.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2021 00:50:59.7090 (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: VVFp6KkfaTL8EPQGlo55ulIR/CUhJr5rARJAjbiKpGB5p5Qrb1fDDx9/ti6P68RhoF0uKkfM5usRWAMO2YWfdCNXSBywMIp01Vh+EDnIZU8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4307 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9951 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 malwarescore=0 spamscore=0 adultscore=0 phishscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104120001 X-Proofpoint-GUID: eQoY-t68V8_gnbNjB1CMN2kwz8JOSDu8 X-Proofpoint-ORIG-GUID: eQoY-t68V8_gnbNjB1CMN2kwz8JOSDu8 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9951 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 mlxlogscore=999 spamscore=0 impostorscore=0 priorityscore=1501 lowpriorityscore=0 adultscore=0 bulkscore=0 phishscore=0 suspectscore=0 malwarescore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104120001 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 --- 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);