From patchwork Thu Jun 16 22:45:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 582523 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32583C43334 for ; Thu, 16 Jun 2022 22:46:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379133AbiFPWqg (ORCPT ); Thu, 16 Jun 2022 18:46:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379155AbiFPWqV (ORCPT ); Thu, 16 Jun 2022 18:46:21 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B71D062207 for ; Thu, 16 Jun 2022 15:46:20 -0700 (PDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25GJNLVl022339; Thu, 16 Jun 2022 22:46:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=xAH0fWq0MiEG/RRAMmz5Fy8/aXlzVNJ6t8P8ObwRJZg=; b=FVmzc/JemWB6alpi+0/7k0dpsNKQv8OLQHW/+VlgDGh8iEeUq8CpYiK+igIWxoaOARz2 enuCYy6Va/bsWpZltf9Onkc1YP5E+TVMJEQMtYyLoTs1jVkjGr9dMiPp87vQMjBXNsS8 s3ZU4CHhJ1iLbd4dTFbVNZLxSi3S35fj7Che+7g4Abs8JSAJGgBB49y2dId7gdlGotpU Swa4j/Gb9lUUh9UzPPYKjOAHXQJSdBufc7zxEmnduhk9Ta7keIbxQrvWWc6OWgbl0VSg /Crp4Sfyz10aTXyPl0CQT/nlzbAgsNRbmmFq0BmxPcrWO0CR1/1SIvu0QRWoIl2G0KMM Hg== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3gmhfcvcfs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Jun 2022 22:46:08 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 25GMaQMZ003820; Thu, 16 Jun 2022 22:46:07 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2176.outbound.protection.outlook.com [104.47.59.176]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3gprbtax08-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Jun 2022 22:46:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kn3Ik29FcqLHlBNLuGYIre7RdWYF8KsMahvUGgjdQJvO3VRwVzlAZsYCBfdARrxBeG0kWnS+abkp5TR9oAk7N1mCCbjF7Bi6teNpM3qbmZV3yQjrdLnBIwFPz7T9Kubs0ncobLfKfc33FUODmh2WgP7t8KKHOGXaawOe7wLVogzE/dcMMdXBQMzg9HltKCAsi2eZ0tiabR0o+Y81RhvTBTyA5X22gkQOgyFfAVTdMDAowOueQpq//yc+JNUA2gEkvDILETqMRm4LaczJU7dP0Z2XhIUvAVGtMcqP/eY40A6qsQBxJtpsUVaRCTyAHHdOzY0FALjFHwPRsgC1Y8sMVA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=xAH0fWq0MiEG/RRAMmz5Fy8/aXlzVNJ6t8P8ObwRJZg=; b=Y1gnqXB1W6XFMPevDD2qFzck/8SbU6QdV+WTQxBPsJ/JIR86dhFI7N4ZkrdKg13YGZs8F4drFYiD9xxNh98Moxe8OD6SZwzKXWUzWHbDCqR7+r1LY2iD4I+Zp7FnLJzSU8tbsF7rugwaBHJRjCYehzD/W4xXmYQh4hhbw2axISdB0+ygtGz4jFwKrQv1wZ6HWyk7RXJSmpiraQzC+4ex25wdacATJqG6XRNo8ez14ayzImv2/FNPbmDO7Mdom3RvAAlSudFFxAK0ooqCa0MxRlpqhrp5LCV2i/53hIJSzA7IFOpXj8F1A/xZPItNdwkRmnEbkOT5JIh8lEF7g3GO+w== 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=xAH0fWq0MiEG/RRAMmz5Fy8/aXlzVNJ6t8P8ObwRJZg=; b=spFVwPI9tMrt2gwrtDIHRKIIPsI/jps/6RtcNnmMXV96gspViVR3jULY3zkCu3WroEry6+uEV+DBDlhpep3Xf1rqzQJ9zLvOn9j/MSz1nBIQrWu8KKO6RLRbzlHBhIJTesp2qfVjNZchgkExSisLg/NbHQfS697J9vBdEOFuDlw= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by MN2PR10MB3597.namprd10.prod.outlook.com (2603:10b6:208:117::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.15; Thu, 16 Jun 2022 22:46:05 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b%3]) with mapi id 15.20.5332.016; Thu, 16 Jun 2022 22:46:05 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie , Wu Bo Subject: [PATCH 1/9] scsi: iscsi: Rename iscsi_conn_queue_work() Date: Thu, 16 Jun 2022 17:45:49 -0500 Message-Id: <20220616224557.115234-2-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220616224557.115234-1-michael.christie@oracle.com> References: <20220616224557.115234-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0264.namprd03.prod.outlook.com (2603:10b6:5:3b3::29) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 74f1629a-7b5d-431b-b707-08da4fe9ff4b X-MS-TrafficTypeDiagnostic: MN2PR10MB3597:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ameCtmcyHz+Ts1A5d5YeB7/VQeJv9nB2Nf3aVf641WwarBWnx5XteDUBXwf2erQBDQj9ASk3Z6z/gpUVaq8cKzgSjOfsK1zoCixevIfGsKh96KdBFKpPoLgRUTtdli3nuWIc/USn2EhX1Xkgdg0oQNcDzs6UPGOYgqh0Zb5f/U+mPouGIeSIoCfUX4IXcFGHrsx2erV5D9qZqM/t4k9ZJy4FltsODNO3jFnmrkPSX5ZDh63vSwFwUZ3wTVXs3ElJoTRybe6kiqgJuDU6M+LJ2iovNYiq4GHl3TKD1XTfiJKrMvDn2kvKSbRfsJeIvDrrjOsk4mLc1ln6Y2XAIeuxQ8QenoJozEZNA9V3k3sus077kbphorKAqEOaaQmoJDNE3YGDQZVZVfa8PdTfY2iS+dQN+HoErVkVB+ezRL4s2111DrVScSeSC1/g3xFdFjLeo/1I6IEnQPRETY9ZpYSkr99/LNeSrebFHSZsEFiFTB+/qC/3hpFQgzvjTJGbM6mgk+/UidAEIfqKP4QxLl2dZX6IoLej2iy/5XsARc5+W0CVgz4txnKWCe1DuWLz8BBUOOds4O5g0kjuO+Z6t/Amzx/7WLqYbIyhV6f8UdJs0nJt0Yw083FDHnzIY1xdNRJIOiV4PozzsaiyHcSUkn2eFI2qq+cprkFDHp+VO+LsOpzleKXkDa/5lniup68M5L0RHZk87X0IJz/JV7B2bHbJiA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(366004)(66946007)(66556008)(6666004)(4326008)(66476007)(8676002)(2616005)(54906003)(26005)(6486002)(86362001)(508600001)(83380400001)(186003)(36756003)(1076003)(8936002)(316002)(52116002)(2906002)(5660300002)(38350700002)(6512007)(6506007)(38100700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xI5xax7YnDVuO3cnOxCuRUGJBFh0tevRzC1TC4dTz+LJ14aC/BfFfOOhine3gmjVETL2kDLuZfCbikVqVQv9Vf4PVwBaIE3WMdeoTrrgggbPER1Ctx5aMlfSPaNkUbRjDg914wzN2iKA0N7ibfHvH9Eh4AxC+UPj2wzWdneQVj7oI2+FaDopz6JyMp4+13/PV3f+1+yom25RUjLnRHSS+gcHe7zR6vHNzttbJYT3hq8FTDIOH6FGOIxeky9LyQ39UI64KRb0S8OlAq7g7LOVkYIE6a9Gzk1uYlUVyTThC9MN8HTsCV4V7RqaqWAscmS916dfBOmjSgFQNtjiyMZiiN66t6bbKOaNkbNS9GhmFVZ2q97tx/NKWeQkY8B1GB2IZHLMnZ7k4dGZBz8pQBGct4uFXXQ5FzDbUR6et3ZEnHsThT4VZ8fqXTPHiQ3tGCrB8+gkvvUi2sAeInN3DmYd/CKdlNE7ccYsMIKWjYcKnlNFtimtTE1ee/TsbZGeLyuNPIEipBrgMt4Wzq7YqeupV7W2etzzteB2sEM8oVw4I/M5v9SpZ0fcyrIKhprgn6nwSbTRSV7IVyyWtv39Fm8ul3tZmmXAQbeaQCQq04vr0a/lQOVS9eHFktb9xGidZ+vBSjEtDREY4BEaa6CqqBSi5FC/SUrQkyTe3klkAtBx0LM8Oz78NfWa+3qyjN/3iuT9JOcievgz1gZhCCtUPopeGJk1NQX0PGBuc7wZw6uO5+G4VPSLP43/KohgmwuzOLSQirYffN84YhLHlwZ27yl20cAmycyPJztUZ1PNq5JLptxBETGvDPc1CQDfkx52WwdLYAz9BIumHc1nIHAqC98cDcJ9U0z6h12vbtVg0ayId0VF1UdFHGTBF8WqyH9bu6F2BOZ6ps0HIK+ThZya2jTrUH9X/EHxAWgs3y76tC9B+iPpbrlkgJioeYmbRxnV/a4aGa3VSOYUqRr/p47p6ki9JKcvrF9CfigsBeun8rb7D5gipqZy9KxAaWp/x/eDcxToK99O5LtfHtfmFrVqk2Z5MROmCCw9dE9orw6QZY/yxKpQgKaJphW6sfUH8fL1w2kfbLQZa2HzT8oYbobQypAVs1C4k2qVL17urJPpMZESmbD2GYfrdjBgFRRG9pd22FOOMmFiV2Me3wc+opLsxfkRwBYEio13ccEBo0lbuTkeOCfe7+coXZ+sYhMtkGlVhvfF4H69WFuCIE1QdphjGyGLE9XA0u/6+9QhO7ktHdzS/iUv+cQVFUsDtrfZOfqZ2dwAGTt8Hgl96/wAnbwYrbVO3Ry1zrJqe5uWrXLN6cxi0v331UuferR7Nd8rDvA3T5fSld6MROc5crZWfyvZRTu6ec8LQMDvijMvuvjIE+UyiI72pxB6bVjz53HQntMuJB3yIQboygpo066l2o2/pZ4ua4GPBQbcDf9rnQgje4GW5jzi1b+FzAmCBZCwyG7dNxkA0t32IHeIN0AxRcHAri3aB9aEfNyphzgen+hVpErS5GQw7Mx2F7q3dptOFiwT33X2uG9s6wlFRmJYlxU9VXnqHqsuQnuQCHhAgYB/Lno0oWGCgG7zNh8aGxvpvk/nqpDTR0+gxBZkxeExd2eGbJIv0NxJjgiEeMmo69YCpHGBzjLZ/cLqs/AK/ybgEbA2rHfFQm9EwlqA0TKdsCoUfxcnnVPC3w0XlQl4AiCOnTHF5UDlLmORK10sU0BuLviYmylVHrFz33CbD242Pf81Xu4pHJPcifCkFqYoyCspEXk9N5U= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 74f1629a-7b5d-431b-b707-08da4fe9ff4b X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2022 22:46:05.7347 (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: dK4IY32R0+6MHmSc98fLozzzXzj/YjxzKKKD0aJjYeJ5IoM2Ib35lToLbe+ad3jh07S7ELKWDuALubbULqJtgrQbJVs94RN3C8mamgSg5RI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB3597 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.883 definitions=2022-06-16_16:2022-06-16, 2022-06-16 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 mlxlogscore=999 spamscore=0 phishscore=0 suspectscore=0 adultscore=0 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206160091 X-Proofpoint-ORIG-GUID: hGvkhKJJ1lE6agtLAr5NKU3s_RTeC9gx X-Proofpoint-GUID: hGvkhKJJ1lE6agtLAr5NKU3s_RTeC9gx Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Rename iscsi_conn_queue_work() to iscsi_conn_queue_xmit() to reflect that it handles queueing of xmits only. Reviewed-by: Lee Duncan Reviewed-by: Wu Bo Signed-off-by: Mike Christie --- drivers/scsi/cxgbi/libcxgbi.c | 2 +- drivers/scsi/iscsi_tcp.c | 2 +- drivers/scsi/libiscsi.c | 12 ++++++------ include/scsi/libiscsi.h | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c index 4365d52c6430..411b0d386fad 100644 --- a/drivers/scsi/cxgbi/libcxgbi.c +++ b/drivers/scsi/cxgbi/libcxgbi.c @@ -1455,7 +1455,7 @@ void cxgbi_conn_tx_open(struct cxgbi_sock *csk) if (conn) { log_debug(1 << CXGBI_DBG_SOCK, "csk 0x%p, cid %d.\n", csk, conn->id); - iscsi_conn_queue_work(conn); + iscsi_conn_queue_xmit(conn); } } EXPORT_SYMBOL_GPL(cxgbi_conn_tx_open); diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 9fee70d6434a..c775acc5208d 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -205,7 +205,7 @@ static void iscsi_sw_tcp_write_space(struct sock *sk) old_write_space(sk); ISCSI_SW_TCP_DBG(conn, "iscsi_write_space\n"); - iscsi_conn_queue_work(conn); + iscsi_conn_queue_xmit(conn); } static void iscsi_sw_tcp_conn_set_callbacks(struct iscsi_conn *conn) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 8d78559ae94a..3a73aadc96a4 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -83,7 +83,7 @@ MODULE_PARM_DESC(debug_libiscsi_eh, "%s " dbg_fmt, __func__, ##arg); \ } while (0); -inline void iscsi_conn_queue_work(struct iscsi_conn *conn) +inline void iscsi_conn_queue_xmit(struct iscsi_conn *conn) { struct Scsi_Host *shost = conn->session->host; struct iscsi_host *ihost = shost_priv(shost); @@ -91,7 +91,7 @@ inline void iscsi_conn_queue_work(struct iscsi_conn *conn) if (ihost->workq) queue_work(ihost->workq, &conn->xmitwork); } -EXPORT_SYMBOL_GPL(iscsi_conn_queue_work); +EXPORT_SYMBOL_GPL(iscsi_conn_queue_xmit); static void __iscsi_update_cmdsn(struct iscsi_session *session, uint32_t exp_cmdsn, uint32_t max_cmdsn) @@ -765,7 +765,7 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, goto free_task; } else { list_add_tail(&task->running, &conn->mgmtqueue); - iscsi_conn_queue_work(conn); + iscsi_conn_queue_xmit(conn); } return task; @@ -1513,7 +1513,7 @@ void iscsi_requeue_task(struct iscsi_task *task) */ iscsi_put_task(task); } - iscsi_conn_queue_work(conn); + iscsi_conn_queue_xmit(conn); spin_unlock_bh(&conn->session->frwd_lock); } EXPORT_SYMBOL_GPL(iscsi_requeue_task); @@ -1786,7 +1786,7 @@ int iscsi_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc) } } else { list_add_tail(&task->running, &conn->cmdqueue); - iscsi_conn_queue_work(conn); + iscsi_conn_queue_xmit(conn); } session->queued_cmdsn++; @@ -1967,7 +1967,7 @@ EXPORT_SYMBOL_GPL(iscsi_suspend_tx); static void iscsi_start_tx(struct iscsi_conn *conn) { clear_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags); - iscsi_conn_queue_work(conn); + iscsi_conn_queue_xmit(conn); } /* diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index c0703cd20a99..4f4be93aa0d9 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h @@ -453,7 +453,7 @@ extern int iscsi_conn_get_addr_param(struct sockaddr_storage *addr, enum iscsi_param param, char *buf); extern void iscsi_suspend_tx(struct iscsi_conn *conn); extern void iscsi_suspend_queue(struct iscsi_conn *conn); -extern void iscsi_conn_queue_work(struct iscsi_conn *conn); +extern void iscsi_conn_queue_xmit(struct iscsi_conn *conn); #define iscsi_conn_printk(prefix, _c, fmt, a...) \ iscsi_cls_conn_printk(prefix, ((struct iscsi_conn *)_c)->cls_conn, \ From patchwork Thu Jun 16 22:45:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 582525 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7ED92C433EF for ; Thu, 16 Jun 2022 22:46:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378725AbiFPWqT (ORCPT ); Thu, 16 Jun 2022 18:46:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378590AbiFPWqR (ORCPT ); Thu, 16 Jun 2022 18:46:17 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE04D62135 for ; Thu, 16 Jun 2022 15:46:16 -0700 (PDT) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25GIQFvP026656; Thu, 16 Jun 2022 22:46:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=30veNVdGdWLohkh5NmOj/rSP1gCQdKhZ+kJv8SWs9Wc=; b=SApJtO6sLqJ0zjjG73IJP1tqkF7BrDsYR76ptIVDiW5LVae3OC6uk05WuYMt3SogONJN tc60+Il6CDtXjiUexHLMPlqFssT+IUJLOfDY22OLwfhUcUyCeCjRGajpXkk7xgzIleb9 DI59ChiKKhR9S1XYKbn6I19imtzo87h4hLCgpIFNoD5A2ythuIrbaZ71Co5oIrUBWjPp nBslXswkL2yjDO7L5iKMLXC0GXv6zPB23pi6JUlM6rGAxvVsA/7Jo6olnuhaTvgvbCdr uH/IrXqUImqAIn6tXWOAEA3m2Xh6AmvuaeTen5cozFyJOdjBVbh5fjG5C47fz2kGrgKt XA== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3gmhn0mjp4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Jun 2022 22:46:09 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 25GMaOYc035621; Thu, 16 Jun 2022 22:46:08 GMT Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam04lp2049.outbound.protection.outlook.com [104.47.74.49]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com with ESMTP id 3gpr27dmq4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Jun 2022 22:46:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cDPuCTi7B2Y52CTf1fpH9XMXFX6lqvr08pQYahLQ7K2QAMhatdFCfYlMBCp2NmGqeke1ycxlpR4ovHpBIj5dicMVMG9SUJyaofgoX6F+SzvotwAsXkbsXrJEmkXlI7a72OPDLG0mAmeKR+VtpbPXOdf6MCZF5wzwZiAdJARUSIQv+YPBi9NRGPFfEnru0SvT+a0/pG8cQKEa+tk89f95q3omiS2gdiq51gX8ui8h8D+/0rM0O8Ei3whbEink3ASfb9tkkLrmg7CNa6w+CpGWNRakvvNfv7afw6ydNNFFt7akGISrnM9ZxWsmmmnC8Y9uVDrOJSHJko+mvP5sQKtx1Q== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=30veNVdGdWLohkh5NmOj/rSP1gCQdKhZ+kJv8SWs9Wc=; b=ljKXt7NeoIpwvPV/3s6ozKnsyVJs8Rnv4Bm0k7Z1axnK0iRGLbQYoHgrywc6hVv1NVcvicSHWYkeH2AE+eg8P6uc1anQVWNhF04bvgLAopx0+S3vcdivCOtddANfxPbMnxzLojTKBppzh8ODv/S99TZX5l6nsCKwWiZP9iYdnolKzzZb1vjMv8vHLkzOhGHJ4mSi0HOZxI62/pICpgz0vJGkNC5/wKKz1XAn9++J4LBejOncK3d5bnd3KVSKc9rWSVaEX3Niwt2v+r3vozcIcn93OOISfdWWu8Lti+lR8avAKhklmxkzRGSfPj/wp6bvaBdVSDEyok7i/xWA+m6gpw== 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=30veNVdGdWLohkh5NmOj/rSP1gCQdKhZ+kJv8SWs9Wc=; b=TK+mpak6/aGfGx30R5K7ydM3wpVd0twFGSpGz/GHYWSv2iM4vUYhIlJL/UI+bp0H6kY+b5Sskify9drRDnTO3ZLFhYiA1Q5pCNAPC5RvoE14L1EJwvWChmU6YwPFWFaBhSPpzMkclTwmDn2D3mu1bVVV12ISNDGsWOGo/3wp8ZA= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO6PR10MB5617.namprd10.prod.outlook.com (2603:10b6:303:148::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.15; Thu, 16 Jun 2022 22:46:06 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b%3]) with mapi id 15.20.5332.016; Thu, 16 Jun 2022 22:46:06 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH 2/9] scsi: iscsi: Add recv workqueue helpers Date: Thu, 16 Jun 2022 17:45:50 -0500 Message-Id: <20220616224557.115234-3-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220616224557.115234-1-michael.christie@oracle.com> References: <20220616224557.115234-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0264.namprd03.prod.outlook.com (2603:10b6:5:3b3::29) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ab0f00c4-bcc9-42cb-d7ba-08da4fe9ffaf X-MS-TrafficTypeDiagnostic: CO6PR10MB5617:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OyXLclhkPLz8d2NkT4Bhl4GUeLIQERQPrwXl8GU+aB5E690gV5CbtiMeBXNrnjDRHevprSAtddoWvxuRHeE6Ml0fCzZ9XPcg2jIO+EeuYb+KUffqctcZ8KhFvqzH+Jvi+ntxbmVRAq2ECbMbSFQiEp5X8m2NjylVfL2bvVI6eAS+dzpl291yqlHRQmtxM2pMH9wSxiWBgoid5k87I08OMWcZGiu341bFqNLWhP1waT3bp5qslp0WAY92Noo3mfk0MgbeYHwznjhocW86z8XNWsCSDxWDuS5kkeEA1J5TZqZuxtrCY2Rad4FRlvSEsYllNw0pMto6U/0yvFqX2WF1AvzhwwAYh6rMW1QMIPRcaAlS5OVl46+bxZ4GL75Hp+wM0W0rR13Eg6jJ/eZTPnkqISKzt14Gg2+v9QCdc1jH3793VbHam0yRGSZOa26cDiDlkthpJwtfJMou2MXc4EZTY/2Ezh13sigqgQ353vlHOToCFI04H5a1yoFIk/gATFJRg5kEL4ijYN8gsuOPFbY4rMxONnFs83EitbEv6JL5xT2vyWDb9bANEqJENnDqyJhCSCcWLf1za3W5Gf7T11Wor3tSPYYHcRfqjw83zC34BR0AUpqvJ/DmkpR+sarNbSC/lDNZURsMsCXVGB1/iw2bWRO1wf/i6QoXXJ0jqS75UDHRGIZ3jVx4k/miq6IY3Eir/pW5H6AS8KLqaUXxWUBdWw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(366004)(83380400001)(2616005)(52116002)(6666004)(66476007)(5660300002)(38350700002)(38100700002)(36756003)(4326008)(6506007)(8936002)(508600001)(6486002)(66556008)(8676002)(6512007)(26005)(186003)(107886003)(1076003)(66946007)(316002)(2906002)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8N7iWfTjH2Urj3jXa2HRnMBCtrRTX/8pxQ2GJmdY290VV2RZ6TKlQwQxiFvnWx9ChXA9EejhG+8mUrOfKZD3JGT+su4tQIq/baqY7Q238JxehVsk/UOYIcoA3caMZhUhWblVb3YPeXItFn0Msv20LUyj2sgaM4WXTUOgtNJxmvYkHnZWWTcB/K2rvWxW5xzSPc7pltQPXYtzXeKl/jNuWZxR9JJrBYUORd9EVAlC+oc9+nT0gW979XWSSaMMYnE+8BMQVvhtZgbMPJWCCji5IVbF/ABK5PnT2rUcHBBMopQrIlUuQsTPJQ+evIDucplKQCuoM5qGhsrTdgeqtPN2crmFEiwoCLdGmNeg1MR5GQubw2it0T4PVeWG7Y7JmkmX5oRb3vW/lcHf94TnLnLQsKzsK1MC4sdIzmK9mwM0PGwrJ/nqe5u5oAIIMc3GCe54FFbVeNZltv4d3WSqBBKVtis91W/WlgPWVYZT+Rc6HIUEofQLuSAjJR6UWzUuJ2DtHpxVZVWEicufpCfxQfcVDZ0l7d7naKTpExrLwTEaRYYPm4lTuyBfBMYjUBCFEbjZvwGRErRfFmtELieajgtdBwl2rmlhK2t3MAudBVgQAhqSrzobsRtYjsQD/UcYzjEAyTfJpBLDQTKXqel/S3WLhwIpelbv6gDu8CszN9wZtzbR6qE9mI8EwFvL3atuDz/wPDR8wFkPfO7EVUMvRPgfo6Wpeclb4uF2TMmXVA9iKm4gZIXIaf+LjIwftKsoGRTuj6mDsl66hxgFtAy7tUUkVx40hcJ3RKpAgxB6LjUziL9f4iayv3e53E+hHPfE6nLpIvMfwr0/PMAL/um3XIxc1lxuv8lt7suJbWAOZOgPm5R+8U4kq1a8E/tBFi1uJlD2Fhvz4j2ue22hilfw0plCRWmUB9qw9dnJFj2dmQpM3oKJXfv8gXzFajl7VB0jlQEiE5ANT4DmGyursaLZhP+1rJ1hqiwtQoiAItjdoghqc6X56gK7UuUUxtwAeynMOYYxuwLHJSqDeUfnXDB1gfnM1gWluOjLcbYbrPyutDHPs0H8usheUef2yZVXfpOEFjCwEuydKmTdDru/UF2d9TZBe8/ebCTBejc1vbdEqJpIZmVcBvvn1h2JN/BvpPpMeOG3R7X3DofH+xo233egzXC1YWCLcCGZu9U8x0x+Hyn3uRu3Yn5HXPnxfIxQ1dxfURXGGJ4cII0stTeZcwtf4iz61iPdhJxOfHBQqO30Yl9hhW6m+0SID/dubQmbqQu2+nXsLolJqj52fTZZMbEPDSd/1ycyLUJWbrm5XChY0SjMoiq9rg6zMbUfUpdIkhcdv/AVKq+1iDq4wJfH/tIWdjARoRkjE05LthOyzLp6ysgpX3IwPqi+FE1AS2hpH6W/u2OPqpKJFi8ant6gkhRztlpTvz+Vu/sAdPXSazVt7k2l3op3qrROmL8Aw0rKs6syXi2Xem7gQq4CC6M0iSAgc9RaAj8oCi1Wnpy82NA1qFDkQo0H7HNrKpzMf5Scs8wVUEwwQZ6XPRWZ2uuufYnFjc/7lpVXn+yFlYDBgMRxCZ9r+mE0LeRgLw6xPo7mPfZISUMzOi+xVbizCG44QNipih5uXil9k3TOV/ITHcifpx0PH9lfphC/nuA8TlRmAsVFRZo4rmNTp/muOYbbY6SSYhinrvUcWONkvKR937ZFX3/Lw6cqb3I78UoRHWF9x3afHs5T7Wy68eiuK5/4sB9SzFxoDCSXshrErNUSuwMO6one8o0= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ab0f00c4-bcc9-42cb-d7ba-08da4fe9ffaf X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2022 22:46:06.4065 (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: OgOri8ITa8nq8gGBdmphTUiPlOoVPbqrInZNN1D8K7YOVD0A3TJg13XHko6RxQiBk5wOeApvfOG72YooLrC8NHirsCHCuprHkNE5tU8doa0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR10MB5617 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.883 definitions=2022-06-16_16:2022-06-16, 2022-06-16 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 suspectscore=0 spamscore=0 mlxscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206160091 X-Proofpoint-GUID: 0hKebPY48tTExHXH74fJjnlZclkWoFn3 X-Proofpoint-ORIG-GUID: 0hKebPY48tTExHXH74fJjnlZclkWoFn3 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Add helpers to allow the drivers to run their recv paths from libiscsi's workqueue. Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/libiscsi.c | 29 +++++++++++++++++++++++++++-- include/scsi/libiscsi.h | 4 ++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 3a73aadc96a4..44283014c4eb 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -93,6 +93,16 @@ inline void iscsi_conn_queue_xmit(struct iscsi_conn *conn) } EXPORT_SYMBOL_GPL(iscsi_conn_queue_xmit); +inline void iscsi_conn_queue_recv(struct iscsi_conn *conn) +{ + struct Scsi_Host *shost = conn->session->host; + struct iscsi_host *ihost = shost_priv(shost); + + if (ihost->workq && !test_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags)) + queue_work(ihost->workq, &conn->recvwork); +} +EXPORT_SYMBOL_GPL(iscsi_conn_queue_recv); + static void __iscsi_update_cmdsn(struct iscsi_session *session, uint32_t exp_cmdsn, uint32_t max_cmdsn) { @@ -1947,7 +1957,7 @@ EXPORT_SYMBOL_GPL(iscsi_suspend_queue); /** * iscsi_suspend_tx - suspend iscsi_data_xmit - * @conn: iscsi conn tp stop processing IO on. + * @conn: iscsi conn to stop processing IO on. * * This function sets the suspend bit to prevent iscsi_data_xmit * from sending new IO, and if work is queued on the xmit thread @@ -1960,7 +1970,7 @@ void iscsi_suspend_tx(struct iscsi_conn *conn) set_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags); if (ihost->workq) - flush_workqueue(ihost->workq); + flush_work(&conn->xmitwork); } EXPORT_SYMBOL_GPL(iscsi_suspend_tx); @@ -1970,6 +1980,21 @@ static void iscsi_start_tx(struct iscsi_conn *conn) iscsi_conn_queue_xmit(conn); } +/** + * iscsi_suspend_rx - Prevent recvwork from running again. + * @conn: iscsi conn to stop. + */ +void iscsi_suspend_rx(struct iscsi_conn *conn) +{ + struct Scsi_Host *shost = conn->session->host; + struct iscsi_host *ihost = shost_priv(shost); + + set_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags); + if (ihost->workq) + flush_work(&conn->recvwork); +} +EXPORT_SYMBOL_GPL(iscsi_suspend_rx); + /* * We want to make sure a ping is in flight. It has timed out. * And we are not busy processing a pdu that is making diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index 4f4be93aa0d9..b4700de3445a 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h @@ -213,6 +213,8 @@ struct iscsi_conn { struct list_head cmdqueue; /* data-path cmd queue */ struct list_head requeue; /* tasks needing another run */ struct work_struct xmitwork; /* per-conn. xmit workqueue */ + /* recv */ + struct work_struct recvwork; unsigned long flags; /* ISCSI_CONN_FLAGs */ /* negotiated params */ @@ -452,8 +454,10 @@ extern int iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn, extern int iscsi_conn_get_addr_param(struct sockaddr_storage *addr, enum iscsi_param param, char *buf); extern void iscsi_suspend_tx(struct iscsi_conn *conn); +extern void iscsi_suspend_rx(struct iscsi_conn *conn); extern void iscsi_suspend_queue(struct iscsi_conn *conn); extern void iscsi_conn_queue_xmit(struct iscsi_conn *conn); +extern void iscsi_conn_queue_recv(struct iscsi_conn *conn); #define iscsi_conn_printk(prefix, _c, fmt, a...) \ iscsi_cls_conn_printk(prefix, ((struct iscsi_conn *)_c)->cls_conn, \ From patchwork Thu Jun 16 22:45:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 582723 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB477C43334 for ; Thu, 16 Jun 2022 22:46:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379148AbiFPWqU (ORCPT ); Thu, 16 Jun 2022 18:46:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378914AbiFPWqR (ORCPT ); Thu, 16 Jun 2022 18:46:17 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04E8962201 for ; Thu, 16 Jun 2022 15:46:16 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25GIjK84032718; Thu, 16 Jun 2022 22:46:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=6/hFvvcSwQFADytRccZxOh7jrn8omvxfvFpRKfXzXSQ=; b=DSotYXUn57stbDhlfLRZivArely5uL2QkIorlceJnt3PgZYccxD0GaU+1XLUy6cmGUJP WwByiQdjMGYPq8Ag3V1Kp7l2SI4ZKrpHMo878el9S96+KlJjILGJ+o6OfigskbALDvgA eawNXznYA/qQyzCIavwEBqI3eMHSFbUEaIIZ6Kbz9tCQke7O/5T2cg+cFMQATCIM8aqF wyHFmqFIZ0yFy7nHwPrCaIWOQ4m0sRHcBhY4sEt4QzwvnAvvrWbJB0SQmVEGYyqHIhjU KCryXHCX9317rX7pW+cMQ3PlA/UJ/CJNprwLOSf19ZgdylkKs0cYHsYQXvcFqVUUOjOh NQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3gmhu2vmny-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Jun 2022 22:46:10 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 25GMaOYd035621; Thu, 16 Jun 2022 22:46:09 GMT Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam04lp2049.outbound.protection.outlook.com [104.47.74.49]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com with ESMTP id 3gpr27dmq4-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Jun 2022 22:46:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ikfjkWXf+DFmKwaNUtS/5n2v//D+vb6vTA+NU8oLs/NGNIh3IDZcNSKJz53hob3/GW18zjs5IkcYPt4kzFmn1+zqfBs4hISZXo2t9lNFaMYeBzEzAdiHFuSnpBs9T/RgOrRbInO7opbo+rV3xB18R1tw3oRkeHh/+z808AIzhXklK00fkwf4BBoKuzPp0uZdmsyQ37SVYnf+tDISzdZZAVoPPRT6ExCsjr/j1DkIrNGROBc2O1eN/932enppvFgoRCxKOO1SGrYzg/7DU3rPFcvm8fHRaFy1L5du5P2NjUJCzYLo7NKmneCew1Kd6p7nXYViI+2BkMc39uyCuMi9lw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6/hFvvcSwQFADytRccZxOh7jrn8omvxfvFpRKfXzXSQ=; b=bH0LuR+7tbf72yRW/+qeynu29QylnCdsPdheei27UrTJKFK3iqx+ensOHQzRE7NAcnigi+bKcaeWTDmrmpDqrtlEqvLuSyPUzT6G54aw8TFfxaZWRyJ5IdJBuWFRoxCx52zAUaz4NZueHF4yBehC0I7XjoVApmXN1Qk+pZBmWM2eWKCvTt/J0l4RNUaHlvVxXZwxrgyK1irlV+KWzah4DG/dRudXu92euLydcqJeUZM7lhrqRkqBrNpxnp6o1EcXKfaulI5zv4anTa5YBM3BZ+oIS5YBSBoNViC+Pj3BaNIUCY/ptRVeeDUmcB676PH7WuMgG6Ib/M+/mtiyOOtMCQ== 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=6/hFvvcSwQFADytRccZxOh7jrn8omvxfvFpRKfXzXSQ=; b=qWSj4bLK6cipOZsjqlFa1twmnii40ilsRSD5D/ERVTiGT8vrngWXsFoYa9Qk01VfKU540ekm9TKLjphI0fHchw9vTORCr3leM+CxWKoT+prclMsWKgqgQgbzmRnmJEhh1y4823LrHtaARxZDu57/qEIr2iCod1sS7RXBFGj83J0= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO6PR10MB5617.namprd10.prod.outlook.com (2603:10b6:303:148::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.15; Thu, 16 Jun 2022 22:46:07 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b%3]) with mapi id 15.20.5332.016; Thu, 16 Jun 2022 22:46:07 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH 3/9] scsi: iscsi: Run recv path from workqueue Date: Thu, 16 Jun 2022 17:45:51 -0500 Message-Id: <20220616224557.115234-4-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220616224557.115234-1-michael.christie@oracle.com> References: <20220616224557.115234-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0264.namprd03.prod.outlook.com (2603:10b6:5:3b3::29) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c3ff3d14-9a05-4da4-bd0a-08da4fea0018 X-MS-TrafficTypeDiagnostic: CO6PR10MB5617:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SEOBmaZXnyMFzghpFLrSdWgr8xlDiw76+hg0SgK9iCFNP25pajSB1cuHAcVRj+o3AcBoaCJ8eLdNXXtsdLS6YrmPNqWPNz0n0HOWWQ8skLXoTjWmYrDKXaOcST/GK1cqkj6NV3XH3aMtzt2lEFFT7F+hnxRmQ3DpJ6cF+QIxL110W461ReIFNPOvW0Wj5eKrgYiaXrfVw8ljkmNtnEMaSQUxLL57IzSvwU4TaRA2pS1+01GcHu63Rx1QTGjl5enCbLyWriQ5UXc0BVLbNuknpW8JFaj4njuuzVqzrcU0oMSzengTF2yU3dem0ZgbuKmAJhV+sZ3MJq7valS8uQSifgG0SF8l6GeY8CAMO61QrpEpudFqmR6tEhekWg5ELGb8ZdB5aOBGE3U37zSnbt8sClUSNabZgvZseEJLXvvq7SCwngzAJvEip/tz9YDW4FQyyBVwnXKLh+GaqgiXLUxstflGWvnEzMmHRDMuoBRh8Ol1pV1VlLSICZVSzKkDvm1Plj+Wjpe/X5Exc+60TF0wEvNJsTHfzs42kut65Jy0IaFiEMNkJkx0VbvxZ69NdOP40E0BrWU4HA90NZizdNsVfDO4sjZ9XqQLJ9uCqAM0txfHyIzbtvfmhSv5sx9ZoewKqBsgzGGFH/FJO+cB/lXy+Eob9B5ABDf6IcJ/u6Q4uzzXP4L55cgQ9jReUjfXpTeZ3sOJuzfe32A3dJ7FCJFrow== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(366004)(83380400001)(2616005)(52116002)(6666004)(66476007)(5660300002)(38350700002)(38100700002)(36756003)(4326008)(6506007)(8936002)(508600001)(6486002)(66556008)(8676002)(6512007)(26005)(186003)(107886003)(1076003)(66946007)(316002)(2906002)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +HhoAfXbZCOfDTwRX5R+3NyqEEvgrHdMD88OiWXgk+C6CJT112/ZGFZyYLK/cAh27MkCFrsFQ8aSiwJ+3rK1yuLcH9mk7cSTKTgxhOg70QNFZs7dyvZ5fvpc/2JJ2t/w4/T13p29PGvYYhvEzwZLCD6/w2CzJ+z5JrfcICTAjImQ9rA7pNv2zaVbICABPHsNktn2GEsie6ppfX2FST3lMvMxfThCy89zdGNjtxUsPk5aO8tvR3kkAAKei6FG4fPQkQ25G1YAxyB93T9ILprRi4gIBbcrSyDGSX5x34mpsELYgs2Jx90FKWs/QmBVOdalDN4cO8C58/56EOGjNJznHUCe1eijnTQdOktfPalEX70PzwZQLRnYjR5yFzGO5l0yuWmyxipl2ToZhr2Pc8ZShKkQJ5T38fdt6NStfthsSkjKNNUl7rzaJMHc1e2tFjJHyFiCSTwFmM9IenjY8VtPalEpGU0zMr1lQovplYxzRWK5bFy1izV3eFFnEslxDJ7PifC35kbHX9MksoJgJGY2t5q0VPbpUDe8M/xjXyd3WRgqHNGquPK8qCkSUme8QS2hTItcw1SFdxxh05JR2k/p7RLV6Cd6kltl2j2Zmcj3CC+Ro8HAQLHnRKNIkL2M+HwyoxozJ+4hdRtmlaeT09pgmbQIpBwLdV7L9iGPK/5JB7YNgkDmz3U5dwKWiuqRAvxTvpJX67a6vpjrYgW1frkf8Mm3oTSM+pajMPJ3eCsgO7wkOf1pF+Fb9vojXLKJ4FMsAy8/uuT/Ua2lLnu0bKl3oAo1tCKbZ57DHM8X6M5BImtOPMS4HAlG0s+fF1JfpM9FUs/yu4YJoh0E7eZ3lUHN3efJ7HKr25lTCdUclfucZDEkzv4Ru7/UCiFgX6TiDBzHjFX/LkvimiMMBAhOjR8bMfbNmTQRZB7F9e7sGe56f+ViR/iLpZk0vshg5m5Fh3rD5rcWGerzw6Jn3sS44g4CKS9PikEaEF1lpQog2qPiko7ZqPoFawj4lxJK+EMeK5s1x8BqCUVN+96OF8OGWkFgUcmt48tRfyRo7wxR1dU6C6idbk8i2CypCRzdSq9ZFsQ01mP+FcBARXWTA/ikAFLl7mQN9/ahujWydVszzAKGwTShxZLhaec+4KEzwmFQuawBqMF6tmtPH+JAp99WZgaxO+Kk2XHRCXsea+aS/MyqeUJcVHcUrPdmZn543pauyZgnvXvG5nxw95hqosOYw+e7s5cIrLHdaRha5ISvW3SNW4yAKb0O8qWz76ukGneh3417Bmt38xyYKl4j3DaMuKtizIyZEzauh+Ta6L5MJq36nh7eJAaWYfE8RoWgRouQgsemM1vmeRi88doFmorUO6DaqtVkK1ey8YtHf8AGKng0OAvX8b3BAo0QjjXKY6LYHzsOSLUpJMENMH76wKHkRbBb3Aj0bgCBxyuEbQv+iWc0IOci+Xhd5i5JD9nxtufsIKUczDGJ78yrjOlve22mMvDLg1ylNEAThNA9N/7zbDOHIqvww2+iBPPHOrtteA44oEjZwEKake+DuC7jo8QBHsWEZK0bbNBHtdvSGL7nr92mDNe9MdabX1qqJ5pmDnt2UhawO0b30uaeijRMzSCJlxxOKK62dpr2c4VsUVkV6R/TV54RuBu6038fFOXOTRsRP9NrHX/FY5Yc1GP3pQXzJEaTLYWVwagEZ7qxDQ12UR0b52nrpGwAtF6RiddcRcoNWEVLMAXBWTxgXtsiMRUwFPgOfZeL3Cw2/c4kTJulrUTiy8E= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c3ff3d14-9a05-4da4-bd0a-08da4fea0018 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2022 22:46:07.0784 (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: nsT4hSjfJdD5jjAKwiM4pe0lK+QwRZaXbyLkZLJeu7SdwkgvY4I2/VOF9F4jwTLtELQD6mpyQm32fxsr0W6DQ3Jfjj5JczTH+LDI+PFT7K8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR10MB5617 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.883 definitions=2022-06-16_16:2022-06-16, 2022-06-16 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 suspectscore=0 spamscore=0 mlxscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206160091 X-Proofpoint-GUID: iowBq1gZaB2IBRG6nX8t17toajuuZYx5 X-Proofpoint-ORIG-GUID: iowBq1gZaB2IBRG6nX8t17toajuuZYx5 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org We don't always want to run the recv path from the network softirq because when we have to have multiple sessions sharing the same CPUs, some sessions can eat up the NAPI softirq budget and affect other sessions or users. Allow us to queue the recv handling to the iscsi workqueue so we can have the scheduler/wq code try to balance the work and CPU use across all sessions' worker threads. Note: It wasn't the original intent of the change but a nice side effect is that for some workloads/configs we get a nice performance boost. For a simple read heavy test: fio --direct=1 --filename=/dev/dm-0 --rw=randread --bs=256K --ioengine=libaio --iodepth=128 --numjobs=4 where the iscsi threads, fio jobs, and rps_cpus share CPUs we see a 32% throughput boost. We also see increases for small I/O IOPs tests but it's not as high. Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/iscsi_tcp.c | 65 ++++++++++++++++++++++++++++++++-------- drivers/scsi/iscsi_tcp.h | 2 ++ 2 files changed, 54 insertions(+), 13 deletions(-) diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index c775acc5208d..d6d329fbbfcc 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -52,6 +52,10 @@ static struct iscsi_transport iscsi_sw_tcp_transport; static unsigned int iscsi_max_lun = ~0; module_param_named(max_lun, iscsi_max_lun, uint, S_IRUGO); +static bool iscsi_recv_from_iscsi_q; +module_param_named(recv_from_iscsi_q, iscsi_recv_from_iscsi_q, bool, 0644); +MODULE_PARM_DESC(recv_from_iscsi_q, "Set to true to read iSCSI data/headers from the iscsi_q workqueue. The default is false which will perform reads from the network softirq context."); + static int iscsi_sw_tcp_dbg; module_param_named(debug_iscsi_tcp, iscsi_sw_tcp_dbg, int, S_IRUGO | S_IWUSR); @@ -122,20 +126,13 @@ static inline int iscsi_sw_sk_state_check(struct sock *sk) return 0; } -static void iscsi_sw_tcp_data_ready(struct sock *sk) +static void iscsi_sw_tcp_recv_data(struct iscsi_conn *conn) { - struct iscsi_conn *conn; - struct iscsi_tcp_conn *tcp_conn; + struct iscsi_tcp_conn *tcp_conn = conn->dd_data; + struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data; + struct sock *sk = tcp_sw_conn->sock->sk; read_descriptor_t rd_desc; - read_lock_bh(&sk->sk_callback_lock); - conn = sk->sk_user_data; - if (!conn) { - read_unlock_bh(&sk->sk_callback_lock); - return; - } - tcp_conn = conn->dd_data; - /* * Use rd_desc to pass 'conn' to iscsi_tcp_recv. * We set count to 1 because we want the network layer to @@ -144,13 +141,48 @@ static void iscsi_sw_tcp_data_ready(struct sock *sk) */ rd_desc.arg.data = conn; rd_desc.count = 1; - tcp_read_sock(sk, &rd_desc, iscsi_sw_tcp_recv); - iscsi_sw_sk_state_check(sk); + tcp_read_sock(sk, &rd_desc, iscsi_sw_tcp_recv); /* If we had to (atomically) map a highmem page, * unmap it now. */ iscsi_tcp_segment_unmap(&tcp_conn->in.segment); + + iscsi_sw_sk_state_check(sk); +} + +static void iscsi_sw_tcp_recv_data_work(struct work_struct *work) +{ + struct iscsi_conn *conn = container_of(work, struct iscsi_conn, + recvwork); + struct iscsi_tcp_conn *tcp_conn = conn->dd_data; + struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data; + struct sock *sk = tcp_sw_conn->sock->sk; + + lock_sock(sk); + iscsi_sw_tcp_recv_data(conn); + release_sock(sk); +} + +static void iscsi_sw_tcp_data_ready(struct sock *sk) +{ + struct iscsi_sw_tcp_conn *tcp_sw_conn; + struct iscsi_tcp_conn *tcp_conn; + struct iscsi_conn *conn; + + read_lock_bh(&sk->sk_callback_lock); + conn = sk->sk_user_data; + if (!conn) { + read_unlock_bh(&sk->sk_callback_lock); + return; + } + tcp_conn = conn->dd_data; + tcp_sw_conn = tcp_conn->dd_data; + + if (tcp_sw_conn->queue_recv) + iscsi_conn_queue_recv(conn); + else + iscsi_sw_tcp_recv_data(conn); read_unlock_bh(&sk->sk_callback_lock); } @@ -276,6 +308,9 @@ static int iscsi_sw_tcp_xmit_segment(struct iscsi_tcp_conn *tcp_conn, if (segment->total_copied + segment->size < segment->total_size) flags |= MSG_MORE; + if (tcp_sw_conn->queue_recv) + flags |= MSG_DONTWAIT; + /* Use sendpage if we can; else fall back to sendmsg */ if (!segment->data) { sg = segment->sg; @@ -557,6 +592,8 @@ iscsi_sw_tcp_conn_create(struct iscsi_cls_session *cls_session, conn = cls_conn->dd_data; tcp_conn = conn->dd_data; tcp_sw_conn = tcp_conn->dd_data; + INIT_WORK(&conn->recvwork, iscsi_sw_tcp_recv_data_work); + tcp_sw_conn->queue_recv = iscsi_recv_from_iscsi_q; tfm = crypto_alloc_ahash("crc32c", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(tfm)) @@ -610,6 +647,8 @@ static void iscsi_sw_tcp_release_conn(struct iscsi_conn *conn) iscsi_sw_tcp_conn_restore_callbacks(conn); sock_put(sock->sk); + iscsi_suspend_rx(conn); + spin_lock_bh(&session->frwd_lock); tcp_sw_conn->sock = NULL; spin_unlock_bh(&session->frwd_lock); diff --git a/drivers/scsi/iscsi_tcp.h b/drivers/scsi/iscsi_tcp.h index 791453195099..850a018aefb9 100644 --- a/drivers/scsi/iscsi_tcp.h +++ b/drivers/scsi/iscsi_tcp.h @@ -28,6 +28,8 @@ struct iscsi_sw_tcp_send { struct iscsi_sw_tcp_conn { struct socket *sock; + struct work_struct recvwork; + bool queue_recv; struct iscsi_sw_tcp_send out; /* old values for socket callbacks */ From patchwork Thu Jun 16 22:45:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 582524 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A840FC433EF for ; Thu, 16 Jun 2022 22:46:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379156AbiFPWqW (ORCPT ); Thu, 16 Jun 2022 18:46:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379133AbiFPWqS (ORCPT ); Thu, 16 Jun 2022 18:46:18 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF4686213F for ; Thu, 16 Jun 2022 15:46:17 -0700 (PDT) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25GIe3jq009842; Thu, 16 Jun 2022 22:46:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=3VA3icLDYUvlEczZcTorlDcaSbBLkdOZhbgydxfayYk=; b=RN9V3BLMJTXdyfUIbLn0aSKjmfnludz/48vIIbEroqcX6BgwvLr7Fi/vk56gAV/qpgjr i73WqPVP9ojb9IytylmarROrq5xCnSuy87FnhrQkG83PJvlDmOWf/psI5oB+3JYMPMQE nNDRaT6DphD9QYDC6FtNSANl7jz2YNXMOtuWqjtvzkFw2AxnrB3eQE/RnjA1s+U6Pmwa Ij9bsp/2Vl+draPdnXQqc33nSku7xyyF8aSd9PvWCWnAaxrrUh/V2clc6T6RKiHngSwh Ik/g4TH7Gkc3kGGtNvMQluqNWchqIWy+MbM51hv6bwBhk61mEzr/Pkf1m3lGdezraiU7 0w== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3gmkktmhk4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Jun 2022 22:46:10 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 25GMaOYe035621; Thu, 16 Jun 2022 22:46:09 GMT Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam04lp2049.outbound.protection.outlook.com [104.47.74.49]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com with ESMTP id 3gpr27dmq4-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Jun 2022 22:46:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A0lENTGmwxmu6P7bx2Ix27bvMBSNvXt1Pj8uu1KpXW/S2ZeFYKPy69/n1IUpN4p+/d2fhG8qM07t5wlHfnPcBcmo5TTcVTKMj3chrv2uclIdzMdMQ3lqWfM9RzFxt18mutUtaoM0UJIPXTTu7uRWBrpNrm0bBiuoGh92suJ3SGNu7PMp3NyVUpDzyK7dII2hZfy9eHe7SYl6F7Da3OqPZo6I0Mlaw5uJMruq3hF9NtE8x2bsy/ZN5UELJQ30/H53l7O/v5Liv7ToRkOruj09JNQSvp/+J4Zq2TSTzfca+dltzckeSGflkKtnuSQ2Fg+NeYermlfcOnz5ZEGOw+VCyA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3VA3icLDYUvlEczZcTorlDcaSbBLkdOZhbgydxfayYk=; b=GTFwSSPGj/584gDlOi4noKRKfvxQlmrZDWM8nLEq29felfigpnZ8tglzkNqDttpdHV7474zZZ71mADKM/YVFJPorekbxbZQ4FaCf6GVXiJ71XYc/fpMMrok/KPwkFC50/i01b+sPGBoNxgWTMy7hsL7nhgStPsgTN9YxReDeKqwHdAgSI3i22xM5NlnHPTGBGbfmj/dcybqKEPR0IVsiQllh24s52CS/wVCMff/aehhNcQur1sNzNWNiUeKI9O61Ec4AJd0PoBNMmjHBBY098y1quLDiHntPRfciO74le6papQ7g+QjVF/9XruW7zVCVsXTDUoYxkS8Zs8AQrugtQw== 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=3VA3icLDYUvlEczZcTorlDcaSbBLkdOZhbgydxfayYk=; b=hDs635L/1RVRr9QqzkYR8/d+ZmFcUVYbg4oEcE+g4P+Dm24kxnB1zExxyKircKcCBHsvCqzfT5C+nS1EW0+a+LFk/yB6W/xRfrf7fXEvc38rzBrkMJDhh3aZUqQKJgRLFWErepNhVuYeUw9lCNAocrKJCR34+UyBr92Yl7jomfA= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO6PR10MB5617.namprd10.prod.outlook.com (2603:10b6:303:148::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.15; Thu, 16 Jun 2022 22:46:07 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b%3]) with mapi id 15.20.5332.016; Thu, 16 Jun 2022 22:46:07 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH 4/9] scsi: iscsi_tcp: Tell net when there's more data Date: Thu, 16 Jun 2022 17:45:52 -0500 Message-Id: <20220616224557.115234-5-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220616224557.115234-1-michael.christie@oracle.com> References: <20220616224557.115234-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0264.namprd03.prod.outlook.com (2603:10b6:5:3b3::29) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c9aa495a-d296-459d-dda8-08da4fea007c X-MS-TrafficTypeDiagnostic: CO6PR10MB5617:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8A9n7604pMoYLDdJTKVklD9LUgKawa7I5/AeOMjOo4egpO79FzxPxabxCHDx3T1i07HfvFf2IO8z86hzoKlm8uBVqFCoo/ncAbFdjH83Bi8y0gGi3M9XLpt/oJhSkaaMrUhiNwk+HUybvm2CGOpyiGHS5kDkOPg5E6R9xLkXqO0lU/01uJYqLriDPHC13fhZV5Xl95hj3OO+t47kDbufqSF5AVPDJPeB+1RDDvShjAPkpAL3aJvKY7E/Z4rNMtgzKQW2pPfqwa7Sev788nvGJMdKRfwoJ0/XrUtAU/Pff5algIW4sDgVUok+ioAz957QIIoxzQ6JaJ41JDRtJxg75QEtHOIbnH7i9/AEEQS5pNCauJC3w7lzdmI2hr2tNq7qXwZkXTZi8euwK6Q5v3RLlDKHlFyhjV4qMBpeSXEbyLRiqtIkn4JvvroH8sUNbDSw1e1ZVN555K8mKqiDfsiXf+Fn1yGEIDhs0/ft5fKHNEXuosyc507YPYVwaX793pZ4kXySctijdcN4ktaprxwk6F15zgZmj6xeWfIOq/jJ5pv6rSY/YOwsy5M/in1bnF+htJa31CwohFGqNaquvYyvHnna3ejhKMrIqSq61HS75mD29wzhCQYmq9kI5Qbt4MPMwWD7PIXJ/UFYpNIDvmQycGU3i23UElnXUs8PPommCHQM5HQ44/Rc7ogQFwJdNILfjTqOWW7Gu6xRV3ovmRCDXQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(366004)(83380400001)(2616005)(52116002)(6666004)(66476007)(5660300002)(38350700002)(38100700002)(36756003)(4326008)(4744005)(6506007)(8936002)(508600001)(6486002)(66556008)(8676002)(6512007)(26005)(186003)(107886003)(1076003)(66946007)(316002)(2906002)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: OGJ9Xy3r2VEt4PIsFX/9wRwDCYrtb7IQphDphxMIiyv6ovbJzwvedqE9ZtEYirJmNmGL9lZkFrBVYXMCxP4alVCyw/6D6qH7M4oFkY9fiifJvhjxxkY+QFJxEOMrFS+reUsV0b1GRnRnDlXw2HJ+iUXvpzg3jBD7ZIi9aBZhijPVPeROcy1q1JCNBwueUlGPQGnqrfyfLGzkfH8lQNl4H8TDVxZVH1OVpT3JUVWBdYFGm9iSOvVstoz5rqU/1gXfrgObcvtXsrVezlzF/bQ/YJYb7pMPAhR5M5uyKT7/Xv37tWUFX/JpX0V4UBfnwpTKoiIAH1moHEEcYjLVUYpWxM7tFq84bwVurjTKz/GhX4lPSJvsGYLzqjy9jSW+iGVJs71ANvHHDvCizIAByjIOiYnksMSkh0mcOnqX/g7ubNtS6W/5+tSstDQlPUAvKc2nJBRNGCEOZz/+p7/wxfJUtLhUWjMKveG+I/XglbvSVi+j6+Wex3kOLNg3g+sk11H6CJowD1JnzhlsPKmUXAkdAQ5eHUDvuAQk+6wPrUO1/qvG23pa71HIAguGHqanSpUG3qyBEGBW7HuL7I9Uzp96CB1CT1CFIX4Ob8FICWN1LqgzKQhQNK1uDjE7yjn1kVGb0m177L2+Y4JUzi6b1stqBKYBaMmdj+j+sXWglRMy64p03YgXLeNOGfmAk9ZYPqTYZBBFAPIUK4r7DVHgPUFpqvLFY/nxRGMUuWdsA5jUAIwud73Im/YP/jrwxXkI6AJfLqNbNSqcqNEL0XXKtzcrJ7MbnUl0Cm3jS23LoAD/guSn6W9Bgkx7ljVTv/UqgIuViQUHUazOWPGCbidR22/hImQ2PHkViax+1fii8yapS5OWyuMd4Lw4p/Rzx+6MXbbGreg4V49oW7KpgBSJMIO4aXHKvJCzFZ0KkTrX2hX6PBO1t0C1gkmIOynWjhd9DZ8nKPQGJ7QuYOVZOGQF+5nq2K6JBk94qBy4TwB1oUOMi1A/t9qGUFZ0mhWy7dGhUN3SnDtAa48zeuutBy+x9GuC7kFVr24O0LdesYXYPKXVSe7Jjdt5cotSoNA6R+zPmvE4HszaEtRimc3T4cs4pCf0aflBIwRjCawfUWgdURc/suA0/Q/THGUeKcY6Cd04opxBeBu/bzAO+hElMkdyKZO4MXGB/kkxQCQU1umeQDaQXD/5xjJBBFmL7PLw2QheJhXS1hm2aCd42bDLsda+e92vBZ2Nez/q/+tRWuSQAmV7yQ+OJG1wZ9acxP59CKL2fcOZyJazyLTrWkcdA/ym2fc2weWFlM4C0FvOlxqpaK66keIT5hSnpOIhMC7cZjVUQhA/yNhg4LwE8UiR/1C5WJwkZgDnNeno596u9G/nGKAOU+MUP20qiqotVpukelh6wLCyJcJESs/jHa2cTjIqN+Ujic9oLegMTUTq3FLKTsK4ZtxooFTzDJlRFn18QtkPrtnYVkMAY1gRJcY26a+y9xn5rIOjTs0rhrH/zmjgaZCIikorGldU5SBp3kxU2K7OAx5ZnokDKyowSJ/hhSGn8izYM69s98cqwvnaFBLhSfXwyeHbns24J2CmKQmIUsE4u7nHC/3RP7r0FoDt34d5QwXj0URfw52eNxHulsaRUfYNifICp86UIHmQgN+Iguwk+J2s5Lfx/cSMJnn+rfv/wqQbIYxoUq5hSCMDTEE1Y5snAoEMmP8JY5iO69Su6FYj9U1/8GuWCblG7MzofouXr13l5Zx5PBOiYhfli3coj7XbWqc= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c9aa495a-d296-459d-dda8-08da4fea007c X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2022 22:46:07.7033 (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: MTnCjEsKDvyQ8ZkVgNnHkjtCK8IJWBtPSkdFGGfOcciOGTl71969QSwIUHPlRa9n5nji+OAB8DbhEZObG62LMpRulG4TlAFVvVuo0EhwLlw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR10MB5617 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.883 definitions=2022-06-16_16:2022-06-16, 2022-06-16 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 suspectscore=0 spamscore=0 mlxscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206160091 X-Proofpoint-GUID: 4XspC2gTlVK5yz2TEFZfBKpwSy_c1B5_ X-Proofpoint-ORIG-GUID: 4XspC2gTlVK5yz2TEFZfBKpwSy_c1B5_ Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If we have more data set the MSG_SENDPAGE_NOTLAST in case we go down the sendpage path. Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/iscsi_tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index d6d329fbbfcc..df38c6c10aa9 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -306,7 +306,7 @@ static int iscsi_sw_tcp_xmit_segment(struct iscsi_tcp_conn *tcp_conn, copy = segment->size - offset; if (segment->total_copied + segment->size < segment->total_size) - flags |= MSG_MORE; + flags |= MSG_MORE | MSG_SENDPAGE_NOTLAST; if (tcp_sw_conn->queue_recv) flags |= MSG_DONTWAIT; From patchwork Thu Jun 16 22:45:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 582722 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9336C433EF for ; Thu, 16 Jun 2022 22:46:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379196AbiFPWqf (ORCPT ); Thu, 16 Jun 2022 18:46:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378914AbiFPWqV (ORCPT ); Thu, 16 Jun 2022 18:46:21 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C4B562206 for ; Thu, 16 Jun 2022 15:46:20 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25GIhsOo032716; Thu, 16 Jun 2022 22:46:11 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=B+G/OvNVzvhDw58d4fW1gXsXuKjx2evAw6uXQ6jCcKA=; b=T1+qtlx9SIhLbWilrDLoZJrSZRI+EI4jHomwjU2bDdnQevZ4nGBGp5CIX856DOFexp2p YPGd1OJmqJi97M6fvfCHlyobae8rcYvNQO7/pezkrnPMoNkbeGkjJtdLmFyJbEWIehki 17iL0XSmRNwoicbp3lfEGHg+ngUS3IOvQ0uZAIWMtT5X82GKsci8v2+v1w1aDl710KKq dxVCb6q3xpVklgtn+XMfLCuwG3CARlaeh49yVNMn+XszUjHxGvAx4FOtKCcyAsYXlGdT tUtMj0ELfQZuiUakZM2Rn24fLcAtDCyahgvpiyj79uRO002vB2zX4sBLOw7mj1zTXVIQ cw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3gmhu2vmp0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Jun 2022 22:46:11 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 25GMaOYf035621; Thu, 16 Jun 2022 22:46:10 GMT Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam04lp2049.outbound.protection.outlook.com [104.47.74.49]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com with ESMTP id 3gpr27dmq4-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Jun 2022 22:46:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NSyk3grxPS87wF7UfbUoCJ0OvhjJL72FkfkHhH4Sni9rRtNMJeu2MVc9LyPpon4eeo6p0VJs7Igvaub0PO5Gvgd+2zgqYLnqpMKNvSMyuTFNb3MjLhxhMzDz41N2KDUkYbdeC8+HhrqyDg+USPXmN4EDpGxF2NSQgjU+2ut0KMphE4M/wjyCQclklU2ZEGSOQkwZD/wlMeaY3vpn8N8pi3LoDaZbXs4U51oaLi6/WMzl5dku3XHzCun7NY90uLbjJNzsf8MILnTrpaXrUPw0eikwMdQ3hqjlnRR/jpvNqkuhc4dBQ1o0ZKd1tbo/C9ddYVXB1Jmb5xuUQorXvnQj/w== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=B+G/OvNVzvhDw58d4fW1gXsXuKjx2evAw6uXQ6jCcKA=; b=fb0Kog1QAsPx5j58TonUMsqSUNN981ERCGICXg6jsutbFIvYLkfZX+NOTxBVn2NerTqt5umUUrgeWKVRK0GYbKhOJIwBxcloxDHJGk9BUZmJYTgmlTm8whyi0hce5po0aDoXLmkgq+Ohh01kCsIJ/dnzNgbI0u5p4YuUdysGywH27mi9iulq6fWqZLMf97hikmwtSop3T3SOJEY6UyMP78xQEhsfuM3tjdy4x848XrtnkI9WfY+QyQ9mjxG/dioHBSBOwDkeL6wbZVyG7/ka1T1ndU0z+y/cDD9DkjnPPTdGi/KrtEhtiwn5Zp2GTG9StHo5LhbXy62HxNwLrqZN7A== 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=B+G/OvNVzvhDw58d4fW1gXsXuKjx2evAw6uXQ6jCcKA=; b=iyFux3UdIjLpa9bi0lfgeQgD2aUQUY0+9eUJ4Qt2/y2XXWQJYLuf1L53pRw2L9BIYCPLWc3YpMV6mp/lDqAgwwnFcu+aZrD00ZF9+TUgJkRt4fd2TkndcmBn4aTxw6Ci8BfVZx0GNG1k49TnEl2SQdjnVZCbh+7PuO29DyAaLq0= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO6PR10MB5617.namprd10.prod.outlook.com (2603:10b6:303:148::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.15; Thu, 16 Jun 2022 22:46:08 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b%3]) with mapi id 15.20.5332.016; Thu, 16 Jun 2022 22:46:08 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie , Wu Bo Subject: [PATCH 5/9] scsi: iscsi_tcp: Drop target_alloc use Date: Thu, 16 Jun 2022 17:45:53 -0500 Message-Id: <20220616224557.115234-6-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220616224557.115234-1-michael.christie@oracle.com> References: <20220616224557.115234-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0264.namprd03.prod.outlook.com (2603:10b6:5:3b3::29) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2cd4ed40-7f1a-4d3b-fe52-08da4fea00e0 X-MS-TrafficTypeDiagnostic: CO6PR10MB5617:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: U4tljvoMSP47yvlfhyqLCGpq3f/Tn2KDb6sEsB/mg6YOD5GLxG/YfrJ9J3tfKmxmP0ItdORkLhdqdwgCDSF0PnidJLLZmT2a2/kmXhfSCWwSbItzUG9Hjg8XfVdnsVtv8MZWavwaVjNPW9HEE/oLHZ9+wRAi8/RElFHOOzpefXRuRoLDhr4ejpTtKtASlkO+F97ZGxI+c05E4+ueDTEsa/YFhpfb5Re/MpBvKDHahtF56Od+Qvqb9Gic6fa9Y0Fwu2gDPqkPe6N4nCTvUeqeDwOLVaevHE2FkZAaoEc+WTlnLwVZ19uRQqBAi/vkN4V5ezsQ67BXdJW4pABqtYLNx5lUKbIr+Uo0Za4pqfpLcLPmTBOmtHTh+mg7OuJs0ulGyUnL6aNYyxwNE1kMzNZ1Rv+ecQHdyRLKZrwipTizPr8V/bCyz6E8BUJgUH+d0hx0jdcZgwnxd45KeKVtlosg8vjL1Taf/PV8i1DFqK2QFNMTJbDgdfPSLxOAwI1zOq5oV14MXTukj2nQ5Xj+o2T3mayNEDpEPSVKYsnI7U248pHhhMvb4mBKhs+nxGcOh/Wg7uxXFW+WiyYWW08ftCRuLf0hMeZCjgLeLCrnYg3P7tFIGpO9Hyjfcr0bMe+GV1uc7A6aqElawThcbLQIN0H06szoZtmcmq3lmxSxX1+8G6coAYByNgw6AIDeK07MN9yKAe2zc1KQ7RJ6Xy+pz0SKLA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(366004)(83380400001)(2616005)(52116002)(6666004)(66476007)(5660300002)(38350700002)(38100700002)(36756003)(4326008)(4744005)(6506007)(8936002)(508600001)(6486002)(66556008)(8676002)(6512007)(26005)(186003)(54906003)(1076003)(66946007)(316002)(2906002)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: B+zK3kC9yf2H3cX2I5hmjJz87acQA/QrdfbpOd9PivPA1FeGC7mvZK8ZG18bPew4qPwDQfFc0gAVmBqKk6RHapF2csa4wVx77k+cv/rMZ0TuiHdlsUvfjkrH3FjM/rBljQfEI7ne31lZksLFcpfACy7R9NkKTj+NFqCsFRgsVAEMwoLj4HJ6+Fa/vfvx1prBNDGRLgiG2Q3NviD9CX6wNIgcdJ63ktjfsXCsVajtiaZfaXMxiTK4vpskX4TV+jTdzEeiyKbQkcDzSkbHWghU/iBKBH1Z8xVvwo8/SSRx4cgvkvGPAcaBWWr2FdhvsjH2Co7CNEiqoPH8SW2jRe9lZehdoiqdqzlKvUHwL1dWXmdW1KdWph1XwhiK+nDe9dCNRrQo0afiSdmXPgf2QxfNRzqQ+fgPJMWYKo1xqChyYLRsc5Jy6sTAh0pcj9quDkGoyeRGUY3r4bTkMYb9f5bwY+9+Dsc916iLBB+WZrROkTaaftwcX2KDqO61ADVay75gWqYPsDl4N4HJb1DKxuI4L+04bmqpCTEjtweH0+JlE2E1kWUTinhWpRgnoJ9QrFhQO4UlhXGm4oLLdQsJgR4yOuZsQrgULwa86HVuvzc1MSqVO6DZZiqWK2nrVRF+6otQD7jfYJvc0/T39wqFDya4BjnlfWyTCgJXPZB7u/P8auSE/2ERIc9g8xrmw48aTNC8lAY2aMDkXW3B76LrjNKdHqR9Ew0ccdD3X2SC6WxAKcNnuBwLu/lAnjiqb8gbTZ8SVQeSv8NbWjBuv/fvQedHWHm9rsO8CsPfRVg4BKMEJLltToUA9VI4qfFYxinodZV7Dn/Z2+OohyqQqEu2eSPr7UY6B9UWgXwnD5bawquN5NUbbweN4BY8evfgJEHUe4DXkdev9pz7cOjqXq7I8FnkqU4zDHmlTXNHpGAhoBbHrAyXBzi78uvVMX1ts6KFTKUwblT4FO9cizkEvAgFzq0QLzBTnH3b648WP0/K6F6F/P4U7gsufdC0biCcM97pNHbn/WfLYRsVVfLXITyKWtoUewgIhq3JBttSMn5cMPABODYpLbZwnLEntNZsrEmOC3NPFNYBvPtnGn/i9P94Sr4U1vJBVTWCbKHNVBUgeww0aC0/QxOKs71o/A5gncD3+rzIqSrwirlG7u6r9yBSGpAeQdOZWdETh9bDGJhvDcckwD303cnhEO5FFv/H2f617t+erfxJAK99+x5QWoztRrIbe9UkAAcSe5oDPHU8NpaYLNkTbJAbSt6SIzPyf+sd67f3oO9YXV0aMGpPgkgl8X8+QdGigJRL/UDYddHP8pOaLUETIWQHfFSUD2yYxVrRvOirY/jQuLlY+nxJEtnKad5xyzUOva2F2s1xzKAjb/3t5v3XNKl+JLXGsSOau3FWqDrGSsb8wLqq3l0aIdqfu1jbNovZIVm0FAVXR4xXRVCGSBmU6iQx+Fr3joo9c758QjKgBrszsRGndM/es7NcE01Ob7nLK9A2IjH1xDQSz0IjCfn0aB4WftxSe5AnDIqcCQJVmbx+47WQWqeIx86Y0gN+A0URx50JVrRVc2xKGY0Bgl3CdKbaj3KPJm1ivTUmFAGtKM3un7dR2j0XM0bQ74GmZ4i/X6E/gW95lkGiFsTnnxnYbol/S6TcFKf00ZsVJ18FT1lpVy+ZSPtfIVSG7u4XuQYqfHdvL6uwJZpgDGx7Kvw9cwIKTRzkrSMoB5ZNEBkfxAl12+kt/92Cvf2H1Wje/a+GesE19H72J0urhf/oWOo= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2cd4ed40-7f1a-4d3b-fe52-08da4fea00e0 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2022 22:46:08.3908 (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: sf4S2m68XiaYNkTziV/SXWBnecPThOiBcW0vSShSij60zpDA+hQeEXf1EbF16xAt+93czSAmh5nDmE/QpblvUsjYR9IQefFV85gxWHKWIr8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR10MB5617 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.883 definitions=2022-06-16_16:2022-06-16, 2022-06-16 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 suspectscore=0 spamscore=0 mlxscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206160091 X-Proofpoint-GUID: D9Vou4EAsdu0O6Aqorenkdw4xrM1eDKD X-Proofpoint-ORIG-GUID: D9Vou4EAsdu0O6Aqorenkdw4xrM1eDKD Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org For software iSCSI, we do a session per host so there is no need to set the target's can_queue since it's the same as the host one. Setting it just results in extra atomic checks in the main I/O path. Reviewed-by: Lee Duncan Reviewed-by: Wu Bo Signed-off-by: Mike Christie --- drivers/scsi/iscsi_tcp.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index df38c6c10aa9..2cfd40cf2859 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -1042,7 +1042,6 @@ static struct scsi_host_template iscsi_sw_tcp_sht = { .eh_target_reset_handler = iscsi_eh_recover_target, .dma_boundary = PAGE_SIZE - 1, .slave_configure = iscsi_sw_tcp_slave_configure, - .target_alloc = iscsi_target_alloc, .proc_name = "iscsi_tcp", .this_id = -1, .track_queue_depth = 1, From patchwork Thu Jun 16 22:45:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 582521 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC969C43334 for ; Thu, 16 Jun 2022 22:46:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379197AbiFPWqn (ORCPT ); Thu, 16 Jun 2022 18:46:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378493AbiFPWqd (ORCPT ); Thu, 16 Jun 2022 18:46:33 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7548262217 for ; Thu, 16 Jun 2022 15:46:23 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25GJQ3rk029767; Thu, 16 Jun 2022 22:46:11 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=wEoc7WaT6Vq6Gz+MGT1GF/5W4+b8emHnddcnziVQR6Q=; b=bnpUO8aP1b1itMFbQqxY9XZgTtpbrNcwq/cikLWvVMkw1lGeX1O0XjO/vutisfnFlFNb tN+17mPUYg9mKKuLZ0NChD8M6l99ZQaABT1ReveHhU+cZrXYP7Tmo8XhnX6vj7YvnfAW sc4TQW4GGpRAOfVNOm4+yLGXDJHRAIdDRjv/5y4WPC5TPXUdDoojTNrNE4YERytGCWQq ogjKJQOrxQKp+3hueES3iYONWMigDqp1KlwmNdGS+p01Ahu2tZCUZv8I1d3G7wG9KQI+ GZ1P2FArm/EsDVBiqFlKCYubnOYLXSOvNa0DxPc2apxtlABpQcXzVOrw236rz6spPOu1 sQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3gmjx9m8bs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Jun 2022 22:46:11 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 25GMaOYg035621; Thu, 16 Jun 2022 22:46:10 GMT Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam04lp2049.outbound.protection.outlook.com [104.47.74.49]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com with ESMTP id 3gpr27dmq4-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Jun 2022 22:46:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xphe46OViY85Z/SmOmFRhK5Q8N4qLA9QlOGK4wXA1BN+38187X02y3vxAp1NghUBfZ4JszTJFr66LX/BtgRFM8MJpc0+0W7h3EQag/U85ZpUiQ7wFXyGjl16ceBwtbZjZ1o24zgAjEs4UuzXZ7bwrQwNej1MzAIFkmiwciGrk1GjfE2UuV1I5dZBAvF60OL4IsD4wbfVAMvmOEwDxGwIyoXboWSBE/NWwrVo7Z49qZzt2nJ2AxSkHVnyRnUNmbTqeEJDaSCdQibQqyfKixVJy07ndsXKSgjZsW+wmImRejoq0QkNby3707w9YWSJMHnHTWN3wakoUZ6thLOVE2CNfA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wEoc7WaT6Vq6Gz+MGT1GF/5W4+b8emHnddcnziVQR6Q=; b=DfxE0ix4IRhdbqEuCvLYXZ8QWqkC1eER0q1ojMPZ5eVOzahJ0u2bCzv5XV5U8ca0LHpCxbR5S/4VBGP9kbiNT14wjbb4BD25QlbhTD0v2fK2tbUH7CRzYgwVVp9DCorHntAG2gC5MmYGWW8a7EpmLFfwstuhAv2rHQFov7CGOxShaT8dv7Dz2j7VqJ4QsB7A56eEUtL3yexQ1rlQYLrjiyt+tVtCDC090v0dEb1Erc4sWCn1g4aADdtJgWZLebqgNlM+Xl/P0xhVG1fhG+DLe1lE+O9pGU2m/9pdGfnvbsewqNZI24mb36ILAMYEmlE9wQEz/lDn+8Httzw2dOeyew== 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=wEoc7WaT6Vq6Gz+MGT1GF/5W4+b8emHnddcnziVQR6Q=; b=UxB7CaA6FGDhMvn2dA6K4svl9J3zJoyelrtf/1frQx21ZBWutlJo7AWOE1XTVaNRdGACe4b2vwkqJmBn4vfBDvgsqosfwnQwBcTKAXzsLAjvFxNmLQv6yXjmGsMVQZQIo09cce52csa9tCTtVrnr5+YS8WUISSsoLIGo2mz/ezI= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO6PR10MB5617.namprd10.prod.outlook.com (2603:10b6:303:148::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.15; Thu, 16 Jun 2022 22:46:09 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b%3]) with mapi id 15.20.5332.016; Thu, 16 Jun 2022 22:46:09 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie , Wu Bo Subject: [PATCH 6/9] scsi: iscsi: Remove unneeded task state check Date: Thu, 16 Jun 2022 17:45:54 -0500 Message-Id: <20220616224557.115234-7-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220616224557.115234-1-michael.christie@oracle.com> References: <20220616224557.115234-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0264.namprd03.prod.outlook.com (2603:10b6:5:3b3::29) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: eff73f7c-ab9b-4567-e395-08da4fea0149 X-MS-TrafficTypeDiagnostic: CO6PR10MB5617:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: p1V0RLZRImcgCF/Dey2Zv1AtJT/UBDiQbgVBLzG/1M3iehsNHy5gPID21ZrTzV4qBIwCx3qX41gwRzD0DxjSoP3bqHm+GqcKfGXM73wBFn0dWVCCpRvWxG/VrrUQ3+h3ksYI5ll2G0XAz1pCl2kaxdfy2mlTK74bFs2HKKxg/NT+W4/tdAQf9+afdQjWghQkG5LM5oHqyRw1WZfOb7oYw3MIZIFoD2vB++zW6WkYOlJNH8B9NP0/dxrL0WgDNyawei+z5kdzXtlEBcVsUuCNGI30/GNVcbeW7LljIt2Hx+vMx7EIepFPF4fgbaJ/8hm/A4oEGxtyQzxyM2pJAXE5tTOmr5Jmbh5+5AG9bqzZ/0PUTS4ZcF2VZ3jqNE2bHbJbN/hwO2PW36LcAbkldW8hbXHuiDFwDBPT6i0O8zdnVBXXHesQ2OmO5HprX/tEzB3nS30WwyyIfPhOjYuOGyHIhLMG5JhKCZ1bx6n3eXEsFn9bVLzFZsQ4fBVLVx4/U5JlqJueyKw7biRbsJzyM5zhEbBV5Tdr855rz6XelbP6Q3WI9+SjuTp15L0/x8dMWLSgYMu4cTGEjKq9dFdTw0Y7CkzeWCuMz3oFTHK7Td6zOKoXvTdljqYf1Ol5kcGfbgnpxFf7usA4bCvtD8LksL9xEnPjawrd1h+/ARzbn8f86WE4viFAeibB/n+To6QaoRRal3y+FYt4a6hZxcyCfgfpVA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(366004)(83380400001)(2616005)(52116002)(6666004)(66476007)(5660300002)(38350700002)(38100700002)(36756003)(4326008)(6506007)(8936002)(508600001)(6486002)(66556008)(8676002)(6512007)(26005)(186003)(54906003)(1076003)(66946007)(316002)(2906002)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6a7IjglotNvLDNQkQaBTtLaFef7u3BwlyPApcyLKiyfUF5F+g+0vrJeqZbXy0hEb95tMQ2WotHDHTWplSyYTIvWmafgdpfdJm/x578pREYJBFb9pEpE5372fmiTg7d7W8WBH0tpBVrigAop5LTYtoTPeLaGS4XhWX3s36YJ10boSdk0KzViyHkpaISqnetWtTfJG9c2FURmqNDUn7kgVb5vwesseEvgXjlZ0scUdclYFFGc4BHG4wAMf2vj4mEwOIsUprwXMuCIKPwf5nOo1cQH6tdPqHhOR4FhlVkR3ihN8OWyoK3N5j76Ol2Ymn9iKn9b9a3QPFTJEOD/0VlK2XlaifO7wSKCrPLqaYk23rJIXhGFdUyzWKon33HEXzrQhI3PhcIbVG5fL3czOruL8KiBlGG3WlALwzOk/HzbxpR56oiqTuqlmuwD+E+uX1C8b0BcS2vBUC7kORUxxmw95Swxg9up2RieRJvpLfaQs6MkOhWkWI795dQg+H7ra9J2/QYZvrDjjJXDyzSdEXGLjZQfirJC0cJ4ddn/GPJfRqRi+yL5Xz6T9cWRVwCPlPsPudYIFHPRSEktUmGeub9TpnDptAaJV9opSwnvotNEzQIJTsPFowDuMPpkQf2Xa7A7Vy1JfjHvtLWSXYhnn7RjCG1IqnE6QS4mCwOtZeptldBKaivOW1YfSGJGufMMFMwWmG90U+UaDeguNah7eqU6PjzB7xjqzj/6CjEtgLMVguwxNnI+hJYAUX4U7usDVg9Z4H450wt91z3whyevfig/674KQx2c+8qvuAwjcXoyNfiybcni0aKpRg0oy/afFApq4/TaXubOOy5A/iaU1RPlme1UamuhjVaQ0Nn7MkhXBWTcVMH7NhGljgIWbryrXe4WDWuQ00SRhL5Byx43IhIuKR34kvHPPSn/vIFtUL/8AGTNYRMI7o4Oct5W2k/9/09L1BTi1aP3QqV2JhYXLJw9vt7J9yR8RWOWAbNve9sUS/wzn6TZmshJGFhWQ9Pfi7rGTBz1Oyzhzj85suH9bAWfNjidlj/ebeZVzwTywNGTyEkXzjCTlmfxOBfka0KRdb3nELrGkZc6nz4Jnxi+G/f8LioiFHBvhBVnLB5jdC1FQjKdbqTffKwGeHtFJ6MfmXo7PvjSQaaSHRf6vzSkJeME9V6JFjRA28hr+LjfNKsXAKEXvIDJdCuvB9Dj1ud+44+jZOsmNuyg7Ub0M9ZHyh25PGMSsSplTcTaSK6/TBsIKZk1ySNw0EwJjQNGNj5yPxmNGgdIvvaeLZTgIGJAGu65JNCwcZqkeWfGzAnE04iysO1y9U0AywP3mmqAaDWDt36ELBHGhmuWE1kL44+hh+QZ+O1YPtLi10zv7oi4k8B9U6rzHBZ/po2vjd7zxY1+87DaTCepV/fQKviq+LLv61kccB13uwQTxDYq3yTfLaWX4DH7zrDpTfNzmmDjLLGC+MR7J6DwjMacp/LX7o6RARLZMCdWygjIgEL4GGEydSA3T3++fDYOLcXE442s50t1dhUR41724EEW+ouwPrbuVjJxq2e7D9qqoyhoE8ykLEQuzhmbs9pNzKw7oV6FdanDRvLwZNTjAdn18FmV4FRcWcWbPehMVhwi0h80K1+6VMgJHI0o9kvSRDcMIg4YqyvL2dYoLajDfbN2zIWvJGTaVQcRjVwt6K23BTlVHFAKUSPlJeg3UbSaVo2Yca92uSW/9CdoRtbm825m6wnQ4C3ewskaBmjI+Q+zC6naJ+R8dJ1QW76M= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: eff73f7c-ab9b-4567-e395-08da4fea0149 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2022 22:46:09.0626 (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: e7azU8BWGSfNP7/5VPPzArKPHOz70Xdfen1tuLUrGKMakqALI7FDjeu8NXJDw7gRO5A0xlDRFqNbKmJnCJ6PRjhmsYZoa1ieGmJs5eMr3bQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR10MB5617 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.883 definitions=2022-06-16_16:2022-06-16, 2022-06-16 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 suspectscore=0 spamscore=0 mlxscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206160091 X-Proofpoint-ORIG-GUID: p-BfmPzyvMUHEqCRPA69ETaRSg-6M74p X-Proofpoint-GUID: p-BfmPzyvMUHEqCRPA69ETaRSg-6M74p Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Commit 5923d64b7ab6 ("scsi: libiscsi: Drop taskqueuelock") added an extra task->state because for commit 6f8830f5bbab ("scsi: libiscsi: add lock around task lists to fix list corruption regression") we didn't know why we ended up with cmds on the list and thought it might have been a bad target sending a response while we were still sending the cmd. We were never able to get a target to send us a response early, because it turns out the bug was just a race in libiscsi/libiscsi_tcp where: 1. iscsi_tcp_r2t_rsp() queues a r2t to tcp_task->r2tqueue. 2. iscsi_tcp_task_xmit() runs iscsi_tcp_get_curr_r2t() and sees we have a r2t. It dequeues it and iscsi_tcp_task_xmit() starts to process it. 3. iscsi_tcp_r2t_rsp() runs iscsi_requeue_task() and puts the task on the requeue list. 4. iscsi_tcp_task_xmit() sends the data for r2t. This is the final chunk of data, so the cmd is done. 5. target sends the response. 6. On a different CPU from #3, iscsi_complete_task() processes the response. Since there was no common lock for the list, the lists/tasks pointers are not fully in sync, so could end up with list corruption. Since it was just a race on our side, remove the extra check and fix up the comments. Reviewed-by: Wu Bo Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/libiscsi.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 44283014c4eb..1d646f02d516 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -567,16 +567,19 @@ static bool cleanup_queued_task(struct iscsi_task *task) struct iscsi_conn *conn = task->conn; bool early_complete = false; - /* Bad target might have completed task while it was still running */ + /* + * We might have raced where we handled a R2T early and got a response + * but have not yet taken the task off the requeue list, then a TMF or + * recovery happened and so we can still see it here. + */ if (task->state == ISCSI_TASK_COMPLETED) early_complete = true; if (!list_empty(&task->running)) { list_del_init(&task->running); /* - * If it's on a list but still running, this could be from - * a bad target sending a rsp early, cleanup from a TMF, or - * session recovery. + * If it's on a list but still running this could be cleanup + * from a TMF or session recovery. */ if (task->state == ISCSI_TASK_RUNNING || task->state == ISCSI_TASK_COMPLETED) @@ -1485,7 +1488,7 @@ static int iscsi_xmit_task(struct iscsi_conn *conn, struct iscsi_task *task, } /* regular RX path uses back_lock */ spin_lock(&conn->session->back_lock); - if (rc && task->state == ISCSI_TASK_RUNNING) { + if (rc) { /* * get an extra ref that is released next time we access it * as conn->task above. From patchwork Thu Jun 16 22:45:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 582721 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 803D4C433EF for ; Thu, 16 Jun 2022 22:46:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379170AbiFPWqi (ORCPT ); Thu, 16 Jun 2022 18:46:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379153AbiFPWqV (ORCPT ); Thu, 16 Jun 2022 18:46:21 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BFC262201 for ; Thu, 16 Jun 2022 15:46:20 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25GIsdO2005223; Thu, 16 Jun 2022 22:46:15 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=cK2xinyekZ7au6sYfTfvqjthHuCIlIdKapR83NK5KEg=; b=rSrngq9gdkp4bOo/MG3DBz4L7dNM5S+B2XCOn3vUPmwZA2VHtJ2tV4mNXe647RMDrxgX otCBjNIx3lLkqKVNzX8L5t8s75upN02GLYwCa7fDy37WUTx2JK404CgUzFIMInFkclxl rT9SBrQBqvj/qF0weRvRV/jIkXcqnKehhF4YmqyC+X+790jWdIQ1B+MAwuPmHb/pKCsA cEigNDev4LSpsPJS0Sw/9LovsXWu8e53mRkoBKYHMV5DlYViF3EdM87Mwe5OD21JQpyj zLWTbT6P8+LCtbkQm0jayQaYR4C15vLD/rPbxNwgXgl/42axRaWLiOYxWXjk6N+8ZgEF kg== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3gmjnscgbu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Jun 2022 22:46:14 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 25GMaPd4035724; Thu, 16 Jun 2022 22:46:13 GMT Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam04lp2046.outbound.protection.outlook.com [104.47.74.46]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com with ESMTP id 3gpr27dmqw-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Jun 2022 22:46:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lOIbStocha9NW5x4PtxeL0bLhKrCzzmW0cjwsk0z+mDj5Z/xaDwaRvtbr97CiJOlONO82VHObYuCnsvY1jj5GD87iiPLAHjQtHBsbatSSX9NVhWNXJF/0dOUotTj/ogzsNsUoOzjU3C91xSBxBIZMKdB2oxlf+5db2P1NPOtND7VRl3oEQ1x3DP5uKLiS1Si4PoHe9Tie6dkaATZA8HWinPhhyWqwl1R6Ei2RF8J9zVeiCk3F/cFlC5vrelJ3r7l/E8lo78Eeem2xfZ/7y5EVsEgUyimRKLTlCwdV7eQJsED1sFPIp4t0Nr1+5GCkzV+oEz2/MwBYVn5gLqBSw6K9w== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cK2xinyekZ7au6sYfTfvqjthHuCIlIdKapR83NK5KEg=; b=W4RyXolx1aN0erGR1yrY5WC4G/n/KXi//0iHE83hopi0WptrE8cOFHJDjLjacEBFYnzNkLr4iXeVdIW6FmCmgUUYaickTBaVyn8J8ITFdOda8+h8DrlsVLAVVdb11O3yGZKjOaL2uLoq/xuWNStyur//jEF+Cnsb52xhqvh47vzudCICSFZz54z4g1MdQkuEat0pWC7KQtSiOP2aSPipnewKIVbdHXL8aC9Pcb+CTBgkP2EwR+s66H4vi5gqBO7+qcgcILIfHcWkijd68KGQLSM/5LM8kM2IEIiuCvoLCoy+6TjWCMX64xvCEBsKMG+zza0qmwRcLlIo2KwfiNw1fg== 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=cK2xinyekZ7au6sYfTfvqjthHuCIlIdKapR83NK5KEg=; b=Dj7Pw2WwREWEzjmGUVl3zFywTmAPZeiChPGW3l0757Pf7JpOTPKmgEO8ba746d35MhmlUt6ZEmmUje0OrT7383UMUaioLtZka0OyAf8JXrjZ8BhGYkgYH0PP2JTKFn7XRomaOAPGwNkXkt8KvlcyDD0kOah8MSOWnZssLzFisLk= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO6PR10MB5617.namprd10.prod.outlook.com (2603:10b6:303:148::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.15; Thu, 16 Jun 2022 22:46:09 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b%3]) with mapi id 15.20.5332.016; Thu, 16 Jun 2022 22:46:09 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH 7/9] scsi: iscsi: Remove iscsi_get_task back_lock requirement Date: Thu, 16 Jun 2022 17:45:55 -0500 Message-Id: <20220616224557.115234-8-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220616224557.115234-1-michael.christie@oracle.com> References: <20220616224557.115234-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0264.namprd03.prod.outlook.com (2603:10b6:5:3b3::29) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2c821eaa-27c0-462d-0447-08da4fea01ae X-MS-TrafficTypeDiagnostic: CO6PR10MB5617:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: isydP5a3K2DEiExe9IlhxeUHsjPO8BMyRGz2WLPHfDJhfMaquZKi68YmCDVsnpKQofrzSbDv9N9QQVSik6tgx6YcGZ19+0K4OAV+568tGzyY4DHSe+qCoK1He8PwhI42SLFCG3i/S1q13ENL3V7Ga7bDpfjbjXUgByJBMVWfI+BI6+46YPZlXVDRZFjYGZfjKWNv8HU0waNP3MlKKhYw0ECnyDLiT5pj10XXaPMUEzVEY0Jku9ZZh5T8qw/TxevxOsvfPmLPCE02KSvGFfHxrqInFuC/OV9lkash3b+FySDcrHVPyK3XUDWh8mJzRjyvwlkcwoGYhvMQuQglwEqTTQH+9VDLXF5LWeb+fxsvWpEJX2Iemn0YBTsUT8UkJuFXafaNNwMjxQCVIvWewAy+ij0SRjciR1gZmXmHHSExQE5y7O7JrbSw3ebaCF9WKeEbMpsfPyEqSh1HPkSzPECY/7fIo7U31qBBvfHn/QY2+edzjoMNvj82l0A+jwMC0j+kW7mCQwVmNWIvEq4spyqWW/L/ab3iRd2rOTw+p+XBoVvxPtzxcoJpa4L/oelwdY3BIS5p2yl5hZGeD8BWbzGgRIkBGcrlx6j2q8XXMqvov8HamJtCBpYWh9oLo5YtmZi/BDNgru3pRYO51PxvgX5Mm7DfhqjM0z51jOOvUmRYFgirCdTXl8KefK6gkuulwoZOB8Yu1nywunxEznDCbPWpOA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(366004)(83380400001)(2616005)(52116002)(6666004)(66476007)(5660300002)(38350700002)(38100700002)(36756003)(4326008)(6506007)(8936002)(508600001)(6486002)(66556008)(8676002)(6512007)(26005)(186003)(107886003)(1076003)(66946007)(316002)(2906002)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ONZyodvpwgnv7rTNGdpxE0DVeNe6SVV1lNiqr8QJy409GWW2Bbiw1JY1zekHRvl2yoL9PD8DfhwSclGXrYNvwwhY6lxLu/i7mRWaIEKavy/QE5j3erTtUrEO6KxBW9oAj2dcDQbo6saS0/t9VWaez/QjSOBsDHFNHj/ZojY89X9tOn2/TvGFdv9s+qo7UcPpEvo49Mapiky1jPo9S/YlZD/IrkpT9bpkGspt7TxUXNjMj/8Rr7B9uvL57qZipfVHN8JcL5o4nl0tQHmQhyskxu8lRelNdoFXK+FCKZnIyZBDCNT3fFQwgTzpxbaE2Lgqd3mhCT2ryymGX50tqRoc4x9swGwvacaUk+oytcWfz74R3SjF1G9dgj1aOuRgZ8tsfL/Aw8FCegMSuDscGNYzIFX+2VgSBznHP1VLAQjRwQ5r0sHpQBAb0y6s9P8LV41RFFEto8C7hY1048EhqNJ3XpwWzzGA7hNVXNEerHWDNdXNFcN1EvfgmRrgFxQbTDPgAdWR2g8Pyw7KlCF4xv2IfTWJAjyetp+fyRK2sxcmOHhIlsvnyfKNqfcKi6TK6yUgXVmxGwKBO70gw4M+5S6t6qP/uG666dfOwTUBrjRxUh08Bc6nV44TLlEREsWgNCt1T3lClWAdIDvJf/f/KpPVunOtINZY9FS2Sriiy5GUvVghBIEL+rjqTq2uO3u2Eu2iaNcEt+tj277/S7ifiO2l6/GfpN079CUzhGNiLsiQiDGe72BB7xQZGCT8B0IEVgv34pCA0byShhsUNlPLlYJJ18dLSmq9kAlH4ecyKe7Cv8YyZRps2FVgP0AVCCXP2MTJcolWP5eAo+RcceAXE1buTzuiHoBt9cQSqku015H7uS9AQLWwf5Vvmz7S7gsnlCHEKZD42EoGJY+io0dravDaQwpOabA6nlWsHnZTV9LzlEc0mVGz1vgcrMEQyRm5MYeHLMlYUk1rcF6C9a7DFRvPBuFzrw492eBXHqaYao4z+ayVLdREFMjkHe1gyUqcDzXIVawqOV8gizTPo+m4/fVxjeuAcae27BWLJWqKbCl8sgFG+bOe+zoVP9wRFTwjsCa1RPkROsYogPGGgsVIk2lQ3nVcrlOjgA9WATTSWqHPjM/GEhHt0xa61zbuyXgRM4gdYfdAFMnb/V8oc1JreG00qlXk3apgdVIsNm3+Td0JbELsnvvEW4zV6xHTb9eN13peMqzIVTe6QCG4kuwSTWyJj5VJYwdGA67Te08wE42TOk9aa4+0t4416O3JNp0W44kVS/NM6y9fwUMKT0vnDVjA4azCh69oEIxAZtTUAMBQLO3Bm+OUmTcICFmc5TOmVc8gHf5BUuX7UJhIFDn75WQ7CpVEsqO9intGhm/NVvRL9byQOmgMlRAnRYvNTH9VM0fM0x5rQadaDucUh9vhy8UFcCTCyWXfCygL5yuGNkfsE/U5u/D99ZzTHCe/ahxVtegjwIlpfvcvGxxR1G1l0LpES8v2Dqz9IxJ4JjJ+MXUZZ2/6CEyj5Eyzt3FGyqbkCUQB1lcPdaN65qqdsUEJJy9Ru1ytSGdvlryvOT9FyHqGjmuoyDXmNXhSddz1sL/fV5anmI/CP+4AzIF8KfmX5e0aHIGWcCpPWsmqRAZKZxBxoRoK9cRAM3KYok3aQ9Fy3JfluTkuIidjWihjUOoiCNwO3s8Gxndx5XdSvehMNXlpOwqmk+dB6lQV8HnqwWO607JNdTufLidT3MbQ2bdmaCKutPC14zsRR1PbbTX8FugSASs= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2c821eaa-27c0-462d-0447-08da4fea01ae X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2022 22:46:09.7656 (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: /xJlwXM5yrYnXKCBfEElv5XGiJHDlPtEc/DguRMuJ0EgHlwvcA2//azAeGVzIv3XyIlQPJk1l9FOLnSM3vyR1tet9plF2UNrSwBPQHz5rU0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR10MB5617 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.883 definitions=2022-06-16_16:2022-06-16, 2022-06-16 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 suspectscore=0 spamscore=0 mlxscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206160091 X-Proofpoint-GUID: sI-_bQqP-0QI02mg1k9lPk9bCDsfPLzV X-Proofpoint-ORIG-GUID: sI-_bQqP-0QI02mg1k9lPk9bCDsfPLzV Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org We currently require that the back_lock is held when calling the functions that manipulate the iscsi_task refcount. The only reason for this is to handle races where we are handling SCSI-ml EH callbacks and the cmd is completing at the same time the normal completion path is running, and we can't return from the EH callback until the driver has stopped accessing the cmd. Holding the back_lock while also accessing the task->state made it simple to check that a cmd is completing and also get/put a refcount at the same time, and at the time we were not as concerned about performance. The problem is that we don't want to take the back_lock from the xmit path for normal I/O since it causes contention with the completion path if the user has chosen to try and split those paths on different CPUs (in this case abusing the CPUs and ignoring caching improves perf for some uses). Begins to remove the back_lock requirement for iscsi_get/put_task by removing the requirement for the get path. Instead of always holding the back_lock we detect if something has done the last put and is about to call iscsi_free_task(). A subsequent commit will then allow iSCSI code to do the last put on a task and only grab the back_lock if the refcount is now zero and it's going to call iscsi_free_task(). Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/be2iscsi/be_main.c | 19 ++++++- drivers/scsi/libiscsi.c | 95 +++++++++++++++++++++++---------- drivers/scsi/libiscsi_tcp.c | 6 ++- include/scsi/libiscsi.h | 2 +- 4 files changed, 89 insertions(+), 33 deletions(-) diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c index 3bb0adefbe06..dd32a90ef9c2 100644 --- a/drivers/scsi/be2iscsi/be_main.c +++ b/drivers/scsi/be2iscsi/be_main.c @@ -231,6 +231,7 @@ static int beiscsi_eh_abort(struct scsi_cmnd *sc) cls_session = starget_to_session(scsi_target(sc->device)); session = cls_session->dd_data; +completion_check: /* check if we raced, task just got cleaned up under us */ spin_lock_bh(&session->back_lock); if (!abrt_task || !abrt_task->sc) { @@ -238,7 +239,13 @@ static int beiscsi_eh_abort(struct scsi_cmnd *sc) return SUCCESS; } /* get a task ref till FW processes the req for the ICD used */ - __iscsi_get_task(abrt_task); + if (!iscsi_get_task(abrt_task)) { + spin_unlock(&session->back_lock); + /* We are just about to call iscsi_free_task so wait for it. */ + udelay(5); + goto completion_check; + } + abrt_io_task = abrt_task->dd_data; conn = abrt_task->conn; beiscsi_conn = conn->dd_data; @@ -323,7 +330,15 @@ static int beiscsi_eh_device_reset(struct scsi_cmnd *sc) } /* get a task ref till FW processes the req for the ICD used */ - __iscsi_get_task(task); + if (!iscsi_get_task(task)) { + /* + * The task has completed in the driver and is + * completing in libiscsi. Just ignore it here. When we + * call iscsi_eh_device_reset, it will wait for us. + */ + continue; + } + io_task = task->dd_data; /* mark WRB invalid which have been not processed by FW yet */ if (is_chip_be2_be3r(phba)) { diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 1d646f02d516..07fc78aa1aa2 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -83,6 +83,8 @@ MODULE_PARM_DESC(debug_libiscsi_eh, "%s " dbg_fmt, __func__, ##arg); \ } while (0); +#define ISCSI_CMD_COMPL_WAIT 5 + inline void iscsi_conn_queue_xmit(struct iscsi_conn *conn) { struct Scsi_Host *shost = conn->session->host; @@ -482,11 +484,11 @@ static void iscsi_free_task(struct iscsi_task *task) } } -void __iscsi_get_task(struct iscsi_task *task) +bool iscsi_get_task(struct iscsi_task *task) { - refcount_inc(&task->refcount); + return refcount_inc_not_zero(&task->refcount); } -EXPORT_SYMBOL_GPL(__iscsi_get_task); +EXPORT_SYMBOL_GPL(iscsi_get_task); void __iscsi_put_task(struct iscsi_task *task) { @@ -600,20 +602,17 @@ static bool cleanup_queued_task(struct iscsi_task *task) } /* - * session frwd lock must be held and if not called for a task that is still - * pending or from the xmit thread, then xmit thread must be suspended + * session back and frwd lock must be held and if not called for a task that + * is still pending or from the xmit thread, then xmit thread must be suspended */ -static void fail_scsi_task(struct iscsi_task *task, int err) +static void __fail_scsi_task(struct iscsi_task *task, int err) { struct iscsi_conn *conn = task->conn; struct scsi_cmnd *sc; int state; - spin_lock_bh(&conn->session->back_lock); - if (cleanup_queued_task(task)) { - spin_unlock_bh(&conn->session->back_lock); + if (cleanup_queued_task(task)) return; - } if (task->state == ISCSI_TASK_PENDING) { /* @@ -632,7 +631,15 @@ static void fail_scsi_task(struct iscsi_task *task, int err) sc->result = err << 16; scsi_set_resid(sc, scsi_bufflen(sc)); iscsi_complete_task(task, state); - spin_unlock_bh(&conn->session->back_lock); +} + +static void fail_scsi_task(struct iscsi_task *task, int err) +{ + struct iscsi_session *session = task->conn->session; + + spin_lock_bh(&session->back_lock); + __fail_scsi_task(task, err); + spin_unlock_bh(&session->back_lock); } static int iscsi_prep_mgmt_task(struct iscsi_conn *conn, @@ -1450,8 +1457,17 @@ static int iscsi_xmit_task(struct iscsi_conn *conn, struct iscsi_task *task, spin_lock_bh(&conn->session->back_lock); if (!conn->task) { - /* Take a ref so we can access it after xmit_task() */ - __iscsi_get_task(task); + /* + * Take a ref so we can access it after xmit_task(). + * + * This should never fail because the failure paths will have + * stopped the xmit thread. + */ + if (!iscsi_get_task(task)) { + spin_unlock_bh(&conn->session->back_lock); + WARN_ON_ONCE(1); + return 0; + } } else { /* Already have a ref from when we failed to send it last call */ conn->task = NULL; @@ -1493,7 +1509,7 @@ static int iscsi_xmit_task(struct iscsi_conn *conn, struct iscsi_task *task, * get an extra ref that is released next time we access it * as conn->task above. */ - __iscsi_get_task(task); + iscsi_get_task(task); conn->task = task; } @@ -1912,6 +1928,7 @@ static void fail_scsi_tasks(struct iscsi_conn *conn, u64 lun, int error) struct iscsi_task *task; int i; +restart_cmd_loop: spin_lock_bh(&session->back_lock); for (i = 0; i < session->cmds_max; i++) { task = session->cmds[i]; @@ -1920,22 +1937,25 @@ static void fail_scsi_tasks(struct iscsi_conn *conn, u64 lun, int error) if (lun != -1 && lun != task->sc->device->lun) continue; - - __iscsi_get_task(task); - spin_unlock_bh(&session->back_lock); + /* + * The cmd is completing but if this is called from an eh + * callout path then when we return scsi-ml owns the cmd. Wait + * for the completion path to finish freeing the cmd. + */ + if (!iscsi_get_task(task)) { + spin_unlock_bh(&session->back_lock); + spin_unlock_bh(&session->frwd_lock); + udelay(ISCSI_CMD_COMPL_WAIT); + spin_lock_bh(&session->frwd_lock); + goto restart_cmd_loop; + } ISCSI_DBG_SESSION(session, "failing sc %p itt 0x%x state %d\n", task->sc, task->itt, task->state); - fail_scsi_task(task, error); - - spin_unlock_bh(&session->frwd_lock); - iscsi_put_task(task); - spin_lock_bh(&session->frwd_lock); - - spin_lock_bh(&session->back_lock); + __fail_scsi_task(task, error); + __iscsi_put_task(task); } - spin_unlock_bh(&session->back_lock); } @@ -2040,7 +2060,16 @@ enum blk_eh_timer_return iscsi_eh_cmd_timed_out(struct scsi_cmnd *sc) spin_unlock(&session->back_lock); goto done; } - __iscsi_get_task(task); + if (!iscsi_get_task(task)) { + /* + * Racing with the completion path right now, so give it more + * time so that path can complete it like normal. + */ + rc = BLK_EH_RESET_TIMER; + task = NULL; + spin_unlock(&session->back_lock); + goto done; + } spin_unlock(&session->back_lock); if (session->state != ISCSI_STATE_LOGGED_IN) { @@ -2289,6 +2318,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc) ISCSI_DBG_EH(session, "aborting sc %p\n", sc); +completion_check: mutex_lock(&session->eh_mutex); spin_lock_bh(&session->frwd_lock); /* @@ -2328,13 +2358,20 @@ int iscsi_eh_abort(struct scsi_cmnd *sc) return SUCCESS; } + if (!iscsi_get_task(task)) { + spin_unlock(&session->back_lock); + spin_unlock_bh(&session->frwd_lock); + mutex_unlock(&session->eh_mutex); + /* We are just about to call iscsi_free_task so wait for it. */ + udelay(ISCSI_CMD_COMPL_WAIT); + goto completion_check; + } + + ISCSI_DBG_EH(session, "aborting [sc %p itt 0x%x]\n", sc, task->itt); conn = session->leadconn; iscsi_get_conn(conn->cls_conn); conn->eh_abort_cnt++; age = session->age; - - ISCSI_DBG_EH(session, "aborting [sc %p itt 0x%x]\n", sc, task->itt); - __iscsi_get_task(task); spin_unlock(&session->back_lock); if (task->state == ISCSI_TASK_PENDING) { diff --git a/drivers/scsi/libiscsi_tcp.c b/drivers/scsi/libiscsi_tcp.c index 883005757ddb..c182aa83f2c9 100644 --- a/drivers/scsi/libiscsi_tcp.c +++ b/drivers/scsi/libiscsi_tcp.c @@ -558,7 +558,11 @@ static int iscsi_tcp_r2t_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr) return 0; } task->last_xfer = jiffies; - __iscsi_get_task(task); + if (!iscsi_get_task(task)) { + spin_unlock(&session->back_lock); + /* Let the path that got the early rsp complete it */ + return 0; + } tcp_conn = conn->dd_data; rhdr = (struct iscsi_r2t_rsp *)tcp_conn->in.hdr; diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index b4700de3445a..cf7dfd61860f 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h @@ -482,7 +482,7 @@ extern struct iscsi_task *iscsi_itt_to_task(struct iscsi_conn *, itt_t); extern void iscsi_requeue_task(struct iscsi_task *task); extern void iscsi_put_task(struct iscsi_task *task); extern void __iscsi_put_task(struct iscsi_task *task); -extern void __iscsi_get_task(struct iscsi_task *task); +extern bool iscsi_get_task(struct iscsi_task *task); extern void iscsi_complete_scsi_task(struct iscsi_task *task, uint32_t exp_cmdsn, uint32_t max_cmdsn); From patchwork Thu Jun 16 22:45:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 582720 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE78BC43334 for ; Thu, 16 Jun 2022 22:46:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379159AbiFPWqm (ORCPT ); Thu, 16 Jun 2022 18:46:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379150AbiFPWqV (ORCPT ); Thu, 16 Jun 2022 18:46:21 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C46262205 for ; Thu, 16 Jun 2022 15:46:20 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25GIm6DL032726; Thu, 16 Jun 2022 22:46:14 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-2021-07-09; bh=JCRsGOWJ1NTG9Fa7EtV71ZLam/8OEdct4i79GPCrAao=; b=ONRhVgZ+ab/wmqAzvbUWf9G2RsZc261bEICTEDbuR1WTannxBLpC0Jl56IMIALYZYcvC pJlw4EVwe6NU5uxkbzEwzoahit7Ypbaftmh7wKioRA5eSaMRVqmB4sPeKlFn7SA3h1Pr FWHuGklVmT7L/py5xd3P0imubY762lHCb6XPYQuCiKi/GZdku5O2L2m0v2sbrW5vXhdn ZLyFUQhklVPhU7aw/KtMtoNtB+CODx7E6cd5G6nQL8IkEbPIfw/rHTVUUsDAupYmtHZb SIhnksMwrYtV13SmuTbNjbBjwoe3A+lS4kJiNzvZq93GQ37s5ckFfEzeCtUMLYd16YPH ow== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3gmhu2vmp3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Jun 2022 22:46:14 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 25GMaPd3035724; Thu, 16 Jun 2022 22:46:13 GMT Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam04lp2046.outbound.protection.outlook.com [104.47.74.46]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com with ESMTP id 3gpr27dmqw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Jun 2022 22:46:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Uf78ckl40ouUjEVqtWGpZiEKKER/N/S4SWxIBfDcvWKH3pLbzKydNi2/mJWQbqyu26kVe+SMIJqhgpcrSUx5TOTKAVDZ261eA+OvR4CZXkWyK+DFb0kajlbTOKHJvH64g7UdCSHqaGrWuYPztHH958r+b5ZV3jHdMM7Zoe6W48YLnoRgTRxq7fIJyTY4dzKPOK15aPMaJW0c6XGPgyFl3uXNxtZPjL4QviLgIK2H4841Cch/2HYALTrbUXvkBZ+rbP0Z6REej9RC4n6oms517CSrfj+/ZH05Cw7kAUVNd7w2N31r5Oya++i7KbKqxAhJX0vcwqC3XaGgbEgApb8eaQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JCRsGOWJ1NTG9Fa7EtV71ZLam/8OEdct4i79GPCrAao=; b=MvIyxlHbbsVaBMEukr7zDvYBpsGDYKQ04iSYwYpLCzr3K6Y2m8zXd3iQPYHFFse4OVFtOJxLVGpCZ0P0ScfDfDUVySUp6Yh05bWImZBmkkGLRFMMGI0bthngTNE7Jm28jt9+zwZT0LfDUZaRtvaPqw33lPetoouW+IDb2293qIbVGf9DU/Osw9G2y001Nki+ZDY/UVbG7QFvT0pV6dZQJbnfks61mpv8jiYOnUbzuaerXnttbkjjpows3CpB1YOgpbi5auh1ON/dLa2QGe9+8CFJVWBkwzcE+gai1wg2k2ygIGoMvbOxMhpzEFZVpqNaZN+PD0sbLFAyXjbYxDUF7g== 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=JCRsGOWJ1NTG9Fa7EtV71ZLam/8OEdct4i79GPCrAao=; b=mJ+rCuoaAd96vbc+Sxyd60yTP+4x2PuBymdGlq3Kwa6E8QZDG5ZK/458shZlj12tUq6ZNuQSh9uL00gcmEuh077B63UTY8RGGfsAT4Ndqz6NtwJcUAhYLhNksNnB6Qtr5tcVU82uvjyqAZXAOeo0lUlfF/GOz9s6fVg838LDqqU= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO6PR10MB5617.namprd10.prod.outlook.com (2603:10b6:303:148::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.15; Thu, 16 Jun 2022 22:46:10 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b%3]) with mapi id 15.20.5332.016; Thu, 16 Jun 2022 22:46:10 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH 8/9] scsi: iscsi: Try to avoid taking back_lock in xmit path Date: Thu, 16 Jun 2022 17:45:56 -0500 Message-Id: <20220616224557.115234-9-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220616224557.115234-1-michael.christie@oracle.com> References: <20220616224557.115234-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0264.namprd03.prod.outlook.com (2603:10b6:5:3b3::29) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f2c43f00-d94c-41a9-1076-08da4fea021e X-MS-TrafficTypeDiagnostic: CO6PR10MB5617:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lD6A9EM4yEoPk+UGZm4L1XY2PolGuSWgxauptNoFMyaSh9KwkCDRt2Y8Sj64T2mNcq8zI+fo/EjuqUhzM0T+XAk2X91cooGPzeCpi2S5529JvnkU6PoUuDAhkNQ6Z3eMRNZWvUewiEde0OMxaNLX5/NdcfHch8WKtjOjroQxJn+BGUfF6nCE+/zS2r/AKpnItLZ4y7pQ6Dkf1uG791ZYnq2zpQ7XGBAer/VWiT5RuGG25qZTe1i4eLHpMEsijcHLI7DGsOxbq+dw47KK6HIGsuNQfXAQTwdv0C+VvsDD2/ImFwGOln5LRzvxMY9MRgQBH2MZTwgbglXHszaE/Fa3mxg93FfqKOAGCSi65eSj1qIzA9WgHj4Gw+VA0j9UTfCKXxw6L/chbxCiaT8+y4jJwAUHPObZJUajAUMup6mt0WRpyb7v+P+x6lV4Ua7KFQIvmYQdfynJXO9vyVPK5TVHyvfz4nyN5ilw535I6eIoa+E1e8Dwq712MB2nnRDEvbH7MUakZm+oZxR11PcMyKE4dyJhO53jkF10gjtfU/igSiE461cd7h3eu7p7o0q2ySIvS/ad3aTHwU+ME4IPx8lWAUH+3umGjmYXeoiaKWljmqIPSSqhgc1iqYzAzTuCmgYO2OKvO9Xtq47vD+Ig6q39QYP8F5WtIDIO2+h3b2vlXWXbYDPiKygaAofG7WS2lIGuoT/66WCKVtnfnnZmLrK3sQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(366004)(83380400001)(2616005)(52116002)(6666004)(66476007)(5660300002)(38350700002)(38100700002)(36756003)(4326008)(6506007)(8936002)(508600001)(6486002)(66556008)(8676002)(6512007)(26005)(186003)(107886003)(1076003)(66946007)(316002)(2906002)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Syfs0AJm7tnvPz+xSTAbUxxDcZnPWWXysozwOSCHbjGSb9B8EU+o/DEBWwaWAciM2CCORKlXWRpsp24jDKebLhfEdoRcx+QkWRpr5pE4/4+bWKIPz7IuI2V4A3INv6kIOQhPO3AX1Obut7IY/TaD+avYmkeP1t/v996TDgBK0OwzXIDmFKOlJigMixDCa9X01mbaiZf1hZIg1Wowheu0n53KuV48p0WCP8qsyr7rm1rRgAnWabgj1TnXRW4gbXVempsJvxEA8Xy9Jw/cS3HBBe0hF5uRjCuzDPSWrz3dFLjP1VLeks4wMAdY3Q/j5Q1OUrqEWlVVOHz/VOCCpfpHeA1bo90wer5oWRryuDqV7Da8s39UFuPs9qlVARH8VnA17xmtXLzVPb+EMD0hoQ+cNzBxI+7X2Ve3wPyBjlPbmRYDMcveOBO1UHPNrnsqJJ9N1inQtaOXuoDhzuCCM4jvxIQ1HFbqzXViURqMnmbDwFzRbCWzr7fMSeh9DGQcV2Jsm1iGQNNE3csC7ZLF6qtp0R5PdAt1UK4mwRq6LzRRKRvu9k6pDlu/5QZgMNSGzwVxo0wr7+M9/fLRxqFUOz2/q8ufAtSqXm4mNyQ07u6JXV1bH5N3IrBo722TGip/eW7X0CKmMVADfKo1cplinBRpnMW1upIkJSoJCMs4LZ3INSuAhTwhc0vAxbzk55AwYb8U8yFDw9lIIB+pXwA7l4wvnPjqFZvFjMg/ihF+PUC8k/MPM8TvIlBdzz9hh/OLpwapU8zepOYhENgZtXqZfj3dNkuyVwhQSiflir/sG17Nsmovdpe4hlOL7oHGFx52vG81Hq4gVpeo8u3GO7c3P/C/t85mQ6XGn9vs+bXh+KoM93nrto2DueH0FJmLPNP+vn0XBXcI2RTKE7P506sEIPbal1+YozTNNq1+bFna/mgGs+N9xcopZP3Idpyo0ny7kPggenemKFMj8ABErirSbSQyxvIStzE1wajy2VsCQuytJYmtzq58Xrmdadk1ugZFYisMGjWVIn8VhY8V9XEG1sx2w6JC3e/CaARx2GysdAHBKdA5oU5oBvfH+yNpICSyhy53T1K9C+YaF2VxHKPs31EtO17GiggmFdQz6UlQQInMDRMv/PctTMnewRd+ncrpSSpgkXCbRHJfPBZwUTyVnoWu2klrqStLEucJ4CfRnqSsIbOBE6FqQ+cUY5QvRGzjywsSfMBPuolPI6WqULIA0V4yEn1ndD/4CslkfDkfGiPynPauv07exvPoXrDQXzS3bHBHeKDb+eA3iTqWjQcTa/UZ72SdsKlJgIV9bqQ9soEIgcHhCF4cOH0NFJy90+NmNF2y3YpMbqdT0rdWyvLJDzwzmGJcOCYT65YmSvO9/AIC7Ly7wv003LBXcK+hwtwtbTP3joygbbwnzctPvfjYwDqGZsj12f4+gMqWnka25xCckEsqYZtZDKU/TSLeEJk/qge95kgH+/Ln8ys5eMDzF0HWEaIFjVzFaWOdU1oJ5wBhvvSuwZsYdV5qo9l91F6eEqJAxyKalCc87aBkrHESHkV+q974I1vURCwcR0UZiaUMjRtAOo3D7i1/8s5QWuU4KCedZx+sq+eh/L4KwS7egUrvCSiwzqi6bgJLq7kiHc83b5rYLV/j3bS+ZFF1FzbkMOvtEBlCHip5rm2/F+dqyhw7d1hT7Z0FbHPTeCp+U8Z+TwBLhoWqMkzgQjc9VkuHaOg6DTKCp7be9gwxE5oEttOAf/vlr7hhUWwfgIATiQGfKPE= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f2c43f00-d94c-41a9-1076-08da4fea021e X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2022 22:46:10.6718 (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: /iuohUXkofAlSLu/zCLn33fDyH126bGWyBdC8HK63l6TNtrraEp52G7mBYsKHjkGdZhCy4qLeXevajPX9AXi96BG/FUnhdWd7o5OZWDm90U= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR10MB5617 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.883 definitions=2022-06-16_16:2022-06-16, 2022-06-16 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 suspectscore=0 spamscore=0 mlxscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206160091 X-Proofpoint-GUID: P-EVV3nJOR_3gMh_VDZmOauWyh0TiHcc X-Proofpoint-ORIG-GUID: P-EVV3nJOR_3gMh_VDZmOauWyh0TiHcc Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org We need the back lock when freeing a task, so we hold it when calling __iscsi_put_task() from the completion path to make it easier and to avoid having to retake it in that path. For iscsi_put_task() we just grabbed it while also doing the decrement on the refcount but it's only really needed if the refcount is zero and we free the task. This modifies iscsi_put_task() to just take the lock when needed then has the xmit path use it. Normally we will then not take the back lock from the xmit path. It will only be rare cases where the network is so fast that we get a response right after we send the header/data. Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/libiscsi.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 07fc78aa1aa2..da292761995f 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -490,6 +490,12 @@ bool iscsi_get_task(struct iscsi_task *task) } EXPORT_SYMBOL_GPL(iscsi_get_task); +/** + * __iscsi_put_task - drop the refcount on a task + * @task: iscsi_task to drop the refcount on + * + * The back_lock must be held when calling in case it frees the task. + */ void __iscsi_put_task(struct iscsi_task *task) { if (refcount_dec_and_test(&task->refcount)) @@ -501,10 +507,11 @@ void iscsi_put_task(struct iscsi_task *task) { struct iscsi_session *session = task->conn->session; - /* regular RX path uses back_lock */ - spin_lock_bh(&session->back_lock); - __iscsi_put_task(task); - spin_unlock_bh(&session->back_lock); + if (refcount_dec_and_test(&task->refcount)) { + spin_lock_bh(&session->back_lock); + iscsi_free_task(task); + spin_unlock_bh(&session->back_lock); + } } EXPORT_SYMBOL_GPL(iscsi_put_task); @@ -1454,8 +1461,6 @@ static int iscsi_xmit_task(struct iscsi_conn *conn, struct iscsi_task *task, { int rc; - spin_lock_bh(&conn->session->back_lock); - if (!conn->task) { /* * Take a ref so we can access it after xmit_task(). @@ -1464,7 +1469,6 @@ static int iscsi_xmit_task(struct iscsi_conn *conn, struct iscsi_task *task, * stopped the xmit thread. */ if (!iscsi_get_task(task)) { - spin_unlock_bh(&conn->session->back_lock); WARN_ON_ONCE(1); return 0; } @@ -1478,7 +1482,7 @@ static int iscsi_xmit_task(struct iscsi_conn *conn, struct iscsi_task *task, * case a bad target sends a cmd rsp before we have handled the task. */ if (was_requeue) - __iscsi_put_task(task); + iscsi_put_task(task); /* * Do this after dropping the extra ref because if this was a requeue @@ -1490,10 +1494,8 @@ static int iscsi_xmit_task(struct iscsi_conn *conn, struct iscsi_task *task, * task and get woken up again. */ conn->task = task; - spin_unlock_bh(&conn->session->back_lock); return -ENODATA; } - spin_unlock_bh(&conn->session->back_lock); spin_unlock_bh(&conn->session->frwd_lock); rc = conn->session->tt->xmit_task(task); @@ -1501,10 +1503,7 @@ static int iscsi_xmit_task(struct iscsi_conn *conn, struct iscsi_task *task, if (!rc) { /* done with this task */ task->last_xfer = jiffies; - } - /* regular RX path uses back_lock */ - spin_lock(&conn->session->back_lock); - if (rc) { + } else { /* * get an extra ref that is released next time we access it * as conn->task above. @@ -1513,8 +1512,7 @@ static int iscsi_xmit_task(struct iscsi_conn *conn, struct iscsi_task *task, conn->task = task; } - __iscsi_put_task(task); - spin_unlock(&conn->session->back_lock); + iscsi_put_task(task); return rc; } From patchwork Thu Jun 16 22:45:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 582522 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 472E7C433EF for ; Thu, 16 Jun 2022 22:46:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379153AbiFPWqk (ORCPT ); Thu, 16 Jun 2022 18:46:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379159AbiFPWqW (ORCPT ); Thu, 16 Jun 2022 18:46:22 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D2F462137 for ; Thu, 16 Jun 2022 15:46:21 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25GIhsOq032716; Thu, 16 Jun 2022 22:46:15 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=Xco2W5MJOgBU8hzidLJwRHIPwv+I6e5HUYyqcUlR5Y4=; b=jT4Ew1TyQZEhOnuoYX9E+cBg9uhN2NLlsmRsaalkYBCe2PrvoFYrHbjcFzYZBrTrkbV/ vH8uGADbPB5R9yCeA3XcNS8KGCqTAmu5A2Yi3YygfIPvmjAU85lLNrvwHzN8YGbxy4Pl mtlSI8q3I78AFL+eAD+k0Bb9O2Ec+2/MIWSgVVTaiP2oGfZIsnKRKX7UPeH2VO1cdv8N 0aT0BjVXqXeYjsjj1U1DqPf5oKtB0aCsvrP9DVqDxQ2NG6LcGDVyeb3kXE9SZ2d0AdF7 GiN75vu9PvG07HyCNOIdaMaqay2qgoFCMnXbS+pJPg5qpzhi0LMkY0XtAwKzEQS3mBef kQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3gmhu2vmp6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Jun 2022 22:46:15 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 25GMaPd5035724; Thu, 16 Jun 2022 22:46:14 GMT Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam04lp2046.outbound.protection.outlook.com [104.47.74.46]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com with ESMTP id 3gpr27dmqw-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Jun 2022 22:46:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FweuNskDkhOK7raEmWjspiljmewJX4M8pMkOd9yW50mR/avIsbyeE+ffOrNg0P2Q3pGFEmkMcDlmZZ30rJykp5z40FV5R1dPaCrG89ToDDul/KHZj3PBchXNra3r1uVU3V5NM3AcupaxopiogHN8VfJ1p99z2LkYhHQPBrhaRQJL7+evVYtQX0m/QSBETrt+Rj720xjQA1M80uer64TxED68Ni7GdbsZ8K2SbvJaMJfpH5P7Pi9jESAscwEZSuS7N7Qx2o700aitevRUFNCHO614R8kLXsRcHh5ILWfS7jmFF3t/XUXV8XfJOVK19edGdf2Wwzm7gZI/MMOil1OW2g== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Xco2W5MJOgBU8hzidLJwRHIPwv+I6e5HUYyqcUlR5Y4=; b=al/WfHOxYA6Jt9/N8gU4ahL9vHY+uRnD6VWHI9Z1+AxKXQ3dQj9y4tUaN6eR5fuBcODief2H/Bw9NIYRd5RSC1mT08o/eIM9Jh4Bhf/Cdi3EMm2k3UHiDQUtksVZlf7s4CO8Nd6gEw4T/RUsbJqa8XuuQv4/aIQPy5Wd4Z59H7+pW8jM/XyhftJhn21ejpvgcWbq5H8QFTrRobxG1ZrL7nh0rEl74+mHBP9KYSkgZHvlnOJ3QO2MKQpkebFekgycSnjMXHuI6q7ncVmiJgXV2PSx5OhjZYog7OIV54buwAA67TjyHQs6KBDnt/YSgbMZo3hCCk9f7E8pviu1dAQJyg== 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=Xco2W5MJOgBU8hzidLJwRHIPwv+I6e5HUYyqcUlR5Y4=; b=WZBBnhVL77RzhnX3a3zutX4Cm+y7ZINF2S1edshMGXW+V4tY14SGuyW5QwIXTaRZMJu0d0kdnLTj/WcTShgdNN1JAJGoo8XHyD1L5fS2lWPwZayQ6LBKNUN3l344agfLuTLwbWnsj0V6AXYivZygE3aofVVN0fGPJZVMsd6dMek= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO6PR10MB5617.namprd10.prod.outlook.com (2603:10b6:303:148::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.15; Thu, 16 Jun 2022 22:46:11 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::f81d:b8ef:c5a4:9c9b%3]) with mapi id 15.20.5332.016; Thu, 16 Jun 2022 22:46:11 +0000 From: Mike Christie To: lduncan@suse.com, cleech@redhat.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, jejb@linux.ibm.com Cc: Mike Christie Subject: [PATCH 9/9] scsi: libiscsi: Improve conn_send_pdu API Date: Thu, 16 Jun 2022 17:45:57 -0500 Message-Id: <20220616224557.115234-10-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220616224557.115234-1-michael.christie@oracle.com> References: <20220616224557.115234-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0264.namprd03.prod.outlook.com (2603:10b6:5:3b3::29) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 28732989-deb9-4715-1a93-08da4fea02ad X-MS-TrafficTypeDiagnostic: CO6PR10MB5617:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yWNgs8mHvBvU3SdXoi9mLNDePNNiMC2jSb69kfss7NgNied6DI9n9u8lJ3bQOu+mLYPYlifBUY3eaKIsaG866Tg2Rg49A0GqVHQnJjNc5O4XCXlWTGFoFqKB9iWrNYuYxF6t4TUwXHQOzADWj308I7CWCSCvFpiunQigFkSGhGBsE8B9lEq5/7pRFiXX9kZ0MB2/jj4NUlFVX3omsRydOXk5ISHx34DB+aaBSc9AAkeAZnqUdOLz+WiFjpmf0HHccn3TIM+OsU51juJiWcE0betbJb4vwaUnbsn+gDJFNl/2Df1v17edE0YuibAqwUtcAqPJGH4T4OTqES/MDO57ioYJ8/pqJRVPOdrKrEWwvB6O6Wm6x6Q4fOlza+lhhMsMJnVQAIWsQRBzok9pAFJ6CdndRq9+DkhiI1jQgLo2W4cgYfo9P15mON0kXoqucwi5aWhNGv6yRM4laX+4DVTQgWFk/3JRagCPtcSzDJyqhAKN8LOGI54Q5yF68kSCaTbkjTVm3dDum4baTKtyxWEEeHKwZ5uO4YfExsyTLDdC2CcPX5nNGdpxB3WMAUUCbDI8yxEnN+e8dQUXSCUoAmsHJrG0mpVGGuLR4TZ5Xr5BtY+blrqP2uR2R9AeioJMZqLPaNOJK76cp6MNqP0c4KlngCNpL7huQpjE1MdrB3DaRmYIKigRP3sEs1R2IT7DbBE1GhHEFpPOkBVN15zH5JVwrQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(366004)(83380400001)(2616005)(52116002)(6666004)(66476007)(5660300002)(38350700002)(38100700002)(36756003)(4326008)(6506007)(8936002)(508600001)(6486002)(66556008)(8676002)(6512007)(26005)(186003)(107886003)(1076003)(66946007)(316002)(2906002)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: H9F9mTy+ne+64WgXQpXxAXr15oDOCitdzZ4D21cZbQ9dqa0KvcUrnwqXbzPAUVM1gRgCBhFuA/Ux09HMZnj/0tiRIppCv8zp0pAznjryyicNpKbev/06u4zQ8kCaefILZByZjMegMB87zd6nWWuKur2fiFhZfhKI5YEXj4d0sSkMgQXcZaR5HF7gqOtJaER5U15x+JcZc3//as4I+LzubkhL8Cpm5BA6RO3PVnx2zhUEvIJlN89T69KKZhNotuT4YFgKtuz6hhUBzVj9wp13Q2aI97hYCiczzQSwI5xnJdPLsd9zYSEhV7RCemF4mX/gra7VKkuAvCFms1NZVnkmLGLox9x9a+u+J7GfqE0XQ7UcfjbEzFP+VsGq08XpaquxchTC6mHzKN2djg8GAMs2mhqvpskufafUxVLYgTwvBfjOffnvg/FnvgWqeq4O/OjTZ+l8exulwFqBMv4QQOfsHmFdXBHii1pTwbn3GqPLSD9XBp9poULHYT4i2CQa00K+iVDhtr0QJk+CKdgX49B3bWWz8rvRe69LmMNZ2Brj9xW/c02yZqfAmXlxsVA27P6aFW+Mks7C/VhYfWl0/C5lCgdFxm61ydfUqY7XX/XRd4PDyTEvJpwiS9GAlIUD5basiX1wVjRCEk9yuQJPdiMtZF6lfgYZHKPPPu+gNeAKQUg7qzroHAy6AHK9qw+/73Swb4WAxblo5fIzQJacHjxIisqNxIKWUOaZwcoYLTJNBOizqGDqfd8cwkmcjkqPOwlKjE266xHiWv2O0NgqZw5BrgLab+fGgsW89g9dkoy5zw/WsgqEK4+t4yFgp9QYuRxRvT2nsaa6Ef/dcb9IIB3Xg0g5NPkHjUSH/0T9MV5cyb5A4S2KHA5d8tfGynLXdlzw3xxdsAytUPdYn0/HWZ6zW+O8Tgkf+77KOreg6xBCfhrmo5dqK6ycWYnPbpXuMtKCHfs3legoXuoWhAOcMK/T6qZhWA68nPfjZSKI5ekxHJTLGgI0nW1UuDm+bjm37j8VjwqGRekLQ+h8IeGiWQC+5r8/f2TsjsIlTm/Zp3+G/wJ94fspLjZ1ljsGb3nCT1rQoVYcwvncnl0IQUECBdUwIf/xCCGFmILEEMaaAXy1V/+EB4yN3tovhERdy679AIDfLghVAza5DLsrV8cyNLDCsIzxTmF6RpL0YlFZlsc1osGKTSdK+a4UQP1VtzMWLQYvaYYo/CU3IFcwJkzuyp1P/jD5sZhRb+cnxO73Li6AhQAZD2n7JQ3uivAgCWsO5iQUJqiaV0QXuhD2fhptOIt7ws+tJYiQAjpcGWOTJDb8/hGFIVG7dgNtNSeAIUAw/iXOxjv7bWoI+rRHzSV3W+wP2iTx3tHu3DsH52el4vGTHC69JncNOPDf6b1TL19fbCW59PmR2JE55SbnlY6vF8QauabKnL90RDqkYm7V79rbbMsWsa0Doy5nraDy76t/+EycuGFrZuw3/EeWpL03XfY+EjnG8T2xCVza5ev+e9QWYEdix7T7gAwTIH+D587LBkwiwtOs3ZZ/CoshWjmrRgsG/jM174od/yY84i0Svqtgech81ITI4uT9g0L1oJNE3WGBoAWVylQVrrDWNFKTQUVtx8fTjNkJdxi7N2OO73RoMaTjdeUglGTmFx6GG5sSnceUjgTu1iKOGGflcMVvM2Q/ubuFumqJR/K4MTeRpDyMVYIeKuqM5skqEwgWy6vbYWtf1PXuPx7UELEMBnRz1bJpji4DiaKNvrWuFbFZjIw98W8= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 28732989-deb9-4715-1a93-08da4fea02ad X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2022 22:46:11.4686 (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: CC5HhuV5uKsDT/ja6RgCvXWu1erMdK0XuUp1z+QbC/DHln+pkBXMeUOzgN4MurTlrid0EifXmE95UOjr9pqGzy7sL6XxI7O55KOdZDL8Flw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR10MB5617 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.883 definitions=2022-06-16_16:2022-06-16, 2022-06-16 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 suspectscore=0 spamscore=0 mlxscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206160091 X-Proofpoint-GUID: 6wLV9jW7H-ETRm4u60Vfm2TqqNwqI7pP X-Proofpoint-ORIG-GUID: 6wLV9jW7H-ETRm4u60Vfm2TqqNwqI7pP Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The conn_send_pdu API is evil in that it returns a pointer to an iscsi_task, but that task might have been freed already so you can't touch it. This patch splits the task allocation and transmission, so functions like iscsi_send_nopout() can access the task before its sent and do whatever bookkeeping is needed before it is sent. Reviewed-by: Lee Duncan Signed-off-by: Mike Christie --- drivers/scsi/libiscsi.c | 85 ++++++++++++++++++++++++++++++----------- include/scsi/libiscsi.h | 3 -- 2 files changed, 62 insertions(+), 26 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index da292761995f..b06ebbfe5de3 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -695,12 +695,18 @@ static int iscsi_prep_mgmt_task(struct iscsi_conn *conn, return 0; } +/** + * iscsi_alloc_mgmt_task - allocate and setup a mgmt task. + * @conn: iscsi conn that the task will be sent on. + * @hdr: iscsi pdu that will be sent. + * @data: buffer for data segment if needed. + * @data_size: length of data in bytes. + */ static struct iscsi_task * -__iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, +iscsi_alloc_mgmt_task(struct iscsi_conn *conn, struct iscsi_hdr *hdr, char *data, uint32_t data_size) { struct iscsi_session *session = conn->session; - struct iscsi_host *ihost = shost_priv(session->host); uint8_t opcode = hdr->opcode & ISCSI_OPCODE_MASK; struct iscsi_task *task; itt_t itt; @@ -781,28 +787,57 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, task->conn->session->age); } - if (unlikely(READ_ONCE(conn->ping_task) == INVALID_SCSI_TASK)) - WRITE_ONCE(conn->ping_task, task); + return task; + +free_task: + iscsi_put_task(task); + return NULL; +} + +/** + * iscsi_send_mgmt_task - Send task created with iscsi_alloc_mgmt_task. + * @task: iscsi task to send. + * + * On failure this returns a non-zero error code, and the driver must free + * the task with iscsi_put_task; + */ +static int iscsi_send_mgmt_task(struct iscsi_task *task) +{ + struct iscsi_conn *conn = task->conn; + struct iscsi_session *session = conn->session; + struct iscsi_host *ihost = shost_priv(conn->session->host); + int rc = 0; if (!ihost->workq) { - if (iscsi_prep_mgmt_task(conn, task)) - goto free_task; + rc = iscsi_prep_mgmt_task(conn, task); + if (rc) + return rc; - if (session->tt->xmit_task(task)) - goto free_task; + rc = session->tt->xmit_task(task); + if (rc) + return rc; } else { list_add_tail(&task->running, &conn->mgmtqueue); iscsi_conn_queue_xmit(conn); } - return task; + return 0; +} -free_task: - /* regular RX path uses back_lock */ - spin_lock(&session->back_lock); - __iscsi_put_task(task); - spin_unlock(&session->back_lock); - return NULL; +static int __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, + char *data, uint32_t data_size) +{ + struct iscsi_task *task; + int rc; + + task = iscsi_alloc_mgmt_task(conn, hdr, data, data_size); + if (!task) + return -ENOMEM; + + rc = iscsi_send_mgmt_task(task); + if (rc) + iscsi_put_task(task); + return rc; } int iscsi_conn_send_pdu(struct iscsi_cls_conn *cls_conn, struct iscsi_hdr *hdr, @@ -813,7 +848,7 @@ int iscsi_conn_send_pdu(struct iscsi_cls_conn *cls_conn, struct iscsi_hdr *hdr, int err = 0; spin_lock_bh(&session->frwd_lock); - if (!__iscsi_conn_send_pdu(conn, hdr, data, data_size)) + if (__iscsi_conn_send_pdu(conn, hdr, data, data_size)) err = -EPERM; spin_unlock_bh(&session->frwd_lock); return err; @@ -986,7 +1021,6 @@ static int iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin *rhdr) if (!rhdr) { if (READ_ONCE(conn->ping_task)) return -EINVAL; - WRITE_ONCE(conn->ping_task, INVALID_SCSI_TASK); } memset(&hdr, 0, sizeof(struct iscsi_nopout)); @@ -1000,10 +1034,18 @@ static int iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin *rhdr) } else hdr.ttt = RESERVED_ITT; - task = __iscsi_conn_send_pdu(conn, (struct iscsi_hdr *)&hdr, NULL, 0); - if (!task) { + task = iscsi_alloc_mgmt_task(conn, (struct iscsi_hdr *)&hdr, NULL, 0); + if (!task) + return -ENOMEM; + + if (!rhdr) + WRITE_ONCE(conn->ping_task, task); + + if (iscsi_send_mgmt_task(task)) { if (!rhdr) WRITE_ONCE(conn->ping_task, NULL); + iscsi_put_task(task); + iscsi_conn_printk(KERN_ERR, conn, "Could not send nopout\n"); return -EIO; } else if (!rhdr) { @@ -1874,11 +1916,8 @@ static int iscsi_exec_task_mgmt_fn(struct iscsi_conn *conn, __must_hold(&session->frwd_lock) { struct iscsi_session *session = conn->session; - struct iscsi_task *task; - task = __iscsi_conn_send_pdu(conn, (struct iscsi_hdr *)hdr, - NULL, 0); - if (!task) { + if (__iscsi_conn_send_pdu(conn, (struct iscsi_hdr *)hdr, NULL, 0)) { spin_unlock_bh(&session->frwd_lock); iscsi_conn_printk(KERN_ERR, conn, "Could not send TMF.\n"); iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED); diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index cf7dfd61860f..b41b95655210 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h @@ -135,9 +135,6 @@ struct iscsi_task { void *dd_data; /* driver/transport data */ }; -/* invalid scsi_task pointer */ -#define INVALID_SCSI_TASK (struct iscsi_task *)-1l - static inline int iscsi_task_has_unsol_data(struct iscsi_task *task) { return task->unsol_r2t.data_length > task->unsol_r2t.sent;