From patchwork Thu Nov 7 17:03:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13866748 Received: from outbound-ip168b.ess.barracuda.com (outbound-ip168b.ess.barracuda.com [209.222.82.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DEC54216A24; Thu, 7 Nov 2024 17:04:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=209.222.82.102 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730999081; cv=fail; b=Iwq/mw8Nd2hGO4kJgDK+sX9iKmvUkynypeipAmGfdUPvfGeibY1qb7FLFgK0R2l0EeJlq1rBV648NJ9P4kN4VlJVFwNLGqJ2fer64UpaF/OFE1R6FNHWZrBIPFPbLM9MOTQN6RhkPgOcgXYc9Z0CgZ4eyN7LMhGwqWZW1zCGjgQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730999081; c=relaxed/simple; bh=7Xi4hyG04KMKxPwnWaeikRjAaezWNIGfJ7G/TvVGmzw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qu3gO3Qzm2Ih8P2kTaELIIRcVbt5YhOO7casO323MVwbyK1iMNaZF+rQiuQxZFqYtAXy8NYhJcgN1orDeZiFmb7N48Le4ONikI8P9sbznAR1A+E5lBSQ5FDUgls5P2kwGTawMQiYX+Q4qBj1gKXbKziNwYORvrOGQHG/Wo3AEWQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com; spf=pass smtp.mailfrom=ddn.com; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b=ELc9gS8B; arc=fail smtp.client-ip=209.222.82.102 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ddn.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b="ELc9gS8B" Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2171.outbound.protection.outlook.com [104.47.59.171]) by mx-outbound42-115.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 07 Nov 2024 17:04:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=U3WPe6CoJWkrsOVXURIwAcObtkbYf6K8MtpjNBeD6PLUK2trB2sy2nCntZoIcpF4uiWOmbCXsaD+L7uEeqV5CZHsDSBHvMibFe9GWqeFT//nkPalrU9h/oatMpgK6rzKbqeqNgBveXSpQJ1iJtE7H1Q0GELc/oA+ZfKuwrvXN8KPRurwiwMwCA6OaRYUH+g3ISDZi+dZE63sZGBGIP/hRSsCoM7mRRpwMeZ4eXLRUc/BXygZHG93qDn4j3y4Z1OPlcuFEkyZPZ/wgjwDw+Q7cQ9Z+sKVD7a7j9FDwzMZaRLKVPZUMffhYPa41CKBA2Rr39ApDwK52qQ0pQGXdZHAww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=oJZGXDrF/qYt5U60QDosKDvI8xNwlWRog24xMY9CxGo=; b=IxCCnWYOfEANhUfKWSr0Eh7lzDCOadV8KTuMBIIm+tcCmF1Hn5XnqB6p9DWBG8yI4z6ugBZTCkgF+Sg7T0Gjd/0v1EzVyt+/2r1sAQMVR0oRi9Az0dGB0/6wzwTAaUnWMwkB7Ta+ZJplEsmTo4lWfsbsCtDSU5m3BS3txHGiUUqPbNqxSBMJ7oYjRBvsJL4zjRLTu+tovzaO3ZWI9zTsFTWCELxILKoIhaIXsmUW8d07jMyEGNjQ8dL7rQ+mwgGuUAcBxNfvcgOx4gnnnvJhV7PXN1SyeMjDNGiFEKc7xM/eq204KNmHS5xFo3hvA8QeFSG0t26eD3Tylq1bCN+Cxw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=bsbernd.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oJZGXDrF/qYt5U60QDosKDvI8xNwlWRog24xMY9CxGo=; b=ELc9gS8BUowqo4dyAQtD+0jIJtEvTmPGPtkQAfCUMbZtN15RSSnOOGaWkAdPdQjfXyMIWMOOdoaFojZhM20pbmYKA8bK80ihUmdwIJYmdQOMys08bMK8vB/MUhI5aoLoz6emxJO+6WDMol+c5nU0sgwP45m6KdT5H1IYOeReoTI= Received: from SN6PR04CA0087.namprd04.prod.outlook.com (2603:10b6:805:f2::28) by DM6PR19MB3788.namprd19.prod.outlook.com (2603:10b6:5:248::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.20; Thu, 7 Nov 2024 17:04:12 +0000 Received: from SN1PEPF000397B0.namprd05.prod.outlook.com (2603:10b6:805:f2:cafe::b7) by SN6PR04CA0087.outlook.office365.com (2603:10b6:805:f2::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.18 via Frontend Transport; Thu, 7 Nov 2024 17:04:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by SN1PEPF000397B0.mail.protection.outlook.com (10.167.248.54) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8137.17 via Frontend Transport; Thu, 7 Nov 2024 17:04:11 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 50FAFC6; Thu, 7 Nov 2024 17:04:11 +0000 (UTC) From: Bernd Schubert Date: Thu, 07 Nov 2024 18:03:45 +0100 Subject: [PATCH RFC v5 01/16] fuse: rename to fuse_dev_end_requests and make non-static Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241107-fuse-uring-for-6-10-rfc4-v5-1-e8660a991499@ddn.com> References: <20241107-fuse-uring-for-6-10-rfc4-v5-0-e8660a991499@ddn.com> In-Reply-To: <20241107-fuse-uring-for-6-10-rfc4-v5-0-e8660a991499@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1730999049; l=2183; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=7Xi4hyG04KMKxPwnWaeikRjAaezWNIGfJ7G/TvVGmzw=; b=aYCNaa2Q++ZUQmBXaEHouma6n3Adn9vZaOZvL/uQ0pMmC+TqfEh5vKOYYIToqEtmSlEwmupD/ +rehjzjXLHdDvR/E/dxYgdrv8WdEGpk4P+uYhoBLmX1doqrWDPQ9MIk X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF000397B0:EE_|DM6PR19MB3788:EE_ X-MS-Office365-Filtering-Correlation-Id: 0d8ab1c7-a05b-413a-b681-08dcff4e33c4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|7416014|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?q?0JEdByjWah444VD5nHYXXIB9gnvGsSk?= =?utf-8?q?CzvNUYKEC9+qQhkb4Y02/q7ZF4KxzweVYY9LBIAOJ8mpTdsdLdXrK4OVpIybWTIfX?= =?utf-8?q?Xg4buIboS6Wmx3clcakT+0JzD0Tx3et21jFJC1tLWNeG94GvdGjaEdKwKwOU0W83D?= =?utf-8?q?Kx8U+y7dThm+8K4yzOXf3ZvxxB+0UBx/1RrTWVQfKkl4KLTSjx6aioKHORBbXxfJb?= =?utf-8?q?xLgAp/IvfD96diZwzkNLabKRJtiBUyL159+b8F8E0q12nT5A6n7Jl9tcojcXbnDSH?= =?utf-8?q?IR/0iH/FiuKXuh+gB3QDu5f5D95VNWheMulSX9hvWT4DDZvqXiJyB4DOhsCrmr1Cq?= =?utf-8?q?Q902atd7GSJ5cdQPh9J3S4ItJN6j2ZoXIOfb2cpjA4q1idD91WK297DUlzcPA9gKV?= =?utf-8?q?iaZeNtM+wNMlpEYsOjD4QsYJxN5y1RX12SEXB2iHv/yZTstqP97O5IDolMs5ubktT?= =?utf-8?q?05Ha3xLrmEEXYnQO570BT4fX2KnipYwgZzNyOylES0D+4sAO3lwsfM0vfAQcQHi+p?= =?utf-8?q?Z2Np2po9fEWKS97p+uReXHPk8/GzvByy6IUiw9LYCjD3rx3CU3MdSZgkxdNp4G9wn?= =?utf-8?q?F4zs9TUF8BP6OBfhhPhh5M4/UCL8abPgZLTUNVLwLM9TfRrisFDqV0Eenrw3jSdhp?= =?utf-8?q?evV4Vb2q8O4gvlb2Dt7WUu+MXVkimLr48z+4hgME3MGpBeTsYYQE4/7kClVg0SeEs?= =?utf-8?q?NPmTGP7uqGipOGADI2URv14+KgX5DOg70jadqM1DD88ek0CVEItLiIg8tGCVSpe3z?= =?utf-8?q?HiVnPCH5pfsaMrZEyambz986RBMUQc/6HBeezS67Q5sUh34Z97e5p/CP1krylftSt?= =?utf-8?q?DcMQls2TEsuvM8dvBxjoLSexHXsND7emTaQRg7Hu6kLtHYgJvYY6+NlGzTjTbD+hz?= =?utf-8?q?veXPxCTLkVVS/CVglgglLJLs4Zi4rpW/hYHPT80XO1Vw3n5Oj3F/qIwVIb7UlwFt9?= =?utf-8?q?csPaIZH8Xo5+tUsy7clgP9b3msoYo9EV+ShbTvutOVBFKYMEsbm93xBHgYs8NX097?= =?utf-8?q?g9oDZtCzrm4MZUXpdz7Jzp4cJ5oja2tSuuV86M6ctsiPv0lH0d/Lk2lUyu+MoFjm+?= =?utf-8?q?HV2i3yw4zZx9FlytHoBtsP2zQaQ7iH+Zl2QtnLn5blHgYHTK2wQexMehaYZMUuP61?= =?utf-8?q?jpOMj/uv3JXnrkKeZdOLCSXE+W69DV7nkN3ELtj7TTcNRtY/3tFzuUjrBTtamNfLK?= =?utf-8?q?3p7adQkyuJDY3PixWAipl+/BjZ/5JnJghBlRXznjAwOfpSUryVK88A3PWoNDa+/Xa?= =?utf-8?q?db6J/N04jC1msrg10Lr4ikhoPfQq3hiUHQtZvYuH6Y44lduvpQOwEYDk+celcXWty?= =?utf-8?q?oCD+rWEKL1StuQaPpvPmbOhbHnKfI2M6JQ=3D=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(1800799024)(7416014)(82310400026)(36860700013);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: GZ63f9Rw8XYSPHLIfzTnv0/QTqeWmb9bniqneHp8uzDL9arG7Lt2e82aYiJxOm48uooQxqPfcCfl1ksiTp286yUZPnRcHqQz64YIRLPWwg9DbCt17nm7xmRfoSwMWsxzOFKDAwxNN4c/DMGImIpEaA26iG3ad20NtHULw6YLj1XmmZ6Z8MMHlsxa9lUa9Pg9nc4FOmRXCrp7iQitjG+EPR6G5HAxmEG5bzRJ1U/a3PsmWvtDHVnaU4dSngP+cE7MGho4T5BYHz/Y9V70TIHEsF5QjErRGB38DsGk7SKzuEMup5PreeMHKABPu6pmyV6u0tPXoVYfc/mev8hTSW1Bfonix2Cf7gFsozzVwetgOypnz6xWqAwynjInleYFk8NtbFv+m4RHFyRj2yVEHE0hq71OOK2ljeRyUlQEQKbP/BAGrSgd79H6Xwb/Wxe82xz31mkKpG/e8rv4fabPtwbFoUBeppc0Wnkn5qrLZB+i5AL43JN1ug+RPqwsL2ZYXwmsAe5DtuhRbC/d7ZshuImxi4YdciiWOc8IG0BulUwa048JdcsFD2dbl2IRHR1QjkskroDsJsJVhtMyZw6ZPrj63Wq8/7DtG1bKst6BbxxbbUkltl0g2R8BB1gS4rV0U/+d/iesvbSdIZQeT06SgYm4/w== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 17:04:11.9892 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0d8ab1c7-a05b-413a-b681-08dcff4e33c4 X-MS-Exchange-CrossTenant-Id: 753b6e26-6fd3-43e6-8248-3f1735d59bb4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=753b6e26-6fd3-43e6-8248-3f1735d59bb4;Ip=[50.222.100.11];Helo=[uww-mrp-01.datadirectnet.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF000397B0.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR19MB3788 X-BESS-ID: 1730999059-110867-12748-13473-1 X-BESS-VER: 2019.1_20241029.2310 X-BESS-Apparent-Source-IP: 104.47.59.171 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVkaGhgZAVgZQ0MLS2DLN2NLQ1M TcMNXcyNwoMcXY0jzNJMnA0sgsJdlUqTYWADHjmkBBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260269 [from cloudscan12-251.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 This function is needed by fuse_uring.c to clean ring queues, so make it non static. Especially in non-static mode the function name 'end_requests' should be prefixed with fuse_ Signed-off-by: Bernd Schubert Reviewed-by: Josef Bacik --- fs/fuse/dev.c | 7 ++++--- fs/fuse/fuse_dev_i.h | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 9eb191b5c4de124b3b469f5487beebbaf7630eb3..74cb9ae900525890543e0d79a5a89e5d43d31c9c 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -7,6 +7,7 @@ */ #include "fuse_i.h" +#include "fuse_dev_i.h" #include #include @@ -2136,7 +2137,7 @@ static __poll_t fuse_dev_poll(struct file *file, poll_table *wait) } /* Abort all requests on the given list (pending or processing) */ -static void end_requests(struct list_head *head) +void fuse_dev_end_requests(struct list_head *head) { while (!list_empty(head)) { struct fuse_req *req; @@ -2239,7 +2240,7 @@ void fuse_abort_conn(struct fuse_conn *fc) wake_up_all(&fc->blocked_waitq); spin_unlock(&fc->lock); - end_requests(&to_end); + fuse_dev_end_requests(&to_end); } else { spin_unlock(&fc->lock); } @@ -2269,7 +2270,7 @@ int fuse_dev_release(struct inode *inode, struct file *file) list_splice_init(&fpq->processing[i], &to_end); spin_unlock(&fpq->lock); - end_requests(&to_end); + fuse_dev_end_requests(&to_end); /* Are we the last open device? */ if (atomic_dec_and_test(&fc->dev_count)) { diff --git a/fs/fuse/fuse_dev_i.h b/fs/fuse/fuse_dev_i.h new file mode 100644 index 0000000000000000000000000000000000000000..5a1b8a2775d84274abee46eabb3000345b2d9da0 --- /dev/null +++ b/fs/fuse/fuse_dev_i.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0 + * + * FUSE: Filesystem in Userspace + * Copyright (C) 2001-2008 Miklos Szeredi + */ +#ifndef _FS_FUSE_DEV_I_H +#define _FS_FUSE_DEV_I_H + +#include + +void fuse_dev_end_requests(struct list_head *head); + +#endif + + From patchwork Thu Nov 7 17:03:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13866822 Received: from outbound-ip168a.ess.barracuda.com (outbound-ip168a.ess.barracuda.com [209.222.82.36]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE930191F6A; Thu, 7 Nov 2024 17:38:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=209.222.82.36 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731001104; cv=fail; b=mvjUEr6nb1rfT0D71dZJpRYD+hm4RDnbLEobH/zSUEgVyLkTKRujE1OurpmqqCENmwrUTEdpFnC6hBl05pVgaeejSEBE7pOclZvGaVEwhF5HZPcmxEvzHyGW3pB0oaiwNGllV/JQ4EmiIrsRNYc4ElmPnPjsemLd0IOL+CN/RqE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731001104; c=relaxed/simple; bh=qp3XmdsI95RnpqhMvcQU6Y6BK+0DGMicc5TzsLF6qBE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gwpeDF30XFfTzU9sW7A17Wl8InzaRdXSWcIp3QGSJFuYDVhVucVsK2PPeq43WP80QM4nDwMS2e9cBhsTeVZU9AOUGQSXxc4WCt24wvPjiZCstcvJt6fvagOEisQoq//6TDdFmAviMxFEHL4G6raoGQ2PiieITx+TWIcvwbHStgc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com; spf=pass smtp.mailfrom=ddn.com; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b=HLzAnvnc; arc=fail smtp.client-ip=209.222.82.36 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ddn.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b="HLzAnvnc" Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2042.outbound.protection.outlook.com [104.47.66.42]) by mx-outbound-ea15-210.us-east-2a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 07 Nov 2024 17:38:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=IjapuIfAlLah4nyqs/n7NKsWSrOHLllLZNr1abqckID1baybjNcZShfQaVToj0tHQ1jbSTQQ9A/C/oLpVxKAXufqRgDME1G8sbQ6C0o8ZwxDsB5OH/Nn4uCxqOoQpahWd4UZ5z6ykBtKMPJa+zcECzrB5DVdbwNnNef7zqgDc1C3q/+cjn9uuTRJlJAYJTrW4++lZi8PJJS5CURC0xN5AS1YdFZn2X3RjEPZHTvJElv8NAdN7wbiROh18egCtwsqeOpVjpX/VfbQWBxSKADOBTl3ep2bXTzQgdUZnXPBuou4vcahvbx5ygGDHQc4vLGdIb8hd2BK30HcnI2jwPgHLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=/oNa4TMLLXFZIwEaJyUIRnKy/4MYwHse8Yj0xKhVyRI=; b=SxpKiO5sR1yfXBdPfo3w6JKw7RnTo5MaEgN4lYF9Cza/qU1sIBPmmrsmzo9P327C+vIoG+P0Rex28AEt+Lhe13brC+DnKW+43FS4mjeMmMqXsrG9F97nc02gFFQgE077YUgRxzbHg7XV2pJK+hgkl/z6N18eG7+Ur+qVmea1KWK/xMKs1aFYDKLsvaJm9mRx9LIrMnNdxQpoJTrNX+hS/1fzgfApJyUpNkyCjy+SUYLVDl3VdY4VSXU9+XMvh5VRR3ku1WwNOaxCE3SXtNXrtl7sWxRe8rZi0WW0b5mI45X+PwAkZ19A3/WqIMeclvm8MwFFh1fsxj837zL/r+lcRw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=bsbernd.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/oNa4TMLLXFZIwEaJyUIRnKy/4MYwHse8Yj0xKhVyRI=; b=HLzAnvncUScne/fb7Rry8IpMTnjTv8rbcaxYJq8pe0Y9lIQ04Vqvu7TvUrBzKyjzs1hxy+WYij5NLqPtYjNmJqA/4dvKWUWO6L6M4fFBeDv7LnoK9Z2y9lp3TG4+fw4fmcRq5uhHgiQTYHDByKUM3wzy4xGqwtcYW6pyHHJad5Y= Received: from BYAPR01CA0007.prod.exchangelabs.com (2603:10b6:a02:80::20) by DS0PR19MB8749.namprd19.prod.outlook.com (2603:10b6:8:1ff::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.19; Thu, 7 Nov 2024 17:04:13 +0000 Received: from CO1PEPF000044F1.namprd05.prod.outlook.com (2603:10b6:a02:80:cafe::32) by BYAPR01CA0007.outlook.office365.com (2603:10b6:a02:80::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.18 via Frontend Transport; Thu, 7 Nov 2024 17:04:13 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by CO1PEPF000044F1.mail.protection.outlook.com (10.167.241.71) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8137.17 via Frontend Transport; Thu, 7 Nov 2024 17:04:13 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 49B2B7D; Thu, 7 Nov 2024 17:04:12 +0000 (UTC) From: Bernd Schubert Date: Thu, 07 Nov 2024 18:03:46 +0100 Subject: [PATCH RFC v5 02/16] fuse: Move fuse_get_dev to header file Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241107-fuse-uring-for-6-10-rfc4-v5-2-e8660a991499@ddn.com> References: <20241107-fuse-uring-for-6-10-rfc4-v5-0-e8660a991499@ddn.com> In-Reply-To: <20241107-fuse-uring-for-6-10-rfc4-v5-0-e8660a991499@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1730999049; l=1579; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=qp3XmdsI95RnpqhMvcQU6Y6BK+0DGMicc5TzsLF6qBE=; b=WdtX6jvPrGXeH0CIEnqyxYhzp7DmDXXoviz+bR8tnWYLjEbkzO7pVmUtG/njrwOazjvbM+N/J JBv502HOGnfApFznfFY3YqAqscVOOH8onD0CznZ3Y5Yn5wn7WSeNQmg X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044F1:EE_|DS0PR19MB8749:EE_ X-MS-Office365-Filtering-Correlation-Id: 0b2638c8-6d06-4079-9c87-08dcff4e3466 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|7416014|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?OpLi4h0RgZ015ZXb+zxEDMTXWzb2RuU?= =?utf-8?q?fJHemNbVzVWdl9KHD9WGOExp4BHlPD5kvx8A52F/R/z9EAoO40VOaYbQF2DeZm6/p?= =?utf-8?q?eznJ9kBlAX8qHDvGLdVVxPQ+w4KHQPGOBf/QJ6Xev/NZ5GxJVeOCkZdxwpwT0HBX+?= =?utf-8?q?QpxUxCtFVG8MwTOdd+kUV2zbKRnE/cbcs3ihJVkmR9gv4cHjfyPkO058tytNRhwPq?= =?utf-8?q?ZT56EgFZpFwvk1wIO3U+AKgdTGefuvcGECyzTCN0K8KJTW3dmZhBHiOnS4GAjD3bk?= =?utf-8?q?7oefbo6KI4G4DlQn6WqcZc6dUssF1P/s2gh+zqlkd0D8BriVFL6pSDcQCKvRrD3zA?= =?utf-8?q?ZzUwzdR/DrJ047l7cTxmKFUQgomkdHk5g1oQaw+78XaL1S8vJxpQYOfGg/sbOE5JV?= =?utf-8?q?wWaaZuFbKWChPJxhJ1iDpYC7Gaov6c7wYYTlHjZoK/GHj2l3L1Sf/7/QbejW4d0oR?= =?utf-8?q?y+aDfFoCQxaS2ipgqQTeYDFD8nid+0v4CAZc/sLieKB7oPjrA6aAhikq8yf8iRHQ2?= =?utf-8?q?pB1I0jpU0QQq+oHIqFcPH+IDBxMTqOvvKYW/h0tgqV+1mGRkmYBhQmphoqvAeB19F?= =?utf-8?q?eGu4Uvrx4mGwmvrEfurERObxp2mF76OduYxK99jU/H1RuogU65JAq4bJieYMAQbd0?= =?utf-8?q?2nYp/YJzrfCVyMzOPUL2pZlDTWSNVwCUOAiGztGm+ACU87l2AwV6lB9l9Se8PhKR/?= =?utf-8?q?DwDpbJ5gXrpDj1mJKnTHKgjgGKadLpkq5zXFf+c1B6NUBihNDSnNYe9lmcNF0IfGb?= =?utf-8?q?kLu6sOSIoFiTKjQUhJMzXtfDyKKZzGBxGQKmjlKWy27RowtwqR74tOfCE1zH634HB?= =?utf-8?q?za6ubg9qagwSkM/P0zOHSZ8fzAoId+mfSF/gI3IaFNAjdcdXcuSwdGqGSdfNpIpm/?= =?utf-8?q?FohsQfS+4iLp9+jL3SQnQKdB9i1Xe4+mdCbHuhmwjgxBXabIgbZ1Apki+tCsgnBtR?= =?utf-8?q?0EMqOgT5nhkNSEoXcBwfsT4Cum8x/RC9jGuNigfJvS27nyLWnKrTaVTMme8kI3XSh?= =?utf-8?q?pUKJqoPuz2tBWONvEmI3FKmasoEYZCFlth00uqbBaf+cnNfGsMubU2Z1KmPrFPDIV?= =?utf-8?q?wCB0X3L6bp7CpwZtYgfMJEWxuA+jZK8K1Okzrek+u8hUk4eGtV11oGS/B5CQfLyPV?= =?utf-8?q?T7quSz+hvdNRmlkhJ+r2VV754/ZongrNU+7sxzPD6w3z/M41I3J5VKOjz2TTap99L?= =?utf-8?q?rrMiCSpsPIbTj8wWpGuOyA9FZ5XGnlQkOb1y4ljBA5qewKaPYvkoremjJdZfW2uQH?= =?utf-8?q?ofmOV1VG4E3eefTPROj2RolXTm2S/Ul1P3/w/vDQJoxVFEONMWM3Vamm3o9a7WkEX?= =?utf-8?q?V5hVKYmUQV6gt9UIoQh32QCx+V7+RKGnkg=3D=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(36860700013)(7416014)(376014)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: LPY/WRhrkQyVpVww5HnsmUwo5CEuvpPhr/CqhEvarDlg03VYIJieP+U9XsAXJbOhexB6IOY/YPY0Q3Kwb7xmXYHrpMivkL0ZaWJ9owB+sLeq64ivbOy73dzQyjz4hApdPcI9w2sqkASRTts/ELQPAgHhPpCn1WPiPYS8edTIr0fCbtjNnRpjCjhDEYqyvM0Ltqr+PyRqvC3GLCe95ayNsNse/y1KRsPl5VXHL0NVKhS0zKphOOm65cdoAnjS/vvb7n1gMOEVK5K4xHc3ftQDIlzzRBg2cQ8FBl/Wq/G4Iv3et+5ntJxUG/z/Ogwhv+T148KE+pV4MC0nX2GA48+M1dL7ILzd8ZRXqbSGlKm37Bo6mN0vCFt3DpZWQ+itYDJBhBT3PBCBwzfVeORToVLU+QnBrD5GP0H2vDf7R7/K9S82ZNOR2pUvZnMYoBxWS5MuIzDsFdxKna4MlyTvI6W74RaKyJpEwkgzflayBzX7sBxqH8bmKSAx+F5UDK2gunZjB7f4QSBZhuEuBh0Ej1bhBZGTGPObGBKHamDcOgCl4yxd+yJQz96fQdVegEG+JUCllGr3c7cOK15BeRNKXIETiiE9SCB4j7SNxqBUx0GcvAMsUVu8aSFWjQvklHPG/u3kIOKKd7rS3+Ed0aERCclNcA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 17:04:13.0502 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0b2638c8-6d06-4079-9c87-08dcff4e3466 X-MS-Exchange-CrossTenant-Id: 753b6e26-6fd3-43e6-8248-3f1735d59bb4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=753b6e26-6fd3-43e6-8248-3f1735d59bb4;Ip=[50.222.100.11];Helo=[uww-mrp-01.datadirectnet.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044F1.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR19MB8749 X-OriginatorOrg: ddn.com X-BESS-ID: 1731001095-104050-19924-4508-1 X-BESS-VER: 2019.3_20241105.1723 X-BESS-Apparent-Source-IP: 104.47.66.42 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoamRuZAVgZQ0NzY2DzZLNUyyS DV3CIpNdk8NdEixSwxxdjSNMXE3CBRqTYWAE+IqGRBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260269 [from cloudscan20-190.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 Another preparation patch, as this function will be needed by fuse/dev.c and fuse/dev_uring.c. Signed-off-by: Bernd Schubert Reviewed-by: Josef Bacik --- fs/fuse/dev.c | 9 --------- fs/fuse/fuse_dev_i.h | 9 +++++++++ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 74cb9ae900525890543e0d79a5a89e5d43d31c9c..9ac69fd2cead0d1fe062dc3405a7dedcd1d36691 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -32,15 +32,6 @@ MODULE_ALIAS("devname:fuse"); static struct kmem_cache *fuse_req_cachep; -static struct fuse_dev *fuse_get_dev(struct file *file) -{ - /* - * Lockless access is OK, because file->private data is set - * once during mount and is valid until the file is released. - */ - return READ_ONCE(file->private_data); -} - static void fuse_request_init(struct fuse_mount *fm, struct fuse_req *req) { INIT_LIST_HEAD(&req->list); diff --git a/fs/fuse/fuse_dev_i.h b/fs/fuse/fuse_dev_i.h index 5a1b8a2775d84274abee46eabb3000345b2d9da0..b38e67b3f889f3fa08f7279e3309cde908527146 100644 --- a/fs/fuse/fuse_dev_i.h +++ b/fs/fuse/fuse_dev_i.h @@ -8,6 +8,15 @@ #include +static inline struct fuse_dev *fuse_get_dev(struct file *file) +{ + /* + * Lockless access is OK, because file->private data is set + * once during mount and is valid until the file is released. + */ + return READ_ONCE(file->private_data); +} + void fuse_dev_end_requests(struct list_head *head); #endif From patchwork Thu Nov 7 17:03:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13866755 Received: from outbound-ip168a.ess.barracuda.com (outbound-ip168a.ess.barracuda.com [209.222.82.36]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA79B2170C2; Thu, 7 Nov 2024 17:04:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=209.222.82.36 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730999096; cv=fail; b=Fpu/eZahhFCsmV90s9eqngyAkx5/xOnR72T2VweXdI4VYXIBbdyZ5Stz3iA2Ub+sm4frPJvQhGXIu0vAP7a+YZAqUJ7Ya3HtA8cbNMbFno2WhBbDka5LzuLVWbRw1Ly/0WN5LX/gnmPftwUZvOFw3CNWFxPfspjcBw+9Kj+GzlI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730999096; c=relaxed/simple; bh=kxd7WZI62yzyG8I2jj0Qg1Mf0LWeh2pb5fEjZ+QpxYc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XVjT3xwHvkT7Z8gK8cLWoH4U5r3DD26YXA3fxFSS4LUhVI3psUZt5kwZTzeo4nQ+tZHYiMQJXmj8Am24Isl3chjg5AV+/H4IxVF/UqwojopOzq7pNNJRBVdytbT24s04TWtJgXoqWBAFzMLV/1XS+rE9kTdo7A0A3/k6gruNpsM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com; spf=pass smtp.mailfrom=ddn.com; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b=W19WHX96; arc=fail smtp.client-ip=209.222.82.36 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ddn.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b="W19WHX96" Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2174.outbound.protection.outlook.com [104.47.58.174]) by mx-outbound8-74.us-east-2a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 07 Nov 2024 17:04:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=x/XVCEyyyP+ofTnjN8u/5XhDPQjwds35vR8I/jzegRVJYcg8+01wNPXJ38WlJLPsx83Uw+TnQE+YwJd/nBVSVl8VCUEtzadS/amr8zHKvqi7M7T01swGHYcqn++3ei7VBpvUqL0WVGKNefUfg5w/eAYLSu8psx/5bkhKIL8MQVjQu8CftRF1J5JFI+sTVK/zvVq6F6cj7snZMTxSNbfqhRwg9fM9saupTjEzXhrDQaEb47PEWAgeRDbMLwaYmOQyXwwZAXI+x7vA25mOrQ6/JIBhrEHzPTe5ARaZpW2Qe3jGc3WeuM+PLXT8aShDi7dW4pud+GpRx/1kz3NK4qSreg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=KcIGYKzNIixd5dmjaCE4zhPOtcctg7hqHSHo7mkIorA=; b=ToeIE8rGHMAT4XtLdUmgM6+uyS82ZAp7+5+0xNnWEjmZtZrepIhNXvHkiAnjZSWY1wpBuzAVAhDIcXc0vcb5ckZOfk0WBF7FzERGVWp0GDN06G0drFX5vfzbOI6bXfAnyAk2CZk4uBhJ7nhu3h/Kp2VjmhcASUv2PBO3ZaJ5I8LSkmeOURR9VFZAf2NHAFbc9lsh3xsIDQHNEXvBo8i1fYRxDhqwXOzPua/5nmJ2axQSFN+2Hyiw04wKH5wNY7rvYKXYIaPENfAFA1lMgvOAtJyvQ8lJTl4Gu5OFl91TktZUSVSaVljMJeulC5sSNBUk4g57+ttscDKcxRRwJM0jfQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=bsbernd.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KcIGYKzNIixd5dmjaCE4zhPOtcctg7hqHSHo7mkIorA=; b=W19WHX96f+LX4qfZ+3QbszLX41iw9Rc4fYm7kOSGEXOTj7VDNltgE8+/c8c6ISYdKLr8m2RfFoAQTh3m528JkCR6TAFMSusuBDXI456D+7v221YvbE6dAKQ6KLeeTcqSug3Do9evd9u/FGjE4iVNqa43Jgk2sMkvULYEqGhpCHA= Received: from MW4PR03CA0257.namprd03.prod.outlook.com (2603:10b6:303:b4::22) by IA3PR19MB8708.namprd19.prod.outlook.com (2603:10b6:208:516::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.29; Thu, 7 Nov 2024 17:04:14 +0000 Received: from CO1PEPF000044F3.namprd05.prod.outlook.com (2603:10b6:303:b4:cafe::30) by MW4PR03CA0257.outlook.office365.com (2603:10b6:303:b4::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.20 via Frontend Transport; Thu, 7 Nov 2024 17:04:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by CO1PEPF000044F3.mail.protection.outlook.com (10.167.241.73) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8137.17 via Frontend Transport; Thu, 7 Nov 2024 17:04:14 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 44240C6; Thu, 7 Nov 2024 17:04:13 +0000 (UTC) From: Bernd Schubert Date: Thu, 07 Nov 2024 18:03:47 +0100 Subject: [PATCH RFC v5 03/16] fuse: Move request bits Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241107-fuse-uring-for-6-10-rfc4-v5-3-e8660a991499@ddn.com> References: <20241107-fuse-uring-for-6-10-rfc4-v5-0-e8660a991499@ddn.com> In-Reply-To: <20241107-fuse-uring-for-6-10-rfc4-v5-0-e8660a991499@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1730999049; l=1326; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=kxd7WZI62yzyG8I2jj0Qg1Mf0LWeh2pb5fEjZ+QpxYc=; b=igczCXxA6W67b8Tdytsic/uThPq6paPKlLPRcy/+Dx/5JJ7J2jZQCK5MKGqjFoxUfYI2mdmR2 ZR2NCpswOF/A2gFznwI24PZIwQUdyNviT5ka9ojY7L895/cO6sN7R1r X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044F3:EE_|IA3PR19MB8708:EE_ X-MS-Office365-Filtering-Correlation-Id: e134b788-72a3-4d1a-b96f-08dcff4e34f9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|7416014|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?Zb1bN98PqzpMYuuOHVRuX1FkGKAXZam?= =?utf-8?q?y0WisWEmJ18oDZy8PJpr8/kgF/TUzet60oh6XbSgLmkvd42Qi5XD9DmR/fqZNbb/t?= =?utf-8?q?OMQ5G+Ix9PfBC0hmqI5l+646mAAWeroeMjFRzsgHhPZTgzzAg8rFGPOi/um0RMwQ8?= =?utf-8?q?npVQS44rCgjvcjM9T1tBGXQ8ZUQwYRe/xIsI2mbr5zG2f11L9K42S0E8THHo8foKT?= =?utf-8?q?Rc11IotMxTXDDNBPZynvYGDDD9Q0Ebh1V9pT8yZZ1rV0RAkPEe46wNbWSfvs4Us8m?= =?utf-8?q?Rr+FKl5zQmceEZmQXRFQZEbWsbg4MYvaPJg0wxToHnwLIfcnauWbUqY40VDfYIB0q?= =?utf-8?q?H0TsxSfDxRVOQZHeRfr1f2Tvn64aWOfuquj1SYuE+Vss8P6G3wCQ9UKkY7MkyNElr?= =?utf-8?q?W7bxkFOT7x1ho5JnT1C3kne2TnU/C5UqgR7x80s3AMjV25DygwkbgvI93SzNm2kqI?= =?utf-8?q?iuiWhM1q8sBThBP8ftYjvVXbX6qWbSE6pKQLKaYLQBxGiEOeRRxtRAZHb2kHetzFG?= =?utf-8?q?px6gbg431s++UnHFaI3RYqFHE364z2J58QBY8BSIrw99TbV9+idf8pqR2ii1pJaFH?= =?utf-8?q?hNFltGMtjByvQP217rWQ7HQpvMWkp6aDodXSQoABvCBi66E5CyKygIEw5+mVgtYVQ?= =?utf-8?q?0IWJJ7em6x1ZUhZ1z7MYH0qX9KNhAftYKXe1/xYUF6iiNtRSL3Cbgi/41IoRUBp4u?= =?utf-8?q?495kq0KzaXgG6kEhLRdLv61wAAYG30NVMJoWxDDrMIjU3mUBL4ZQ74ubGj6sRLcpn?= =?utf-8?q?pC652411ciOSaGjPhccVJ06GWHmSN9tR66dhvb+rf1JrZpc21Vq3MJNSjisalXi2r?= =?utf-8?q?aChwZhPGgw2EF7xihWrj9Xy7fRgIf2W9MS5jXilcQmAVkiOlVKK5jJ7Ub6qobQ1FQ?= =?utf-8?q?iz4JXlK2ZTmL02is2QU3OMgdj7kH4HSUf9zUAnGsa08Qed9YeErB+4jh5lTlYxUmU?= =?utf-8?q?Ollp6VzwQ+cKgZqlxQjgILW4Fbtf6NJ1psyCCgkNiNdxGWgCaRXTOhKT2GAZUJeIj?= =?utf-8?q?Xg8tF6QdgwM6iLAfCp2Dx3t5OhSUYqpjEWv5Udkuaboi4brDSs8sK4qMEvlTQn7gC?= =?utf-8?q?FW/xdVMEBw1LBzLLkfmqB/N2gu8iwLFnKeZbrhJaY4PLRApwnCVYvR2QSfy8xbDFi?= =?utf-8?q?jX6V6AblQvMZf2ZXEBOK3928MwhDBG2f3Htm5l7n1djuBOzwrKXUFAj1L+f2uxLvu?= =?utf-8?q?Ya/3R4vuVGijys38QbmWncW82nLQq5wcu0CUbrijwFzpKGUHyc7gB+FCtgfx/q7qD?= =?utf-8?q?VYdOXkv74C4K1Jc5eC4vaxTEWYMU8hw2eyS6/B1XwwPH2KZJy8KjuWE/cqzDeZK5t?= =?utf-8?q?luc7BH7f5hlU6PWQZ98TOHsR9MT0QFti5Q=3D=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(376014)(7416014)(1800799024)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: pLuCOWuBH/7yrknc8xYCcPXq8VSeIZYFNOQHC6nFA98gQpvh5JM7QljpNWHXeYIig5nw7pfMu8QpjlvQSkJrsR6y62GUj3RgsOoM9wgvD6ykt3pbrNv24w9F1PTMdXFz4gjHAf734otwrk20mGr1VDZrapM/gVgFuiPk3Iun6zHIghqvRkS5Ardmf6ycWZLD37y6Ys1LCHRmztRVjRynM6JQXSokYixwNEXKLjRdNS6u7eNVfcOd6aSbit/8hWvjxzfudExfgaqKgQOvlMPoGsiYyy0xXciXgFHLGatG5HVMa0BNQ6etpC0tDnAfeNj/XGBrY9s6sN/Nq/4loh/jKrG3pK952mvHTINhOqigb+TXbMEThQeR7UYsxqJREhZmWkGU53aJeWciNs6+Ddrv2k+pYMBt1a4mz6QVQvJpxGVZSYlQtbvjn2lIbuAhbtyhm/EUlj10JI4aIZ0hjNXEsumUd8DgbvCLbZGwWEh1Ku+rAfVP2YHb9pRHaJ/p2hgOma+zBozYbSyF6TFliKeCFbt9QsDgYBpHk73NQW0LvBJencA+g4I2Lm3ipuAqQIgwYIXQDbY6SHO5o15g3mNsb5N5b0euLDIHqXMQebrlC+EoVm3XiTgFT1Nkm7cRH737Zg20iRLRhcX/AXqPsUpEdA== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 17:04:14.0143 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e134b788-72a3-4d1a-b96f-08dcff4e34f9 X-MS-Exchange-CrossTenant-Id: 753b6e26-6fd3-43e6-8248-3f1735d59bb4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=753b6e26-6fd3-43e6-8248-3f1735d59bb4;Ip=[50.222.100.11];Helo=[uww-mrp-01.datadirectnet.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044F3.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA3PR19MB8708 X-BESS-ID: 1730999061-102122-12672-29984-1 X-BESS-VER: 2019.1_20241029.2310 X-BESS-Apparent-Source-IP: 104.47.58.174 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoZGFqZAVgZQMMXEONEwJdkkxd LMyDTZ2MTE1Mws1dQ01TTZyNzMKNlAqTYWAFfTRnhBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260269 [from cloudscan16-55.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 These are needed by dev_uring functions as well Signed-off-by: Bernd Schubert Reviewed-by: Josef Bacik --- fs/fuse/dev.c | 4 ---- fs/fuse/fuse_dev_i.h | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 9ac69fd2cead0d1fe062dc3405a7dedcd1d36691..dbc222f9b0f0e590ce3ef83077e6b4cff03cff65 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -26,10 +26,6 @@ MODULE_ALIAS_MISCDEV(FUSE_MINOR); MODULE_ALIAS("devname:fuse"); -/* Ordinary requests have even IDs, while interrupts IDs are odd */ -#define FUSE_INT_REQ_BIT (1ULL << 0) -#define FUSE_REQ_ID_STEP (1ULL << 1) - static struct kmem_cache *fuse_req_cachep; static void fuse_request_init(struct fuse_mount *fm, struct fuse_req *req) diff --git a/fs/fuse/fuse_dev_i.h b/fs/fuse/fuse_dev_i.h index b38e67b3f889f3fa08f7279e3309cde908527146..6c506f040d5fb57dae746880c657a95637ac50ce 100644 --- a/fs/fuse/fuse_dev_i.h +++ b/fs/fuse/fuse_dev_i.h @@ -8,6 +8,10 @@ #include +/* Ordinary requests have even IDs, while interrupts IDs are odd */ +#define FUSE_INT_REQ_BIT (1ULL << 0) +#define FUSE_REQ_ID_STEP (1ULL << 1) + static inline struct fuse_dev *fuse_get_dev(struct file *file) { /* From patchwork Thu Nov 7 17:03:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13866746 Received: from outbound-ip191b.ess.barracuda.com (outbound-ip191b.ess.barracuda.com [209.222.82.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D12B7216A05 for ; Thu, 7 Nov 2024 17:04:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=209.222.82.124 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730999080; cv=fail; b=JzcL6Yw9s3NiWPhCvxODHkK2b5kOSrW6tnIZLzWaifdk9YsFn/UEuJHylSWTD1R2pd5jMnRnT0y+cu0Rn1pxEhscwb8fM6jDNm9gWqXB8XLu4ulTF2QZNoFnshMty2G775IHnIK7cU/Ihk5/xn3Ytc8TQ7N1SS8719rtBAY/CqY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730999080; c=relaxed/simple; bh=LFN5iHBpQL1ZELcsQiNVADSnkWR8kAU4UAejqcRjIy4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=E5sArCXOHjV8jHbaAsOjsI4LomAaj28slurxGAGgxr3RajdNQFd3iT7sa5Os2ruWi+Aq5Oo9RIPAekHZvO6yapDCSCObwHGy8fACxn3BA/DtvUoH2zjeULfIEGmA62pb7LbQxCFpZZ9Hik7HiENAAN3+T7x1TCvYBDirkIUL/94= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com; spf=pass smtp.mailfrom=ddn.com; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b=GTd7cY4d; arc=fail smtp.client-ip=209.222.82.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ddn.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b="GTd7cY4d" Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2169.outbound.protection.outlook.com [104.47.55.169]) by mx-outbound16-173.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 07 Nov 2024 17:04:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YmZGvVNXC7qoUMM7O6FYAAf+/f9TC85gr2Cu/aVCeEXAuuUXf6G6CBb9UooHV45/IUxdv+xf3yrVzEI0jui36A/aDEK9/qoLu7jzU1MK9wG1oJkTaSVTDsykpsG1I7AIHe9Ef1ez93VFLFxw2uBa/hvocHrHZVKOBrlkRJRJC91yUxLAc7yJypBK6oJeK5QzYPFyItV6N3ly/wwei/i/2Ha8SNOpaPcnu2Qj6Sq3PteLBKjYYvbECggqg85DWIypDZxpsH+LSgLyXZNbMMWTDOSf+aEG8h1qH57RVIOKtcIB78mjqnLnoc4g6GH+xy7Vv6OLZhByhAZncvekE/oAgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=LHa7n4UGF0oKchdUGLawEi6S0wIRCEXCHai9Y5sQ2zM=; b=o4z34C7xdcWJYn05q5seYYfHlD0lH41XENugTUq0BRjtm8y7yu/c2FuiRXcIqTrMHoae5P83Uz3l9e2fTd6XEhfxCWCKi0oQol4Lee2VD+97jnMbqT4X1k+iz9y6QIxFEggq/HYczO1B5Vlo/th5NiH4IKUyg2eZkPomJPBqdU07udyRPmnE4+K85i5jfrEaAVjXk0B5z0vxLMwqtFUMJaf3R4QnazIazSGQuUnddpDs40vsYVwO5BKJ5M8STa++epgk6srbEk73H6tLHUuef7M3ImZz4hjVjBUdsw7KbIv8jh/QCtKWLn6/9Bv6Jy5zJg4pV9s6RPEJ/RT56qG7sg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=bsbernd.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LHa7n4UGF0oKchdUGLawEi6S0wIRCEXCHai9Y5sQ2zM=; b=GTd7cY4dndIy21eUwB7WUfRo/Oi4rcr8QS6AfB6n0JSgK6t3ySOZm79yXYkbMAMjPRSmlKoMsKa7+QEJlmEcBIm/iZq9mV36493RsDt+F3xmRoxgiv6rARfF4auTAgUOAIQzn3ArAKTDlHcDQ5L3F1ZX1v/dkTdLG8pTNvXS+To= Received: from MN2PR04CA0036.namprd04.prod.outlook.com (2603:10b6:208:d4::49) by SJ0PR19MB4543.namprd19.prod.outlook.com (2603:10b6:a03:284::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.19; Thu, 7 Nov 2024 17:04:15 +0000 Received: from BN1PEPF00005FFD.namprd05.prod.outlook.com (2603:10b6:208:d4:cafe::8d) by MN2PR04CA0036.outlook.office365.com (2603:10b6:208:d4::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.29 via Frontend Transport; Thu, 7 Nov 2024 17:04:15 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by BN1PEPF00005FFD.mail.protection.outlook.com (10.167.243.229) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8137.17 via Frontend Transport; Thu, 7 Nov 2024 17:04:15 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 3C1917D; Thu, 7 Nov 2024 17:04:14 +0000 (UTC) From: Bernd Schubert Date: Thu, 07 Nov 2024 18:03:48 +0100 Subject: [PATCH RFC v5 04/16] fuse: Add fuse-io-uring design documentation Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241107-fuse-uring-for-6-10-rfc4-v5-4-e8660a991499@ddn.com> References: <20241107-fuse-uring-for-6-10-rfc4-v5-0-e8660a991499@ddn.com> In-Reply-To: <20241107-fuse-uring-for-6-10-rfc4-v5-0-e8660a991499@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1730999049; l=4808; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=LFN5iHBpQL1ZELcsQiNVADSnkWR8kAU4UAejqcRjIy4=; b=ndCnzBsNqxSOfcjS2r2PJQegPhOOKVt41UpjSkL8R9QouUPVbEzVP2Hov5gT1X8PddicqIsys iuJJfL5kDm1DC8tG4xsaeuk2jN9iBBrQ9vbd7OBUfEiuTQ1z3xx+Q+F X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00005FFD:EE_|SJ0PR19MB4543:EE_ X-MS-Office365-Filtering-Correlation-Id: 98e0d213-08ec-4454-ce42-08dcff4e35bc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|7416014|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?M8TtdIELTCLt5PliZLhSt14Jx0CVcr0?= =?utf-8?q?QYCZjg6++060kg4xqpRJ0X4eNgX0lVSfs91hjFx7QzdgoRC7tNVaVqRJMnLvJwHoC?= =?utf-8?q?+b1A9bIdFXVlEx8IP6gclQiE+8nDUUSNgdZBV1CXO8shsh/pEPC5rVNqd4+DRmwDF?= =?utf-8?q?WcbHa/UukjKo+5EpPmHHqER2zOn3xsSUCTSSCjnOZWiAbVxoRD97pFf7234gVLWXy?= =?utf-8?q?xofwO0cO8zzn/XnsaV0EsCsXjNxytrddb2TX/5VyyVqyGxBchT4Ub65cZNQBihy7e?= =?utf-8?q?gaRQSwGatg413JT8XVMv2f9+zMR5gfJnpcg+8s7SB+pF96xjfK7VBCsLPf68Ky0mv?= =?utf-8?q?oPytPMX2EDt137nDRD5FGj5DJeMziFs8EXZntpIf/cMsg0kNyExlOKRlKUcdBJK4L?= =?utf-8?q?QMjyQVOP4VaY6XcXQO2eYrsgwhsr7dz+CFg2jYRCIyHUNo0esqIx4Jn7KUUfP6VEV?= =?utf-8?q?pb58E7msWz9dpXgvs4djqdQWpplpDcVrDuvJu5uJFky7liKv0vUahcNLBZ/lC32pI?= =?utf-8?q?iwbRmHnSJJJlqL172jP/rXolUGBWOtz/PYIZB4ldNtHWngPQskWuYq1RLDNe9hsER?= =?utf-8?q?IHmATt6c1zjXgCs11clH7v8P7IhEYL4FrmTpqnxWtw+Xgrq2d/0tYRrkJoLZi4PvQ?= =?utf-8?q?0adrjjhPlDLPDB0xjmesvCjtRtswWekpOidJKXzwC0YGxvJq+97eUs5o5WBPYFrf0?= =?utf-8?q?LnG0cxlek9/gHqs5Fam/Cu/h0IycQi1yKXF5CR/zL/3/iup7QGgAoJtAWoVrXtDUt?= =?utf-8?q?B4rJdi8xlTcRPdHcxmYbjVNz0rd7jznX4ncitqAQyTgx7KdxspLId5Jx4S9xIy44v?= =?utf-8?q?xBq0CWTiOtFuERMCZdNOKVQ8nb7y5v7l53ZNhr9dj+sgmYbFecA/8MLPYQQIoAApx?= =?utf-8?q?Rah2Yl+Pji11LH00qbRQs9QcwljnHAOU9EVba21XFAM9zY43Eers6TBDUkDqBfhd5?= =?utf-8?q?jXSzXR2jUvkcCv6eEaPvXmRWeTu0Vi/pzJ/z5AtQtctFqb3r2HPmTyZZBYIA5CK0V?= =?utf-8?q?XMaroi/B2XfQ9Ix7vstfslClMDHAsCGTT7af5k3LBZdCkxtsHcCH/BqqysFnY6IQI?= =?utf-8?q?EUyUvZFn/CG7DA/lxFW99+h3f2oE4odZihhnFPEEUzOhHXS+CwmOcozI2+qQhjrUo?= =?utf-8?q?QXKKTHx0qV8qU2RzI4kpCulNN4Sm/tmtl1SoXNHgDM63ucjMqJ1njEbyj8POJTb5k?= =?utf-8?q?+cGucyFBuJ5hvmL9UnztdNs2ctKth0Var1Va6I724D6W+/OFF5ePdScmPMDT9xKDE?= =?utf-8?q?smBG2wxsEqm0GAtlXwclm0tD9/2wX6pgrIuWKposBk8bqjKn++vQFmtnfgotVXxJq?= =?utf-8?q?xO/HYpwVKuFQIyHJ++LkFpuvZHs2AbCyNA=3D=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(36860700013)(7416014)(376014)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: mZaRPXNQQtChHi4GDVJhWh+jcYqi/cwKhKgNgjkWveJMG79PmZs9YogUxlwkl+YGewJejdUr/VrJQWm7gxmwv4cO6La7gJbGYnyWRQQxweUdhfsXdE0bgcLT+iSTOdmdxDNWXLzTVvUnbhO8E7QNLAXogMk7yXf/ik/avNDViNvAc8UR8/FTzfE3xHJbcEWyB85ERLi6uxdq+tAz6+HEr/p9YqEhwYEuFdaWPLrvgWO9UuGCA37nfAzbuVC73JjvBN53RnTNMDrO+kh1aDl+nz5oXYrO07goWeZ4wJGi6a1QHXQZol3Sb1IV/VC/jFgsxyOOvhWHSrTMJnoXWa+oxbjoEsWJAZh8Gy+Oq+67LBantnxQRi8j9bkYz6EQ7FA+KwqtvY0+Ypb10HY0doKbFvDpFjAqlO/cyjDDrhI9cwc3Lo6KTZAfp+WWlQk+/PFMRUoEmFfJX+JI6I2jDITph8WxfOl+2XXD8U9JdgGkRTWKiLeknVhyRUqGC8XLDfk98mf8opZYnZP7BcpQDql9fkLsi6EV2jep6E3Ov53oPnMA1uXG5O014kHZvI2C+A6cmUpcrK5CpI7JzHvhAy7Keb21/76adlChVZRdlP/qU4gFEkvti5T5aOaEVXfVmWuzRBJPqsGIPVEJrUmWfdZdGQ== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 17:04:15.2459 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 98e0d213-08ec-4454-ce42-08dcff4e35bc X-MS-Exchange-CrossTenant-Id: 753b6e26-6fd3-43e6-8248-3f1735d59bb4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=753b6e26-6fd3-43e6-8248-3f1735d59bb4;Ip=[50.222.100.11];Helo=[uww-mrp-01.datadirectnet.com] X-MS-Exchange-CrossTenant-AuthSource: BN1PEPF00005FFD.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR19MB4543 X-BESS-ID: 1730999064-104269-6950-6632-1 X-BESS-VER: 2019.1_20241029.2310 X-BESS-Apparent-Source-IP: 104.47.55.169 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKViZmliZAVgZQ0MLE0ijFNMU8Nd HA0sjQ2MjcPM042STZzMTIIi3FKNlcqTYWAKwEH+ZBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260269 [from cloudscan14-29.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 Signed-off-by: Bernd Schubert --- Documentation/filesystems/fuse-io-uring.rst | 101 ++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) diff --git a/Documentation/filesystems/fuse-io-uring.rst b/Documentation/filesystems/fuse-io-uring.rst new file mode 100644 index 0000000000000000000000000000000000000000..50fdba1ea566588be3663e29b04bb9bbb6c9e4fb --- /dev/null +++ b/Documentation/filesystems/fuse-io-uring.rst @@ -0,0 +1,101 @@ +.. SPDX-License-Identifier: GPL-2.0 + +=============================== +FUSE Uring design documentation +============================== + +This documentation covers basic details how the fuse +kernel/userspace communication through uring is configured +and works. For generic details about FUSE see fuse.rst. + +This document also covers the current interface, which is +still in development and might change. + +Limitations +=========== +As of now not all requests types are supported through uring, userspace +is required to also handle requests through /dev/fuse after +uring setup is complete. Specifically notifications (initiated from +the daemon side) and interrupts. + +Fuse io-uring configuration +======================== + +Fuse kernel requests are queued through the classical /dev/fuse +read/write interface - until uring setup is complete. + +In order to set up fuse-over-io-uring fuse-server (user-space) +needs to submit SQEs (opcode = IORING_OP_URING_CMD) to the +/dev/fuse connection file descriptor. Initial submit is with +the sub command FUSE_URING_REQ_FETCH, which will just register +entries to be available in the kernel. + +Once at least one entry per queue is submitted, kernel starts +to enqueue to ring queues. +Note, every CPU core has its own fuse-io-uring queue. +Userspace handles the CQE/fuse-request and submits the result as +subcommand FUSE_URING_REQ_COMMIT_AND_FETCH - kernel completes +the requests and also marks the entry available again. If there are +pending requests waiting the request will be immediately submitted +to the daemon again. + +Initial SQE +----------- + + | | FUSE filesystem daemon + | | + | | >io_uring_submit() + | | IORING_OP_URING_CMD / + | | FUSE_URING_REQ_FETCH + | | [wait cqe] + | | >io_uring_wait_cqe() or + | | >io_uring_submit_and_wait() + | | + | >fuse_uring_cmd() | + | >fuse_uring_fetch() | + | >fuse_uring_ent_release() | + + +Sending requests with CQEs +-------------------------- + + | | FUSE filesystem daemon + | | [waiting for CQEs] + | "rm /mnt/fuse/file" | + | | + | >sys_unlink() | + | >fuse_unlink() | + | [allocate request] | + | >__fuse_request_send() | + | ... | + | >fuse_uring_queue_fuse_req | + | [queue request on fg or | + | bg queue] | + | >fuse_uring_assign_ring_entry() | + | >fuse_uring_send_to_ring() | + | >fuse_uring_copy_to_ring() | + | >io_uring_cmd_done() | + | >request_wait_answer() | + | [sleep on req->waitq] | + | | [receives and handles CQE] + | | [submit result and fetch next] + | | >io_uring_submit() + | | IORING_OP_URING_CMD/ + | | FUSE_URING_REQ_COMMIT_AND_FETCH + | >fuse_uring_cmd() | + | >fuse_uring_commit_and_release() | + | >fuse_uring_copy_from_ring() | + | [ copy the result to the fuse req] | + | >fuse_uring_req_end_and_get_next() | + | >fuse_request_end() | + | [wake up req->waitq] | + | >fuse_uring_ent_release_and_fetch()| + | [wait or handle next req] | + | | + | | + | [req->waitq woken up] | + | X-Patchwork-Id: 13866745 Received: from outbound-ip168b.ess.barracuda.com (outbound-ip168b.ess.barracuda.com [209.222.82.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E0D72170AF; Thu, 7 Nov 2024 17:04:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=209.222.82.102 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730999080; cv=fail; b=okZuI7yHf9IgAYvCokT5th574UA+w8VtCacmG3iv/NsCLWJbhG+3W1vpa8b9arTcwRRLmYNsAwbUrpyiOdok6QfC8cuSMn8peMZxbnM02Nj6EHgYoNLaIwbIGfPzp57+GtG3z7l1rK9ujYMVw+42e+TmSYwmrPsoEey3IgSxbZg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730999080; c=relaxed/simple; bh=hj7RRgikG7hzVLz5Xt3Qr5QdpFRTN5r8a2u+RPCOzOs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=aqRNV071cXzcSsKOxOL96aDCin3T94X/0hR4L/r4+SEEncjC9jNwQscLDKn1LQPSpykiuaiW/Y0V2DMyPzvZnMMTjKnhT10VlyN6nCmXeXvLV7BJ26Z9u3Jx8nDckoIsfHYmPlnXRjWOJD06bkc9x6pMHDVBMoRqgzdPpFCDklY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com; spf=pass smtp.mailfrom=ddn.com; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b=Z3Nu8LJj; arc=fail smtp.client-ip=209.222.82.102 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ddn.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b="Z3Nu8LJj" Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2175.outbound.protection.outlook.com [104.47.59.175]) by mx-outbound41-169.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 07 Nov 2024 17:04:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yfYjl616YbWRgw/WWzUR7PFjHsj2tJ9ZlsasjJrg1IroSEPp4P3RYropI1+FWyhO1pVZSlRPCUkqyWzbIC+umK6BsPlohcRmWD3bjOr3OINcC211RMK4G+g/jjCDWCANh/J4Yw35d6Wfmyur7BTFrogwgyefguzUHfWT6xCRbFozDHmhChN6h6bn8diplLhTyFX0mxUQF9pmpztEtN2lnlF3ASH17PJb84ZnFLr/+Q14oQ9aDQrLLxgQUK35Jkcc4yt0dqlHSXGswdpaghTtFNWr9zwYWI1ZFVF77gAtvnhAJMnG58qHePDzcZ6EXISAGxXZ+KYx3LxkgavoHOatKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=f4meqAlc/o5Ix2xRPpcPz5BQ/KNWYkQ94OlVvmKV+V8=; b=UU+BJzKW7U6+nYLzkZ2g1sADnczMOqaRGbOW0dBbs5qyOUoRtlGPyhoj7zk0vG0P7xthpx/qiH6iWZP9J1EmSVPmJ681hjkZAUpFTRqWR5xJ/QdLIplqK0rA+whWWltuxF2W6TYMoesgrmKfDajZ+Tcq3AJYC4sJMVwWvTCL4Nlsx7NBn/Jj/m/rIASxL7wLE1L0hdZy8Ju4vAmCtP28iR1OTVJydVbtYMP5l6y06m4rbGEkdGDTJmcz/O+HqY4rAx5COqSYxmUaB7kzSPnvMZsUxQkrx6qofFP8y2jqOIkczk/9EUSRm3FcXjvGQjv0531XLUHMvt/yLMQ+nzYS2Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=bsbernd.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=f4meqAlc/o5Ix2xRPpcPz5BQ/KNWYkQ94OlVvmKV+V8=; b=Z3Nu8LJjRyeKBkaGsS7p13gilHkfzvaO9oockfXDOWpk0nKUDL4MjBRw4xgNKYnN6331qIFcPkm9VfDEvGA692a8Blju/s24xZ/GeYr6qbHWXnaz9ralByDhAOvkr1tzU0LfndKsi7HtrX6aouSQaORzWbrgd8WdT5AhQ6pktEA= Received: from CH0PR03CA0111.namprd03.prod.outlook.com (2603:10b6:610:cd::26) by CY5PR19MB6494.namprd19.prod.outlook.com (2603:10b6:930:3a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30; Thu, 7 Nov 2024 17:04:16 +0000 Received: from DS3PEPF0000C381.namprd04.prod.outlook.com (2603:10b6:610:cd:cafe::43) by CH0PR03CA0111.outlook.office365.com (2603:10b6:610:cd::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.20 via Frontend Transport; Thu, 7 Nov 2024 17:04:15 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by DS3PEPF0000C381.mail.protection.outlook.com (10.167.23.11) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8137.17 via Frontend Transport; Thu, 7 Nov 2024 17:04:15 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 3400FC6; Thu, 7 Nov 2024 17:04:15 +0000 (UTC) From: Bernd Schubert Date: Thu, 07 Nov 2024 18:03:49 +0100 Subject: [PATCH RFC v5 05/16] fuse: make args->in_args[0] to be always the header Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241107-fuse-uring-for-6-10-rfc4-v5-5-e8660a991499@ddn.com> References: <20241107-fuse-uring-for-6-10-rfc4-v5-0-e8660a991499@ddn.com> In-Reply-To: <20241107-fuse-uring-for-6-10-rfc4-v5-0-e8660a991499@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1730999049; l=8693; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=hj7RRgikG7hzVLz5Xt3Qr5QdpFRTN5r8a2u+RPCOzOs=; b=avcXF+nQsyLMClrbxovLU8coYJDoiCDGyjD6abWA9+RinrqfDyC409m4OboGtqlMKLxef+UsU CUenKG1S3wXAdyOS2pgRB3z8FWYtg2/OcfdQumI9gFePHhx/7XFc0ta X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF0000C381:EE_|CY5PR19MB6494:EE_ X-MS-Office365-Filtering-Correlation-Id: 9b7d280b-8d66-4122-e636-08dcff4e3611 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?Veq2mNAuGgJG4KBButthGPo9nXaBxsQ?= =?utf-8?q?2jox28FA1DpffjrLlDrniwPL0AhYM+7p42WD4UP6+PBm1aTUyyOJgwz8D5KaGNpQR?= =?utf-8?q?dCG0E5V6UHdQaCKMAYFyaPc7AUGgdYo4o04DpvtZVTs89zxHOWPel6SEtaZRiDZ/u?= =?utf-8?q?XZSC591ujYUC08GnMg+Alg8DkYRx18BMbreCPoYlLCNxCOAu7zn1/tEPvU+JpUE1/?= =?utf-8?q?+q+1TrPtjwaO9G3Q4eo4IvxuMJwV8oaWu2V5Vai/lLvkPKKVKs/36G9l5pebB8WR/?= =?utf-8?q?SJVkvIHBlDeOn2RvaTZB5yznhfgqUyIl/Ia1sKEtDcVTipqF1UrEF3NvcHkp28tZ5?= =?utf-8?q?GtCaA6NENB41615gffX3tqvJIxDIvyJ+n1916BALXTLp9tpBDVyX51EpELzzPF6Us?= =?utf-8?q?QHmjoyDefZuojSk+Aa32AYPOjSJwchrqIt9rQmsTFwvJhInDnXZjdeno78OuQnJXA?= =?utf-8?q?2dHnMLvD8TlWP1p8uR1TZGm7riUBddK1HzBwnox2UNBSjKeJe5+/0Oq8QT6C/Uri6?= =?utf-8?q?A8vp44Whj7aK+C5yc0715kyKAi99CPxh0yLPYhOovMNA7f9Uqa/nwIEd1iHtJBeBJ?= =?utf-8?q?JVfk3LiCpZOXnQmXOrn9jnORu8sc6YaxQznd0nYnWKWTviiHnL0ioT7tiasAkEjTP?= =?utf-8?q?lxt6EIqQxOHiGKTg+Va96HG22gm/Qh358rqmj7Pqt5mR6mw7TqUDpUevQDnr46kBM?= =?utf-8?q?/qhfZ6rB7JrQG7NSVuBLR5fKnrP6gQ1t1yi66esqaOS1EQNR3T46RKZ0BwponGzqs?= =?utf-8?q?h/82nR47IZ79KtaLeuN6UeNrJF5WzpQJH7rEV5cShIKrRnIlw+ZbV2DeDp95aPwYq?= =?utf-8?q?XXpjRS93PozNg+AAJkpKBxrIbK14kirZnv6ZnGa+YbbsHZ5eg31lNXXOmC88WBlAY?= =?utf-8?q?mA38mfcHQDx2Bi92RIZouN8bDXAqTjGFUfFzn3UNZ2T8ku+0eU7KMJBX5aFa+eh//?= =?utf-8?q?ZkWjxkLP7U0aQmXsfXatJvGDjEEeehp47bws7uW42PmvjF24q7IozUz45hiUAk3jF?= =?utf-8?q?g74RlaXbYPfgdke49T2SvwYVOnoBqq3V9S2vbugXhVrworfQtjNNgmXK23Nfe46S3?= =?utf-8?q?JSs/1czkjzgE6318/f2vexEneGPOuHj0ondS3VbsziAYwM7hHIox9f0CHY0AsiwU2?= =?utf-8?q?zI6Jmbr/iXGxL9+He6rjLhgSP4iAL5CtCt6bEk4EH6ba3IO5ioXzEJxG5ZatrsMBB?= =?utf-8?q?x8B+TyO7PQJwcG4X/smlSuj8DcCfcKSTbPP3Dyhkgau8ibYBQhMO0NHNpIftZ/fvO?= =?utf-8?q?gdTqFfU4saVenHILMlwKrEFVWxdYrPGqnbplXc09wIIxRmcd2aSdXuz4jmTRk3D+8?= =?utf-8?q?oFeepcW0Vw+O+MNkEv5pCcf4E9ew5tuR7g=3D=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(7416014)(376014)(36860700013)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: xiZogyISOQvwiLPi1pyBOJIpXCEfgk+lTikiPBXhFa4ZRKwEoP2s+I+Eepi7xhjq5gBs96lIekVxxL+YKIVLn2FL32c+zLxbi1vG1Two5s9lbkOIxy/DnYR6Bt7vlu+DD3R3F24BRIceg/4DX8S1PBDUsujb4NMes38+RcNxsNSJMqjTd5yJb+xMnjMXgsCIprG6/reaXsDFLYXkKnoAchkdOYi+1Xi6mCEe5nCJ7XagvblYsVy6vs3hFOQE0ZSsnDFNbZ2TK5gjDkOt75eFb4y+906z6Kp/UPZostRpcxfjxAWrp3KAXy1AyjZTHI1xhZY7/VuIb2tTD0zQCguyXATfBOb3IKkM854gnH3DoD+FX85W1ObPN2yjAMbNgSr1pCOoTPAKMhMUQ+rgr8CNHykEJw3M2A2AufRDWea2AeMrRYgdsaaTE6RXc/AtQdDTgz+QTpjj2kFpdQyIZw75Fk1EbAIxMyk+ivg7IrVNK7bAWOSg3CedrGprKcitZalCh/9KhT89iRoG/KNQE+aqDs7D3IL6AG3kRdsdejTQhoGeDpeytQiCKjgCH1d36/g1VV8jPbRFUvwko4yko3CFIU9jLgEUR4lFEv3J0fVgN/AXvmbkVq/XcNlhQrL6BOluSI7weVvyvESwEs5ech11qQ== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 17:04:15.8504 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9b7d280b-8d66-4122-e636-08dcff4e3611 X-MS-Exchange-CrossTenant-Id: 753b6e26-6fd3-43e6-8248-3f1735d59bb4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=753b6e26-6fd3-43e6-8248-3f1735d59bb4;Ip=[50.222.100.11];Helo=[uww-mrp-01.datadirectnet.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF0000C381.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR19MB6494 X-BESS-ID: 1730999063-110665-12655-28789-1 X-BESS-VER: 2019.1_20241029.2310 X-BESS-Apparent-Source-IP: 104.47.59.175 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVhYmpgZAVgZQ0NTCItXIICU5OS 3N3Dgp1czIwjgxzcLQ0MgkzczILNVAqTYWAEq3/DlBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260269 [from cloudscan23-103.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 This change sets up FUSE operations to have headers in args.in_args[0], even for opcodes without an actual header. We do this to prepare for cleanly separating payload from headers in the future. For opcodes without a header, we use a zero-sized struct as a placeholder. This approach: - Keeps things consistent across all FUSE operations - Will help with payload alignment later - Avoids future issues when header sizes change Signed-off-by: Bernd Schubert --- fs/fuse/dax.c | 13 ++++++++----- fs/fuse/dev.c | 24 ++++++++++++++++++++---- fs/fuse/dir.c | 41 +++++++++++++++++++++++++++-------------- fs/fuse/fuse_i.h | 7 +++++++ fs/fuse/xattr.c | 9 ++++++--- 5 files changed, 68 insertions(+), 26 deletions(-) diff --git a/fs/fuse/dax.c b/fs/fuse/dax.c index 12ef91d170bb3091ac35a33d2b9dc38330b00948..e459b8134ccb089f971bebf8da1f7fc5199c1271 100644 --- a/fs/fuse/dax.c +++ b/fs/fuse/dax.c @@ -237,14 +237,17 @@ static int fuse_send_removemapping(struct inode *inode, struct fuse_inode *fi = get_fuse_inode(inode); struct fuse_mount *fm = get_fuse_mount(inode); FUSE_ARGS(args); + struct fuse_zero_in zero_arg; args.opcode = FUSE_REMOVEMAPPING; args.nodeid = fi->nodeid; - args.in_numargs = 2; - args.in_args[0].size = sizeof(*inargp); - args.in_args[0].value = inargp; - args.in_args[1].size = inargp->count * sizeof(*remove_one); - args.in_args[1].value = remove_one; + args.in_numargs = 3; + args.in_args[0].size = sizeof(zero_arg); + args.in_args[0].value = &zero_arg; + args.in_args[1].size = sizeof(*inargp); + args.in_args[1].value = inargp; + args.in_args[2].size = inargp->count * sizeof(*remove_one); + args.in_args[2].value = remove_one; return fuse_simple_request(fm, &args); } diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index dbc222f9b0f0e590ce3ef83077e6b4cff03cff65..6effef4073da3dad2f6140761eca98147a41d88d 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -1007,6 +1007,19 @@ static int fuse_copy_args(struct fuse_copy_state *cs, unsigned numargs, for (i = 0; !err && i < numargs; i++) { struct fuse_arg *arg = &args[i]; + + /* zero headers */ + if (arg->size == 0) { + if (WARN_ON_ONCE(i != 0)) { + if (cs->req) + pr_err_once( + "fuse: zero size header in opcode %d\n", + cs->req->in.h.opcode); + return -EINVAL; + } + continue; + } + if (i == numargs - 1 && argpages) err = fuse_copy_pages(cs, arg->size, zeroing); else @@ -1662,6 +1675,7 @@ static int fuse_retrieve(struct fuse_mount *fm, struct inode *inode, size_t args_size = sizeof(*ra); struct fuse_args_pages *ap; struct fuse_args *args; + struct fuse_zero_in zero_arg; offset = outarg->offset & ~PAGE_MASK; file_size = i_size_read(inode); @@ -1688,7 +1702,7 @@ static int fuse_retrieve(struct fuse_mount *fm, struct inode *inode, args = &ap->args; args->nodeid = outarg->nodeid; args->opcode = FUSE_NOTIFY_REPLY; - args->in_numargs = 2; + args->in_numargs = 3; args->in_pages = true; args->end = fuse_retrieve_end; @@ -1715,9 +1729,11 @@ static int fuse_retrieve(struct fuse_mount *fm, struct inode *inode, } ra->inarg.offset = outarg->offset; ra->inarg.size = total_len; - args->in_args[0].size = sizeof(ra->inarg); - args->in_args[0].value = &ra->inarg; - args->in_args[1].size = total_len; + args->in_args[0].size = sizeof(zero_arg); + args->in_args[0].value = &zero_arg; + args->in_args[1].size = sizeof(ra->inarg); + args->in_args[1].value = &ra->inarg; + args->in_args[2].size = total_len; err = fuse_simple_notify_reply(fm, args, outarg->notify_unique); if (err) diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 2b0d4781f39484d50d1fd7f4f673d8b08c5fd7cf..6d67d7f8e6b4460c759df3fb293e169bcc78a897 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -172,12 +172,16 @@ static void fuse_lookup_init(struct fuse_conn *fc, struct fuse_args *args, u64 nodeid, const struct qstr *name, struct fuse_entry_out *outarg) { + struct fuse_zero_in zero_arg; + memset(outarg, 0, sizeof(struct fuse_entry_out)); args->opcode = FUSE_LOOKUP; args->nodeid = nodeid; - args->in_numargs = 1; - args->in_args[0].size = name->len + 1; - args->in_args[0].value = name->name; + args->in_numargs = 2; + args->in_args[0].size = sizeof(zero_arg); + args->in_args[0].value = &zero_arg; + args->in_args[1].size = name->len + 1; + args->in_args[1].value = name->name; args->out_numargs = 1; args->out_args[0].size = sizeof(struct fuse_entry_out); args->out_args[0].value = outarg; @@ -915,16 +919,19 @@ static int fuse_mkdir(struct mnt_idmap *idmap, struct inode *dir, static int fuse_symlink(struct mnt_idmap *idmap, struct inode *dir, struct dentry *entry, const char *link) { + struct fuse_zero_in zero_arg; struct fuse_mount *fm = get_fuse_mount(dir); unsigned len = strlen(link) + 1; FUSE_ARGS(args); args.opcode = FUSE_SYMLINK; - args.in_numargs = 2; - args.in_args[0].size = entry->d_name.len + 1; - args.in_args[0].value = entry->d_name.name; - args.in_args[1].size = len; - args.in_args[1].value = link; + args.in_numargs = 3; + args.in_args[0].size = sizeof(zero_arg); + args.in_args[0].value = &zero_arg; + args.in_args[1].size = entry->d_name.len + 1; + args.in_args[1].value = entry->d_name.name; + args.in_args[2].size = len; + args.in_args[2].value = link; return create_new_entry(fm, &args, dir, entry, S_IFLNK); } @@ -975,6 +982,7 @@ static void fuse_entry_unlinked(struct dentry *entry) static int fuse_unlink(struct inode *dir, struct dentry *entry) { + struct fuse_zero_in inarg; int err; struct fuse_mount *fm = get_fuse_mount(dir); FUSE_ARGS(args); @@ -984,9 +992,11 @@ static int fuse_unlink(struct inode *dir, struct dentry *entry) args.opcode = FUSE_UNLINK; args.nodeid = get_node_id(dir); - args.in_numargs = 1; - args.in_args[0].size = entry->d_name.len + 1; - args.in_args[0].value = entry->d_name.name; + args.in_numargs = 2; + args.in_args[0].size = sizeof(inarg); + args.in_args[0].value = &inarg; + args.in_args[1].size = entry->d_name.len + 1; + args.in_args[1].value = entry->d_name.name; err = fuse_simple_request(fm, &args); if (!err) { fuse_dir_changed(dir); @@ -998,6 +1008,7 @@ static int fuse_unlink(struct inode *dir, struct dentry *entry) static int fuse_rmdir(struct inode *dir, struct dentry *entry) { + struct fuse_zero_in zero_arg; int err; struct fuse_mount *fm = get_fuse_mount(dir); FUSE_ARGS(args); @@ -1007,9 +1018,11 @@ static int fuse_rmdir(struct inode *dir, struct dentry *entry) args.opcode = FUSE_RMDIR; args.nodeid = get_node_id(dir); - args.in_numargs = 1; - args.in_args[0].size = entry->d_name.len + 1; - args.in_args[0].value = entry->d_name.name; + args.in_numargs = 2; + args.in_args[0].size = sizeof(zero_arg); + args.in_args[0].value = &zero_arg; + args.in_args[1].size = entry->d_name.len + 1; + args.in_args[1].value = entry->d_name.name; err = fuse_simple_request(fm, &args); if (!err) { fuse_dir_changed(dir); diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index f2391961031374d8d55916c326c6472f0c03aae6..e2d1d90dfdb13b2c3e7de4789501ee45d3bf7794 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -941,6 +941,13 @@ struct fuse_mount { struct rcu_head rcu; }; +/* + * Empty header for FUSE opcodes without specific header needs. + * Used as a placeholder in args->in_args[0] for consistency + * across all FUSE operations, simplifying request handling. + */ +struct fuse_zero_in {}; + static inline struct fuse_mount *get_fuse_mount_super(struct super_block *sb) { return sb->s_fs_info; diff --git a/fs/fuse/xattr.c b/fs/fuse/xattr.c index 5b423fdbb13f8f17c3982e96dd0de836662092b0..2df1efd2e9bdb46571148f484d7927044f31c184 100644 --- a/fs/fuse/xattr.c +++ b/fs/fuse/xattr.c @@ -158,15 +158,18 @@ int fuse_removexattr(struct inode *inode, const char *name) struct fuse_mount *fm = get_fuse_mount(inode); FUSE_ARGS(args); int err; + struct fuse_zero_in zero_arg; if (fm->fc->no_removexattr) return -EOPNOTSUPP; args.opcode = FUSE_REMOVEXATTR; args.nodeid = get_node_id(inode); - args.in_numargs = 1; - args.in_args[0].size = strlen(name) + 1; - args.in_args[0].value = name; + args.in_numargs = 2; + args.in_args[0].size = sizeof(zero_arg); + args.in_args[0].value = &zero_arg; + args.in_args[1].size = strlen(name) + 1; + args.in_args[1].value = name; err = fuse_simple_request(fm, &args); if (err == -ENOSYS) { fm->fc->no_removexattr = 1; From patchwork Thu Nov 7 17:03:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13866749 Received: from outbound-ip191b.ess.barracuda.com (outbound-ip191b.ess.barracuda.com [209.222.82.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 05BFA216A28 for ; Thu, 7 Nov 2024 17:04:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=209.222.82.124 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730999083; cv=fail; b=Rhfy2y5BM4KRhOQEsNyqpoPg0B2r35TF6nQvkB8u/oFRzRgExlcAo/PeM/Vp/nczaik9ITh55QZEZBmcPXg2LsjERk5ydQF2miJrRVsDqbnQ625hDEcg3bT3xl4AEWLztFd0R6ncjlxeUbqW+UGeX31jfUxSpMcvEsqZBhhzj+M= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730999083; c=relaxed/simple; bh=SZvuLq31UmsGrTKDikqryaQNQk1jcWp6aJ3JBJknMvU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Y5oH+MqD9I6Bq7HtvO7ZOkC7sMZJ/f1lxJixztx/n3dXnkhmp8G1W6+pkiZeOLpPe/jNzvEmXTRNOl1pbo7McqUJ2Up5KFYL7cfMabDiDfXJUALzwNw+0UibLrKAdEU+0/mWlqctNjSUcfjGceGhHKwZ4Gau5iy6jy4DMl9B+kw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com; spf=pass smtp.mailfrom=ddn.com; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b=OPx/gl/K; arc=fail smtp.client-ip=209.222.82.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ddn.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b="OPx/gl/K" Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2046.outbound.protection.outlook.com [104.47.70.46]) by mx-outbound16-69.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 07 Nov 2024 17:04:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SuB19xSWGlcIW0Scv+de3RgXTnhsHnO9w75GwpUUxQQuVWvm9/P4B89rwDD+kiw0mkbF6cY2/KL/ooUv69mIZMbUHHHeIKQlfZEaL+sZmvkH7PUeAvJPG3dHNhoBuY2R6vtgLLFxg+2xSDFgjvVEdmx8TBGbQ9UOAZmZo+t2NqSyWaCDV3e+FjqJSn/3cnSq7NvWRk9xUAbAqLxbM+qI67V8rf8Cl4w422S7vjuCr0pZXxLyjUBrzWxmo0nDfVlWuFr0ZaTaf6UQrqYU0VfapqhaMATiOnxoZb4KyFMyJOqgo/eaPLX9u5KQIKXOu+iHoSkToLWC4+xBV5JZ0Cv85w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=L7R7lCVAIXbEWxPc8BrPFnw9ed5q0EwTc5vypP/6XJ0=; b=xY3DbvlFTO85oHUSyV2XHRwRKF403vICD1YD3368GW74pGMhwtMme2+XxiKtiC8nYT4y6gExPwc8EFSdLW/BBuCJc4PAkvARdtmExmJQ1iCZtFlK0cRn9DrWAws7G3ts7XlHqHMMyrfGK7XNVLnimbLAHI8mPchOHRAAhrLd+floAUl3HvdTgzmr6wb4042lC4w66OJFivzJVUvnhPGNqyxUiZAaeT5bB/JNQtOZnq2dAg8WW/em4I+UCC3NoIklEQUKdHmx/8G9RtGgu+VpVJ9+/QR5Y8LXhAKk2Evt9PS4Fv67Tf1htVuUhgr+6p/xtGg6xTewYSDmXvMY/hXLZQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=bsbernd.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=L7R7lCVAIXbEWxPc8BrPFnw9ed5q0EwTc5vypP/6XJ0=; b=OPx/gl/KsKMoV3yo6DRPTDSWmWdfZfAn07WX29w17AW1RRDUHite2Dd7/Kwca71YXVXTkrYd00C829mltwSctx2GhxCbnwZPopUb6O0TdDOEguwBYvzhUhflDhEgeVZCKJ6cA8Cau1KGNvWuXW5IpaHwVBY53cAtBUOZI3pgzBY= Received: from BY1P220CA0025.NAMP220.PROD.OUTLOOK.COM (2603:10b6:a03:5c3::12) by SA3PR19MB8167.namprd19.prod.outlook.com (2603:10b6:806:397::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.19; Thu, 7 Nov 2024 17:04:17 +0000 Received: from CO1PEPF000044EF.namprd05.prod.outlook.com (2603:10b6:a03:5c3:cafe::2a) by BY1P220CA0025.outlook.office365.com (2603:10b6:a03:5c3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.20 via Frontend Transport; Thu, 7 Nov 2024 17:04:17 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by CO1PEPF000044EF.mail.protection.outlook.com (10.167.241.69) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8137.17 via Frontend Transport; Thu, 7 Nov 2024 17:04:16 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 2B8617D; Thu, 7 Nov 2024 17:04:16 +0000 (UTC) From: Bernd Schubert Date: Thu, 07 Nov 2024 18:03:50 +0100 Subject: [PATCH RFC v5 06/16] fuse: {uring} Handle SQEs - register commands Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241107-fuse-uring-for-6-10-rfc4-v5-6-e8660a991499@ddn.com> References: <20241107-fuse-uring-for-6-10-rfc4-v5-0-e8660a991499@ddn.com> In-Reply-To: <20241107-fuse-uring-for-6-10-rfc4-v5-0-e8660a991499@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1730999049; l=16666; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=SZvuLq31UmsGrTKDikqryaQNQk1jcWp6aJ3JBJknMvU=; b=93vcld+n+XDvSPzc4XrtS3gDbSO2Jtqs1D7O2auCh0pwPxi/zlkZJem2OlgmMih3xakiK1P89 lQr88oSEri/AZUhwQJa2ps8s+2TuR/W55XofxpjEjqIT8RZS0oIgaDi X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044EF:EE_|SA3PR19MB8167:EE_ X-MS-Office365-Filtering-Correlation-Id: 30b612f4-38a2-4ce8-7d41-08dcff4e36aa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|82310400026|376014|7416014|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?q?0gBshoVgzZmVWw0+EL+q4aJQt10QMGd?= =?utf-8?q?vvuyG8FE9+dh0O8wBvdEH1EaIBbg4MxC8AQk7PPB5NpZzgQVi+NXPihqe1Jkn0n1a?= =?utf-8?q?+Nen53u+Yv12bL2A6nKM7kxTqJzFzuqKTJ5/NTM5BQDzB7FR4opehM5aoQrJkEDtb?= =?utf-8?q?RqAjy5tsXcNR8jJnFYWP/sT5zQmevtv2Dw3+pc8nsqEMTZUCJDeC+LDueuoSRqek6?= =?utf-8?q?OUhbFlFbJvXIWEKzvdGhLrLMQK5a5roOOq5yUlSIFQEpqFrZn818T3LLviI2/6fmI?= =?utf-8?q?hJqUwHEf5L7n8V/JWXcz6DGbngaIX7rqv7vrYzayE4XSbVU8oU7ILjt7thTgnFX31?= =?utf-8?q?xQ8KMt/KrMKwdJGqiF3GHDDW0eMtjcmUoWdjdLlu41UYArfug2vCCHzpdFut0pDW2?= =?utf-8?q?puQ15Z+WjZ8UAm53cogkTciO2iiNU/pl0z9sKLclb6POJR6sI2daeS1E0y+lS8/WF?= =?utf-8?q?QRmmV9BMGq58aV5E9cEnzzl3DOyrWRpPPI+HvC50eYK43AWmMlX4ktn6wG9EMqqXx?= =?utf-8?q?/dlrZC66vum6+z+sa+bJBQcfYsWC4HDVSnr+jG3A6cM5mKrzCCuxoGS2ghPZpBQCT?= =?utf-8?q?dN60uP0SRIVvMjUm0j55F8bvfjdrjlkPPyqZIw0E3V2nvPBATFjTzzs337YZ76xPt?= =?utf-8?q?VQrRCZLgl344I5XXqXCYW8IrCF5GY/pArfnePf9B9XVfP8jK+Ln22GJ9Cg1IGzao7?= =?utf-8?q?Hfququa14iffYgeQrA69jJjf7n9AnJp3AUttw6TAXKzm+ACfZNSTESRmDzhprOBn7?= =?utf-8?q?9dqpdkq/3oWsWUDdsJkQ5vCpY3Wy3/eo6gHGuubsokhbBFwHZp8AnaGRDSCb3COiH?= =?utf-8?q?/3lOLEECRyIHGiAoTWP3z/Uycp1QtuFeqgd9C7x7CZghgAt2PG1rKOCu9mAzvmnUC?= =?utf-8?q?YBslWZ+eSFwCXI5wQsvzLQ0njFaReRp7ijLy7hWph6tDCd3/yjKvFL4DxgRcNiuJ9?= =?utf-8?q?e9hS9NHa9yDOuKnzJhE1F8LwWkzvIvd+kfLCA2DQcx3ZloKiqSKMf3+9tEshyLoas?= =?utf-8?q?hI9Dl1XhkPOVeabiAk6Pf8PIGz/tXG0o3CWL0jSYTZeel9eyKrAuNL0wzF8MYrAOS?= =?utf-8?q?I2IgaZS6wMtr4PsfEfNj5B2husiqSjkmIqO5Fxryk1MILgv316DfF/qQMqrLXZmNS?= =?utf-8?q?a0dTkMKP++UwyN9j8jp2vS5JfVyTeaiINkknFPjS8P+h0H9YrU46CjQZlmG7Zb6wD?= =?utf-8?q?aVoGuI+xVOdEIJNUQMwqVzdWZ2q1VTWNWLD/yeXHD1Y+f8HE20L7xynEsWJNCaxGK?= =?utf-8?q?rJDka7TAsLBmRmwwMpZ0tMiAadh4ruLEcEbBXS0FaASLRaZ7GCxD57H+hSiCttRNN?= =?utf-8?q?u1k8vh6IGJCch3Z156R1HVtZZbnZfQ3OPw=3D=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(82310400026)(376014)(7416014)(36860700013);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 9dZsKQLOFxBRT+liYNq8mA7vfQ4gBpYVeBxTMarj3TD3qHuod+MATBFJkTuo/b8QJOueK3PydtVWf1e3TOj0ofacskbrzb6pqOn4nG1yFz7c5rMk22PMgmrrx80LBwo0eU5JF2JKggPu3QtaksZSm6e0PZg6upPbekq4HkufRghzXGfSX1uUOaZRlanWTnFMQyGDUQ/8vhFvdO+97sjBonsPrRoXPQkQ67VDye8HV0VL7TFGTnIIV2hVCOEA9MOaVLuIYWe6p9kInGv2gWm9ASVdgmPDGxT84qjjdkjg3s2+iGFow63NtwdS3m185ixQOJvaDZFfK3d4NS3tfXGfYc+Vo5ZBnPYt8wTHWrMtOE7TFhGg4Q93I/CUzGqLxt5j8vDWm7LNYgOvVlKZPWxgrNYwuUYUhuLTM3xVjpnVGt7eVQ1npBLtH5O7GNwmGKIJxYJw4KYCw0cvPqZTQCABABW5ujBlTFi9FPjoUkOTDxF3WjkQ9nKpY8ME8hlzyzWGKFdJVEgte50DC51cXzNcjM4ELGhJykcjUBJ1PsMNZgNbRhVPevPR/OIgtqg+7DLngcMEJH999FDGJtksbfjVaLkW9APl6KQqeNv7GF9/SoHpsZmVZT+EbO4u+gYBoMvLHd5yys5WNXT41UZac1sjgw== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 17:04:16.8505 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 30b612f4-38a2-4ce8-7d41-08dcff4e36aa X-MS-Exchange-CrossTenant-Id: 753b6e26-6fd3-43e6-8248-3f1735d59bb4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=753b6e26-6fd3-43e6-8248-3f1735d59bb4;Ip=[50.222.100.11];Helo=[uww-mrp-01.datadirectnet.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044EF.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR19MB8167 X-BESS-ID: 1730999064-104165-12628-30432-1 X-BESS-VER: 2019.1_20241029.2310 X-BESS-Apparent-Source-IP: 104.47.70.46 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoZmBoaGQGYGUDTF0DDN0NAsLT nR0MzEMC3FLC0lxTLJyMLQLCXRPC3VUqk2FgD0VmqwQgAAAA== X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260269 [from cloudscan21-163.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 This adds basic support for ring SQEs (with opcode=IORING_OP_URING_CMD). For now only FUSE_URING_REQ_FETCH is handled to register queue entries. Signed-off-by: Bernd Schubert --- fs/fuse/Kconfig | 12 ++ fs/fuse/Makefile | 1 + fs/fuse/dev.c | 4 + fs/fuse/dev_uring.c | 349 ++++++++++++++++++++++++++++++++++++++++++++++ fs/fuse/dev_uring_i.h | 108 ++++++++++++++ fs/fuse/fuse_dev_i.h | 1 + fs/fuse/fuse_i.h | 5 + fs/fuse/inode.c | 3 + include/uapi/linux/fuse.h | 57 ++++++++ 9 files changed, 540 insertions(+) diff --git a/fs/fuse/Kconfig b/fs/fuse/Kconfig index 8674dbfbe59dbf79c304c587b08ebba3cfe405be..11f37cefc94b2af5a675c238801560c822b95f1a 100644 --- a/fs/fuse/Kconfig +++ b/fs/fuse/Kconfig @@ -63,3 +63,15 @@ config FUSE_PASSTHROUGH to be performed directly on a backing file. If you want to allow passthrough operations, answer Y. + +config FUSE_IO_URING + bool "FUSE communication over io-uring" + default y + depends on FUSE_FS + depends on IO_URING + help + This allows sending FUSE requests over the IO uring interface and + also adds request core affinity. + + If you want to allow fuse server/client communication through io-uring, + answer Y diff --git a/fs/fuse/Makefile b/fs/fuse/Makefile index 6e0228c6d0cba9541c8668efb86b83094751d469..7193a14374fd3a08b901ef53fbbea7c31b12f22c 100644 --- a/fs/fuse/Makefile +++ b/fs/fuse/Makefile @@ -11,5 +11,6 @@ fuse-y := dev.o dir.o file.o inode.o control.o xattr.o acl.o readdir.o ioctl.o fuse-y += iomode.o fuse-$(CONFIG_FUSE_DAX) += dax.o fuse-$(CONFIG_FUSE_PASSTHROUGH) += passthrough.o +fuse-$(CONFIG_FUSE_IO_URING) += dev_uring.o virtiofs-y := virtio_fs.o diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 6effef4073da3dad2f6140761eca98147a41d88d..d4e7d69f79cec192cb456aedfb7d4a2a274fea80 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -6,6 +6,7 @@ See the file COPYING. */ +#include "dev_uring_i.h" #include "fuse_i.h" #include "fuse_dev_i.h" @@ -2414,6 +2415,9 @@ const struct file_operations fuse_dev_operations = { .fasync = fuse_dev_fasync, .unlocked_ioctl = fuse_dev_ioctl, .compat_ioctl = compat_ptr_ioctl, +#ifdef CONFIG_FUSE_IO_URING + .uring_cmd = fuse_uring_cmd, +#endif }; EXPORT_SYMBOL_GPL(fuse_dev_operations); diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c new file mode 100644 index 0000000000000000000000000000000000000000..ce0a41b00613133ea1b8062290bc960b95254ac9 --- /dev/null +++ b/fs/fuse/dev_uring.c @@ -0,0 +1,349 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * FUSE: Filesystem in Userspace + * Copyright (c) 2023-2024 DataDirect Networks. + */ + +#include + +#include "fuse_i.h" +#include "dev_uring_i.h" +#include "fuse_dev_i.h" + +#include + +#ifdef CONFIG_FUSE_IO_URING +static bool __read_mostly enable_uring; +module_param(enable_uring, bool, 0644); +MODULE_PARM_DESC(enable_uring, + "Enable uring userspace communication through uring."); +#endif + +static int fuse_ring_ent_unset_userspace(struct fuse_ring_ent *ent) +{ + struct fuse_ring_queue *queue = ent->queue; + + lockdep_assert_held(&queue->lock); + + if (WARN_ON_ONCE(ent->state != FRRS_USERSPACE)) + return -EIO; + + ent->state = FRRS_COMMIT; + list_move(&ent->list, &queue->ent_intermediate_queue); + + return 0; +} + +void fuse_uring_destruct(struct fuse_conn *fc) +{ + struct fuse_ring *ring = fc->ring; + int qid; + + if (!ring) + return; + + for (qid = 0; qid < ring->nr_queues; qid++) { + struct fuse_ring_queue *queue = ring->queues[qid]; + + if (!queue) + continue; + + WARN_ON(!list_empty(&queue->ent_avail_queue)); + WARN_ON(!list_empty(&queue->ent_intermediate_queue)); + + kfree(queue); + ring->queues[qid] = NULL; + } + + kfree(ring->queues); + kfree(ring); + fc->ring = NULL; +} + +#define FUSE_URING_IOV_SEGS 2 /* header and payload */ + +/* + * Basic ring setup for this connection based on the provided configuration + */ +static struct fuse_ring *fuse_uring_create(struct fuse_conn *fc) +{ + struct fuse_ring *ring = NULL; + size_t nr_queues = num_possible_cpus(); + struct fuse_ring *res = NULL; + + ring = kzalloc(sizeof(*fc->ring) + + nr_queues * sizeof(struct fuse_ring_queue), + GFP_KERNEL_ACCOUNT); + if (!ring) + return NULL; + + ring->queues = kcalloc(nr_queues, sizeof(struct fuse_ring_queue *), + GFP_KERNEL_ACCOUNT); + if (!ring->queues) + goto out_err; + + spin_lock(&fc->lock); + if (fc->ring) { + /* race, another thread created the ring in the mean time */ + spin_unlock(&fc->lock); + res = fc->ring; + goto out_err; + } + + fc->ring = ring; + ring->nr_queues = nr_queues; + ring->fc = fc; + + spin_unlock(&fc->lock); + return ring; + +out_err: + if (ring) + kfree(ring->queues); + kfree(ring); + return res; +} + +static struct fuse_ring_queue *fuse_uring_create_queue(struct fuse_ring *ring, + int qid) +{ + struct fuse_conn *fc = ring->fc; + struct fuse_ring_queue *queue; + + queue = kzalloc(sizeof(*queue), GFP_KERNEL_ACCOUNT); + if (!queue) + return ERR_PTR(-ENOMEM); + spin_lock(&fc->lock); + if (ring->queues[qid]) { + spin_unlock(&fc->lock); + kfree(queue); + return ring->queues[qid]; + } + ring->queues[qid] = queue; + + queue->qid = qid; + queue->ring = ring; + spin_lock_init(&queue->lock); + + INIT_LIST_HEAD(&queue->ent_avail_queue); + INIT_LIST_HEAD(&queue->ent_intermediate_queue); + + spin_unlock(&fc->lock); + + return queue; +} + +/* + * Put a ring request onto hold, it is no longer used for now. + */ +static void fuse_uring_ent_avail(struct fuse_ring_ent *ring_ent, + struct fuse_ring_queue *queue) + __must_hold(&queue->lock) +{ + struct fuse_ring *ring = queue->ring; + + lockdep_assert_held(&queue->lock); + + /* unsets all previous flags - basically resets */ + pr_devel("%s ring=%p qid=%d state=%d\n", __func__, ring, + ring_ent->queue->qid, ring_ent->state); + + if (WARN_ON(ring_ent->state != FRRS_COMMIT)) { + pr_warn("%s qid=%d state=%d\n", __func__, ring_ent->queue->qid, + ring_ent->state); + return; + } + + list_move(&ring_ent->list, &queue->ent_avail_queue); + + ring_ent->state = FRRS_WAIT; +} + +/* + * fuse_uring_req_fetch command handling + */ +static void _fuse_uring_fetch(struct fuse_ring_ent *ring_ent, + struct io_uring_cmd *cmd, + unsigned int issue_flags) +{ + struct fuse_ring_queue *queue = ring_ent->queue; + + spin_lock(&queue->lock); + fuse_uring_ent_avail(ring_ent, queue); + ring_ent->cmd = cmd; + spin_unlock(&queue->lock); +} + +/* + * sqe->addr is a ptr to an iovec array, iov[0] has the headers, iov[1] + * the payload + */ +static int fuse_uring_get_iovec_from_sqe(const struct io_uring_sqe *sqe, + struct iovec iov[FUSE_URING_IOV_SEGS]) +{ + struct iovec __user *uiov = u64_to_user_ptr(READ_ONCE(sqe->addr)); + struct iov_iter iter; + ssize_t ret; + + if (sqe->len != FUSE_URING_IOV_SEGS) + return -EINVAL; + + /* + * Direction for buffer access will actually be READ and WRITE, + * using write for the import should include READ access as well. + */ + ret = import_iovec(WRITE, uiov, FUSE_URING_IOV_SEGS, + FUSE_URING_IOV_SEGS, &iov, &iter); + if (ret < 0) + return ret; + + return 0; +} + +static int fuse_uring_fetch(struct io_uring_cmd *cmd, unsigned int issue_flags, + struct fuse_conn *fc) +{ + const struct fuse_uring_cmd_req *cmd_req = io_uring_sqe_cmd(cmd->sqe); + struct fuse_ring *ring = fc->ring; + struct fuse_ring_queue *queue; + struct fuse_ring_ent *ring_ent; + int err; + struct iovec iov[FUSE_URING_IOV_SEGS]; + + err = fuse_uring_get_iovec_from_sqe(cmd->sqe, iov); + if (err) { + pr_info_ratelimited("Failed to get iovec from sqe, err=%d\n", + err); + return err; + } + +#if 0 + /* Does not work as sending over io-uring is async */ + err = -ETXTBSY; + if (fc->initialized) { + pr_info_ratelimited( + "Received FUSE_URING_REQ_FETCH after connection is initialized\n"); + return err; + } +#endif + + err = -ENOMEM; + if (!ring) { + ring = fuse_uring_create(fc); + if (!ring) + return err; + } + + queue = ring->queues[cmd_req->qid]; + if (!queue) { + queue = fuse_uring_create_queue(ring, cmd_req->qid); + if (!queue) + return err; + } + + /* + * The created queue above does not need to be destructed in + * case of entry errors below, will be done at ring destruction time. + */ + + ring_ent = kzalloc(sizeof(*ring_ent), GFP_KERNEL_ACCOUNT); + if (ring_ent == NULL) + return err; + + INIT_LIST_HEAD(&ring_ent->list); + + ring_ent->queue = queue; + ring_ent->cmd = cmd; + + err = -EINVAL; + if (iov[0].iov_len < sizeof(struct fuse_ring_req_header)) { + pr_info_ratelimited("Invalid header len %zu\n", iov[0].iov_len); + goto err; + } + + ring_ent->headers = iov[0].iov_base; + ring_ent->payload = iov[1].iov_base; + ring_ent->max_arg_len = iov[1].iov_len; + + if (ring_ent->max_arg_len < + max_t(size_t, FUSE_MIN_READ_BUFFER, fc->max_write)) { + pr_info_ratelimited("Invalid req payload len %zu\n", + ring_ent->max_arg_len); + goto err; + } + + spin_lock(&queue->lock); + + /* + * FUSE_URING_REQ_FETCH is an initialization exception, needs + * state override + */ + ring_ent->state = FRRS_USERSPACE; + err = fuse_ring_ent_unset_userspace(ring_ent); + spin_unlock(&queue->lock); + if (WARN_ON_ONCE(err != 0)) + goto err; + + _fuse_uring_fetch(ring_ent, cmd, issue_flags); + + return 0; +err: + list_del_init(&ring_ent->list); + kfree(ring_ent); + return err; +} + +/* + * Entry function from io_uring to handle the given passthrough command + * (op cocde IORING_OP_URING_CMD) + */ +int fuse_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags) +{ + const struct fuse_uring_cmd_req *cmd_req = io_uring_sqe_cmd(cmd->sqe); + struct fuse_dev *fud; + struct fuse_conn *fc; + u32 cmd_op = cmd->cmd_op; + int err = 0; + + /* Disabled for now, especially as teardown is not implemented yet */ + err = -EOPNOTSUPP; + pr_info_ratelimited("fuse-io-uring is not enabled yet\n"); + goto out; + + err = -EOPNOTSUPP; + if (!enable_uring) { + pr_info_ratelimited("uring is disabled\n"); + goto out; + } + + err = -ENOTCONN; + fud = fuse_get_dev(cmd->file); + if (!fud) { + pr_info_ratelimited("No fuse device found\n"); + goto out; + } + fc = fud->fc; + + if (fc->aborted) + goto out; + + switch (cmd_op) { + case FUSE_URING_REQ_FETCH: + err = fuse_uring_fetch(cmd, issue_flags, fc); + if (err) + pr_info_once("fuse_uring_fetch failed err=%d\n", err); + break; + default: + err = -EINVAL; + pr_devel("Unknown uring command %d", cmd_op); + goto out; + } +out: + pr_devel("uring cmd op=%d, qid=%d ID=%llu ret=%d\n", cmd_op, + cmd_req->qid, cmd_req->commit_id, err); + + if (err < 0) + io_uring_cmd_done(cmd, err, 0, issue_flags); + + return -EIOCBQUEUED; +} diff --git a/fs/fuse/dev_uring_i.h b/fs/fuse/dev_uring_i.h new file mode 100644 index 0000000000000000000000000000000000000000..11798080896372c72692228ff7072bbee6a63e53 --- /dev/null +++ b/fs/fuse/dev_uring_i.h @@ -0,0 +1,108 @@ +/* SPDX-License-Identifier: GPL-2.0 + * + * FUSE: Filesystem in Userspace + * Copyright (c) 2023-2024 DataDirect Networks. + */ + +#ifndef _FS_FUSE_DEV_URING_I_H +#define _FS_FUSE_DEV_URING_I_H + +#include "fuse_i.h" + +#ifdef CONFIG_FUSE_IO_URING + +enum fuse_ring_req_state { + + /* ring entry received from userspace and it being processed */ + FRRS_COMMIT, + + /* The ring request waits for a new fuse request */ + FRRS_WAIT, + + /* request is in or on the way to user space */ + FRRS_USERSPACE, +}; + +/** A fuse ring entry, part of the ring queue */ +struct fuse_ring_ent { + /* userspace buffer */ + struct fuse_ring_req_header __user *headers; + void *__user *payload; + + /* the ring queue that owns the request */ + struct fuse_ring_queue *queue; + + struct io_uring_cmd *cmd; + + struct list_head list; + + /* size of payload buffer */ + size_t max_arg_len; + + /* + * state the request is currently in + * (enum fuse_ring_req_state) + */ + unsigned int state; + + struct fuse_req *fuse_req; +}; + +struct fuse_ring_queue { + /* + * back pointer to the main fuse uring structure that holds this + * queue + */ + struct fuse_ring *ring; + + /* queue id, typically also corresponds to the cpu core */ + unsigned int qid; + + /* + * queue lock, taken when any value in the queue changes _and_ also + * a ring entry state changes. + */ + spinlock_t lock; + + /* available ring entries (struct fuse_ring_ent) */ + struct list_head ent_avail_queue; + + /* + * entries in the process of being committed or in the process + * to be send to userspace + */ + struct list_head ent_intermediate_queue; +}; + +/** + * Describes if uring is for communication and holds alls the data needed + * for uring communication + */ +struct fuse_ring { + /* back pointer */ + struct fuse_conn *fc; + + /* number of ring queues */ + size_t nr_queues; + + struct fuse_ring_queue **queues; +}; + +void fuse_uring_destruct(struct fuse_conn *fc); +int fuse_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags); + +#else /* CONFIG_FUSE_IO_URING */ + +struct fuse_ring; + +static inline void fuse_uring_create(struct fuse_conn *fc) +{ +} + +static inline void fuse_uring_destruct(struct fuse_conn *fc) +{ +} + +#endif /* CONFIG_FUSE_IO_URING */ + +#endif /* _FS_FUSE_DEV_URING_I_H */ diff --git a/fs/fuse/fuse_dev_i.h b/fs/fuse/fuse_dev_i.h index 6c506f040d5fb57dae746880c657a95637ac50ce..e82cbf9c569af4f271ba0456cb49e0a5116bf36b 100644 --- a/fs/fuse/fuse_dev_i.h +++ b/fs/fuse/fuse_dev_i.h @@ -8,6 +8,7 @@ #include + /* Ordinary requests have even IDs, while interrupts IDs are odd */ #define FUSE_INT_REQ_BIT (1ULL << 0) #define FUSE_REQ_ID_STEP (1ULL << 1) diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index e2d1d90dfdb13b2c3e7de4789501ee45d3bf7794..91c2e7e35cdbd470894a8a9cd026b77368b7a4b6 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -917,6 +917,11 @@ struct fuse_conn { /** IDR for backing files ids */ struct idr backing_files_map; #endif + +#ifdef CONFIG_FUSE_IO_URING + /** uring connection information*/ + struct fuse_ring *ring; +#endif }; /* diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 99e44ea7d8756ded7145f38b49d129b361b991ba..59f8fb7b915f052f892d587a0f9a8dc17cf750ce 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -7,6 +7,7 @@ */ #include "fuse_i.h" +#include "dev_uring_i.h" #include #include @@ -947,6 +948,8 @@ static void delayed_release(struct rcu_head *p) { struct fuse_conn *fc = container_of(p, struct fuse_conn, rcu); + fuse_uring_destruct(fc); + put_user_ns(fc->user_ns); fc->release(fc); } diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h index d08b99d60f6fd6d0d072d01ad6bcc1b48da0a242..2fddc2e29f86cec25b05832ae7a622898a84b00f 100644 --- a/include/uapi/linux/fuse.h +++ b/include/uapi/linux/fuse.h @@ -1186,4 +1186,61 @@ struct fuse_supp_groups { uint32_t groups[]; }; +/** + * Size of the ring buffer header + */ +#define FUSE_HEADER_SZ 256 +#define FUSE_IN_OUT_HEADER_SZ 128 + +/** + * This structure mapped onto the + */ +struct fuse_ring_req_header { + union { + char ring_header[FUSE_HEADER_SZ]; + + struct { + uint64_t flags; + + uint32_t in_out_arg_len; + uint32_t padding; + union { + char in_out[FUSE_IN_OUT_HEADER_SZ]; + struct fuse_in_header in; + struct fuse_out_header out; + }; + + /* fuse operaration header */ + char op_in[]; + }; + }; +}; + +/** + * sqe commands to the kernel + */ +enum fuse_uring_cmd { + FUSE_URING_REQ_INVALID = 0, + + /* submit sqe to kernel to get a request */ + FUSE_URING_REQ_FETCH = 1, + + /* commit result and fetch next request */ + FUSE_URING_REQ_COMMIT_AND_FETCH = 2, +}; + +/** + * In the 80B command area of the SQE. + */ +struct fuse_uring_cmd_req { + uint64_t flags; + + /* entry identifier */ + uint64_t commit_id; + + /* queue the command is for (queue index) */ + uint16_t qid; + uint8_t padding[6]; +}; + #endif /* _LINUX_FUSE_H */ From patchwork Thu Nov 7 17:03:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13866756 Received: from outbound-ip191a.ess.barracuda.com (outbound-ip191a.ess.barracuda.com [209.222.82.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C128B2170C0; Thu, 7 Nov 2024 17:04:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=209.222.82.58 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730999102; cv=fail; b=dw2IpPltYa3YXd6UP0J1e7oMAqFSIPlO3pSHg/FRUGO5YjjhlQ0AnX4aZBvI8IjYjqidSIeBa/NL9Yk4a0vNn6Zit7cMfeQ8zfFILv04pAfy0k+1txuy9Cj+hJAm+4dGz882roaobo5zi/7euc1DH+dt0LkFym/j+qhgcOeNxms= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730999102; c=relaxed/simple; bh=jPWR3XcsZ1Cmw5po+zK7lJlD+oF6fDj04DmSWzK5sFY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=j2z8oTGLwCLGumAs7aDEXLNAQyDZsJtrhmDbv//46kFnRy3OdAwLqKLXVejJ8nlgCGoIC7uIiSxPYvbcZmJwKah6u6Tlh95SlpD3/dRGdIdFx+26NuRBQ44irZu7JFS9LB4YNXVlvBvNvh934SUPsL5jG8/PK+aX3Y4f0V0Bw60= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com; spf=pass smtp.mailfrom=ddn.com; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b=Jf9kihgk; arc=fail smtp.client-ip=209.222.82.58 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ddn.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b="Jf9kihgk" Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04lp2047.outbound.protection.outlook.com [104.47.74.47]) by mx-outbound46-164.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 07 Nov 2024 17:04:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=gxg/nqDXK/ihNfyli83DjU5GXxe7o/vlurhcRx8Uu8yXVsb0VXUxsywJr42sOHqG4MfZlaf0d8t0VZuIdjQH79bEErViQoGScPy48VTguSR7zjvWXgIjhOhwkXJjqlKfay4+tkD1Tj4UAHfGEQ4Xygt80h4wfDBBDzLlYq7EpEa8H973KLwYXBu9k3hci9NFOtzw5FonpAmFhn6VL2JQ8D+hl3PEbfdiS4gvAcPh1TljOL7cFvZ9cFICxq3ktLZ0Y9G9iCNx0jYuFFBsEuVax9gdVgO9a56GM/miDBLV6rJVuHlqYxKCEQVGwtDNII+wjxSbfJJAIssMqQ/7MEey6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=TI1apY/HHnxAvwZA3PFvZapzOk6WLqDpAOZN9ms8KgY=; b=g52LIJfDthAQY3ocTp826ZmP0ylnHtLO6KX/EOHg59z5+ROM5gS7oHQPiPMyKcoDYeXHrm+hi6aS/NQ9HTG+UnhDNRiXvyhcJZ3Y5RVxnQgrhs2zNXrXXvAbXRpRAqINkEVVNEoCNDUiHa3rH8weuYtM/4cmrtKAfAC6NOsBp58xwFGYjhGtroYUW3FPU5HGVH/x66SqaG0o6+UEl8Liq87jX4gCcGiVFKaK54iYKBeulfRmeo9+ImVPQkiZjy86QVTH5DvRmmrLwt9ZiZiGitYb2Yk0C86td3hQwVxaecZoyUxHyu61+ShSy0gVfDvIqcI4waO9Dt6861qA2POOew== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=bsbernd.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TI1apY/HHnxAvwZA3PFvZapzOk6WLqDpAOZN9ms8KgY=; b=Jf9kihgklLYf/BkfNmWir1WLueCJTSn4h+3AFlZA4jmWade7l8BZYNXU5xnsgtxApX6ymlm819goqRwT6171iAgExBmSIK45Iq22G4rD5r94Nf8g10c0vY8jepk24mBusr0ZVI0u/Uwg1UuGqVO4zltHH5y70C7ayHBHzIPaZGU= Received: from MN2PR10CA0006.namprd10.prod.outlook.com (2603:10b6:208:120::19) by PH0PR19MB5599.namprd19.prod.outlook.com (2603:10b6:510:143::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.19; Thu, 7 Nov 2024 17:04:18 +0000 Received: from BN1PEPF00006002.namprd05.prod.outlook.com (2603:10b6:208:120:cafe::6d) by MN2PR10CA0006.outlook.office365.com (2603:10b6:208:120::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30 via Frontend Transport; Thu, 7 Nov 2024 17:04:18 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by BN1PEPF00006002.mail.protection.outlook.com (10.167.243.234) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8137.17 via Frontend Transport; Thu, 7 Nov 2024 17:04:18 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 238AAC6; Thu, 7 Nov 2024 17:04:17 +0000 (UTC) From: Bernd Schubert Date: Thu, 07 Nov 2024 18:03:51 +0100 Subject: [PATCH RFC v5 07/16] fuse: Make fuse_copy non static Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241107-fuse-uring-for-6-10-rfc4-v5-7-e8660a991499@ddn.com> References: <20241107-fuse-uring-for-6-10-rfc4-v5-0-e8660a991499@ddn.com> In-Reply-To: <20241107-fuse-uring-for-6-10-rfc4-v5-0-e8660a991499@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1730999049; l=3663; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=jPWR3XcsZ1Cmw5po+zK7lJlD+oF6fDj04DmSWzK5sFY=; b=TAY1KPQOgHbn28sUU8Pt9gtC/U+IHoaD5fYYYMKYr9xdhxKubagE6SnE09tV5V0C0asIO4rxu CUfBAtVjHrzCn0RhCEpExUKUHlLDl0qWkOPLQe3kVjC5Yyj1z1kRYoX X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00006002:EE_|PH0PR19MB5599:EE_ X-MS-Office365-Filtering-Correlation-Id: 9a5609c9-0813-4087-98ae-08dcff4e377e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?NpvsSBN4dkgVqMbpMWCm0S+c/vEfzsR?= =?utf-8?q?+WTj4WESqTd94OS7cXHAgvRljA7gHVOaYqcGQyqH6+PsdbTdKAb89lioxntUkjyRB?= =?utf-8?q?0zy52cksc1XidFyUUnldGAttCetmMvGS0yclIW84a2XNhTrgmgp01atKKfp+D1Pi8?= =?utf-8?q?5gSwxolNgcMk2MvOZU4FGAxCPsrRF0V0oomTkUWti75awo+RiOBLOBfNLTZb/kjXZ?= =?utf-8?q?W27iBNan4NOqDSqSraIRiLhU5vajM1jbkKT5CN9YUUKX9YsR3W+X9N76sxXNqJKNc?= =?utf-8?q?9kkNgOgIVwIPk+4EanEEYSzLxnqqr0yo35Hz7H+uucIesUTox5TtEjVTFRIFNuUl9?= =?utf-8?q?yQwIWB7lcCG2sxaiwHmUqR3qDcP2YbUEBx0R8oKv04uWW27VWcj9/JYYpoDW0Uv4Q?= =?utf-8?q?U7ulU9KY06MdDReC+1td95KZNIdZOo5rPCRT2ht6IwztZjyDfLZ2Ye1HwH3bY51Hp?= =?utf-8?q?ImlZjCZy71+GeeyHqLemfRO4W2N8OVBR1QbH7VofQBhHnrew8VApk46SIMz5pqAWT?= =?utf-8?q?nKVm0L+LX9BLP1cZ9SfCpxdSL4F8iL97DV+ynfSLGY95nd3E1p1yGQZc8QPciEXVF?= =?utf-8?q?vBlLoULQlGq0Rc8DnfigKN1Zy1wKXiXLjB2g2od4e+V8cgKbnGys6bUpCLyza9zYX?= =?utf-8?q?hMDRkutl9YHgLKmt6+TgWppp/cq4rt05BKVW6ZLr3Pg2+T+FpIgPVjMDiIckFiyR2?= =?utf-8?q?SR1J1rEovcBAhYahACYERSV9Ii/blvt+WOImCnODT6UqTMYy2RTdVhoD/eEcI3vQ/?= =?utf-8?q?tSjefsMw8x5q7u26rEAmDawxJ5NFjWjftJ28QLkqZVz53N+wjbBSmuFokKAEftTcS?= =?utf-8?q?XQjcF5e30HVxudt4JQ3KesOF41fZWk5A+6youyLXKJyjMhNGtaewtv2At8sAFo1aD?= =?utf-8?q?dtJ5UJcVrbXbcItUDAQ4CEQ01h+6+KWED6Pnf86iRpyJGadqlQ5xVpYjt4+hU6yUe?= =?utf-8?q?lzCLr5fCuT2nBUBgpy5IPMkm6aPPBskEYqBTu6dGoX5MpjOpS0CFrM0uzqhrhmUvs?= =?utf-8?q?5GVeNAOxI2hV7t4e7iUo43EufHxSGg1F7P87SE4YUHpVT02DKC7CvWhjQVuV/oRKg?= =?utf-8?q?96Id8NodzPgA4mxc6+am40/ZhvH6S+WduPI4AOE5Ds3bNL+vy8rNi/0htkf2mw+Kk?= =?utf-8?q?2Xs79IHwIVPWy51NAzvxdezmGf3fdRaOFIRNOn8/vf173h5q5xebAKbTCV6nqi1s7?= =?utf-8?q?a1L342BCG74ow9Yv1Wqx6QFXiNjwCf62NNtE/T2cVKijb6AxLytRJZNp/wWRFbUsv?= =?utf-8?q?a3zk9n96F2UicedcjFDr1vCOs9YoY13vkZC66Bbs2PCVO4YOoZnHM8Il8Mte2dqym?= =?utf-8?q?GyUCfEM/1fKWlDNH4SDf9UiDw4nN/ea0bQ=3D=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(7416014)(376014)(1800799024)(36860700013)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: W/l6+3p0xfcHxOepG9jCSZtcKLgZjCCCtI5yGf504DaxcbAom3oNtnAurnT8hSIDShHbQ46XZBMuvIYc94vSRPOK8Yh/qp5xYz1lr1+a4cmalENMov23hGGDA4tkpK/Cb+v+8MI+kZrkSLMo2p55fWxqp+e2qLZURX99vdQt2YrR7LTu138Xr/c8soU1uLcNZCyVAlfo3ggxPx3uQjciZewUeC/f43+JhxhWdI95KbhC+GD1vikk1Oe9pQlvz/2k9q9GV/aic+Hk/wMyyNS8RiGzM1OIDqhXrCzCG0sKdxNdNaeuRWlJS4fk7lyz2ktN122SGMzx74V70qTeR8QcwHuqfjJmOPBV3es5b3zAMgSzXxpslslb+X+erxmy89Xh2cIQBkv6+DJRaL7nBf+a7nG5qSVBTs+pN0oG0ljB3C/gxA7W7I16n7SGE2mDjT93ZKEJZXAQO2Fot8ez/qo6Hvb3Djc6ggaBVJqjkDm7TqMJ9C19rhnk84c4ebOcG7DRVTT0r0j+B/HvsZQQOASM6W5LLGv9gnMa4Ac2EEYdnlA5mcIVQmu63Ivf7aaG12R0LU6uFDXLUa+LyeaDIFEg5H3fqx8pWDWny2eukMrWBBC+Ywa29XcQ8kK4RkenVqeHGzCsqGsBUlRYQ7y5k4gveg== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 17:04:18.1937 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9a5609c9-0813-4087-98ae-08dcff4e377e X-MS-Exchange-CrossTenant-Id: 753b6e26-6fd3-43e6-8248-3f1735d59bb4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=753b6e26-6fd3-43e6-8248-3f1735d59bb4;Ip=[50.222.100.11];Helo=[uww-mrp-01.datadirectnet.com] X-MS-Exchange-CrossTenant-AuthSource: BN1PEPF00006002.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR19MB5599 X-BESS-ID: 1730999066-111940-12772-9953-1 X-BESS-VER: 2019.1_20241029.2310 X-BESS-Apparent-Source-IP: 104.47.74.47 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVsamJmZAVgZQMM0gOSnVMinNLM UsyTQ10TDNzDjNxMzYzMjYMjXVxMJQqTYWALAhJhBBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260269 [from cloudscan10-145.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 Move 'struct fuse_copy_state' and fuse_copy_* functions to fuse_dev_i.h to make it available for fuse-uring. 'copy_out_args()' is renamed to 'fuse_copy_out_args'. Signed-off-by: Bernd Schubert --- fs/fuse/dev.c | 30 ++++++++---------------------- fs/fuse/fuse_dev_i.h | 25 +++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 22 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index d4e7d69f79cec192cb456aedfb7d4a2a274fea80..f210f91a937b24e75a467e943cdec4581900e061 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -630,22 +630,8 @@ static int unlock_request(struct fuse_req *req) return err; } -struct fuse_copy_state { - int write; - struct fuse_req *req; - struct iov_iter *iter; - struct pipe_buffer *pipebufs; - struct pipe_buffer *currbuf; - struct pipe_inode_info *pipe; - unsigned long nr_segs; - struct page *pg; - unsigned len; - unsigned offset; - unsigned move_pages:1; -}; - -static void fuse_copy_init(struct fuse_copy_state *cs, int write, - struct iov_iter *iter) +void fuse_copy_init(struct fuse_copy_state *cs, int write, + struct iov_iter *iter) { memset(cs, 0, sizeof(*cs)); cs->write = write; @@ -999,9 +985,9 @@ static int fuse_copy_one(struct fuse_copy_state *cs, void *val, unsigned size) } /* Copy request arguments to/from userspace buffer */ -static int fuse_copy_args(struct fuse_copy_state *cs, unsigned numargs, - unsigned argpages, struct fuse_arg *args, - int zeroing) +int fuse_copy_args(struct fuse_copy_state *cs, unsigned numargs, + unsigned argpages, struct fuse_arg *args, + int zeroing) { int err = 0; unsigned i; @@ -1883,8 +1869,8 @@ static struct fuse_req *request_find(struct fuse_pqueue *fpq, u64 unique) return NULL; } -static int copy_out_args(struct fuse_copy_state *cs, struct fuse_args *args, - unsigned nbytes) +int fuse_copy_out_args(struct fuse_copy_state *cs, struct fuse_args *args, + unsigned nbytes) { unsigned reqsize = sizeof(struct fuse_out_header); @@ -1986,7 +1972,7 @@ static ssize_t fuse_dev_do_write(struct fuse_dev *fud, if (oh.error) err = nbytes != sizeof(oh) ? -EINVAL : 0; else - err = copy_out_args(cs, req->args, nbytes); + err = fuse_copy_out_args(cs, req->args, nbytes); fuse_copy_finish(cs); spin_lock(&fpq->lock); diff --git a/fs/fuse/fuse_dev_i.h b/fs/fuse/fuse_dev_i.h index e82cbf9c569af4f271ba0456cb49e0a5116bf36b..f36e304cd62c8302aed95de89926fc894f602cfd 100644 --- a/fs/fuse/fuse_dev_i.h +++ b/fs/fuse/fuse_dev_i.h @@ -13,6 +13,23 @@ #define FUSE_INT_REQ_BIT (1ULL << 0) #define FUSE_REQ_ID_STEP (1ULL << 1) +struct fuse_arg; +struct fuse_args; + +struct fuse_copy_state { + int write; + struct fuse_req *req; + struct iov_iter *iter; + struct pipe_buffer *pipebufs; + struct pipe_buffer *currbuf; + struct pipe_inode_info *pipe; + unsigned long nr_segs; + struct page *pg; + unsigned int len; + unsigned int offset; + unsigned int move_pages:1; +}; + static inline struct fuse_dev *fuse_get_dev(struct file *file) { /* @@ -24,6 +41,14 @@ static inline struct fuse_dev *fuse_get_dev(struct file *file) void fuse_dev_end_requests(struct list_head *head); +void fuse_copy_init(struct fuse_copy_state *cs, int write, + struct iov_iter *iter); +int fuse_copy_args(struct fuse_copy_state *cs, unsigned int numargs, + unsigned int argpages, struct fuse_arg *args, + int zeroing); +int fuse_copy_out_args(struct fuse_copy_state *cs, struct fuse_args *args, + unsigned int nbytes); + #endif From patchwork Thu Nov 7 17:03:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13866744 Received: from outbound-ip168b.ess.barracuda.com (outbound-ip168b.ess.barracuda.com [209.222.82.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4BB93216A00; Thu, 7 Nov 2024 17:04:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=209.222.82.102 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730999079; cv=fail; b=RDfsG7EiymGhvGMiJX8S/VtMVUmT08vjBOu3l1NmPcPBlpq69Aunaitc24GssyHwaifmnrJ/9JJNG9Ey4as1hslnISXKytO1nPnyZMA1r5le7A8mS6B9qLuRjJghpwL2VCRaNKzj3Q7tAAf4R8oP+yvKe+FRYu9EYdBn0AXtGe4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730999079; c=relaxed/simple; bh=ikGif04sjep7rEQpVSE2ac++O9XaMsyCGtY4Tkd2gKQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Moglyyw7PhIDzGw2OTldUOWOMUA0nQHYysUIW7n/NV4HCsFN5tC2H2XXzqOUAgtjQwZLkk5IWNzvRcNOAG+vxlyAGLn9l0U6m1TkkjYMABvai9thd/sj/tQwS0IDBMj9pSftaZnnGlLyxhrc+5f2CBnkoHKxKvOSwBxQIC4/hsM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com; spf=pass smtp.mailfrom=ddn.com; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b=rnVQ75rQ; arc=fail smtp.client-ip=209.222.82.102 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ddn.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b="rnVQ75rQ" Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02lp2043.outbound.protection.outlook.com [104.47.57.43]) by mx-outbound19-226.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 07 Nov 2024 17:04:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BZ6l3VCk8cHszcGeoiriMmYMm0DFSBMITnflnyfo2+LYfd9HUs/R6Q00E+2A1xN6r6s3nbt0ii+sT+bl+6yabQs3WIc/4XzgTrV461pROgzH4zoO/kD9QvtNvkC6jfBGXNyzOx/0R5Z8abJpC8zdIImsd8lGErYaI1PeY1xIMw7FGX0ZePOIYvtYqM10Gz0XEsmFpyUrFyZsGjIC/svmHSpG2AvT1Z7qmA7lhCy+a1/Fa8U5/aLXbNxMmkM8V+yxtdhVvPs1ZNZ5XXjQ+ls9RezOw6K6wdftqt/co4wbmAiknnqp96AKCz4/R9ztl6h6LWq122ZuebA2LXctUYBjQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=dlTPtALK3niaLVj2kv4g4nP435uSf0fpIWA5KQAMXQ0=; b=uJO3G9S9o627w9v0CEMi+e3n7iSBO1CoY8SKzl6k0CV1RuU4q7XWZt9f/hz/pFiz+fj7sLywgz2i2X0DJV35OD9/7qGpNyMPwr06+lqI+QM+s8tyukMpIxLqHkeczhAii2chlYuTD2+TP8ib2ocvWY6fkECNUV905Etls3wPT0ujtdzMM+mBWM5xtQHmwiJ3wKfRM5u/v6L5LjG1U11mJlKjFY1EtR6LhKwjhnGAoaDUwipIXF/RrKvWZlltIZ40abB/kRDa062anOjgquu+Sw/hpDu+9Njt+pi0ZnXVQu67IgdusjQk01gL1z5QUAEfuSeQ3GQKAadQo6HS46bcZQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=bsbernd.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dlTPtALK3niaLVj2kv4g4nP435uSf0fpIWA5KQAMXQ0=; b=rnVQ75rQIliOpLwg2r19vO6n6ZA1WYiJL1A7gVlEBLUGNopVsScBfsdksfHaDfPTGdHI0//M9PQT0J30VN1pNBtRFA4UrIXeCTKjOzQFSwDI4JHvisqw63fz6dQZ6iNimaVFF7/ndPRtFhwF7sXh1KC8NHUDd5XnKSQFSmHWU18= Received: from SJ0PR13CA0152.namprd13.prod.outlook.com (2603:10b6:a03:2c7::7) by LV3PR19MB8703.namprd19.prod.outlook.com (2603:10b6:408:26e::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.20; Thu, 7 Nov 2024 17:04:19 +0000 Received: from CO1PEPF000044EE.namprd05.prod.outlook.com (2603:10b6:a03:2c7:cafe::81) by SJ0PR13CA0152.outlook.office365.com (2603:10b6:a03:2c7::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.10 via Frontend Transport; Thu, 7 Nov 2024 17:04:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by CO1PEPF000044EE.mail.protection.outlook.com (10.167.241.68) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8137.17 via Frontend Transport; Thu, 7 Nov 2024 17:04:18 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 1B47D7D; Thu, 7 Nov 2024 17:04:17 +0000 (UTC) From: Bernd Schubert Date: Thu, 07 Nov 2024 18:03:52 +0100 Subject: [PATCH RFC v5 08/16] fuse: Add fuse-io-uring handling into fuse_copy Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241107-fuse-uring-for-6-10-rfc4-v5-8-e8660a991499@ddn.com> References: <20241107-fuse-uring-for-6-10-rfc4-v5-0-e8660a991499@ddn.com> In-Reply-To: <20241107-fuse-uring-for-6-10-rfc4-v5-0-e8660a991499@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1730999049; l=1731; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=ikGif04sjep7rEQpVSE2ac++O9XaMsyCGtY4Tkd2gKQ=; b=YUMvQYM7HsqSUNxBxsK3bpnaL3UEuzVyKv9wJeOzyr17zsxSPjGlSxKvRrK1qyMTWeAqky9DX 8tiNC6skGlEAMOHvjV3uweMR5nq+NVOij/wSXYBBeWnBwiwqkJBYDuk X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044EE:EE_|LV3PR19MB8703:EE_ X-MS-Office365-Filtering-Correlation-Id: 1ba1a087-ec80-43ed-4952-08dcff4e37dc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|7416014|376014|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?q?Ozde/ek0jCuVUPmJUTB68l2n2i2jCw+?= =?utf-8?q?Mp1TIJM4lB+e7skdqhBmH89ql8/y4WpkPVdrKQ3OOCpXzEvj6AFOXhpfSvmvOF99p?= =?utf-8?q?TjSX0zdgJQfe8eBojp2brnjV9WXWlVCfU1DfUcaMFvENZJeWfeZOXmUsTHVGaqaeS?= =?utf-8?q?X78TphqfU8UOq+76E386SLG53hPENuOmqpZlpiZJFyCknEyLSZJsCcU8GfGlvh1il?= =?utf-8?q?fbfYX85wXSUzhWTYTrRdsMN5kC33fyFo2YoxtnJ4YqCg/xdVzEIcR2CzgFRZafoRT?= =?utf-8?q?IhEC9FwPea9mTT0QKsXYVPMIhzmWl9bIOBQEN3YD2mZfI/3Gz060UrrZZTIj+9Pi3?= =?utf-8?q?UAkSP/ou70fatDwYcnTVWGkNt5ujKMZbSY5m40FO7/ofDsNO+yTC/vNHdDr1Wua7D?= =?utf-8?q?bzkENJtj8FK0ViMcGwkmyoGmnN8Nuy5Me5xigpn8Mm1OtGkWvxGt2TOn8JLou8+NL?= =?utf-8?q?WA2pBDQvVxlJ8r+PhyN3tQzIn16oPtRusWyIT4mGlyEFRgBuzl7XuPONtNDR8M45e?= =?utf-8?q?aWB4JseojaOxdsZ/GDn1EdAO/Z5gtvS6ShZBBnpGdgJj7LxIdSz6zNWcCdvbP7E0M?= =?utf-8?q?SdF2DDbkzJsekLZ3X+FvR/wNgCBEWC42p/O7OoOyxOQLieZnCsKWpPBN4GF+8/gc7?= =?utf-8?q?DZgUbuinOomtm8VLlwMg4lNL/YWJxh9oLUqdUPJS8wFWMVkicG9dnT9LQeyK6d3Ed?= =?utf-8?q?ZVXEGD3XtdXYxxq8z5vAHhYazqblm0dnfxyYLcbq0gekk0fHkmL0heXtzSSUA0OkM?= =?utf-8?q?ThPhhZQuel5Jmp9pAXt4MT7nsFpQ3DktU1N7sqICDogca/LrbRrHkLPn5j8/CbBEU?= =?utf-8?q?8g25TK1/3/sXfIQAjvzo601YrahuzTzMjR2IADtktBt5Dd1+8zPD3bfxe6XAZXpnq?= =?utf-8?q?NRfDqVcxBH0AzKGfhCDIW4cjEflMQhbCiXOhIbBnWzIOiu6q3X3/eRVuaW3AMCAGN?= =?utf-8?q?KRX0IUkdYPWvAvwMrCSunsfNGLgKNq/c6HAX0GYjiQ0DffI+zoB7GubLoPhUgzu/u?= =?utf-8?q?1mqa0pgt3DhSzahGZ0HfMrXUGvD401u6NFw3X2DCPc3SLBngSABh/PsAoO0P3s/l5?= =?utf-8?q?Tv4B/425vo/JDvXzRjezEoOGtOsjVv0xloNAPzuFrJZKirgxgbsY/mQtkLTviRyL+?= =?utf-8?q?Gq1twv8Nd/zx7fkvyYtIsTTNWFG0BbAgbcCooxwxaM4HDED8Y1grkDX7iABp6j40z?= =?utf-8?q?JLGHBOuREidYWJyRd1CcQ5nflw5coAbwdnuIP2+uPZK+Z48YaI7z+D/m0/t0hFkui?= =?utf-8?q?NKmSXGuKhqlDhqjJaul/Tyh67A8TL1ZKVDioizHKTHhhaBzry4nYYKxt5bBPoCrRz?= =?utf-8?q?2hu7ZD5zYY/BAlkDRDNx3uxdVJ4uq3PXXA=3D=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(7416014)(376014)(1800799024)(36860700013);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Q0bRsVKGefZl/tCPFD+oyxaIKznCf37dXObkb04xt2pRhd0DRMW6Eq8TZmP1Qcp40iBWR3fzBanpPp4uL/SV0gtiz0juFjS8nBbjriVMJV4CROWBHeSKLtLxyBraPxbU7vWqRpziMyADySI8au8DYOlWN+44U64oVtHp9h1aGe4iafubMl2X0gRZK1U45zAR+Xykm+SdX/6+hRB0G1O4lxcp/B5cOG2zU1i0OFGGgBqr5BetDrmYuUuUfrMzpC7Rrb1ZnLyC8NtlWH46rWoetjPYIkZCm9Avh9UeR8Z8+OvF1allhMmDMmzoul6YhcGcI30nUXeHPZPhiDvI+LJcEuzffXLd/2lftRcsS+vfZiwEeNtBCXJfbdvOROmWsQjre8+L2P2gEqfqBjqIjnEgnDcyLu1c7GE+QwyN3nMdk7V/CJUfcMkRFoAiQNssjkt6LZNJcVgAxeUpDW+1ecPaXBYuy7bVvch1ZoOVg5HoSbcsyB9dbiHIiSGNnEtiez1Ntn39HaYYrJmwU5JGs8+7D7jjsVhFKJvRsXbN9sFuMTo/QluDwFGEutVe4uojwmFKR1HrYLFGgoXq8EeWaqsiGNoi1cSgF9cwKrLLBZGj0+227RsuRxi4R/ZlTPN+1aaBmbB7+G0bhPem+S6sHr0Scg== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 17:04:18.8545 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1ba1a087-ec80-43ed-4952-08dcff4e37dc X-MS-Exchange-CrossTenant-Id: 753b6e26-6fd3-43e6-8248-3f1735d59bb4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=753b6e26-6fd3-43e6-8248-3f1735d59bb4;Ip=[50.222.100.11];Helo=[uww-mrp-01.datadirectnet.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044EE.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR19MB8703 X-BESS-ID: 1730999068-105090-12691-30408-1 X-BESS-VER: 2019.1_20241029.2310 X-BESS-Apparent-Source-IP: 104.47.57.43 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoZm5iZAVgZQMNHAMs3UyNQ80R xIJ6eZWRqmphqmJaYaGlpYJhmamSrVxgIAlFF8U0EAAAA= X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260269 [from cloudscan17-186.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 Add special fuse-io-uring into the fuse argument copy handler. Signed-off-by: Bernd Schubert --- fs/fuse/dev.c | 12 +++++++++++- fs/fuse/fuse_dev_i.h | 5 +++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index f210f91a937b24e75a467e943cdec4581900e061..4ca67c8ae0e28072383478d6ee7ad7791566b6ce 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -738,6 +738,9 @@ static int fuse_copy_do(struct fuse_copy_state *cs, void **val, unsigned *size) *size -= ncpy; cs->len -= ncpy; cs->offset += ncpy; + if (cs->is_uring) + cs->ring.offset += ncpy; + return ncpy; } @@ -1872,7 +1875,14 @@ static struct fuse_req *request_find(struct fuse_pqueue *fpq, u64 unique) int fuse_copy_out_args(struct fuse_copy_state *cs, struct fuse_args *args, unsigned nbytes) { - unsigned reqsize = sizeof(struct fuse_out_header); + + unsigned int reqsize = 0; + + /* + * Uring has all headers separated from args - args is payload only + */ + if (!cs->is_uring) + reqsize = sizeof(struct fuse_out_header); reqsize += fuse_len_args(args->out_numargs, args->out_args); diff --git a/fs/fuse/fuse_dev_i.h b/fs/fuse/fuse_dev_i.h index f36e304cd62c8302aed95de89926fc894f602cfd..7ecb103af6f0feca99eb8940872c6a5ccf2e5186 100644 --- a/fs/fuse/fuse_dev_i.h +++ b/fs/fuse/fuse_dev_i.h @@ -28,6 +28,11 @@ struct fuse_copy_state { unsigned int len; unsigned int offset; unsigned int move_pages:1; + unsigned int is_uring:1; + struct { + /* overall offset with the user buffer */ + unsigned int offset; + } ring; }; static inline struct fuse_dev *fuse_get_dev(struct file *file) From patchwork Thu Nov 7 17:03:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13866752 Received: from outbound-ip168b.ess.barracuda.com (outbound-ip168b.ess.barracuda.com [209.222.82.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C66BA216449; Thu, 7 Nov 2024 17:04:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=209.222.82.102 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730999086; cv=fail; b=ofhVJhnS5wqpLxh/mWRVXA+gfyN2jKf68WkeVSkPc/CBwHA7mIN75Gyw1BmR0pWCKGKQUI6YbXQZdyIEXNLtH49tXtrH3me2wt9UonL8zP1ZweTpgzOPPzcrsSaa8C1GZzrJnlut8yFk1AQE+6o+BIs/lxpkVKLgTmfTuVcK5IQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730999086; c=relaxed/simple; bh=wc2mAxs2Kxeea0Xe+wGTfRrD9ppkb/SSUYT+pcFG8uc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=F2siUIIVVn7IzqY0hQnbsAHgyXRTwlK4+kWBN3yI+tCzUUMmFdDq989PzqorXPN5vUkkQMTBNr2E4/Hzqa0mJ24oZ9woJQ4Vl7ZAXZz5BrhoeK92qh4GIzcPvZ9mSwTpgEG+IFyMl4xhPf1BJF0WdSsTF7fauZrQnA9l1IrP7bQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com; spf=pass smtp.mailfrom=ddn.com; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b=z2fkcI7T; arc=fail smtp.client-ip=209.222.82.102 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ddn.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b="z2fkcI7T" Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2170.outbound.protection.outlook.com [104.47.55.170]) by mx-outbound42-115.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 07 Nov 2024 17:04:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hDklKdVXN3rLdvd0+kiCFL01avAXVvjdTdnLH6vQ/SfWtDeTsIXh+QIYuMjtiRbWpzgdKPtYFyWcImeOuHlIVnQEvsujHeu4achLL+mIa+bEQ6rCDwUQGLgq/JF5YzVYpUs+xLU/SMLqHfcLUbg6MBTPhOXR0tSXKIklkpHXTFUv56AWLLfB7ZF64QfJQbx/BKLVf7+cgpz9Rux+iFArZQt7RJtJoTG53Gz7735G5rDazNea7Kw6lUdRhM55tm/CHuRu/uzW1PONx8+zoXVdZ6R0oJzPug1W/QlocVzzCgKAcm6oxzbarXv3V+pfkdvMze5OqNqyruvTWxn7JDpRYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=lR/i5NJSgjkHp+rLMUus/APsFY7JnE4vZFJkThJqjH0=; b=NQIDFuidJBy9JthMso/ebuz2ptFrJexssSMJem5VFPJIZ68rwbjPh7vuNcX/+RxvLDC5fRQLPL53byJpGFVsojbgxxlEJpzuqWhWc/gW0GZcUYJNMnobriiO4BpkdAsiIRXS+cGblRspoMrtXZMsnNIDjZ5E4mmJ+/5qHgK6nWHsBi3gt0IXCE8kquAbuu5+bQOZ4h7gExGrUmkV1wZXUQgIHYFQMoiEgTAg7X42XVt2ysiE4QgGIynTEP4USRilmRxqPeFJOxu7YqX04E0OECXJARllkiDR8juafDxhsRTRQ0HHJGhfYGkjjjbB8Nt5IOa9VDnNL/z5fcUBhk4D9A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=bsbernd.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lR/i5NJSgjkHp+rLMUus/APsFY7JnE4vZFJkThJqjH0=; b=z2fkcI7TNmD3+mSvTMHgaXhfV7Lz7JX4SVPxIzxe67d4EyywJSmKiRkvXDYIroX72lnwujGaz6dl/gkXHbDSY5fRGjaQWpY/tQMcxdaQAwCbXem0UhqMyABduIqhIOb+PSw8qT/K3sL9PHmp3Qam1eGQt/ssNEZLYHUSV2bo/7g= Received: from MW4P222CA0023.NAMP222.PROD.OUTLOOK.COM (2603:10b6:303:114::28) by SA1PR19MB4928.namprd19.prod.outlook.com (2603:10b6:806:185::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.21; Thu, 7 Nov 2024 17:04:20 +0000 Received: from CO1PEPF000044F5.namprd05.prod.outlook.com (2603:10b6:303:114:cafe::c1) by MW4P222CA0023.outlook.office365.com (2603:10b6:303:114::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.19 via Frontend Transport; Thu, 7 Nov 2024 17:04:20 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by CO1PEPF000044F5.mail.protection.outlook.com (10.167.241.75) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8137.17 via Frontend Transport; Thu, 7 Nov 2024 17:04:19 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 12AC9C6; Thu, 7 Nov 2024 17:04:18 +0000 (UTC) From: Bernd Schubert Date: Thu, 07 Nov 2024 18:03:53 +0100 Subject: [PATCH RFC v5 09/16] fuse: {uring} Add uring sqe commit and fetch support Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241107-fuse-uring-for-6-10-rfc4-v5-9-e8660a991499@ddn.com> References: <20241107-fuse-uring-for-6-10-rfc4-v5-0-e8660a991499@ddn.com> In-Reply-To: <20241107-fuse-uring-for-6-10-rfc4-v5-0-e8660a991499@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1730999049; l=18832; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=wc2mAxs2Kxeea0Xe+wGTfRrD9ppkb/SSUYT+pcFG8uc=; b=nhLmFBi+c8jODrcCM+/bc59+pMBhprKATalO8aMCub0PqGdyC10K8BoXjyCPQeAPrqezmGtz8 LqPChMm8ICJDW/c+KCyEItz0IdmzOVI5pnPOuWn+HE8e2nNGAsquV6x X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044F5:EE_|SA1PR19MB4928:EE_ X-MS-Office365-Filtering-Correlation-Id: 692fd557-f271-4d93-83e0-08dcff4e386c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|1800799024|7416014|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?SGNVWNWgRiXUUo6XOq9xw1HCCYwdrep?= =?utf-8?q?PeNc5itF6X7FyxfeUuXtzkvb13Vj/nct/uJnu3TCg4sqdTEN5/kOVsYlqYZt79FwQ?= =?utf-8?q?0cpPkIoDURBufEojxk6uwoLRNrVU8Wb+9q+KskkdfG9SmA4CWkiarjomJqcmE5rqk?= =?utf-8?q?D3H2LOXEsEnquwPwzm0Va2qguCJ3o6cenjc9hKybvv9z4KDTOQOd9Qi3DbY7ltdhC?= =?utf-8?q?iy/X2h4o9G4yadiPmTeTT/IMoOb+qiJ7Kl0zgTJLyIMefbXdKaRk+wSfuethg6qR8?= =?utf-8?q?vmP3csmRzTfCm05QjbJBG3t5l0MZNm9rXhyTVpNedfiKZm+ldfr7+NyajzGvqNqWC?= =?utf-8?q?94TdNIhi06r4NencfPLnqwsR+ZTFYFYxXaKc0gLXvNQxFmTDlTkLNcXWaWaJ78xVu?= =?utf-8?q?DA6GCUxwj0VH/5ZTknNTlSSraI8z4jXk4Lqg5RPoRMMhKhSUCLefnzT8TmMaNoSMa?= =?utf-8?q?DW6IRSaETXSZfqe86VAbIwcSpkTrLZhWQZEV8F7Ns4GtcI52U25T04B4n5RHACZl8?= =?utf-8?q?mw1tUL2KQr+ZiMB0+gRGPvG26oLakmB6Qg9z0uQ22Z6UZkk2PIonGapC99O+We5LP?= =?utf-8?q?LU8R2MweJUuRRSIxxZWXlxVnYXDDpeJ9fGLGRyyY8waCa4vE4aAl5WRkqm1VO60rj?= =?utf-8?q?m+gOACOiNPt6PdmxRuob/QcNuag5UsaJQpHTml+MiIaR7T/xgl60McvdfSFEIVD2p?= =?utf-8?q?4w3NeOMoBM7Q6iQjwSPngz5VmfKXPXKL0VXN16ELyFcgkGvr7l3sXE5aSQXUhWE7O?= =?utf-8?q?tb+lyRvFOdl1+nd+JmueuTOSxrlvQv11peFVyDA25DIyIbWcmO1MrH5N/U1roFgnz?= =?utf-8?q?LzD4ARKEQnO5n2pqjYLFnNsPpwEXKsmZSYKN6UadQ3FRrBgQELBE7sFUY8YTtMJuB?= =?utf-8?q?CLNBZmAc1gG3ZCClP+6D5n4UCnrkTNwHv/LLUMHKNwyRvEi0QL1+vque0jYkCwjVA?= =?utf-8?q?iPcbvE/g5KLqP8xWSBv6yXqMX2mIaGpwty8+SOCX07rQodd472PQfKcy/Dlu+fDrF?= =?utf-8?q?5jHAiXtLV4yZZqm9AZkQFmFuCTVgqZ7W2Xn4NjkMhc/vrCNb69vDEzq+FsnYuYer2?= =?utf-8?q?w4hcX/FPiNVsZ+K9IY2919NLlc5eUZ0aZjAC0RzrdwACEZV/EUyIci72LjpzQN2OZ?= =?utf-8?q?P+yis2zRxJOfMTuTc/lhA5pxfb9/i8bpTBWTjqnP9JthPmpRgLtJHKPB0ohqzOIwM?= =?utf-8?q?i/muCSvMDxKdaIAgJ15YUHnpS5zaxPh41v8nOLIbmHvLvR6dNu6ERb5U8X8b9PjbK?= =?utf-8?q?28o2+mEsxC0bNhxa2ZY2fLlvrxKNAlZb/q/diG71tFk21mvMpCb78PkNR1m3kwGfP?= =?utf-8?q?WPRtXZXmnsYCSc9OAfDDTFIRSBaGMynttQ=3D=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(82310400026)(1800799024)(7416014)(376014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: M98dlsemyWX2HOr/yLPsI8uHzqdNZBKAtbxethiKozdngwLJzbTgoQt99hZ7LpoTbpsPl0tE95HYqgBrKG1Kg21FzWsqJ3To+ecyloFPoPod2KbT4dTs9IQd7djyPge/h+s4C72SXBjRvQ28g1Rn2An/Y/W5wFoKnRbjelJhD0f7oSPKjdrdd19n3P9kH1ud00aMDXHsKX0oU9n/N0x3Mrb8OuZ9ZtdujR40GtzT1OYB1QL1+1zbPIHTBCXn7LbkiT48onSYf3eBJsZ6dN8WnWz/oBHPwcj6Z1q2nhqB2/zpmEnJA4kFExWAK4gTbGVzODXbFFt4rKy8KvtlmCCk5u2i6dwQjLidD2urZvKe71I75UOaBaz/RQKuZScI516X7/X2aA1j12HKvsyjT4HPD4sAqC3L20UQFOwSF6oeo3p9mIbxxyubJrmhven3gjkv/BdW0LbByHysbUt4HK+KB6vLYwtQDwJq6OC31LWIzloUWAfXs1+h/7WWmTvW75YkHs6WreHjW/drZ+WfxPYkSC6MAXgNoT9v81QEtcYGNX7ilnJnv5DVKBgdM3CMGi3pxUiHZzrul5SCsuJ3wQRh7DczqzG0xtnG6AN9sFr/LkKvLQajBKzV9nFLJlrAH2tz2WaDrFxuwKc5Wlp7f0dzkA== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 17:04:19.7998 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 692fd557-f271-4d93-83e0-08dcff4e386c X-MS-Exchange-CrossTenant-Id: 753b6e26-6fd3-43e6-8248-3f1735d59bb4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=753b6e26-6fd3-43e6-8248-3f1735d59bb4;Ip=[50.222.100.11];Helo=[uww-mrp-01.datadirectnet.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044F5.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR19MB4928 X-BESS-ID: 1730999068-110867-12758-13482-1 X-BESS-VER: 2019.1_20241029.2310 X-BESS-Apparent-Source-IP: 104.47.55.170 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoYWhuYGQGYGUDTN2NjY3MIwzR xIG5qmmaclJhqlGhobGqQYW5oYpJko1cYCAJ3hzPJCAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260269 [from cloudscan8-205.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 This adds support for fuse request completion through ring SQEs (FUSE_URING_REQ_COMMIT_AND_FETCH handling). After committing the ring entry it becomes available for new fuse requests. Handling of requests through the ring (SQE/CQE handling) is complete now. Fuse request data are copied through the mmaped ring buffer, there is no support for any zero copy yet. Signed-off-by: Bernd Schubert --- fs/fuse/dev.c | 6 +- fs/fuse/dev_uring.c | 449 ++++++++++++++++++++++++++++++++++++++++++++++++++ fs/fuse/dev_uring_i.h | 11 ++ fs/fuse/fuse_dev_i.h | 7 +- fs/fuse/fuse_i.h | 9 + fs/fuse/inode.c | 2 +- 6 files changed, 479 insertions(+), 5 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 4ca67c8ae0e28072383478d6ee7ad7791566b6ce..b085176ea824bd612a8736e00c9b6f8f9e232208 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -188,7 +188,7 @@ u64 fuse_get_unique(struct fuse_iqueue *fiq) } EXPORT_SYMBOL_GPL(fuse_get_unique); -static unsigned int fuse_req_hash(u64 unique) +unsigned int fuse_req_hash(u64 unique) { return hash_long(unique & ~FUSE_INT_REQ_BIT, FUSE_PQ_HASH_BITS); } @@ -1860,7 +1860,7 @@ static int fuse_notify(struct fuse_conn *fc, enum fuse_notify_code code, } /* Look up request on processing list by unique ID */ -static struct fuse_req *request_find(struct fuse_pqueue *fpq, u64 unique) +struct fuse_req *fuse_request_find(struct fuse_pqueue *fpq, u64 unique) { unsigned int hash = fuse_req_hash(unique); struct fuse_req *req; @@ -1944,7 +1944,7 @@ static ssize_t fuse_dev_do_write(struct fuse_dev *fud, spin_lock(&fpq->lock); req = NULL; if (fpq->connected) - req = request_find(fpq, oh.unique & ~FUSE_INT_REQ_BIT); + req = fuse_request_find(fpq, oh.unique & ~FUSE_INT_REQ_BIT); err = -ENOENT; if (!req) { diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index ce0a41b00613133ea1b8062290bc960b95254ac9..4f8a0bd1e2192bfbc310eb53dd8e89274e6f479b 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -19,6 +19,24 @@ MODULE_PARM_DESC(enable_uring, "Enable uring userspace communication through uring."); #endif +#define FUSE_URING_IOV_SEGS 2 /* header and payload */ + +/* + * Finalize a fuse request, then fetch and send the next entry, if available + */ +static void fuse_uring_req_end(struct fuse_ring_ent *ring_ent, bool set_err, + int error) +{ + struct fuse_req *req = ring_ent->fuse_req; + + if (set_err) + req->out.h.error = error; + + clear_bit(FR_SENT, &req->flags); + fuse_request_end(ring_ent->fuse_req); + ring_ent->fuse_req = NULL; +} + static int fuse_ring_ent_unset_userspace(struct fuse_ring_ent *ent) { struct fuse_ring_queue *queue = ent->queue; @@ -50,7 +68,9 @@ void fuse_uring_destruct(struct fuse_conn *fc) WARN_ON(!list_empty(&queue->ent_avail_queue)); WARN_ON(!list_empty(&queue->ent_intermediate_queue)); + WARN_ON(!list_empty(&queue->ent_in_userspace)); + kfree(queue->fpq.processing); kfree(queue); ring->queues[qid] = NULL; } @@ -109,13 +129,21 @@ static struct fuse_ring_queue *fuse_uring_create_queue(struct fuse_ring *ring, { struct fuse_conn *fc = ring->fc; struct fuse_ring_queue *queue; + struct list_head *pq; queue = kzalloc(sizeof(*queue), GFP_KERNEL_ACCOUNT); if (!queue) return ERR_PTR(-ENOMEM); + pq = kcalloc(FUSE_PQ_HASH_SIZE, sizeof(struct list_head), GFP_KERNEL); + if (!pq) { + kfree(queue); + return ERR_PTR(-ENOMEM); + } + spin_lock(&fc->lock); if (ring->queues[qid]) { spin_unlock(&fc->lock); + kfree(queue->fpq.processing); kfree(queue); return ring->queues[qid]; } @@ -127,12 +155,244 @@ static struct fuse_ring_queue *fuse_uring_create_queue(struct fuse_ring *ring, INIT_LIST_HEAD(&queue->ent_avail_queue); INIT_LIST_HEAD(&queue->ent_intermediate_queue); + INIT_LIST_HEAD(&queue->ent_in_userspace); + INIT_LIST_HEAD(&queue->fuse_req_queue); + + queue->fpq.processing = pq; + fuse_pqueue_init(&queue->fpq); spin_unlock(&fc->lock); return queue; } +static void +fuse_uring_async_send_to_ring(struct io_uring_cmd *cmd, + unsigned int issue_flags) +{ + io_uring_cmd_done(cmd, 0, 0, issue_flags); +} + +/* + * Checks for errors and stores it into the request + */ +static int fuse_uring_out_header_has_err(struct fuse_out_header *oh, + struct fuse_req *req, + struct fuse_conn *fc) +{ + int err; + + if (oh->unique == 0) { + /* Not supportd through request based uring, this needs another + * ring from user space to kernel + */ + pr_warn("Unsupported fuse-notify\n"); + err = -EINVAL; + goto seterr; + } + + if (oh->error <= -512 || oh->error > 0) { + err = -EINVAL; + goto seterr; + } + + if (oh->error) { + err = oh->error; + pr_devel("%s:%d err=%d op=%d req-ret=%d", __func__, __LINE__, + err, req->args->opcode, req->out.h.error); + goto err; /* error already set */ + } + + if ((oh->unique & ~FUSE_INT_REQ_BIT) != req->in.h.unique) { + pr_warn("Unpexted seqno mismatch, expected: %llu got %llu\n", + req->in.h.unique, oh->unique & ~FUSE_INT_REQ_BIT); + err = -ENOENT; + goto seterr; + } + + /* Is it an interrupt reply ID? */ + if (oh->unique & FUSE_INT_REQ_BIT) { + err = 0; + if (oh->error == -ENOSYS) + fc->no_interrupt = 1; + else if (oh->error == -EAGAIN) { + /* XXX Interrupts not handled yet */ + /* err = queue_interrupt(req); */ + pr_warn("Intrerupt EAGAIN not supported yet"); + err = -EINVAL; + } + + goto seterr; + } + + return 0; + +seterr: + pr_devel("%s:%d err=%d op=%d req-ret=%d", __func__, __LINE__, err, + req->args->opcode, req->out.h.error); + oh->error = err; +err: + return err; +} + +static int fuse_uring_copy_from_ring(struct fuse_ring *ring, + struct fuse_req *req, + struct fuse_ring_ent *ent) +{ + struct fuse_copy_state cs; + struct fuse_args *args = req->args; + struct iov_iter iter; + int err; + int res_arg_len; + + err = copy_from_user(&res_arg_len, &ent->headers->in_out_arg_len, + sizeof(res_arg_len)); + if (err) + return err; + + err = import_ubuf(ITER_SOURCE, ent->payload, ent->max_arg_len, &iter); + if (err) + return err; + + fuse_copy_init(&cs, 0, &iter); + cs.is_uring = 1; + cs.req = req; + + return fuse_copy_out_args(&cs, args, res_arg_len); +} + + /* + * Copy data from the req to the ring buffer + */ +static int fuse_uring_copy_to_ring(struct fuse_ring *ring, struct fuse_req *req, + struct fuse_ring_ent *ent) +{ + struct fuse_copy_state cs; + struct fuse_args *args = req->args; + struct fuse_in_arg *in_args = args->in_args; + int num_args = args->in_numargs; + int err, res; + struct iov_iter iter; + + if (num_args == 0) + return 0; + + err = import_ubuf(ITER_DEST, ent->payload, ent->max_arg_len, &iter); + if (err) { + pr_info_ratelimited("Import user buffer failed\n"); + return err; + } + + fuse_copy_init(&cs, 1, &iter); + cs.is_uring = 1; + cs.req = req; + + /* + * Expectation is that the first argument is the header, for some + * operations it might be zero. + */ + if (args->in_args[0].size > 0) { + res = copy_to_user(&ent->headers->op_in, in_args->value, + in_args->size); + err = res > 0 ? -EFAULT : res; + if (err) { + pr_info_ratelimited("Copying the header failed.\n"); + return err; + } + } + + /* Skip the already handled header */ + in_args++; + num_args--; + + err = fuse_copy_args(&cs, num_args, args->in_pages, + (struct fuse_arg *)in_args, 0); + if (err) { + pr_info_ratelimited("%s fuse_copy_args failed\n", __func__); + return err; + } + + BUILD_BUG_ON((sizeof(ent->headers->in_out_arg_len) != + sizeof(cs.ring.offset))); + res = copy_to_user(&ent->headers->in_out_arg_len, &cs.ring.offset, + sizeof(ent->headers->in_out_arg_len)); + err = res > 0 ? -EFAULT : res; + if (err) + return err; + + return 0; +} + +static int +fuse_uring_prepare_send(struct fuse_ring_ent *ring_ent) +{ + struct fuse_ring_queue *queue = ring_ent->queue; + struct fuse_ring *ring = queue->ring; + struct fuse_req *req = ring_ent->fuse_req; + int err = 0, res; + + if (WARN_ON(ring_ent->state != FRRS_FUSE_REQ)) { + pr_err("qid=%d ring-req=%p invalid state %d on send\n", + queue->qid, ring_ent, ring_ent->state); + err = -EIO; + } + + if (err) + return err; + + pr_devel("%s qid=%d state=%d cmd-done op=%d unique=%llu\n", __func__, + queue->qid, ring_ent->state, req->in.h.opcode, + req->in.h.unique); + + /* copy the request */ + err = fuse_uring_copy_to_ring(ring, req, ring_ent); + if (unlikely(err)) { + pr_info("Copy to ring failed: %d\n", err); + goto err; + } + + /* copy fuse_in_header */ + res = copy_to_user(&ring_ent->headers->in, &req->in.h, + sizeof(req->in.h)); + err = res > 0 ? -EFAULT : res; + if (err) + goto err; + + set_bit(FR_SENT, &req->flags); + return 0; + +err: + fuse_uring_req_end(ring_ent, true, err); + return err; +} + +/* + * Write data to the ring buffer and send the request to userspace, + * userspace will read it + * This is comparable with classical read(/dev/fuse) + */ +static int fuse_uring_send_next_to_ring(struct fuse_ring_ent *ring_ent) +{ + int err = 0; + struct fuse_ring_queue *queue = ring_ent->queue; + + err = fuse_uring_prepare_send(ring_ent); + if (err) + goto err; + + spin_lock(&queue->lock); + ring_ent->state = FRRS_USERSPACE; + list_move(&ring_ent->list, &queue->ent_in_userspace); + spin_unlock(&queue->lock); + + io_uring_cmd_complete_in_task(ring_ent->cmd, + fuse_uring_async_send_to_ring); + return 0; + +err: + return err; +} + /* * Put a ring request onto hold, it is no longer used for now. */ @@ -159,6 +419,192 @@ static void fuse_uring_ent_avail(struct fuse_ring_ent *ring_ent, ring_ent->state = FRRS_WAIT; } +/* Used to find the request on SQE commit */ +static void fuse_uring_add_to_pq(struct fuse_ring_ent *ring_ent) +{ + struct fuse_ring_queue *queue = ring_ent->queue; + struct fuse_req *req = ring_ent->fuse_req; + struct fuse_pqueue *fpq = &queue->fpq; + unsigned int hash; + + hash = fuse_req_hash(req->in.h.unique); + list_move_tail(&req->list, &fpq->processing[hash]); + req->ring_entry = ring_ent; +} + +/* + * Assign a fuse queue entry to the given entry + */ +static void fuse_uring_add_req_to_ring_ent(struct fuse_ring_ent *ring_ent, + struct fuse_req *req) +{ + lockdep_assert_held(&ring_ent->queue->lock); + + if (WARN_ON_ONCE(ring_ent->state != FRRS_WAIT && + ring_ent->state != FRRS_COMMIT)) { + pr_warn("%s qid=%d state=%d\n", __func__, ring_ent->queue->qid, + ring_ent->state); + } + list_del_init(&req->list); + clear_bit(FR_PENDING, &req->flags); + ring_ent->fuse_req = req; + ring_ent->state = FRRS_FUSE_REQ; + + fuse_uring_add_to_pq(ring_ent); +} + +/* + * Release the ring entry and fetch the next fuse request if available + * + * @return true if a new request has been fetched + */ +static bool fuse_uring_ent_assign_req(struct fuse_ring_ent *ring_ent) + __must_hold(&queue->lock) +{ + struct fuse_req *req = NULL; + struct fuse_ring_queue *queue = ring_ent->queue; + struct list_head *req_queue = &queue->fuse_req_queue; + + lockdep_assert_held(&queue->lock); + + /* get and assign the next entry while it is still holding the lock */ + if (!list_empty(req_queue)) { + req = list_first_entry(req_queue, struct fuse_req, list); + fuse_uring_add_req_to_ring_ent(ring_ent, req); + list_move(&ring_ent->list, &queue->ent_intermediate_queue); + } + + return req ? true : false; +} + +/* + * Read data from the ring buffer, which user space has written to + * This is comparible with handling of classical write(/dev/fuse). + * Also make the ring request available again for new fuse requests. + */ +static void fuse_uring_commit(struct fuse_ring_ent *ring_ent, + unsigned int issue_flags) +{ + struct fuse_ring *ring = ring_ent->queue->ring; + struct fuse_conn *fc = ring->fc; + struct fuse_req *req = ring_ent->fuse_req; + ssize_t err = 0; + bool set_err = false; + + err = copy_from_user(&req->out.h, &ring_ent->headers->out, + sizeof(req->out.h)); + if (err) { + req->out.h.error = err; + goto out; + } + + err = fuse_uring_out_header_has_err(&req->out.h, req, fc); + if (err) { + /* req->out.h.error already set */ + pr_devel("%s:%d err=%zd oh->err=%d\n", __func__, __LINE__, err, + req->out.h.error); + goto out; + } + + err = fuse_uring_copy_from_ring(ring, req, ring_ent); + if (err) + set_err = true; + +out: + pr_devel("%s:%d ret=%zd op=%d req-ret=%d\n", __func__, __LINE__, err, + req->args->opcode, req->out.h.error); + fuse_uring_req_end(ring_ent, set_err, err); +} + +/* + * Get the next fuse req and send it + */ +static void fuse_uring_next_fuse_req(struct fuse_ring_ent *ring_ent, + struct fuse_ring_queue *queue) +{ + int has_next, err; + int prev_state = ring_ent->state; + + do { + spin_lock(&queue->lock); + has_next = fuse_uring_ent_assign_req(ring_ent); + if (!has_next) { + fuse_uring_ent_avail(ring_ent, queue); + spin_unlock(&queue->lock); + break; /* no request left */ + } + spin_unlock(&queue->lock); + + err = fuse_uring_send_next_to_ring(ring_ent); + if (err) + ring_ent->state = prev_state; + } while (err); +} + +/* FUSE_URING_REQ_COMMIT_AND_FETCH handler */ +static int fuse_uring_commit_fetch(struct io_uring_cmd *cmd, int issue_flags, + struct fuse_conn *fc) +{ + const struct fuse_uring_cmd_req *cmd_req = io_uring_sqe_cmd(cmd->sqe); + struct fuse_ring_ent *ring_ent; + int err; + struct fuse_ring *ring = fc->ring; + struct fuse_ring_queue *queue; + uint64_t commit_id = cmd_req->commit_id; + struct fuse_pqueue fpq; + struct fuse_req *req; + + err = -ENOTCONN; + if (!ring) + return err; + + queue = ring->queues[cmd_req->qid]; + if (!queue) + return err; + fpq = queue->fpq; + + spin_lock(&queue->lock); + /* Find a request based on the unique ID of the fuse request + * This should get revised, as it needs a hash calculation and list + * search. And full struct fuse_pqueue is needed (memory overhead). + * As well as the link from req to ring_ent. + */ + req = fuse_request_find(&fpq, commit_id); + err = -ENOENT; + if (!req) { + pr_info("qid=%d commit_id %llu not found\n", queue->qid, + commit_id); + spin_unlock(&queue->lock); + return err; + } + list_del_init(&req->list); + ring_ent = req->ring_entry; + req->ring_entry = NULL; + + err = fuse_ring_ent_unset_userspace(ring_ent); + if (err != 0) { + pr_info_ratelimited("qid=%d commit_id %llu state %d", + queue->qid, commit_id, ring_ent->state); + spin_unlock(&queue->lock); + return err; + } + + ring_ent->cmd = cmd; + spin_unlock(&queue->lock); + + /* without the queue lock, as other locks are taken */ + fuse_uring_commit(ring_ent, issue_flags); + + /* + * Fetching the next request is absolutely required as queued + * fuse requests would otherwise not get processed - committing + * and fetching is done in one step vs legacy fuse, which has separated + * read (fetch request) and write (commit result). + */ + fuse_uring_next_fuse_req(ring_ent, queue); + return 0; +} + /* * fuse_uring_req_fetch command handling */ @@ -333,6 +779,9 @@ int fuse_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags) if (err) pr_info_once("fuse_uring_fetch failed err=%d\n", err); break; + case FUSE_URING_REQ_COMMIT_AND_FETCH: + err = fuse_uring_commit_fetch(cmd, issue_flags, fc); + break; default: err = -EINVAL; pr_devel("Unknown uring command %d", cmd_op); diff --git a/fs/fuse/dev_uring_i.h b/fs/fuse/dev_uring_i.h index 11798080896372c72692228ff7072bbee6a63e53..c7bac19e91b781fc9ccce540e39d99b39b751f6b 100644 --- a/fs/fuse/dev_uring_i.h +++ b/fs/fuse/dev_uring_i.h @@ -19,6 +19,9 @@ enum fuse_ring_req_state { /* The ring request waits for a new fuse request */ FRRS_WAIT, + /* The ring req got assigned a fuse req */ + FRRS_FUSE_REQ, + /* request is in or on the way to user space */ FRRS_USERSPACE, }; @@ -72,6 +75,14 @@ struct fuse_ring_queue { * to be send to userspace */ struct list_head ent_intermediate_queue; + + /* entries in userspace */ + struct list_head ent_in_userspace; + + /* fuse requests waiting for an entry slot */ + struct list_head fuse_req_queue; + + struct fuse_pqueue fpq; }; /** diff --git a/fs/fuse/fuse_dev_i.h b/fs/fuse/fuse_dev_i.h index 7ecb103af6f0feca99eb8940872c6a5ccf2e5186..a8d578b99a14239c05b4a496a4b3b1396eb768dd 100644 --- a/fs/fuse/fuse_dev_i.h +++ b/fs/fuse/fuse_dev_i.h @@ -7,7 +7,7 @@ #define _FS_FUSE_DEV_I_H #include - +#include /* Ordinary requests have even IDs, while interrupts IDs are odd */ #define FUSE_INT_REQ_BIT (1ULL << 0) @@ -15,6 +15,8 @@ struct fuse_arg; struct fuse_args; +struct fuse_pqueue; +struct fuse_req; struct fuse_copy_state { int write; @@ -44,6 +46,9 @@ static inline struct fuse_dev *fuse_get_dev(struct file *file) return READ_ONCE(file->private_data); } +unsigned int fuse_req_hash(u64 unique); +struct fuse_req *fuse_request_find(struct fuse_pqueue *fpq, u64 unique); + void fuse_dev_end_requests(struct list_head *head); void fuse_copy_init(struct fuse_copy_state *cs, int write, diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index 91c2e7e35cdbd470894a8a9cd026b77368b7a4b6..8bb6bd1854e41afb52a0d0081fa5fc6bfdfa58d8 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -435,6 +435,10 @@ struct fuse_req { /** fuse_mount this request belongs to */ struct fuse_mount *fm; + +#ifdef CONFIG_FUSE_IO_URING + void *ring_entry; +#endif }; struct fuse_iqueue; @@ -1207,6 +1211,11 @@ void fuse_change_entry_timeout(struct dentry *entry, struct fuse_entry_out *o); */ struct fuse_conn *fuse_conn_get(struct fuse_conn *fc); +/** + * Initialize the fuse processing queue + */ +void fuse_pqueue_init(struct fuse_pqueue *fpq); + /** * Initialize fuse_conn */ diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 59f8fb7b915f052f892d587a0f9a8dc17cf750ce..a1179c1e212b7a1cfd6e69f20dd5fcbe18c6202b 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -894,7 +894,7 @@ static void fuse_iqueue_init(struct fuse_iqueue *fiq, fiq->priv = priv; } -static void fuse_pqueue_init(struct fuse_pqueue *fpq) +void fuse_pqueue_init(struct fuse_pqueue *fpq) { unsigned int i; From patchwork Thu Nov 7 17:03:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13866751 Received: from outbound-ip191a.ess.barracuda.com (outbound-ip191a.ess.barracuda.com [209.222.82.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EB1152170C2; Thu, 7 Nov 2024 17:04:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=209.222.82.58 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730999084; cv=fail; b=qvqpgdDNhdIf7WNHmApVIyJBZrPDsc6F7Q/oeLR43lZEJcA44jjQ/QaqHirQYLtolGFsRdoIUny3S1wSJWwLVLVLbchNB0+eUIzNtydfduisEvpEZlkAjGv0Uxp6mQ4i5Y5N3KvC1YMZ2evzOt8cTpCKWFwbQbi5kn5FjoNGfuw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730999084; c=relaxed/simple; bh=OJTUt4mkYH2WA2Ni9WafRVps8f5ApriSf2zsr8pPUVo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=a/W0AVryiyZWfZ0w4wxMtxkKdvzyJugr6DMVC0im/rIPv8xOYI1MY9JYUK0ZezwyrkTbzW8+bMQdm50UyxHZzLc+Qt89blf+MaGQ0flaq733aOFsf4hVH/K+sl02rAPvdyGhSl/KO+VAFrzhOuCrL89djL0QzQ1X/t3sEGTWcRc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com; spf=pass smtp.mailfrom=ddn.com; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b=oy6hjSEE; arc=fail smtp.client-ip=209.222.82.58 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ddn.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b="oy6hjSEE" Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2173.outbound.protection.outlook.com [104.47.58.173]) by mx-outbound40-242.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 07 Nov 2024 17:04:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=jKparzKYWpUsO+3KN9iAQmMLvbCCOL05oqkVZpKpS6gq7TP/M/a0h0YuLO95iitSGbju0mWY/gvrsOTVpZZk3XR9dhlU4+doz7DzFiFkS+J5UZQdK+naVy0m6OfQLbkQ2SnbhwgV2h3QBvMiTJgGJfX9ebg6K8oNgkL+X3IYyzzD0uEUs5oy8tTOmu6v5p0sif9loG7xX7gBPJuKoQVZaZKxXGr6KUK0tM6HWcsVreITjo2873L1LZkYnwlHZHeM8FR25w27YaXFgzM+AzBdyXbuEXg7qA8x9CNgNtcrR9BQ2nRsw8eArfuNoMlL5abTjMr4SKvBCBw20z+8SCcJrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=ZNXPFJF9TCL5bosK5gGEE984IyCYHF3MK/GzXxaPR1s=; b=ACxfXBFZi05kIdiDIPXGedMYEez+5+Pqw9KEoq3cdP8mq2bqmDtzRJW201rZnuWOHdSz9oaEpIwEbG+3E+H172QeZDHlrKYbKKDuX3gzziZeDELnMbRcj8olcHim8Yh6+AybgD8e0H9SGmE/7Ce127uH4BgKGzfO9OyCHNwW5plct4l57QJ/4S/LG54BFtooCxQZzPfEbvDUFhzkCiPbgKtJoSrc3wI8WaaEMnJsPcf2HmzWsvybucV8IryAio5C8fMv+DM663ukxIxxv2ZWMt8iCb81DEvmqftev1ELdDN415SHkS1rzNsRD6h0ijRpNuYmD26h1SfMsDjva3Bvdw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=bsbernd.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZNXPFJF9TCL5bosK5gGEE984IyCYHF3MK/GzXxaPR1s=; b=oy6hjSEEVEdA6VORxUn9tU1jmQz+QRRtEsyLLxw6Nc8PtUaDCdsinITjs3m7V9Cfa+xuCJ6caD3pP4im0F67/TbGt8SJEc4qSn1TIV0o7lBRmVUu2do0miy/AM56KZWP591t9XDyq33YTDXaERy76xKY8KlCFpr60nspsu/AM5Y= Received: from CH0PR03CA0103.namprd03.prod.outlook.com (2603:10b6:610:cd::18) by BY5PR19MB4083.namprd19.prod.outlook.com (2603:10b6:a03:218::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.21; Thu, 7 Nov 2024 17:04:21 +0000 Received: from DS3PEPF0000C381.namprd04.prod.outlook.com (2603:10b6:610:cd:cafe::25) by CH0PR03CA0103.outlook.office365.com (2603:10b6:610:cd::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.19 via Frontend Transport; Thu, 7 Nov 2024 17:04:20 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by DS3PEPF0000C381.mail.protection.outlook.com (10.167.23.11) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8137.17 via Frontend Transport; Thu, 7 Nov 2024 17:04:20 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 0AD19121; Thu, 7 Nov 2024 17:04:19 +0000 (UTC) From: Bernd Schubert Date: Thu, 07 Nov 2024 18:03:54 +0100 Subject: [PATCH RFC v5 10/16] fuse: {uring} Handle teardown of ring entries Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241107-fuse-uring-for-6-10-rfc4-v5-10-e8660a991499@ddn.com> References: <20241107-fuse-uring-for-6-10-rfc4-v5-0-e8660a991499@ddn.com> In-Reply-To: <20241107-fuse-uring-for-6-10-rfc4-v5-0-e8660a991499@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1730999049; l=11956; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=OJTUt4mkYH2WA2Ni9WafRVps8f5ApriSf2zsr8pPUVo=; b=9fDb2QVegfeKmKwZ1ia3Yyj13buFeQMTJVrOl53JqvMD4K6PeOHUHF4frSpMWpOvM7Rt+G630 HiAWo/eOODhA5OEDCF10g99qNxDAdMSfR/2z5z+8NolAvy9s1CO8sxi X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF0000C381:EE_|BY5PR19MB4083:EE_ X-MS-Office365-Filtering-Correlation-Id: 44da4f2a-1c51-4dd7-26d6-08dcff4e38fc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|36860700013|376014|7416014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?WWDv+VDoFZ5VxCZhFysYKWUCJFPkDif?= =?utf-8?q?vnLfromOByE78yLZLADv9JksuN0SJGmKvW3Fgv5NEllk9R+hn+nDF8Y5FWU6WUHIq?= =?utf-8?q?775KrE8WL02Ffbame5de2Bqk0KCNTWHsf2ViHL3NLUbs6d1l0AbTddGpIYSeR3rcc?= =?utf-8?q?38R1N7gVuOgWxrrtl+EUHA2KENW6bN8KuwvSXdoLIdw7xmHUR/lbV6in7GRY9YGzl?= =?utf-8?q?vMQRN0fq/cvEIFw4nM6CdopqCdaadimeqbg57ZfeqPoDB2SVVXMjLu5t+CQh+7S43?= =?utf-8?q?fqznJXDQEAOkcYSqnTk9jZYGmAUG5p/q3pIyjqWiquVq1TeKRHPuNMSqG5krhmQLt?= =?utf-8?q?I0QAcDkb9vyrMauQlOPunQGLIvkPWeQxPqnmkr7l0XonW09LRRq9OIz+NWFEfK2+/?= =?utf-8?q?ATiVt3HYfNzdPE12P8oEkgm+iS2TQvMlM3227aexyx5xtBDmlGTicB8FMn/1uze1t?= =?utf-8?q?5oriZYHxDZ/dr/qt0yCgSyyg++dSpXmjI0kSrUjTRwedc3mCUAf+FnXghF9zGT6Uc?= =?utf-8?q?YvuQimlaNn+HiMnRVIWFxGekJFltGU7USjYZIzIgtpUajyO1olq0YijuNubYTZpYI?= =?utf-8?q?aLqZYcAdTaIsAD5foZQStMoonIrY3UcoQfh85FEH54ZqLpBXjwxtq//aqMEj6uzYV?= =?utf-8?q?U03I1UlonSOwphvTmQ22xqPBCALep9qjVXwYuCHimfqHf7aCQuznM3Ts9UY97oNq+?= =?utf-8?q?DVvY5wFLzP+uUJgeDpJEyxwsthFe7AI5DSyVIvGXznsoVa+Cf92JrFeLb5mk+U2rK?= =?utf-8?q?cMSAjAD0D4Kfoq1r0RBIpbsawsTEoeIq6guxvEPUgfsfqRTm+3S1VayXgyujQm12Q?= =?utf-8?q?hd+zI9vFtMTFMZpkOIAvLDiPn1oDs5H3J9NhdkTISFf4KDqlQogcRCLkoTCD/Czzx?= =?utf-8?q?Wib275x+iKTixbqT82/WDVzL5+w9hqSSDK+WrWB4u67xKKkjfioSWCEoIPOsmgREH?= =?utf-8?q?qg3fLfWrSCxY1w1e49pbYdYQv6KDfNEH7gL3EHY5Kw/zkB7Kek8ubz7Ahgu4SF7gt?= =?utf-8?q?2PzJQD1p/jErbtYNr4zap6ks/gQOh1+2SsjtziVteMrun5lHJGY5vk/Y8EOHsxCxv?= =?utf-8?q?AOdYqWh37ZUI64W92Q/BO9eGs2iVvciRl+emhTwC3S7gUmsglVc+eizjvvTPWbwRc?= =?utf-8?q?sjOSHvfjJ3JZ6KbxWKvoxIz/+A5qYiEsVcUItS+cK2mC51k83nCRVdhtiXC61gmMT?= =?utf-8?q?83o9TpfHIkGINH6MJmMHCDq1Lh/GXShFusg4CIPdUkkfWZHalmSGghLEKs7MU16y8?= =?utf-8?q?s06QZO0reJZOi+J7JlD2ZL62rNdySXBQJOOsYWAybqLE85Lna8x0xznIu2CEGvxE0?= =?utf-8?q?A3ktLTwpBoqaEEk2A30I8ILHNE+7w00vVA=3D=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(1800799024)(36860700013)(376014)(7416014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: v0oLS8rSAikTVZNNqr1AtQL5Fj4W2yailyY9IIKIF9Iv0noK4ByDiDferbH193+ZMGH7yiiYj8LT05XK5vYR309Hyp4QXEXkPA4TIk2bR68ZTBVUhntBn+hILJW3Dqdy1nJVLGPRNS5whRsQt/EjabsOUdmtmC4rMTmAaWOehdH6OyOxV5wvZS9l6uYKTNLEu+VxoOGu2bqTs3zJgl5WltqoRQoZxYTzVJlJcRvVxJITQvtZp1SMlEWBjZgYGvtnr+I12GE70dFVue2cPOxsqbFzwqfeAWyK/EPS8hFtO7Zk9YmSvGs1+BMvJgkGFuvPdmTFt2MmMOrVqAHpFRiuHvPOi5YpTD/VlBvZ4MEdssvdCUut9rYn1aH9qjN9Pysah2m4DEm1hCmlgtB0yktMBw2C6SJrynitrebEhZ/7Ug7dmYPZOklzF9U9lN4/LSifF6Kk0H6Zs9UxUwaA119B2+8EFvjCo5eKeyNCx42iIJ2IIBvO7QqIzUFI17sT2mP1LMMNen0u8HAZffEF/1nZlynlIz4ilHadF3WmL5Y976Hn5MQNuYqXQ9T7+Chk8Pxda/us2unpKU4TMnxzS7Nob8QurdZ6wRMxVAdoOvRbHSfO2Y4c1HZ2BlNTALdWOMh7OMCxj2anh36MZ8M+fTXUiw== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 17:04:20.7567 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 44da4f2a-1c51-4dd7-26d6-08dcff4e38fc X-MS-Exchange-CrossTenant-Id: 753b6e26-6fd3-43e6-8248-3f1735d59bb4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=753b6e26-6fd3-43e6-8248-3f1735d59bb4;Ip=[50.222.100.11];Helo=[uww-mrp-01.datadirectnet.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF0000C381.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR19MB4083 X-BESS-ID: 1730999072-110482-12748-9945-1 X-BESS-VER: 2019.1_20241029.2310 X-BESS-Apparent-Source-IP: 104.47.58.173 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoaGpiYGQGYGUNTYONXM3DLV1D IxNck81dwoycDE0CwpMTk5zSDF1MjAQqk2FgDq0YHJQgAAAA== X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260269 [from cloudscan11-34.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 On teardown struct file_operations::uring_cmd requests need to be completed by calling io_uring_cmd_done(). Not completing all ring entries would result in busy io-uring tasks giving warning messages in intervals and unreleased struct file. Additionally the fuse connection and with that the ring can only get released when all io-uring commands are completed. Completion is done with ring entries that are a) in waiting state for new fuse requests - io_uring_cmd_done is needed b) already in userspace - io_uring_cmd_done through teardown is not needed, the request can just get released. If fuse server is still active and commits such a ring entry, fuse_uring_cmd() already checks if the connection is active and then complete the io-uring itself with -ENOTCONN. I.e. special handling is not needed. This scheme is basically represented by the ring entry state FRRS_WAIT and FRRS_USERSPACE. Entries in state: - FRRS_INIT: No action needed, do not contribute to ring->queue_refs yet - All other states: Are currently processed by other tasks, async teardown is needed and it has to wait for the two states above. It could be also solved without an async teardown task, but would require additional if conditions in hot code paths. Also in my personal opinion the code looks cleaner with async teardown. Signed-off-by: Bernd Schubert --- fs/fuse/dev.c | 8 ++ fs/fuse/dev_uring.c | 211 ++++++++++++++++++++++++++++++++++++++++++++++++++ fs/fuse/dev_uring_i.h | 51 ++++++++++++ 3 files changed, 270 insertions(+) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index b085176ea824bd612a8736e00c9b6f8f9e232208..d0321619c3bdcb2ee592b9f83dbee192a3ff734a 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -2241,6 +2241,12 @@ void fuse_abort_conn(struct fuse_conn *fc) spin_unlock(&fc->lock); fuse_dev_end_requests(&to_end); + + /* + * fc->lock must not be taken to avoid conflicts with io-uring + * locks + */ + fuse_uring_abort(fc); } else { spin_unlock(&fc->lock); } @@ -2252,6 +2258,8 @@ void fuse_wait_aborted(struct fuse_conn *fc) /* matches implicit memory barrier in fuse_drop_waiting() */ smp_mb(); wait_event(fc->blocked_waitq, atomic_read(&fc->num_waiting) == 0); + + fuse_uring_wait_stopped_queues(fc); } int fuse_dev_release(struct inode *inode, struct file *file) diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index 4f8a0bd1e2192bfbc310eb53dd8e89274e6f479b..2f5665518d3f66bf2ae20c0274e277ee94adc491 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -52,6 +52,37 @@ static int fuse_ring_ent_unset_userspace(struct fuse_ring_ent *ent) return 0; } +/* Abort all list queued request on the given ring queue */ +static void fuse_uring_abort_end_queue_requests(struct fuse_ring_queue *queue) +{ + struct fuse_req *req; + LIST_HEAD(req_list); + + spin_lock(&queue->lock); + list_for_each_entry(req, &queue->fuse_req_queue, list) + clear_bit(FR_PENDING, &req->flags); + list_splice_init(&queue->fuse_req_queue, &req_list); + spin_unlock(&queue->lock); + + /* must not hold queue lock to avoid order issues with fi->lock */ + fuse_dev_end_requests(&req_list); +} + +void fuse_uring_abort_end_requests(struct fuse_ring *ring) +{ + int qid; + + for (qid = 0; qid < ring->nr_queues; qid++) { + struct fuse_ring_queue *queue = ring->queues[qid]; + + if (!queue) + continue; + + queue->stopped = true; + fuse_uring_abort_end_queue_requests(queue); + } +} + void fuse_uring_destruct(struct fuse_conn *fc) { struct fuse_ring *ring = fc->ring; @@ -110,9 +141,12 @@ static struct fuse_ring *fuse_uring_create(struct fuse_conn *fc) goto out_err; } + init_waitqueue_head(&ring->stop_waitq); + fc->ring = ring; ring->nr_queues = nr_queues; ring->fc = fc; + atomic_set(&ring->queue_refs, 0); spin_unlock(&fc->lock); return ring; @@ -173,6 +207,177 @@ fuse_uring_async_send_to_ring(struct io_uring_cmd *cmd, io_uring_cmd_done(cmd, 0, 0, issue_flags); } +static void fuse_uring_stop_fuse_req_end(struct fuse_ring_ent *ent) +{ + struct fuse_req *req = ent->fuse_req; + + /* remove entry from fuse_pqueue->processing */ + list_del_init(&req->list); + ent->fuse_req = NULL; + clear_bit(FR_SENT, &req->flags); + req->out.h.error = -ECONNABORTED; + fuse_request_end(req); +} + +/* + * Release a request/entry on connection tear down + */ +static void fuse_uring_entry_teardown(struct fuse_ring_ent *ent, + bool need_cmd_done) +{ + struct fuse_ring_queue *queue = ent->queue; + + /* + * fuse_request_end() might take other locks like fi->lock and + * can lead to lock ordering issues + */ + lockdep_assert_not_held(&ent->queue->lock); + + if (need_cmd_done) { + pr_devel("qid=%d sending cmd_done\n", queue->qid); + + io_uring_cmd_done(ent->cmd, -ENOTCONN, 0, + IO_URING_F_UNLOCKED); + } + + if (ent->fuse_req) + fuse_uring_stop_fuse_req_end(ent); + + list_del_init(&ent->list); + kfree(ent); +} + +static void fuse_uring_stop_list_entries(struct list_head *head, + struct fuse_ring_queue *queue, + enum fuse_ring_req_state exp_state) +{ + struct fuse_ring *ring = queue->ring; + struct fuse_ring_ent *ent, *next; + ssize_t queue_refs = SSIZE_MAX; + LIST_HEAD(to_teardown); + + spin_lock(&queue->lock); + list_for_each_entry_safe(ent, next, head, list) { + if (ent->state != exp_state) { + pr_warn("entry teardown qid=%d state=%d expected=%d", + queue->qid, ent->state, exp_state); + continue; + } + + list_move(&ent->list, &to_teardown); + } + spin_unlock(&queue->lock); + + /* no queue lock to avoid lock order issues */ + list_for_each_entry_safe(ent, next, &to_teardown, list) { + bool need_cmd_done = ent->state != FRRS_USERSPACE; + + fuse_uring_entry_teardown(ent, need_cmd_done); + queue_refs = atomic_dec_return(&ring->queue_refs); + + if (WARN_ON_ONCE(queue_refs < 0)) + pr_warn("qid=%d queue_refs=%zd", queue->qid, + queue_refs); + } +} + +static void fuse_uring_teardown_entries(struct fuse_ring_queue *queue) +{ + fuse_uring_stop_list_entries(&queue->ent_in_userspace, queue, + FRRS_USERSPACE); + fuse_uring_stop_list_entries(&queue->ent_avail_queue, queue, FRRS_WAIT); +} + +/* + * Log state debug info + */ +static void fuse_uring_log_ent_state(struct fuse_ring *ring) +{ + int qid; + struct fuse_ring_ent *ent; + + for (qid = 0; qid < ring->nr_queues; qid++) { + struct fuse_ring_queue *queue = ring->queues[qid]; + + if (!queue) + continue; + + spin_lock(&queue->lock); + /* + * Log entries from the intermediate queue, the other queues + * should be empty + */ + list_for_each_entry(ent, &queue->ent_intermediate_queue, list) { + pr_info("ring=%p qid=%d ent=%p state=%d\n", ring, qid, + ent, ent->state); + } + spin_lock(&queue->lock); + } + ring->stop_debug_log = 1; +} + +static void fuse_uring_async_stop_queues(struct work_struct *work) +{ + int qid; + struct fuse_ring *ring = + container_of(work, struct fuse_ring, async_teardown_work.work); + + for (qid = 0; qid < ring->nr_queues; qid++) { + struct fuse_ring_queue *queue = ring->queues[qid]; + + if (!queue) + continue; + + fuse_uring_teardown_entries(queue); + } + + /* + * Some ring entries are might be in the middle of IO operations, + * i.e. in process to get handled by file_operations::uring_cmd + * or on the way to userspace - we could handle that with conditions in + * run time code, but easier/cleaner to have an async tear down handler + * If there are still queue references left + */ + if (atomic_read(&ring->queue_refs) > 0) { + if (time_after(jiffies, + ring->teardown_time + FUSE_URING_TEARDOWN_TIMEOUT)) + fuse_uring_log_ent_state(ring); + + schedule_delayed_work(&ring->async_teardown_work, + FUSE_URING_TEARDOWN_INTERVAL); + } else { + wake_up_all(&ring->stop_waitq); + } +} + +/* + * Stop the ring queues + */ +void fuse_uring_stop_queues(struct fuse_ring *ring) +{ + int qid; + + for (qid = 0; qid < ring->nr_queues; qid++) { + struct fuse_ring_queue *queue = ring->queues[qid]; + + if (!queue) + continue; + + fuse_uring_teardown_entries(queue); + } + + if (atomic_read(&ring->queue_refs) > 0) { + pr_info("ring=%p scheduling async queue stop\n", ring); + ring->teardown_time = jiffies; + INIT_DELAYED_WORK(&ring->async_teardown_work, + fuse_uring_async_stop_queues); + schedule_delayed_work(&ring->async_teardown_work, + FUSE_URING_TEARDOWN_INTERVAL); + } else { + wake_up_all(&ring->stop_waitq); + } +} + /* * Checks for errors and stores it into the request */ @@ -563,6 +768,9 @@ static int fuse_uring_commit_fetch(struct io_uring_cmd *cmd, int issue_flags, return err; fpq = queue->fpq; + if (!READ_ONCE(fc->connected) || READ_ONCE(queue->stopped)) + return err; + spin_lock(&queue->lock); /* Find a request based on the unique ID of the fuse request * This should get revised, as it needs a hash calculation and list @@ -730,6 +938,7 @@ static int fuse_uring_fetch(struct io_uring_cmd *cmd, unsigned int issue_flags, if (WARN_ON_ONCE(err != 0)) goto err; + atomic_inc(&ring->queue_refs); _fuse_uring_fetch(ring_ent, cmd, issue_flags); return 0; @@ -756,6 +965,8 @@ int fuse_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags) pr_info_ratelimited("fuse-io-uring is not enabled yet\n"); goto out; + pr_devel("%s:%d received: cmd op %d\n", __func__, __LINE__, cmd_op); + err = -EOPNOTSUPP; if (!enable_uring) { pr_info_ratelimited("uring is disabled\n"); diff --git a/fs/fuse/dev_uring_i.h b/fs/fuse/dev_uring_i.h index c7bac19e91b781fc9ccce540e39d99b39b751f6b..c9497fc94373a6e071161c205e77279fd0ada741 100644 --- a/fs/fuse/dev_uring_i.h +++ b/fs/fuse/dev_uring_i.h @@ -11,6 +11,9 @@ #ifdef CONFIG_FUSE_IO_URING +#define FUSE_URING_TEARDOWN_TIMEOUT (5 * HZ) +#define FUSE_URING_TEARDOWN_INTERVAL (HZ/20) + enum fuse_ring_req_state { /* ring entry received from userspace and it being processed */ @@ -83,6 +86,8 @@ struct fuse_ring_queue { struct list_head fuse_req_queue; struct fuse_pqueue fpq; + + bool stopped; }; /** @@ -97,11 +102,50 @@ struct fuse_ring { size_t nr_queues; struct fuse_ring_queue **queues; + /* + * Log ring entry states onces on stop when entries cannot be + * released + */ + unsigned int stop_debug_log : 1; + + wait_queue_head_t stop_waitq; + + /* async tear down */ + struct delayed_work async_teardown_work; + + /* log */ + unsigned long teardown_time; + + atomic_t queue_refs; }; void fuse_uring_destruct(struct fuse_conn *fc); +void fuse_uring_stop_queues(struct fuse_ring *ring); +void fuse_uring_abort_end_requests(struct fuse_ring *ring); int fuse_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags); +static inline void fuse_uring_abort(struct fuse_conn *fc) +{ + struct fuse_ring *ring = fc->ring; + + if (ring == NULL) + return; + + if (atomic_read(&ring->queue_refs) > 0) { + fuse_uring_abort_end_requests(ring); + fuse_uring_stop_queues(ring); + } +} + +static inline void fuse_uring_wait_stopped_queues(struct fuse_conn *fc) +{ + struct fuse_ring *ring = fc->ring; + + if (ring) + wait_event(ring->stop_waitq, + atomic_read(&ring->queue_refs) == 0); +} + #else /* CONFIG_FUSE_IO_URING */ struct fuse_ring; @@ -114,6 +158,13 @@ static inline void fuse_uring_destruct(struct fuse_conn *fc) { } +static inline void fuse_uring_abort(struct fuse_conn *fc) +{ +} + +static inline void fuse_uring_wait_stopped_queues(struct fuse_conn *fc) +{ +} #endif /* CONFIG_FUSE_IO_URING */ #endif /* _FS_FUSE_DEV_URING_I_H */ From patchwork Thu Nov 7 17:03:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13866754 Received: from outbound-ip191b.ess.barracuda.com (outbound-ip191b.ess.barracuda.com [209.222.82.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F2AC9217643 for ; Thu, 7 Nov 2024 17:04:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=209.222.82.124 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730999089; cv=fail; b=uBYiRlWwYjqnc8LEg7FFJcwapG7SoQpQLgw8J/lhjocJ85jqO+XTDwh63DpKZpSy6F5r6Vv7sAeyWYc0sFwPm20obk32Q27QyutY3+6qjKpDT3IP2R5kH46S4+Yy/RW7KcP7a45tZpLEjI/4296OUcRBgPMfw8B+/5fpxUd0cNs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730999089; c=relaxed/simple; bh=Dhyra5ZisXo3/fGDB7AdDHYq1p7jMsd1intWqgr6dCc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cJUysntL+XwU05XvYQa9ddWHQ8gAPX5zqGjPRHlkb0KvLYsryG3W6VzeLrxsJRHlPUaFPKccd+LyzfH3SaXbfExBRFBpHAYhfK8h1Jglb/oS8j3nmCdiiNxkRkXWi1JYXBhJtnB9iY8ws7r9nT5O44T8mRhICyY+1YXs4yiuolk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com; spf=pass smtp.mailfrom=ddn.com; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b=yzwfEhyc; arc=fail smtp.client-ip=209.222.82.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ddn.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b="yzwfEhyc" Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2168.outbound.protection.outlook.com [104.47.57.168]) by mx-outbound16-69.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 07 Nov 2024 17:04:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=H7zerXG87dP8g8h5KbBHwhTJiChgyC8TP9cqBEoKvvCZgPNVFC+FTMXT+maR5sp7ERpSr0NMzQi6Wc7O+eYolMLchQbBX/Qsnk9054zVJP4QlV/G8bph34nTSSbOqmUGyUhoouKsYkkIcIk+ILGY3lH2JlsaO5xSgSnkoQMIhz3Q/fH1dxBA10a9bJOC1ydAuLbzc4GeMuLzU+G3QY4YfHuQMZBpTBCjgYFT037o0bMgQFIGr8ohCZfg/sVsj/JLQ5gV77RABGFjadqTNYeKV/PdbPuB8ObufYBUm8SE8gV3pbqGDpoaBC//nsAyifVPpyamqtv953sl2H/EQ2TtMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=XY+gSkD3xQJFGPDuPOW2IchQVCHmpEJB0oJ0sto/azo=; b=KuStIlHEiK50vGJgAFi1xuo83XMBFCE7PBm9QnJXvcxODK28ZVpkmO2huCupDF1LiOOohiYi1xzju2rcf6ofS8VwdEo4WTePl4DvqYjEAqtsoHgI3O44TMIuDEXPiizj6Kl9ma8aOkJWd39KordKgA+S+pZ7fcLo4qHxAnulYOcc2ajfeURUFOGFwiAOZJ2S6pA1QO+GAeRgCoMlbXZlDF9MP7WcfMPCy9vtA6ltxF+2UkxOd5DjPXrVQyEhQpZhEUggvKi48AGvYbiyw6Q554npsLAIntVOS1e7U/u61zsEOGVuK081ALRAOF2FWIlWL0yY+JxxE4Hbqc0LU/amOA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=bsbernd.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XY+gSkD3xQJFGPDuPOW2IchQVCHmpEJB0oJ0sto/azo=; b=yzwfEhycnam9EQIvmijNkbaBDvmP2+zIzJs6yJxUtd1YzHjqAoqBZdRGXBGu3M/lkAXvGWChgIjNO11XSiTi5M7IM42ESNcaiJ6cmRxlKJpoIVASdAhBvH2/96bxHAsPRAd0rMlZc/wd9VNkORPQTB+VNAwbaEmIHdE9WbRdDTI= Received: from BL1PR13CA0285.namprd13.prod.outlook.com (2603:10b6:208:2bc::20) by SA3PR19MB7586.namprd19.prod.outlook.com (2603:10b6:806:31c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.20; Thu, 7 Nov 2024 17:04:22 +0000 Received: from BL02EPF00021F6A.namprd02.prod.outlook.com (2603:10b6:208:2bc:cafe::ac) by BL1PR13CA0285.outlook.office365.com (2603:10b6:208:2bc::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.17 via Frontend Transport; Thu, 7 Nov 2024 17:04:22 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by BL02EPF00021F6A.mail.protection.outlook.com (10.167.249.6) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8137.17 via Frontend Transport; Thu, 7 Nov 2024 17:04:21 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 030EDC6; Thu, 7 Nov 2024 17:04:20 +0000 (UTC) From: Bernd Schubert Date: Thu, 07 Nov 2024 18:03:55 +0100 Subject: [PATCH RFC v5 11/16] fuse: {uring} Add a ring queue and send method Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241107-fuse-uring-for-6-10-rfc4-v5-11-e8660a991499@ddn.com> References: <20241107-fuse-uring-for-6-10-rfc4-v5-0-e8660a991499@ddn.com> In-Reply-To: <20241107-fuse-uring-for-6-10-rfc4-v5-0-e8660a991499@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1730999049; l=4829; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=Dhyra5ZisXo3/fGDB7AdDHYq1p7jMsd1intWqgr6dCc=; b=/jsz8YFvAg6/Y9j8vqwGrrD3+pEyKC90DuRteYdeDMOo+AaO6q1VQ18Aw1S0fOFT2tMgGdRG2 1w0BmzeN84+ATIJcrzRV0cnyGCfJlXTgVP8UFZc1yBk3WEqEciAqhhR X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F6A:EE_|SA3PR19MB7586:EE_ X-MS-Office365-Filtering-Correlation-Id: f232172b-6368-4cd3-d760-08dcff4e39bc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|376014|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?q?6+A0xpSMYjQIZOC+VURJzYtslOtmXYe?= =?utf-8?q?d8T65i/zuy6VPHT0/7vXSTJCmOl9A4gQ+5idOOKMpByECrB6N5MS+mIKFowKrS6ei?= =?utf-8?q?vmalmduZeqi2tMJvT6WVJRKyk3M1GOGojMvGVCzqk+/YjI3/VABd5t58HnlJKf4XF?= =?utf-8?q?ZJtskZ/rUWmfc9CekGZCwXOxKt14WHflkIi/Rs9Gc9XaUIPSijTWwmG4/JPi5qXqm?= =?utf-8?q?SY5lvV5m9ROPFU4f8aq0uZHeHH6Rq2nwZvQqi4mXtFXG5ts3txtFGV3okpL1wG5ce?= =?utf-8?q?pO+grduTfi5FMW+D/z4hSczcjfOIfx20QDzTanf8kgV7Yw9cmJA5HXNjsQze+wv5b?= =?utf-8?q?+JSoB4xK5gxev70wad+mUHJptRUvDLmsqPUi3sRYXIV5BYhL+3bRCE19rmnMBHace?= =?utf-8?q?OPLL8LcllpNMX17X4N3ip7YcvytntyZ8h7yXNBfHv2sS8bsC8AvDAt3NYKtIhdfOc?= =?utf-8?q?DT4adKs6nlgpC/pMUe6Uo32ml/IYNuUZa621Ta98Cg3kyQI/Z3lrpwHuN6saDeg6Q?= =?utf-8?q?yNnv4pSIWJJeBy2Gq7oVymuPcnS/AJCsXLPbfpJH37WGcmLn5MR/01KWDpcfmPM/b?= =?utf-8?q?BWJII4WchcSIMJTr3k59Y0Erc+Q9kj7dhY9/ZIpX6dxeqhIP0cSYOHM1iCvETACxS?= =?utf-8?q?c40YIgkkpQ1SaXeHB+jGOwPy1DbcNz/8d3ElOLQTxOFQa9TvUOs2yoiycxFCeehRd?= =?utf-8?q?QoX5kKUTJXrreZM7FV4Vdd+0tzAtY+wHuomDqdoNKZEnmJvZa5HjB+W6D+HVA0OdU?= =?utf-8?q?YJk+lNAOOVdv908v7KRPmODj3u/dlNNlApHonyC6iLUTDAbxGfz2H4H97eNyl3+8v?= =?utf-8?q?AAo4IWQ2IcJ0UthPiVLb1Q6iN23zQeITxF+O6e/+R6x0GveYWWB+DpYki3927g+fm?= =?utf-8?q?9fdN2QGgZ5gK52BtGDYV+z3x995l49E73ffClzWZRNNZvaZ6Rakbw4cSpf20t+3Sr?= =?utf-8?q?ILUwuGUb1hgmXlh8BsP3LsYBhwg0vLYJ8Sjbl3H5McZG4JzqWicNdmsZfxh8Lmkma?= =?utf-8?q?PEV6IRDl5XhY0j35PCzSe5Mmcl15lsI62DWgkRjfs5BRj0qjzO+zJWXC6GAiSysYD?= =?utf-8?q?4zRYX+18sLF8AFEshZ3RjbMxNgffv0wA0l0Ps91c6pT7j5VusyKKwLjjuzfrURLbf?= =?utf-8?q?7H2bXD9jfnU/+TbALlYPwlpVBSbgB3nTrmNHIV/riAAK68YFO2DITvBW48bQTAK+j?= =?utf-8?q?qvvUIQMyIR8uk3E8gxfexEib7ASW+BXJJMocc9xX/yy1KualFZMaXSh/ggWTa0hsG?= =?utf-8?q?LPbH5h9oY+ZfisDqtnePMBrbidfviGow6ZDYXDDDg2iEOekH9PPFWR4g2tgm6eSXA?= =?utf-8?q?+owLyx8xro72Og8tqZeu53vo94D+RbcldQ=3D=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(7416014)(376014)(82310400026)(36860700013);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: zsB4AJC2e7SVq7bDUxT//ybRyc6INtHWqsVxw0ZDIDQr/O44oXr8k9eP3gnNjIopkikbPBFY5bH2ADO1w09Izi+cIrfJW8G0KYSSUN5F8++YiJ5s5mzEpSZm0ryCMkdbw8ApBYtROt7TNGPwKEYBcOagzcJUfVK6P/FnG76fXkzcGKOfLqsRfum1t38py07VdoriJh3VLNDqbzrZEuErYNO0TRMLR4fb6cR3L9YqHf/0iwYKzJJeEyierbEm6M2aruYcQuHARFX2JSccP59EKOV9nZ8X+QHi9eB1wmtMOErbTrIoxRUN1FBjIAedT6Sln+1sPpCX3/7HGGtZr4nYrzN2r9utBarfJyckfJefsE9kxWkennVSN048DKlkNkbdMT3EZW1sxdcbniuqIM+JRZj+nkb2lV3WgLZNr7fvaUmiEXGvVmbT9a/cqyth7ww3iZjaf0qQgLADTIucNGGXroVVgld+OpaJ7e44nmZXM+wY8vAHbfCFPXsuxfnJSEddCxhVHKOX6P8Gl/sfbixc+a0dO4pTxpA5m/iKSR0eCDCo58cZqMjpIn6I925J1k6QsWIFd6ojEVmk9KY7Evu8IorTwbAN3SJG7cpCfft/wnWsgzHuvM1gkuSjArx/NAuUYPLeNO7Iq6G7Wdk0XQ1Ekg== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 17:04:21.9414 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f232172b-6368-4cd3-d760-08dcff4e39bc X-MS-Exchange-CrossTenant-Id: 753b6e26-6fd3-43e6-8248-3f1735d59bb4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=753b6e26-6fd3-43e6-8248-3f1735d59bb4;Ip=[50.222.100.11];Helo=[uww-mrp-01.datadirectnet.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00021F6A.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR19MB7586 X-BESS-ID: 1730999069-104165-12627-30476-1 X-BESS-VER: 2019.1_20241029.2310 X-BESS-Apparent-Source-IP: 104.47.57.168 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKViZm5hZAVgZQMM00KTU50cDEzD TRLDk51cgyySTVOCUpzdgw2SLVLClRqTYWAISggnBBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260269 [from cloudscan18-26.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 This prepares queueing and sending through io-uring. Signed-off-by: Bernd Schubert --- fs/fuse/dev_uring.c | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++ fs/fuse/dev_uring_i.h | 7 ++++ 2 files changed, 108 insertions(+) diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index 2f5665518d3f66bf2ae20c0274e277ee94adc491..84f5c330bac296c65ff676d454065963082fa116 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -21,6 +21,10 @@ MODULE_PARM_DESC(enable_uring, #define FUSE_URING_IOV_SEGS 2 /* header and payload */ +struct fuse_uring_cmd_pdu { + struct fuse_ring_ent *ring_ent; +}; + /* * Finalize a fuse request, then fetch and send the next entry, if available */ @@ -1007,3 +1011,100 @@ int fuse_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags) return -EIOCBQUEUED; } + +/* + * This prepares and sends the ring request in fuse-uring task context. + * User buffers are not mapped yet - the application does not have permission + * to write to it - this has to be executed in ring task context. + * XXX: Map and pin user paged and avoid this function. + */ +static void +fuse_uring_send_req_in_task(struct io_uring_cmd *cmd, + unsigned int issue_flags) +{ + struct fuse_uring_cmd_pdu *pdu = (struct fuse_uring_cmd_pdu *)cmd->pdu; + struct fuse_ring_ent *ring_ent = pdu->ring_ent; + struct fuse_ring_queue *queue = ring_ent->queue; + int err; + + BUILD_BUG_ON(sizeof(pdu) > sizeof(cmd->pdu)); + + err = fuse_uring_prepare_send(ring_ent); + if (err) + goto err; + + io_uring_cmd_done(cmd, 0, 0, issue_flags); + + spin_lock(&queue->lock); + ring_ent->state = FRRS_USERSPACE; + list_move(&ring_ent->list, &queue->ent_in_userspace); + spin_unlock(&queue->lock); + return; +err: + fuse_uring_next_fuse_req(ring_ent, queue); +} + +/* queue a fuse request and send it if a ring entry is available */ +int fuse_uring_queue_fuse_req(struct fuse_conn *fc, struct fuse_req *req) +{ + struct fuse_ring *ring = fc->ring; + struct fuse_ring_queue *queue; + int qid = 0; + struct fuse_ring_ent *ring_ent = NULL; + int res; + + /* + * async requests are best handled on another core, the current + * core can do application/page handling, while the async request + * is handled on another core in userspace. + * For sync request the application has to wait - no processing, so + * the request should continue on the current core and avoid context + * switches. + * XXX This should be on the same numa node and not busy - is there + * a scheduler function available that could make this decision? + * It should also not persistently switch between cores - makes + * it hard for the scheduler. + */ + qid = task_cpu(current); + + if (WARN_ONCE(qid >= ring->nr_queues, + "Core number (%u) exceeds nr ueues (%zu)\n", qid, + ring->nr_queues)) + qid = 0; + + queue = ring->queues[qid]; + if (WARN_ONCE(!queue, "Missing queue for qid %d\n", qid)) + return -EINVAL; + + spin_lock(&queue->lock); + + if (unlikely(queue->stopped)) { + res = -ENOTCONN; + goto err_unlock; + } + + list_add_tail(&req->list, &queue->fuse_req_queue); + + if (!list_empty(&queue->ent_avail_queue)) { + ring_ent = list_first_entry(&queue->ent_avail_queue, + struct fuse_ring_ent, list); + list_del_init(&ring_ent->list); + fuse_uring_add_req_to_ring_ent(ring_ent, req); + } + spin_unlock(&queue->lock); + + if (ring_ent) { + struct io_uring_cmd *cmd = ring_ent->cmd; + struct fuse_uring_cmd_pdu *pdu = + (struct fuse_uring_cmd_pdu *)cmd->pdu; + + pdu->ring_ent = ring_ent; + io_uring_cmd_complete_in_task(cmd, fuse_uring_send_req_in_task); + } + + return 0; + +err_unlock: + spin_unlock(&queue->lock); + return res; +} diff --git a/fs/fuse/dev_uring_i.h b/fs/fuse/dev_uring_i.h index c9497fc94373a6e071161c205e77279fd0ada741..c442e53cefe5fea998a04bb060861569bece0459 100644 --- a/fs/fuse/dev_uring_i.h +++ b/fs/fuse/dev_uring_i.h @@ -123,6 +123,7 @@ void fuse_uring_destruct(struct fuse_conn *fc); void fuse_uring_stop_queues(struct fuse_ring *ring); void fuse_uring_abort_end_requests(struct fuse_ring *ring); int fuse_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags); +int fuse_uring_queue_fuse_req(struct fuse_conn *fc, struct fuse_req *req); static inline void fuse_uring_abort(struct fuse_conn *fc) { @@ -165,6 +166,12 @@ static inline void fuse_uring_abort(struct fuse_conn *fc) static inline void fuse_uring_wait_stopped_queues(struct fuse_conn *fc) { } + +static inline int +fuse_uring_queue_fuse_req(struct fuse_conn *fc, struct fuse_req *req) +{ + return -EPFNOSUPPORT; +} #endif /* CONFIG_FUSE_IO_URING */ #endif /* _FS_FUSE_DEV_URING_I_H */ From patchwork Thu Nov 7 17:03:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13866747 Received: from outbound-ip168b.ess.barracuda.com (outbound-ip168b.ess.barracuda.com [209.222.82.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 752B5216E1B; Thu, 7 Nov 2024 17:04:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=209.222.82.102 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730999081; cv=fail; b=lL3dO/V5nnqOKkZf7RlCUi2va76IcVYTPsFvNpg8gIiZI7pCYfo+SA48nRDmlHSLBPRubUe5PkFE1a9fm4stup8F/NCV5GfX+bjuW22OfDhLBeEZGR+yiVNk97z1Q9bs6QCLxTmocN6y9bhi4CPo+c/IVlzUEb+mIeB1gVbWSok= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730999081; c=relaxed/simple; bh=EbjIGepigT5QCMxXGcpYwuBnrc7SObzF0pQ7empHlzU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iNZZ+nz2DnKq3MPFAHGxdwxPy6UfcLxfpsnbzEKn8TxblW6GhLEFXytAe9euOr5N9KUW9f3N3Sn1TuBBDYS3C0bx96KUgR3xxnZ11iIn3EJq0kUTJZhBBC/yPX5XnJeJSacVxJsdS5b4ecLEgCcv6NjdxRKHrpP1EoIjtc9kzE0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com; spf=pass smtp.mailfrom=ddn.com; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b=h1MPCi1Q; arc=fail smtp.client-ip=209.222.82.102 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ddn.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b="h1MPCi1Q" Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04lp2168.outbound.protection.outlook.com [104.47.73.168]) by mx-outbound20-186.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 07 Nov 2024 17:04:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tAJE9ULU7rzl1W5YEyxd6aNYfVBoCmArLDBiVM7iiEML34+u6OfKDZk5z0ftVvqxGZf3aQGg4Ml1DI7sBpSfIDaoEdODwNllPj3G3yY3fmgzW347OndjWzm+7oKnJ8mSPytAKYJRxBBmH6E/HhBlRnZmeSkQOOaAgd2+DhgmxtHI+/couFWrMmZarVuFeElmv2omrNYbt1Fo3K/cVs/NjeVBHpi5vbpWaWUgLQ7XtIWroeXrK+x1r+3vEwjpLzi3ojuygUIbPYoRxZXRBmG5vYlRZ4/Va9ky439dW1wQ7Br344vijPUTotB28z4ITTBS5Mn94tdB2cNa8ydGmZFvUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=ivKnwXxuApD7RWUAxskmptPBZzPl9aMB2LmxnzK2RAc=; b=mKiHc3LVMCFBIF1jOwmTR6MoktL8Km8M7yKNiQTYqOq3ehv6MyVg0OrimCTuVXTgWgG0A6yGqxZp13Xo9WVB2hinr2KKoVo8ZYEWwo8MUlPJB9Uz4yuFarsOYRK9KzJLLJCPXVYVmZfBvxo1o9JfgZGBxhyhShOMM/rq/irP/7k+LxScPlYEat8Ee0Bng9BdkrvBAcHOIW0atQr8gh80NeB1DvfUXB3rJigHR3tjFFg0V8iCX3VUn1k3sYNE0pyq+xh6va1O29ZNXNN/zdvR/EdY5PgYHOGP0tiwhEakz5+1dv5R883maj2BVQ8gjuedOOziexl3bOxdl+lKjEfLyA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=bsbernd.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ivKnwXxuApD7RWUAxskmptPBZzPl9aMB2LmxnzK2RAc=; b=h1MPCi1QdBsSfmiTEVKQ7ybIO8mAR4lZ6zUKMA9L++DMXAt02AciqycxELBNv/V1JG+sFl0XcI90qYszZVoUKKrf9sxySBqPGijRSudZeTVtIagzhojJjQY2HPXfC9uQrEbjd21NaGa79cag7tUHD0WL3/0g+094Mq39HL9zYgc= Received: from CH2PR18CA0036.namprd18.prod.outlook.com (2603:10b6:610:55::16) by PH0PR19MB5195.namprd19.prod.outlook.com (2603:10b6:510:94::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.19; Thu, 7 Nov 2024 17:04:23 +0000 Received: from CH1PEPF0000AD81.namprd04.prod.outlook.com (2603:10b6:610:55:cafe::4b) by CH2PR18CA0036.outlook.office365.com (2603:10b6:610:55::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.20 via Frontend Transport; Thu, 7 Nov 2024 17:04:23 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by CH1PEPF0000AD81.mail.protection.outlook.com (10.167.244.89) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8137.17 via Frontend Transport; Thu, 7 Nov 2024 17:04:22 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id EED337D; Thu, 7 Nov 2024 17:04:21 +0000 (UTC) From: Bernd Schubert Date: Thu, 07 Nov 2024 18:03:56 +0100 Subject: [PATCH RFC v5 12/16] fuse: {uring} Allow to queue to the ring Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241107-fuse-uring-for-6-10-rfc4-v5-12-e8660a991499@ddn.com> References: <20241107-fuse-uring-for-6-10-rfc4-v5-0-e8660a991499@ddn.com> In-Reply-To: <20241107-fuse-uring-for-6-10-rfc4-v5-0-e8660a991499@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1730999049; l=8020; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=EbjIGepigT5QCMxXGcpYwuBnrc7SObzF0pQ7empHlzU=; b=qkiGAPv3znPA1C1JFZ19v7m0B4pDuQnGOBZpkyT1MlOsOjqWdtIPh/5LWHo3eoW4LsA+NcaQ3 WBK31lEyBaCDOQ0w92d8FjXkRbAFJzz0PXHlNfFN3d9mEtYrHfkrMMi X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH1PEPF0000AD81:EE_|PH0PR19MB5195:EE_ X-MS-Office365-Filtering-Correlation-Id: 3267725d-0a7f-47b4-d6de-08dcff4e3a2f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|7416014|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?XrV2dmgpPEvRsP3+519cJ2iJijwEVse?= =?utf-8?q?ecESlrpOlr5xIo1Pdf7A2HqVH6v0UttxecduEcglazKT+jNpuWdSTzKSv6TW9wlo9?= =?utf-8?q?aeGLnqyxrbEJ/4XrQNZE9Z5NreD5khqsXSS/+/tzDjuvqXN0GJBzidwryFbOK/KXj?= =?utf-8?q?JOB5Gzskv3497hAdWLcIOeEVSkba9o2JN7tGycY3OLlfjH0/m0QYH17QpmLUq1b7O?= =?utf-8?q?APv3MnPl7OcWvk/S640ZgIuArE9AsaD6VsjeiRzTy+jw7FUy9PB6qfmN0/TTCNOkg?= =?utf-8?q?bUhuTrv9ChEgLeg2t9c6yXCitNhISOEM7beeV4+TKtsFcWjVKTK501/ZhnwBOFlAp?= =?utf-8?q?NfnyGwqhAA3jtCGRolVKAOVJEfqQyZxXfSGGOXusZZ/VQTrcF6Z4Hsb2LSTVlxFNO?= =?utf-8?q?PXA6GG5Z7GieKvmOszucLCAUKz08+7ATx6BcxFQf25BShaLEFLn/6TM0JT2haYheC?= =?utf-8?q?I5d78k26xGG6zmO76sbiYNXgLtbisVi+kZLN7ZyJtQuVUBmklE7eZHrbWW86zae6E?= =?utf-8?q?Gioy8tqvVbqkXEL4qrR2B37pyOY0BKxlOe4JYdUVcowQ7EIVWyYh7gKJQqqUny4b9?= =?utf-8?q?YA3T5zs58AYJbG9IDp1PvhAtMakS4Q2VYckZHBPoYA8BQ4qycT+QjVhI8zOCT1ALj?= =?utf-8?q?jQcYgn76dyrHsgM5fsc+ICO5EvtV9QoBXq0Pmb8OfnGEHQgnGgIYyaA+xmqchxakF?= =?utf-8?q?NBmQW7rhG2QDwFbZUfMJpeexGleqWG5qPqHA6Ih3gwO0v6nQS+t/l0r6lRiVCQj90?= =?utf-8?q?P8gZEc8c2JP28o+jKqGGxkdr65ge/Qtqg3dN7Up4qiZQFtoBXS4fm8AEGmOh5+wz9?= =?utf-8?q?CTowDbNkPbtQpt61rh76Ku6CMtSEfi94I5o8MSY1daJguos8UpHMeuZBUWWRM0Cm4?= =?utf-8?q?HjNhtcmga0aqC1vqW++xXSYDg1KB7bBdsSBB/7YtpJpz2rGkl5MncYk87HXOBiNLN?= =?utf-8?q?5Z3A/NaBuVnciU7tKyGZ6JRxe4ANojeHQ62E388vyNaA9FCfQKAPzd4puAxmDMzlb?= =?utf-8?q?two3lTTrfuX1vXe8wgkBZwMxjrzRjsY11cjCMcQ0FLRbmQKu4Pqsxnr0jXfQ6XS5d?= =?utf-8?q?Kt+KWAvWErcSgBlI0vqJneZJUVKMpShIBHU4lWF4j0l1MV7Q1yHCorAdElKo8QDOI?= =?utf-8?q?gfzs6HECtg6hy+nHgJ0ix4JWaRkyWLffg2Kdr9ZhWtMW5pxEgAuDoLqJTgmTIFJiv?= =?utf-8?q?t5zIGMvBh6wq8I6kBR2/JGwgssMhXPnF/rdPdPPyheq3dnvYWOCcVpTr2YSkvMv5E?= =?utf-8?q?lGgyitY1qCkHTpu6RZzFNQ+m0XKW4CvW6ih1Q5Q10QfAX9mcd5+FQrc2MYHkEF5DW?= =?utf-8?q?3aH0zNotYXnB1qEiB5iucmI0FOnOClooPA=3D=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(36860700013)(7416014)(376014)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: nJoXq4ZxsmOsOI+ar7HkUzuwYZCSaFy7USSB6h0kN1fZWrYnfA2T9TYllhliJ4JWI755qJQj7eh+QP8DgXvRRJAnOenR0LYsqQVqw55xuoSH3I6qJGAniSAD95lYYSII0xOnSfX/3FcZRu++BTO/LNO/9ya2kFExAYEPG0QYFWtk6MwDExjNRRG4JELTWsjiE8z9O1yQ/SEa6H/P6Jrhe6Y7rvhMidg2mzzy3+AV3iYD7bz0em5/7LI43S+ZOJS6o3caoOLyfkMT1e4eLUbuPhxt5gCu4aBb8KenT8qRHQy9pYyO4IA/CPuYDZAZm59wZuPMXoTQl0M2On2IPHCNtiy5CgymwEJeWPCQQta7oUFrMVKJf9az+IS3b+vsPhaGmxnRu6dC4Bzrt48jqr6nJDRz/2/DMwirnaZlVoQHbY3WlwuRXR4yaCPloFP4TuA5zKu5Rr4gl8VjV3okfaQM9oVCvvPdrYZXZ3tg0JZphs23XU/90eqJRdBIlv312bnnkBmDL2tnAq3LayoCNM5v3j/rk4l0MiEnQTsxkYQqerzi/oc5rvCg3/2tDhhAA0xpmnYJxol8dBnMK5HNogiUxoRWw9q4KFZzv+eCK7WBkfq/XAmAXV4SPxqUi7xtWmj9txPK/ixv6zdmalQaXc1SAA== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 17:04:22.7107 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3267725d-0a7f-47b4-d6de-08dcff4e3a2f X-MS-Exchange-CrossTenant-Id: 753b6e26-6fd3-43e6-8248-3f1735d59bb4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=753b6e26-6fd3-43e6-8248-3f1735d59bb4;Ip=[50.222.100.11];Helo=[uww-mrp-01.datadirectnet.com] X-MS-Exchange-CrossTenant-AuthSource: CH1PEPF0000AD81.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR19MB5195 X-BESS-ID: 1730999071-105306-8318-4413-1 X-BESS-VER: 2019.1_20241029.2310 X-BESS-Apparent-Source-IP: 104.47.73.168 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVubmJuZAVgZQ0Ng4MdnCwtzANN Us2cLSwiLVxDwlKdUsNTUxKc3MxChJqTYWANzn7Q9BAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260269 [from cloudscan18-80.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 This enables enqueuing requests through fuse uring queues. For initial simplicity requests are always allocated the normal way then added to ring queues lists and only then copied to ring queue entries. Later on the allocation and adding the requests to a list can be avoided, by directly using a ring entry. This introduces some code complexity and is therefore not done for now. FIXME: Needs update with new function pointers in fuse-next. Signed-off-by: Bernd Schubert --- fs/fuse/dev.c | 70 +++++++++++++++++++++++++++++++++++++++++++++------ fs/fuse/dev_uring.c | 33 ++++++++++++++++++++++++ fs/fuse/dev_uring_i.h | 14 +++++++++++ 3 files changed, 110 insertions(+), 7 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index d0321619c3bdcb2ee592b9f83dbee192a3ff734a..c31bccc667dfafbbb09ef04ababd401558a9c321 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -211,13 +211,23 @@ const struct fuse_iqueue_ops fuse_dev_fiq_ops = { }; EXPORT_SYMBOL_GPL(fuse_dev_fiq_ops); -static void queue_request_and_unlock(struct fuse_iqueue *fiq, +static void queue_request_and_unlock(struct fuse_conn *fc, struct fuse_req *req) __releases(fiq->lock) { + struct fuse_iqueue *fiq = &fc->iq; + req->in.h.len = sizeof(struct fuse_in_header) + fuse_len_args(req->args->in_numargs, (struct fuse_arg *) req->args->in_args); + + if (fuse_uring_ready(fc)) { + /* this lock is not needed at all for ring req handling */ + spin_unlock(&fiq->lock); + fuse_uring_queue_fuse_req(fc, req); + return; + } + list_add_tail(&req->list, &fiq->pending); fiq->ops->wake_pending_and_unlock(fiq); } @@ -254,7 +264,7 @@ static void flush_bg_queue(struct fuse_conn *fc) fc->active_background++; spin_lock(&fiq->lock); req->in.h.unique = fuse_get_unique(fiq); - queue_request_and_unlock(fiq, req); + queue_request_and_unlock(fc, req); } } @@ -398,7 +408,8 @@ static void request_wait_answer(struct fuse_req *req) static void __fuse_request_send(struct fuse_req *req) { - struct fuse_iqueue *fiq = &req->fm->fc->iq; + struct fuse_conn *fc = req->fm->fc; + struct fuse_iqueue *fiq = &fc->iq; BUG_ON(test_bit(FR_BACKGROUND, &req->flags)); spin_lock(&fiq->lock); @@ -410,7 +421,7 @@ static void __fuse_request_send(struct fuse_req *req) /* acquire extra reference, since request is still needed after fuse_request_end() */ __fuse_get_request(req); - queue_request_and_unlock(fiq, req); + queue_request_and_unlock(fc, req); request_wait_answer(req); /* Pairs with smp_wmb() in fuse_request_end() */ @@ -480,6 +491,10 @@ ssize_t fuse_simple_request(struct fuse_mount *fm, struct fuse_args *args) if (args->force) { atomic_inc(&fc->num_waiting); req = fuse_request_alloc(fm, GFP_KERNEL | __GFP_NOFAIL); + if (unlikely(!req)) { + ret = -ENOTCONN; + goto err; + } if (!args->nocreds) fuse_force_creds(req); @@ -507,16 +522,55 @@ ssize_t fuse_simple_request(struct fuse_mount *fm, struct fuse_args *args) } fuse_put_request(req); +err: return ret; } -static bool fuse_request_queue_background(struct fuse_req *req) +static bool fuse_request_queue_background_uring(struct fuse_conn *fc, + struct fuse_req *req) +{ + struct fuse_iqueue *fiq = &fc->iq; + int err; + + req->in.h.unique = fuse_get_unique(fiq); + req->in.h.len = sizeof(struct fuse_in_header) + + fuse_len_args(req->args->in_numargs, + (struct fuse_arg *) req->args->in_args); + + err = fuse_uring_queue_fuse_req(fc, req); + if (!err) { + /* XXX remove and lets the users of that use per queue values - + * avoid the shared spin lock... + * Is this needed at all? + */ + spin_lock(&fc->bg_lock); + fc->num_background++; + fc->active_background++; + + + /* XXX block when per ring queues get occupied */ + if (fc->num_background == fc->max_background) + fc->blocked = 1; + spin_unlock(&fc->bg_lock); + } + + return err ? false : true; +} + +/* + * @return true if queued + */ +static int fuse_request_queue_background(struct fuse_req *req) { struct fuse_mount *fm = req->fm; struct fuse_conn *fc = fm->fc; bool queued = false; WARN_ON(!test_bit(FR_BACKGROUND, &req->flags)); + + if (fuse_uring_ready(fc)) + return fuse_request_queue_background_uring(fc, req); + if (!test_bit(FR_WAITING, &req->flags)) { __set_bit(FR_WAITING, &req->flags); atomic_inc(&fc->num_waiting); @@ -569,7 +623,8 @@ static int fuse_simple_notify_reply(struct fuse_mount *fm, struct fuse_args *args, u64 unique) { struct fuse_req *req; - struct fuse_iqueue *fiq = &fm->fc->iq; + struct fuse_conn *fc = fm->fc; + struct fuse_iqueue *fiq = &fc->iq; int err = 0; req = fuse_get_req(fm, false); @@ -583,7 +638,7 @@ static int fuse_simple_notify_reply(struct fuse_mount *fm, spin_lock(&fiq->lock); if (fiq->connected) { - queue_request_and_unlock(fiq, req); + queue_request_and_unlock(fc, req); } else { err = -ENODEV; spin_unlock(&fiq->lock); @@ -2199,6 +2254,7 @@ void fuse_abort_conn(struct fuse_conn *fc) spin_unlock(&fc->bg_lock); fuse_set_initialized(fc); + list_for_each_entry(fud, &fc->devices, entry) { struct fuse_pqueue *fpq = &fud->pq; diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index 84f5c330bac296c65ff676d454065963082fa116..5cd80988ee592679d9791a6528805f7dc8d58709 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -817,6 +817,31 @@ static int fuse_uring_commit_fetch(struct io_uring_cmd *cmd, int issue_flags, return 0; } +static bool is_ring_ready(struct fuse_ring *ring, int current_qid) +{ + int qid; + struct fuse_ring_queue *queue; + bool ready = true; + + for (qid = 0; qid < ring->nr_queues && ready; qid++) { + if (current_qid == qid) + continue; + + queue = ring->queues[qid]; + if (!queue) { + ready = false; + break; + } + + spin_lock(&queue->lock); + if (list_empty(&queue->ent_avail_queue)) + ready = false; + spin_unlock(&queue->lock); + } + + return ready; +} + /* * fuse_uring_req_fetch command handling */ @@ -825,11 +850,19 @@ static void _fuse_uring_fetch(struct fuse_ring_ent *ring_ent, unsigned int issue_flags) { struct fuse_ring_queue *queue = ring_ent->queue; + struct fuse_ring *ring = queue->ring; spin_lock(&queue->lock); fuse_uring_ent_avail(ring_ent, queue); ring_ent->cmd = cmd; spin_unlock(&queue->lock); + + if (!ring->ready) { + bool ready = is_ring_ready(ring, queue->qid); + + if (ready) + WRITE_ONCE(ring->ready, true); + } } /* diff --git a/fs/fuse/dev_uring_i.h b/fs/fuse/dev_uring_i.h index c442e53cefe5fea998a04bb060861569bece0459..7951a8a96702190beba0596212c90b60da659aca 100644 --- a/fs/fuse/dev_uring_i.h +++ b/fs/fuse/dev_uring_i.h @@ -117,6 +117,8 @@ struct fuse_ring { unsigned long teardown_time; atomic_t queue_refs; + + bool ready; }; void fuse_uring_destruct(struct fuse_conn *fc); @@ -132,6 +134,8 @@ static inline void fuse_uring_abort(struct fuse_conn *fc) if (ring == NULL) return; + WRITE_ONCE(ring->ready, false); + if (atomic_read(&ring->queue_refs) > 0) { fuse_uring_abort_end_requests(ring); fuse_uring_stop_queues(ring); @@ -147,6 +151,11 @@ static inline void fuse_uring_wait_stopped_queues(struct fuse_conn *fc) atomic_read(&ring->queue_refs) == 0); } +static inline bool fuse_uring_ready(struct fuse_conn *fc) +{ + return fc->ring && fc->ring->ready; +} + #else /* CONFIG_FUSE_IO_URING */ struct fuse_ring; @@ -167,6 +176,11 @@ static inline void fuse_uring_wait_stopped_queues(struct fuse_conn *fc) { } +static inline bool fuse_uring_ready(struct fuse_conn *fc) +{ + return false; +} + static inline int fuse_uring_queue_fuse_req(struct fuse_conn *fc, struct fuse_req *req) { From patchwork Thu Nov 7 17:03:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13866757 Received: from outbound-ip168a.ess.barracuda.com (outbound-ip168a.ess.barracuda.com [209.222.82.36]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 17FB5217912 for ; Thu, 7 Nov 2024 17:05:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=209.222.82.36 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730999112; cv=fail; b=GWjRLEymxTu0SjhaOqFl5Nbfz9eF8FjIcV/WeiiXL6rq9MEf1X7ruUDkErZF3Z/rytzzR2wtoCrJ3d4c0HYJAPqltsEDQgWD54ewe1GA9q1vrEzBr9u/0ZMSisY4XoyQnUBPTzZ6C5x94u9V1dod2SYwQBbGFSJGzgrm8TeEDcY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730999112; c=relaxed/simple; bh=vNi3ideG1iLjK3+IpG5ceXtr7C851qaww+bttzRaeqM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GxGN7okHHwRvBvjN8/ZdSo5gcVunb6a8xGmE6TuzqV3tArYpBXf2/pPG/zcoKoQWtAgMzEdhFmoEK7fHLQD85hE6zlLesRTs10Rjp3e4lv5iPCemfuEoXKrS2NcK9pIKjbGRei8ZWOdwRSPeRRgRuNvQ1+hz57VYSofzabKohq4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com; spf=pass smtp.mailfrom=ddn.com; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b=eCO2ZYgv; arc=fail smtp.client-ip=209.222.82.36 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ddn.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b="eCO2ZYgv" Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2049.outbound.protection.outlook.com [104.47.73.49]) by mx-outbound8-74.us-east-2a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 07 Nov 2024 17:04:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=uuRDBpqb/UIcqqDLiKVWOx8sghwsFLHj/kl7Iyk5QCsjB3osUuxA9OZlWt/AZNEmuxw2Df29Xf2hzKb9MXxNAQTSnTq0vzzjm+Ikp8SodRJv30wPznAoOglMDW6pG4ijrSAV8UfCH2BV5aH/m1Et3fuV7Ekn7UySZgZx7x9LkkMlWFi308UWPxPc1fuzYRNmFUlpPrEouo0KijtuywggUK4cHKQ2Xfz99+eB4kK4EGp902zYXiAWRnYseWY37vUrt+b9H3XHKYoKUe3tfrTrIRcR8F3eM8Y8fWb/1qwflliunlpvyJLt/DI10MxwQ7+BNpxpNPVYjJ++9u1Q0yLOJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=aBvVN7b+Ds0Ig2dbL7M3V9/Qz+0WwfDX3oe8Zqg06po=; b=T5OLSnwtK8lUCbSEZ6NkRCGl08MrXRka3umgOiE8461i7+BW2AM0SmhOMWGqbuXVEKTeHJ4l7KNq25BmVPd66ci3r1HLAw2M7LhaK8m67QrdPk03QaY7VTTix/0m2qNlP+flsihsLlulp/6Pw/PBfRXKO9l35kTJ3uK8VmMkBpadmWQi2cNLKzpF7Sh/BX9FzAAL20FFRoDyb6kWlf772i6BmFWarM4XjAWCiviim4WJwdgLg87GbXyp3jzjNn0CyBxWnSEN3gqA33xOwmTlNibDd/7PfBop3/KwMTkadXANeBit2G5dENs0tCiEntZQDjdfVWTqhnDm0mXipQWrlw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=bsbernd.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aBvVN7b+Ds0Ig2dbL7M3V9/Qz+0WwfDX3oe8Zqg06po=; b=eCO2ZYgv08wkCeDi1lCR1k0vxtCUAwU13qAsFe8ug1+Tz6A0ZN4ZGFR72EJNkUqYONyOxK2lNl09o1rg1lGTiWCDRjT1+lNFnfCEZyBX43cj0elE4H4tNpeWHlsCS0XFjfgAzlUu+dc/HrrWgC6uVoyepg1csBiuHaQEeE6vlfE= Received: from MN2PR20CA0054.namprd20.prod.outlook.com (2603:10b6:208:235::23) by SA1PR19MB8022.namprd19.prod.outlook.com (2603:10b6:806:388::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.20; Thu, 7 Nov 2024 17:04:24 +0000 Received: from BL6PEPF0001AB73.namprd02.prod.outlook.com (2603:10b6:208:235::4) by MN2PR20CA0054.outlook.office365.com (2603:10b6:208:235::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.19 via Frontend Transport; Thu, 7 Nov 2024 17:04:24 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by BL6PEPF0001AB73.mail.protection.outlook.com (10.167.242.166) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8137.17 via Frontend Transport; Thu, 7 Nov 2024 17:04:23 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id E6692121; Thu, 7 Nov 2024 17:04:22 +0000 (UTC) From: Bernd Schubert Date: Thu, 07 Nov 2024 18:03:57 +0100 Subject: [PATCH RFC v5 13/16] io_uring/cmd: let cmds to know about dying task Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241107-fuse-uring-for-6-10-rfc4-v5-13-e8660a991499@ddn.com> References: <20241107-fuse-uring-for-6-10-rfc4-v5-0-e8660a991499@ddn.com> In-Reply-To: <20241107-fuse-uring-for-6-10-rfc4-v5-0-e8660a991499@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1730999049; l=2087; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=OmthtYeq8dVdFY1LwFpLQXA5OxBwj2Q9ybgpxjq0bpA=; b=BOy+6XxmfrlRUXmdZrga9t7IOr5ma2a1s1/v5FJFpGIumRxeNhFDqfoTnVkxQsw3U5CThpWc5 JtAgtg/rFS6DNHZNJ10i/UWLtnIYSdULpKuRQiWlspdhiLIKjtJirWF X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB73:EE_|SA1PR19MB8022:EE_ X-MS-Office365-Filtering-Correlation-Id: ace8564e-5a6f-438e-edea-08dcff4e3aea X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|1800799024|7416014|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?GM5X50tjm1o2EUQ3D4nl6GNVLTjOxLy?= =?utf-8?q?11N1QMbvNrzKJgf/wXM72y3Rz8JMaZ5sEpSYiJ8H+Kfb0XA6JA2EVHb/KryVAXjEh?= =?utf-8?q?ynPsxzZkOX7cgiLom2qZBwLrPYcmuCIpaQs9S4kDfNZFG73OPvtKXrIxRjqXc0zT6?= =?utf-8?q?rkXSF6V4xOI634sg4YmfS6NtXBJ4o76okzkQ/CSY6sgbrFwF7xjYv0yQhJLo/nu14?= =?utf-8?q?LDVOwc2BWG4m+TNPubUoQ/eyPJpVVpeAvAASQWQgPd1VZ7E6xVqpJRDg00GzZVX4d?= =?utf-8?q?yCKXrlKxC8f+xUmJXFiq7DkcPiwcwUT6Qvcz3LxkawrhP3rXI6bPB4SH9leigWcEJ?= =?utf-8?q?pE8zjjn29OVeRO0yhJD1CW/bd/rqINED/U1hBV2XhOnb7qnJHZm1L0ahVJBKmjDAf?= =?utf-8?q?Zv6x4cXbyvK4yXOJVgcRNQWnD99zTuwa7PlyNOtPC+Wph5uE9QRmjXFkBfJu0YZ0R?= =?utf-8?q?9bSY57ekED2J7guXMJ55JlygEMwiUkJVNG6tG/IQhry8aqCdgAD9hr5PnllbfJUqi?= =?utf-8?q?xKEc4RyrDrEeUMwQLgdPd63n6swftO/+fseEo4GU+SMrW6FA279i9Xt0Qoj6i817l?= =?utf-8?q?7EzWuN6JuQlgLqYNYoNaMW23ek0e/TPDr/D90VobmGc4ou/AKOpAXmAcoV34htbX2?= =?utf-8?q?sk+hK9sFQLG6DFcIH7fM2Qgazqjd6C6g+8utCqYYhIjwY2ewUKKKzxsIhlUDcLwKp?= =?utf-8?q?LvLAzF86fGTICtbWeibiqO2VT+TFIClmLLZjdWdjM/8eMyve/Z0ohOBDn3ebGlCkN?= =?utf-8?q?S07ypSPj1r537duHaSuss81dUIqfl6PPF4Mdyxlfj0z0gWK3kI4npMeecQmnhq9sZ?= =?utf-8?q?aCHEnXSMGLNwDSq6kcdHjEKEtwdXPxBQerCf9Y3Kxyg7j4aPvYdnaJ3E/DvFe7iqL?= =?utf-8?q?flmwwzitR3uaW5oqIz5xps/mD8Y6cVnCzpJ+ivSJBk1W64u7o7RIiB4/BeZZgNYxF?= =?utf-8?q?EBjL7Fve4Yr8YcQ0G7Tr/V4MdAd360+bJZbrm0CS7JS7SIXoFXmUmL6/pokpdNCia?= =?utf-8?q?wK7LZY3TQrcQhFZRTtmXpWbcIV5PfN7czFqYqq+AoPZ5LdZ7HqeNxTZCPNpm/DViT?= =?utf-8?q?Ji6X8JOzSO+qSEJ1JI54yTiJ5l9T/r12h4hOTCTVwWcV0j1uUMW4XbCqUCwuxc3fV?= =?utf-8?q?/6+uOLa4tFfgU/wEQ4Gypu9pwo3aduoLx6mTWUWYL97AQ8cn59nG5rHS3j5WTXQ2V?= =?utf-8?q?7ei+LQoXodZ+FOAOXbnMwS4qLxD/Qopc8VjwLmT80d1xKrvBtFAi1o2l2pGvZCWB/?= =?utf-8?q?oFNb+fGZ2xhZWWPz7A/c8xb+83X1zwAn73lLhJZlnCT05nXMEk4rKd0do7Fj34LGN?= =?utf-8?q?L6LngJjEpE/+q+a+Uh2RvY9GZfrDFqH2pw=3D=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(36860700013)(1800799024)(7416014)(376014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: kbuPVMupXnwquX/FJ+4xh9ZQxAbE2M3/3HQ97uEV+dRiY69AmRRGdBZB456TxxfihpJMjKDhMeAe54dg/S+Qrzjl7T3/yiVSriOojfDOHuduyCqtAIrO/7VKYW3q2wmWOpNuBu++oSVYLv3fWz83y4qd7dztay0wJsPxhCpAiRxIUX95rTsKQEZUSSU50s+/dRJBLd+J1ApPPwHd4S4SBnLrXKZ5m2DXG+1XcWIrs9f+zGWBvFraXoXjmSnrniMhyWREGRF8YLgaCh+CeMXjDty/43HPGCwF2d9uJxRLms2Rb0vqxppx8w/LR5gutnUNQ366fU1S8nybhtasYUXinbpvP/UxTAZxOlG+8Uw5shC/h8HZjEwB2xwocYvjlmD1IkaeIq4yKl+C08CWkSMNz1CT7B2st1kTe8mc0Xn54DoC7rYap8i5a3RwMRq+mXa3UTtaxvqNdjnc7/Lp89KVDIh8GrNu8treg4HAEVNDDm7aPTamY2rQrATCtFA8X5Mf2aV7/CWzi6oN4CjcjgyPF6uRYLrLayRHLvOVTUJQvT3oMX+9PdKU0yOGmMBHNMk1qUk+krP1OxPAXbSAR9eTCjTzskB86BT+3VdYoPH98sxcPEmguO0kZITBnwBQwfXeUA9ABP1Mu7UCS96bxUCs9w== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 17:04:23.9055 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ace8564e-5a6f-438e-edea-08dcff4e3aea X-MS-Exchange-CrossTenant-Id: 753b6e26-6fd3-43e6-8248-3f1735d59bb4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=753b6e26-6fd3-43e6-8248-3f1735d59bb4;Ip=[50.222.100.11];Helo=[uww-mrp-01.datadirectnet.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF0001AB73.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR19MB8022 X-BESS-ID: 1730999071-102122-12672-30019-1 X-BESS-VER: 2019.1_20241029.2310 X-BESS-Apparent-Source-IP: 104.47.73.49 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVkYGFkZAVgZQ0DIlzdAyxcQwNd Uw2TTN3MzI1NwiySjRxNggzTDF1DRJqTYWAEXSBnxBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260269 [from cloudscan14-21.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 From: Pavel Begunkov When the taks that submitted a request is dying, a task work for that request might get run by a kernel thread or even worse by a half dismantled task. We can't just cancel the task work without running the callback as the cmd might need to do some clean up, so pass a flag instead. If set, it's not safe to access any task resources and the callback is expected to cancel the cmd ASAP. Changed to if (req->task != current) based on discussion with Jens, needs to be double verified if really needed. Signed-off-by: Pavel Begunkov Signed-off-by: Bernd Schubert --- include/linux/io_uring_types.h | 1 + io_uring/uring_cmd.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/linux/io_uring_types.h b/include/linux/io_uring_types.h index 7abdc09271245ff7de3fb9a905ca78b7561e37eb..869a81c63e4970576155043fce7fe656293d7f58 100644 --- a/include/linux/io_uring_types.h +++ b/include/linux/io_uring_types.h @@ -37,6 +37,7 @@ enum io_uring_cmd_flags { /* set when uring wants to cancel a previously issued command */ IO_URING_F_CANCEL = (1 << 11), IO_URING_F_COMPAT = (1 << 12), + IO_URING_F_TASK_DEAD = (1 << 13), }; struct io_wq_work_node { diff --git a/io_uring/uring_cmd.c b/io_uring/uring_cmd.c index 21ac5fb2d5f087e1174d5c94815d580972db6e3f..405a39fdd91c9abf741c2b3b6bde2f4d850312ae 100644 --- a/io_uring/uring_cmd.c +++ b/io_uring/uring_cmd.c @@ -119,9 +119,13 @@ EXPORT_SYMBOL_GPL(io_uring_cmd_mark_cancelable); static void io_uring_cmd_work(struct io_kiocb *req, struct io_tw_state *ts) { struct io_uring_cmd *ioucmd = io_kiocb_to_cmd(req, struct io_uring_cmd); + unsigned int flags = IO_URING_F_COMPLETE_DEFER; + + if (req->task->flags & PF_EXITING) + flags |= IO_URING_F_TASK_DEAD; /* task_work executor checks the deffered list completion */ - ioucmd->task_work_cb(ioucmd, IO_URING_F_COMPLETE_DEFER); + ioucmd->task_work_cb(ioucmd, flags); } void __io_uring_cmd_do_in_task(struct io_uring_cmd *ioucmd, From patchwork Thu Nov 7 17:03:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13866758 Received: from outbound-ip168a.ess.barracuda.com (outbound-ip168a.ess.barracuda.com [209.222.82.36]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3637D215F7E for ; Thu, 7 Nov 2024 17:05:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=209.222.82.36 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730999113; cv=fail; b=j0TMa1XZJmV5uJ8vFuWR5fbaatNqSEM3Pw8QcCaSvpEw3rt8Z9PVqU7BYVP9tMYwfno5h2LEg8TVH/iBCcU/chS0AnqjjyjYvVakkKGEpYDL4hu716EgMjbiOnzz+hjwJfjYTWX146vhHWvMIYiCI30dSinscGk+oF7ROtWIXbU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730999113; c=relaxed/simple; bh=pqs8+uHKychBzoVzjSd0VEAPsAXd/lQKOxkL96xcE3Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=g6jY3TLongG78PknZNqF7vTSQdqKG6JtYC1CnelwwWV3YMRXcnVaGxUFu11xBaYJ1IFEUoxQzsd4k1XekSfzctEVQT8udYT3InUz96zKhBcTORsKkKEESKLRIRhvcCH1QZBHv7o4u6ybrm35kTJWr5/MGzVtfPqTOSqOP6w2+Gg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com; spf=pass smtp.mailfrom=ddn.com; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b=HKShBWK6; arc=fail smtp.client-ip=209.222.82.36 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ddn.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b="HKShBWK6" Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2173.outbound.protection.outlook.com [104.47.57.173]) by mx-outbound8-68.us-east-2a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 07 Nov 2024 17:04:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MQuvNPlLduceWQLOWQDziLaH5DzrlZTfVVLRB+TGjRdtuj6Eh50Yzb2cX76vMIifxBP0ia51+D45qsAQpU9dPkB/oTlqickoPKpz6fklbc8z1Y99M6Pb7JVQpof98ouzuxsQA2TQTBYda2E/1h+3zupCif36SjK3gpLJXyV+1RrG1qqmVThfPQ1Dtyc2p0m7rehCJfnkqjCDLpMtNAS0F8V4NyKR7+VkHQM6FdcNsauL8Yopx5hktBlJawbw1ISaMBFih3Q9M8DAG5ReEExq86Qw2Te5v5u52qM2QZDNoetqh++W4ERTGB1MxONXaVU7zd2bSc1gaWKW+V0o1943zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=IKZMT9i96rzTVaQaCIUyI8m+ttkF/mzRjtkzGqsuVRg=; b=WzWFKEDWNAQnpyXLUg5bicQzMKc8ZoZMHVaevySwUc+G6Z26AIvL/9yE+nTe5Y6mVaOqbPtygX7lNl6qfX1Iiz+rZPaWwr73dJA5eTgj2+YTDznzMJ/GZiezdbgXBti3Lg5D63TOHQQzhPznU7XwjEQc+Sa7GKix0v7xOw6HuyoQnDbdgxsqgqz5wuU3OEqJvBJNxKrDYqD2JeIflfKsHnLyNTlOjoqGRNN8r1Oop/lK77sCMi6rsvJTveOvB1hgDdIm2nT4gSxLvThUmTsFfsEjROZqFA2Yn2u97tqn9OoqM6BCC3IcdCLXRVDzL2LnMaBjBPUjaPKDI4NU5D5+rQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=bsbernd.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IKZMT9i96rzTVaQaCIUyI8m+ttkF/mzRjtkzGqsuVRg=; b=HKShBWK68mTaU6w4Ux3y8NZFlf+0BZjvn7ayTIhVf/apNlQtaFoKaffmwDqbhT6I2idQZvSXpzCnsGoa+gbuPd5/NVrp7pN98k15xY/+SzoUS5/V58ixnWyVmXW3P+bPSt5i01cAuqvtILaGfhd1kSVJTP5ZczVCLSmKY2m3H0A= Received: from BN0PR04CA0119.namprd04.prod.outlook.com (2603:10b6:408:ec::34) by SA6PR19MB8651.namprd19.prod.outlook.com (2603:10b6:806:413::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.19; Thu, 7 Nov 2024 17:04:26 +0000 Received: from BL02EPF00021F68.namprd02.prod.outlook.com (2603:10b6:408:ec:cafe::b0) by BN0PR04CA0119.outlook.office365.com (2603:10b6:408:ec::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.20 via Frontend Transport; Thu, 7 Nov 2024 17:04:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by BL02EPF00021F68.mail.protection.outlook.com (10.167.249.4) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8137.17 via Frontend Transport; Thu, 7 Nov 2024 17:04:24 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id DE9127D; Thu, 7 Nov 2024 17:04:23 +0000 (UTC) From: Bernd Schubert Date: Thu, 07 Nov 2024 18:03:58 +0100 Subject: [PATCH RFC v5 14/16] fuse: {uring} Handle IO_URING_F_TASK_DEAD Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241107-fuse-uring-for-6-10-rfc4-v5-14-e8660a991499@ddn.com> References: <20241107-fuse-uring-for-6-10-rfc4-v5-0-e8660a991499@ddn.com> In-Reply-To: <20241107-fuse-uring-for-6-10-rfc4-v5-0-e8660a991499@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1730999049; l=1124; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=pqs8+uHKychBzoVzjSd0VEAPsAXd/lQKOxkL96xcE3Y=; b=U2yofiJxigmBdRtzuP/z3XSnvYfzHfGfK4SRjk+kFOswXtvCjs8DOd3kmwc/bz2wwlouOd1nh slUfrIJ0eD1DMdGHHy1os1RN7KEwu6dre+4qQVeYnqK+R4XFRqI1UW3 X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F68:EE_|SA6PR19MB8651:EE_ X-MS-Office365-Filtering-Correlation-Id: 82f95f39-b217-4dd5-670c-08dcff4e3b7b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|1800799024|82310400026|7416014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?3pXWESIKWOgSwviW90ee9zWF6USK8sF?= =?utf-8?q?XwFEDIuIX2d54oVJHUckAsew3iOZqwVSjwvKZ8BIzauqdsk/+7lW8fmE1K6mXUqbF?= =?utf-8?q?w6m9wIUIvVeIWX0ZiPhFRrS5gSgQ7iqUe307GLsJtcYWygJmzmlLfDWaDdmEoSL88?= =?utf-8?q?39IVP4OFTAEkyEvzO24opbspZ9mbp0YXwYgvvr7sn5xeNzOysuI4SR3RoB0TKnKKm?= =?utf-8?q?YZhQZmYBl6XlhVg0CmVanAbXrjdIFbVAsqLPthh8fg53HwpFH8eJDyA6NVjgfcomC?= =?utf-8?q?HIfMMv15lfyy8OI9E8FcZBlbA3NJYr3ipcAIxFK3d9az9uP3ZbZMkznBsxSLSvfdN?= =?utf-8?q?zKa3D1itKtkWqQcZwIer5K+2TrADdxa0bDfeUukBcrWhk1sdabWpA3S6EhezA/OEx?= =?utf-8?q?3bBiJrPrcBlKmJ2FKy6L9DrQ5xTWTSn+wjWqW+glpauq0pwklWk0e2U7V/YTA9peZ?= =?utf-8?q?WwBYMpccFLhWZCZNVd8M3p68lsX2R/xHmUScL+cxfMy14zhtOoD8tuw2DDRdaU1ca?= =?utf-8?q?oCwfa16jjp0V8LmPt5vwy6ia+W23JAjjd/vvbF9m7aFxTjH1ID/o5zAKl6CdoEs9q?= =?utf-8?q?w1UE2678dWAkiUKjrJBvfyT1n+Mo4gRE6Z3h5oX7gM3JTIDazB5dHxjvaGadXcp3V?= =?utf-8?q?m1pasO/db3ZPtjPNaCIBNTwKz8+L/2yz81RIUzP7eBdPD7uZE/5H8gkie6N2omFZa?= =?utf-8?q?DIHq8jZr8WTfYrGV+BkinfpF4fnrq1xEwY+QL/Gi4pvYp2S64ra558zCGQv5ZoMcy?= =?utf-8?q?EMrpYrQ70lwC7jSmjfyTn5ilRz4uyLE6J0mMdNdPmAHltfR2aUdpYJQTNH972miom?= =?utf-8?q?Dky9boTlK+BQuOt7a45OwZy9VOgWSxZySRKrEkmGYQtObnJk+T6tv19T4UaIjyU4c?= =?utf-8?q?etMkTIvEDRlswaml7eXUxVfbrjzsNHaMNwolSVXOTsp3sqbS6lyBaCXeoiWiIxY6J?= =?utf-8?q?bKn3ug0uOzKe6udfL+eIDYjcc2Bn/RkHEhmcMtuEbWxjzVKjGUa3Tzf5icw5jMxcm?= =?utf-8?q?BTMcfHepaLSlc8tUFiEoFki1lPfaStO5zqGnHbWoWCEh28qkTfiZAv4BLpM2rLTR+?= =?utf-8?q?+cSYFzLhSkCKWbdkh6wuD3sivJN15g6R17V4FoXF4ko3XS2Zh+YxtngvMOnIswjjp?= =?utf-8?q?YuKBq8jAVYKWi7vXSZoeINPcyzIFjwQSK1D/BIQC4EcdPkDH6+KV/eXZLck8f29sO?= =?utf-8?q?7XOVbmONmuvYThSLcalXdzQHzHvJeVHjU3j4+bSUvp/uPvJlWjHsl9Tqbkj0y5ge4?= =?utf-8?q?U9u/8XtlXBUxPhhzfSYIX7CYYJ/cDnz+uI26ZnQ44DwDQXuZtsF3/7PkIAKr4judi?= =?utf-8?q?/Eb+HAkOl3iWIvGqg+1kBQfV3tvHMknI2g=3D=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(376014)(1800799024)(82310400026)(7416014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: m8tIJXzj308u3r1tBNIsRfllS3p+feoFPs8L3atARE3HHFbFgfov5GsfGW1raJDcV3REVv1sG1Ugw+UrCXcmpCeCfo/tBn/6NfUs/bZPucUUI4YyNSPRpB/5LiXVJ8x6PYSRX9Pp68QDRfYXGh+OWwJY8OH3cxzAOJsFb3lcSlLTrOu622EGKf3ywXCCkK2meshtnRZF0ohGXf7JsmgwpKbK5tKYoljZtbceuGS+5C3OwhN6Xe1ZpRS6414jJZQ0VkSphThS8Qz5X38amoKOvBBErt46qZC4b5laAyFLMYJKFGd0Z9Wys5Xh0optnVpXdbs67EemG9BSWJUJnP+OOtSYcTgLii657a0EKFhsa1KhhiccTve8Bp91D6hrWZ9MXoqXhqdImCSQU+/Dc1KRzEDzozScurYxKZ5eCK/TmlRccT+Ix1iv4gVyMq8yIZCzg4MnPOIiokQaocHG8ZMW9JW/cJ5w2Xl8fXkShcBprp9r9oABB8CsN5oBsekhwAWaPULIAgfx2Sm1vSyurgsN9a51AI2ZFd01a2vOyMUo5dO1of+efIbjHIw7UWXS/fZwBmIcoqQrcT16LWcgClp4vF2abbLO+V76NzhwTosyqlpSLqzYiGftBM5MDfPf1me+doadEBPm5SWHokdTad6GhA== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 17:04:24.8524 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 82f95f39-b217-4dd5-670c-08dcff4e3b7b X-MS-Exchange-CrossTenant-Id: 753b6e26-6fd3-43e6-8248-3f1735d59bb4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=753b6e26-6fd3-43e6-8248-3f1735d59bb4;Ip=[50.222.100.11];Helo=[uww-mrp-01.datadirectnet.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00021F68.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA6PR19MB8651 X-BESS-ID: 1730999072-102116-12640-22540-1 X-BESS-VER: 2019.1_20241029.2310 X-BESS-Apparent-Source-IP: 104.47.57.173 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoYGFqZAVgZQ0MDUzMQ0MS05xd jIwigx0cjSIMkk0cw4zdzS3DI51dhMqTYWAItFu/lBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260269 [from cloudscan8-250.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 The ring task is terminating, it not safe to still access its resources. Also no need for further actions. Signed-off-by: Bernd Schubert --- fs/fuse/dev_uring.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index 5cd80988ee592679d9791a6528805f7dc8d58709..6af515458695ccb2e32cc8c62c45471e6710c15f 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -1062,16 +1062,22 @@ fuse_uring_send_req_in_task(struct io_uring_cmd *cmd, BUILD_BUG_ON(sizeof(pdu) > sizeof(cmd->pdu)); + if (unlikely(issue_flags & IO_URING_F_TASK_DEAD)) { + err = -ECANCELED; + goto terminating; + } + err = fuse_uring_prepare_send(ring_ent); if (err) goto err; - io_uring_cmd_done(cmd, 0, 0, issue_flags); - +terminating: spin_lock(&queue->lock); ring_ent->state = FRRS_USERSPACE; list_move(&ring_ent->list, &queue->ent_in_userspace); spin_unlock(&queue->lock); + io_uring_cmd_done(cmd, err, 0, issue_flags); + return; err: fuse_uring_next_fuse_req(ring_ent, queue); From patchwork Thu Nov 7 17:03:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13866753 Received: from outbound-ip191b.ess.barracuda.com (outbound-ip191b.ess.barracuda.com [209.222.82.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 690F2217339 for ; Thu, 7 Nov 2024 17:04:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=209.222.82.124 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730999086; cv=fail; b=PoRq3UH0EMlolqUQOh4S2Cgpa+ZFyYy6WI+BxUE0nM6DL9JvrlicRQjjLukfULPLqdr3FLjYd6NUYZ03cCnSeSfDCfZS7qG7NHJzt++A4wARch9z7BnF4SZeR9YlJnCT4dkVBi51ruQAZhRUrxX4OVniId7UtvjFQX6doKk+IgU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730999086; c=relaxed/simple; bh=qPjPlv+ALLWi2d1RcybZcXQ4moZV8H3KjAxZ8jqYrfY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PtjAoI0DOgUMvncaBdLqTc//GkvpCb/HpG6LPclxy5p3YMdSpJ89fh4ZES+HxkUYbSr0sacRv1k7jtnf4bX2m4fCqJ2KdXiZGrAv3oYwDtZwGC9aAvVMB+9kURrg/23choEt/WUsnM//oQIKxq8YSGXEaaQLqyqCSpUcTmmrShk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com; spf=pass smtp.mailfrom=ddn.com; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b=P+nmEc0z; arc=fail smtp.client-ip=209.222.82.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ddn.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b="P+nmEc0z" Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2047.outbound.protection.outlook.com [104.47.58.47]) by mx-outbound42-219.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 07 Nov 2024 17:04:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qwuh0Swx/dkPN12MApAESsP40t/UL/n8Bbts2ur9eLo3RshZnIT92QJgWXwShP7mFHHf+iBLd7h/ZxeU7vDcZB2sv5DSd1Gm8NNN+5OOqw2RMiAQIvazdZQMnXIN6/Zed601uXDyArCK/W4B+QTuBo7M2Z/KBq3ethDsbglU4voJYNo/wtZG/0QpQehV0uITiFUAFqBYLGONtGm3HK/kuVrhvpm1xQJu0kfIn6RK6w7HCwbd/KdUhAzwbgIGhlweWy7KnVdHT69UmsiNm+HxZCJ6tvsZUZLVuZeNjZx2X68uJGnxSPjjM61BUYzCnDHIxDnJ4tJcau9pDC1Ilj7Ovg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=UJbGYdfcKxrisStMC23eIxi28Iz9jbW7IhfhfVAUNR0=; b=pdcDwXRCUyfKARotHqRJ6DzE2yvs0jxzD8HZupxAwAfZUYPvfK3YNARdNE1MRWZozgsTzaFreiPhfIA52ZEgvkEMeaoklmEJGrHWG0TaVHFrNyWaeJx/1pgdG0ZCTaFR10SQh/JxnHNUyn9s20PEN8L7MqgbIUe3OctpxzFyMQFkrV1NPkYWb0+6iWUtWlYlYMgL785O8IDvrSDUJzqnR05wLfTvrd1GSk6OyDi3sn0pLysFPUfqIrifdGhPwteVRFLPtYqUSblQghtW64RnrdJEbquF2aGVlhZZOOyQcmAPDB4BwRbwdY9vueQKQY2ZJ6OqQ2qVSqyu9W80tipctg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=bsbernd.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UJbGYdfcKxrisStMC23eIxi28Iz9jbW7IhfhfVAUNR0=; b=P+nmEc0zthInBnq80v5xg4sEbZjgPVsi6dEadLoHNJeL6WDNYcQmhEZs+nZ2zpDHBKstwz6xAhD/KGrm9myQzyDR9PGVvfOzh81uB4uHXo7K/rUUqYxJceSk3xLWkDUiYvuyxWpLA/HwDCv03/k6ejniPwJcI7s7xFYUxO/RMb0= Received: from MW4PR03CA0267.namprd03.prod.outlook.com (2603:10b6:303:b4::32) by SN7PR19MB4799.namprd19.prod.outlook.com (2603:10b6:806:f6::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.21; Thu, 7 Nov 2024 17:04:26 +0000 Received: from SJ5PEPF000001CC.namprd05.prod.outlook.com (2603:10b6:303:b4:cafe::39) by MW4PR03CA0267.outlook.office365.com (2603:10b6:303:b4::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.19 via Frontend Transport; Thu, 7 Nov 2024 17:04:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by SJ5PEPF000001CC.mail.protection.outlook.com (10.167.242.41) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8137.17 via Frontend Transport; Thu, 7 Nov 2024 17:04:25 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id D6436C6; Thu, 7 Nov 2024 17:04:24 +0000 (UTC) From: Bernd Schubert Date: Thu, 07 Nov 2024 18:03:59 +0100 Subject: [PATCH RFC v5 15/16] fuse: {io-uring} Prevent mount point hang on fuse-server termination Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241107-fuse-uring-for-6-10-rfc4-v5-15-e8660a991499@ddn.com> References: <20241107-fuse-uring-for-6-10-rfc4-v5-0-e8660a991499@ddn.com> In-Reply-To: <20241107-fuse-uring-for-6-10-rfc4-v5-0-e8660a991499@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1730999049; l=5408; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=qPjPlv+ALLWi2d1RcybZcXQ4moZV8H3KjAxZ8jqYrfY=; b=wdUEGYmxhJbr1XHg+aTQAMiYMsb7Qm7rbH28VP+TEgewB2R/fi2RgwQBAwAI1ax7QlayzNO1X GrsA787zCSOAiJCeJ6PKCa30Wm3QRy6GiOOvqpX2hA2aMzhNNH7ZMG9 X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001CC:EE_|SN7PR19MB4799:EE_ X-MS-Office365-Filtering-Correlation-Id: e9f1c937-b05d-406e-e137-08dcff4e3bec X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|1800799024|376014|7416014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?Hnj0i53bcGV59Al2XoCx32vO79qadv0?= =?utf-8?q?Lp/47S3sf8Q08q7If7kMg7UxYHVOyu4MAdTBSzuj0njNRSkO3R1tnP3r5bImTXrtD?= =?utf-8?q?p9QYW2wzU//Jc8yuyXxuLyBLb5YrsLLZOosQBTg5Ol34yRFOyoy9lhtPkdpXTAIBB?= =?utf-8?q?fN13KmESmFTLAkb5rENfoAaOwYZ0G1SoygC3jKGXosZXJ8xp4Csttp83+M+VarLvy?= =?utf-8?q?8z27zIfouU5QEHoImExX/tpb5IFHw+eFQJ/Dpl1sS6uMoy4VxhripaC/pdaCh/L7N?= =?utf-8?q?UfyRde+q9LmDTM2udtFpau2NHH39I/obVgM0v6IAAX6/yXktoRK8xjfcnk9jcAJa8?= =?utf-8?q?OT0l4WJ0WML5KggBcIURPFqeN4HmC+kDVQ/ou7TqGA4koH1fqO/TvY8wZVP6QQ2X1?= =?utf-8?q?D31d/hdGCURLSnXChE2FAmJIFnomUK5kp5C032YaX6Y7ettNgjdLHuioGb1LpzRhh?= =?utf-8?q?Wu9n5d86485bAcHK2ZhdJFKK+hXem3TR32n8laUdj5fXF/9CBwqgWJHo+ApfZ/nf7?= =?utf-8?q?KA/o28Lj2kS9Wo2rBBraQKREkctT5LocEoFfnWXqf6/smUXcSLECw6vkxR5V1IcWM?= =?utf-8?q?X+LP2GfapnA2HeWw3A82LvdHRSLrvhbgBkXl6jgd8spC7MrJvQitR2/7UPXmxO86Z?= =?utf-8?q?ZxQx7aR30VdQ1w27i6b3w5AQGDqtdJHwYsInhlj43vOCYx+kZI8ZdA3AFYZOEjZ7d?= =?utf-8?q?gDUUwgWAgxVjdmWiH/3qeX8giJvYOOdJzSL2lemZCXlLxYINi8F3D6gZg8DzqEPmS?= =?utf-8?q?HqU4CWhSlgeqSk+sTwSdJpw8Adgv68NB2f0Kgqk+HK4CCVLA+X5T+CUkfxCNoF7Wt?= =?utf-8?q?ejmKGnwT3QFKVU/SrnT43+e/xALFdjwKB4ceuiV39ERfV0t7AaIgwAGYZZtx+K3IE?= =?utf-8?q?VDfKcvHV4VJb+hPeJ0YcjA4imntnB9oaSBOxMQyygQxKWS9hscZG0FNIIUpucSKf0?= =?utf-8?q?vQYwPenDNGAu05m3LcCZuEZv0TyXse72REVpNekFj/C1TsJ9pV8ZkNofDAthAdHoF?= =?utf-8?q?X5i53c6Eh2yxFkMi7nKBnPrQcZGHhTpgQpMpb5j2zKPTA9gpFAo0hVtuMPatkx7cy?= =?utf-8?q?wcussTdU2k8y49fQT/Yv8kUOJ7GJ4gd7k+twNJsZUKKN7aN+3mslg4efH4DL5GrbI?= =?utf-8?q?suQbqaMfVLgUFkDg/Rb9YikZW7bGHuBPhHFL9n7xjYlnjDvjpSVS8r1Ti6GUCO0g8?= =?utf-8?q?ZllOMRJ/yCmcwXND3q8cNVUx6ED7hIUV4WlkhhJvHrJOLh53KSOh0i3hUzig6AwB7?= =?utf-8?q?VP0a8PK46cP6i3e+aGfteMwxyrGzwCgPjwoK5KI+L0x4eDgDyck/HmZwpBOitUnlX?= =?utf-8?q?rp8umSk1ICWBHV/ToB/DUHLkeUN+KpZpEg=3D=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(82310400026)(1800799024)(376014)(7416014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: CmRkf9+x7Cbw0DvztJ7V81IBo+3jhTGItwcDM2x23bmvUpP8/dFbhKPbIVSMHWQdHR066cUrvFV1N7P9wOv9NC7o+Zes5QGE+tMNlBjpAM8nhDZMWqr6aO6NCXxsfKKnTLcZK3wmIOOwok9jSOoUCD71S2EyxHLAYr6AR4MN9kflz/anwAkE6/b/feMw/06hlJuFGjo8G7qXKwfIq/yV9G6c7LRr65cZ/UmIzSpXf8vpDs540YSF/3dA5duwHHaC8975/1nRhq67OfjGfeU8vhchDOJhLOOgCt3qwtlR1Z1RKzEgYUZBwJu9VQD462IrhMnRokJKw304LNIZAjfNzbq+lQlLtR4p+T4aPs2MpiWPsdOh3e1THxOxeCcwtGWwU19faeJpxTnBkaZ6yqivfydgNg/cttDvUkAohlTyQOXvBbpezO8FNu+vuCRzSg/eoglZldecMmslRUT5xPzis07fRMAdomNVrpo6qSOBhuI/AZqdKBUleCHYV03cKsICvShOIoKeTcZZgPPG3/8DZM8FIEIy/tb5zZZJdeNV+aLjGwH6zNCmFlzTIHIj1I8VXKJEpZfKdizGZaCOhrQ3nj3Enwn0FwontUhWC1fjtFaAWbUBfHMxqPFUKreddgj/5LZGf6yBGCuF4CfWOacdPA== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 17:04:25.6429 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e9f1c937-b05d-406e-e137-08dcff4e3bec X-MS-Exchange-CrossTenant-Id: 753b6e26-6fd3-43e6-8248-3f1735d59bb4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=753b6e26-6fd3-43e6-8248-3f1735d59bb4;Ip=[50.222.100.11];Helo=[uww-mrp-01.datadirectnet.com] X-MS-Exchange-CrossTenant-AuthSource: SJ5PEPF000001CC.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR19MB4799 X-BESS-ID: 1730999069-110971-12661-5458-1 X-BESS-VER: 2019.1_20241029.2310 X-BESS-Apparent-Source-IP: 104.47.58.47 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVqZGJoZAVgZQ0CA10cQ8Mc0o2d zMLMXCJM0ixdjAwNgkzcjQNNXE1NhQqTYWAB8s6L9BAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260269 [from cloudscan20-239.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 When the fuse-server terminates while the fuse-client or kernel still has queued URING_CMDs, these commands retain references to the struct file used by the fuse connection. This prevents fuse_dev_release() from being invoked, resulting in a hung mount point. This patch addresses the issue by making queued URING_CMDs cancelable, allowing fuse_dev_release() to proceed as expected and preventing the mount point from hanging. Signed-off-by: Bernd Schubert --- fs/fuse/dev_uring.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 70 insertions(+), 6 deletions(-) diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index 6af515458695ccb2e32cc8c62c45471e6710c15f..b465da41c42c47eaf69f09bab1423061bc8fcc68 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -23,6 +23,7 @@ MODULE_PARM_DESC(enable_uring, struct fuse_uring_cmd_pdu { struct fuse_ring_ent *ring_ent; + struct fuse_ring_queue *queue; }; /* @@ -382,6 +383,61 @@ void fuse_uring_stop_queues(struct fuse_ring *ring) } } +/* + * Handle IO_URING_F_CANCEL, typically should come on daemon termination + */ +static void fuse_uring_cancel(struct io_uring_cmd *cmd, + unsigned int issue_flags, struct fuse_conn *fc) +{ + struct fuse_uring_cmd_pdu *pdu = (struct fuse_uring_cmd_pdu *)cmd->pdu; + struct fuse_ring_queue *queue = pdu->queue; + struct fuse_ring_ent *ent; + bool found = false; + bool need_cmd_done = false; + + spin_lock(&queue->lock); + + /* XXX: This is cumbersome for large queues. */ + list_for_each_entry(ent, &queue->ent_avail_queue, list) { + if (pdu->ring_ent == ent) { + found = true; + break; + } + } + + if (!found) { + pr_info("qid=%d Did not find ent=%p", queue->qid, ent); + spin_unlock(&queue->lock); + return; + } + + if (ent->state == FRRS_WAIT) { + ent->state = FRRS_USERSPACE; + list_move(&ent->list, &queue->ent_in_userspace); + need_cmd_done = true; + } + spin_unlock(&queue->lock); + + if (need_cmd_done) + io_uring_cmd_done(cmd, -ENOTCONN, 0, issue_flags); + + /* + * releasing the last entry should trigger fuse_dev_release() if + * the daemon was terminated + */ +} + +static void fuse_uring_prepare_cancel(struct io_uring_cmd *cmd, int issue_flags, + struct fuse_ring_ent *ring_ent) +{ + struct fuse_uring_cmd_pdu *pdu = (struct fuse_uring_cmd_pdu *)cmd->pdu; + + pdu->ring_ent = ring_ent; + pdu->queue = ring_ent->queue; + + io_uring_cmd_mark_cancelable(cmd, issue_flags); +} + /* * Checks for errors and stores it into the request */ @@ -606,7 +662,8 @@ static int fuse_uring_send_next_to_ring(struct fuse_ring_ent *ring_ent) * Put a ring request onto hold, it is no longer used for now. */ static void fuse_uring_ent_avail(struct fuse_ring_ent *ring_ent, - struct fuse_ring_queue *queue) + struct fuse_ring_queue *queue, + unsigned int issue_flags) __must_hold(&queue->lock) { struct fuse_ring *ring = queue->ring; @@ -626,6 +683,7 @@ static void fuse_uring_ent_avail(struct fuse_ring_ent *ring_ent, list_move(&ring_ent->list, &queue->ent_avail_queue); ring_ent->state = FRRS_WAIT; + fuse_uring_prepare_cancel(ring_ent->cmd, issue_flags, ring_ent); } /* Used to find the request on SQE commit */ @@ -729,7 +787,8 @@ static void fuse_uring_commit(struct fuse_ring_ent *ring_ent, * Get the next fuse req and send it */ static void fuse_uring_next_fuse_req(struct fuse_ring_ent *ring_ent, - struct fuse_ring_queue *queue) + struct fuse_ring_queue *queue, + unsigned int issue_flags) { int has_next, err; int prev_state = ring_ent->state; @@ -738,7 +797,7 @@ static void fuse_uring_next_fuse_req(struct fuse_ring_ent *ring_ent, spin_lock(&queue->lock); has_next = fuse_uring_ent_assign_req(ring_ent); if (!has_next) { - fuse_uring_ent_avail(ring_ent, queue); + fuse_uring_ent_avail(ring_ent, queue, issue_flags); spin_unlock(&queue->lock); break; /* no request left */ } @@ -813,7 +872,7 @@ static int fuse_uring_commit_fetch(struct io_uring_cmd *cmd, int issue_flags, * and fetching is done in one step vs legacy fuse, which has separated * read (fetch request) and write (commit result). */ - fuse_uring_next_fuse_req(ring_ent, queue); + fuse_uring_next_fuse_req(ring_ent, queue, issue_flags); return 0; } @@ -853,7 +912,7 @@ static void _fuse_uring_fetch(struct fuse_ring_ent *ring_ent, struct fuse_ring *ring = queue->ring; spin_lock(&queue->lock); - fuse_uring_ent_avail(ring_ent, queue); + fuse_uring_ent_avail(ring_ent, queue, issue_flags); ring_ent->cmd = cmd; spin_unlock(&queue->lock); @@ -1021,6 +1080,11 @@ int fuse_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags) if (fc->aborted) goto out; + if ((unlikely(issue_flags & IO_URING_F_CANCEL))) { + fuse_uring_cancel(cmd, issue_flags, fc); + return 0; + } + switch (cmd_op) { case FUSE_URING_REQ_FETCH: err = fuse_uring_fetch(cmd, issue_flags, fc); @@ -1080,7 +1144,7 @@ fuse_uring_send_req_in_task(struct io_uring_cmd *cmd, return; err: - fuse_uring_next_fuse_req(ring_ent, queue); + fuse_uring_next_fuse_req(ring_ent, queue, issue_flags); } /* queue a fuse request and send it if a ring entry is available */ From patchwork Thu Nov 7 17:04:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13866750 Received: from outbound-ip168b.ess.barracuda.com (outbound-ip168b.ess.barracuda.com [209.222.82.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 522BE216A15; Thu, 7 Nov 2024 17:04:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=209.222.82.102 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730999083; cv=fail; b=qdpR8qg9lrwOrQ/H9851I/BPaHquMq55e02ksgGyZTpurHLgqNA7UuyZXuUrq8muFL7hw1FgfVKeGTwOKcoSl6DLd3b/TTCIZuJyd5W1ibZo4fj+BwikSQkeHbvwxOGRKz0s0xa9V70phrTloRF2mpXKDHTQx0sOmsc4WLf8tIc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730999083; c=relaxed/simple; bh=jKm4kFdU3Tezi0StqAjPcOzsAyE8qzZlYpZuvcYeiH4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZYNihAKWbq4wCxb85mhuRqKFe1qzhMdOZlNdGfARMcaoceojVGpiY/uod8pV4jR6NNpn8qYcda+PaqU/IWwMyxQbnqTOCprD8HRbfNSz1HSvXANyoMLEbtdR5kCC/MO8Oo+LWLR/pMJ3R9DFqoDM/SZ2oWoUfVtTy5N1FIgo8DU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com; spf=pass smtp.mailfrom=ddn.com; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b=KSUctOe9; arc=fail smtp.client-ip=209.222.82.102 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ddn.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b="KSUctOe9" Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2173.outbound.protection.outlook.com [104.47.59.173]) by mx-outbound16-173.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 07 Nov 2024 17:04:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lydtX+dkOFDZj0FWI93tESCnCAbHNfuGUCuoEPJi+VpXIJZFo3Os8bYU8GqyoLtH9YmAEYyobOZgOUVJWNXTJBj5aJpe8AIuFO32K14W13RlFqPmqKHptki081etDv90Xix2vzKSZvi5SpJdrTQg9utNNxqTI7T3D26kQrAvgS633BDMRXs9K4bT0tsmklx64EjTnTMegwd4BK5Mo+E2MHYJcH7EUZRIrEIKFMzyh1lAkzfv0LKV2lR3noor1ghMk5PCDGSJXh4L62FrE/3TPKgQhHi0D3/kfe4Qf2u5VXdaw+5F7u6+eF1ddvR8RK9YvKkwMGHAWFO9F6aSooHfPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=T30O5KHmapOuYwSuCcKCgLAgQIV7XE97QiyqOtVMWcI=; b=KlIH+hVKV6CO518nQ+Q+OkgBF/Ny/zADDR77GWmcC4BPzj+VOgBxSEgRcunpJx0DtoLu3D0jmP3zXMKxRKL1uLudeueZ0+CXnEjBVSWwiTEYWIcnPO97Wfcgqe8PeNvkFlryWpxB/URG4AJbx7xsMOaqZZ7wZ2yKA52YCUdGwRgW3y6ld74bSay+bqDD77ZZgfs7nkq0e46DV7coNfxQ9SIcd41LpZe5UUcc1Y8AAXUz39kjggRnfouMuH+il/dRxj5bfbPrqn4PSVca+UqLIzJBhPUHPVuFK/X4tv/mvR0FEeyrjXQretWWUmnDjJNm9/rP4lM8T27npyMLs/xdoQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=bsbernd.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=T30O5KHmapOuYwSuCcKCgLAgQIV7XE97QiyqOtVMWcI=; b=KSUctOe9MVgRjxF3LfgnCOnlx3/34uWEVtaPNZO58q9hK0ll1SUn0kF/wvcy7BxgolSpokK4qGA18YHfpY2MDc9TUK2VQIMP/gtXtrf0mUu3HwqcCAAs2GeIEkg7WuNQUM8JjNV6oSVdfbrdaa9BSh6D/9CYzFZKFGXAA5rZvDs= Received: from BYAPR11CA0070.namprd11.prod.outlook.com (2603:10b6:a03:80::47) by CH3PR19MB7905.namprd19.prod.outlook.com (2603:10b6:610:155::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.18; Thu, 7 Nov 2024 17:04:27 +0000 Received: from SJ5PEPF000001CA.namprd05.prod.outlook.com (2603:10b6:a03:80:cafe::56) by BYAPR11CA0070.outlook.office365.com (2603:10b6:a03:80::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.18 via Frontend Transport; Thu, 7 Nov 2024 17:04:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by SJ5PEPF000001CA.mail.protection.outlook.com (10.167.242.39) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8137.17 via Frontend Transport; Thu, 7 Nov 2024 17:04:26 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id CDF2D121; Thu, 7 Nov 2024 17:04:25 +0000 (UTC) From: Bernd Schubert Date: Thu, 07 Nov 2024 18:04:00 +0100 Subject: [PATCH RFC v5 16/16] fuse: enable fuse-over-io-uring Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241107-fuse-uring-for-6-10-rfc4-v5-16-e8660a991499@ddn.com> References: <20241107-fuse-uring-for-6-10-rfc4-v5-0-e8660a991499@ddn.com> In-Reply-To: <20241107-fuse-uring-for-6-10-rfc4-v5-0-e8660a991499@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1730999049; l=828; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=jKm4kFdU3Tezi0StqAjPcOzsAyE8qzZlYpZuvcYeiH4=; b=U4crFgrXTlvp5HvayLFG7IvTG9rO6ywbdsEpLQKmy6oXqMxhtVfTvcxGw5Oxt1jxItVjpF9LN /CVg7ZutoPyD92ksxA/tYtQfDXOUMMP69cd04LeUIUuVZaUol6LL1kK X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001CA:EE_|CH3PR19MB7905:EE_ X-MS-Office365-Filtering-Correlation-Id: 02e91e8c-2ccc-46f5-54a8-08dcff4e3c77 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|82310400026|36860700013|7416014|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?vKqf1/9li/43zm+fB0oBX5k5UYQpw8L?= =?utf-8?q?PWpAARugmzZmP62eoLdYSRpeHlc+tPWakYkSTUkmL1AF0ZDaxqwNo1cAtLXanZKxu?= =?utf-8?q?O6o33Oo5D+12PchWo5/m1UXP3GuLsL3zuu1rj0ULKPcRyRY1uo+Ae3+an1sh5te3h?= =?utf-8?q?Pbg+SBtVwsUUnOB6z14dUcmuFYShqZSyxaUs/x2RscmPBOgLxM6kFph/eGCxw9pAZ?= =?utf-8?q?eSSKl4xjQ7JVdPOTlCQ2lmIPDyiFwO0Q/bQuv3hP9DZssgC7VORYlQQb7NKwqPIRx?= =?utf-8?q?H/FKIqw3Odk9BdJj2o3q52SC78yvagEojVUtb3B1kBU4/3eRbRs0c4Xu8tV2dGDoV?= =?utf-8?q?hdDwTCUu/CeOoVeUtNyEC+z79VOJ0ywEbrwXIV3my/tYbxUksHji4KKmo0a1T1Kwk?= =?utf-8?q?76y4ABwSJXfjGqRHVNiufzt8Agh47hJxSUMElOwHQPrMXQoRkCiJ68V+duqi+EpU7?= =?utf-8?q?G0aTOqQvlX8O5mPSweLzCj0JNdJhPwh38LdFAj2lTsUH/9gOoBdIuief5qB0dgsKi?= =?utf-8?q?c1eLlKkpiAGgb/Hh6SslU28umd9uOVmd6Ziar2+uH/jwj7HghPEmsxdDyzc1+78YW?= =?utf-8?q?IyBBmRrLUWE5IWDWWcBaAPz6vbru7Owf7O7VmUDfzTOkCOonhBByWG0oVOhKBBvaS?= =?utf-8?q?M+aGMlHU9bYRl29FUPPq8x56z7Tw6TOPJvDTsOlRpV72ES8QOHhq8K65HZ/hgOMd4?= =?utf-8?q?gVQWEqtdYPyE1iftgufYL06bP3E8+bE72JbYaIRwLD4aZn8XiueEQ3zJS9qP5xxek?= =?utf-8?q?3eLJmvAJ2xcdZF5OqcIuxun8TvUqfPO26OtMcZxE6JBil8W9Iv2ujl8NSZXCtT2uQ?= =?utf-8?q?zwqZDzeCnofPRBogpBSkNUWRyyPuQylzhXM+dMJPSfdFrr7C/gXPAv69UwwBUt9Tn?= =?utf-8?q?aMrzoI+cQTtdaDPlAu9gXgQWLjML9y0uFRb/vOxILyw0cxjWb8i1SL+ZtgjHbdjXT?= =?utf-8?q?cb5FywRMhvM3X6pn4d79HdMMoNzuRr7/GopE7E8PqLK8R9aOGFiEnKu/DzWWVkS/Z?= =?utf-8?q?G+aXzGSW2CvE9NXA6hCfBfExKJMrRqJE2DOrcgdYdWihkMwhCQ+9vODBv+a4/MYjp?= =?utf-8?q?7pJpeV76EmH0sR6JolhLfzOGQxdPqndm8376GFYl/XlZnFFji/hvoNunYFI5SoJmn?= =?utf-8?q?u82okJcjN1sEnHiSMmP61MeIWkJzxzyUbHxUKybCJuX86Xj2IByg2BP6y0qr+23nB?= =?utf-8?q?3lr0R5j6ERAVixIro/RbXt4T9ILHpX9nd0lYxbgotAg0yLWlJFUxrIm3kWVtIyspD?= =?utf-8?q?JRbCurV5GEm5mxqoBx6ZbFnL7Yf2uGvhSkK/VYbo/31ReSXLV+zv77BS6PVXFTKZO?= =?utf-8?q?Odvk2BT+EGZLsVV/GSPVZV6lOmeS1yQV0A=3D=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(82310400026)(36860700013)(7416014)(376014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 2FWEAK43CapPaiQASyh+tgO6mh7JbgjZeFYk76ZRL0WZJf6RhN8T+6TTWDUkmwAKLQAVu2IvkVhxYt6YeAGRDMv7Pq8ItqYZoBH4tJpVylwGej8B89vlglNT/6Jbtx+dkXqeGjnNjM94zKqTNGsATnjXT4+AuEuyRq1QUEpCfcocuskH6LZ6jfeGQVkTVoe+IRU+b+1AsTcKT87ex+2bU/K1fgJkOrDRqgIVF/C81MzIO4USk9wYQ+2ZzDUKhhwgNLs91wvKOT+K2Fz73MIX2TFgnAOlrrCDUcn5n4MfV/uWr9oaOQxSmayEHSQq1JWNSMgJiLHGD36lvGn/M4aK/lInGtMDTePPBtFyvGhvTwM1pvS2AabKA6LyeqPGb09K8mc7rL0cAgcP8HsAxD2z1VSYyih/dGOYT2MTA3Nv92Z/RPUBJyzvydRLiikRER3P8XQjtVgCfJMvnUrbkxQoFDyBUMZfzKUZgh9Vg8xHxVx0FJZeTAKfIVe7w1TaYOnS7Qp1g1bVzS5ffzj0ipuDLAefW7mH3IgJsdF38u7IEC/QKueek3m2LncwgqtlEMsIIarmw0m9sojqUWxCO1QB5xpDmd691ho/m8sXgAb9DndWvFVb2sh0C36U2cgK1r0YNThACGEiwAkY4CugFrsl2g== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 17:04:26.5815 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 02e91e8c-2ccc-46f5-54a8-08dcff4e3c77 X-MS-Exchange-CrossTenant-Id: 753b6e26-6fd3-43e6-8248-3f1735d59bb4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=753b6e26-6fd3-43e6-8248-3f1735d59bb4;Ip=[50.222.100.11];Helo=[uww-mrp-01.datadirectnet.com] X-MS-Exchange-CrossTenant-AuthSource: SJ5PEPF000001CA.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR19MB7905 X-BESS-ID: 1730999074-104269-31157-18924-1 X-BESS-VER: 2019.1_20241029.2310 X-BESS-Apparent-Source-IP: 104.47.59.173 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVhYGRkBGBlDMwjAxxdQi0Tw50c Qk0TLNMs3AIs0sMS0tzcAoLTnRLFWpNhYAQx2E80AAAAA= X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260269 [from cloudscan15-150.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 All required parts are handled now, fuse-io-uring can be enabled. Signed-off-by: Bernd Schubert --- fs/fuse/dev_uring.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index b465da41c42c47eaf69f09bab1423061bc8fcc68..2ee7d5ba260bc4b54927af1a856dabcf7d725edb 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -1056,11 +1056,6 @@ int fuse_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags) u32 cmd_op = cmd->cmd_op; int err = 0; - /* Disabled for now, especially as teardown is not implemented yet */ - err = -EOPNOTSUPP; - pr_info_ratelimited("fuse-io-uring is not enabled yet\n"); - goto out; - pr_devel("%s:%d received: cmd op %d\n", __func__, __LINE__, cmd_op); err = -EOPNOTSUPP;