From patchwork Tue Jan 7 00:25:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13927918 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 476DF1CF96 for ; Tue, 7 Jan 2025 00:25: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=1736209534; cv=fail; b=BBigKuO/+t2pJ6jHnAcOdDARc4QDBaP2Z2b2FS1YHMCWiD/MwBVgqmalVRgvbhwlwLMu5wNEvArXiGMTcwJwvgldBrDRh8TSS0p3y3h4PIbwUa+eT68q9CiQnxqWldH14ZRUmv4izR/Y6ZmlL3VBjACOt+vE/oeTQZZz2KPq5Z0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736209534; c=relaxed/simple; bh=M3GcQWwOaa8BbwZh7SUIGaTx+lkvQ0F1YCuEjX2dKV0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=L6a56k0Tk6PGesQQAKDPI8Dpv6HOCmB27g1SUQioccAUJOE13+bgpyUoJuVwIhZBWROz2gUQ+lrVGV6rYuE6jOLbJEId7LeyOUJW0bX1C7Uw2CFPbV+LTK8ZbTyamYS+HJ885R1oqmwFoq8dktQLAvbxoPm5t2aGYbUJGoORfAw= 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=HXwzjhI0; 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="HXwzjhI0" Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2174.outbound.protection.outlook.com [104.47.57.174]) by mx-outbound47-153.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 07 Jan 2025 00:25:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lHY4M/6vra0mdNCp8WRFB8KylsrVffvdcDfjg7OXRyevx01OKfSKTWgPg2BcA0YEPmHegF68KxPUXgYIO1ONn2kAxrWJ4eFrQHGi4Hyy3DYjcrgG97cwijeOwZnR0sqwCaAXJO+FD2jJ61yDK/rxzVH5MFcHpVC6TPLTjp4J9zqEX9MfFkzMuZWDK4nxt9hkGGthVp+DX3J9S7HjLV3jkwIfb/XNNyY+e5q6EsD/Bt55UT8zEVtw2tQUbyWP40HflwlnxqzBIt3DV72riU0iVVTfMf3w1j3PfE6a+53ZuM4lf36wgLlw6Ev2NtKr+RSwJdiA9io0rjCNZJTeIzdAhQ== 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=OHfDcEdVZVOJHvupseE7n5zjDtvZEF9X34YNo8Rsf3U=; b=U5m8Yy2+RrZiEeQUOp+yDsyw1NrRK1EpX/ky0oJlfx7JfhN0i1nXuKf53uo1ot9RVtWRbaNwmHU+vTr8gmwFiSRv4ayV2arH/TdTgosl84yVvk0XDKiOdUJbxuAJKvvwUwfAJGY6sQDR1Icx7r+2vvq+jx0XjaQg5lzuHpU9x7yt3sCuGuZ03RyMOfWhG7gOBSdzECMVC0uTnaJvCtmNLLLvFYRnK6Yl+UbCUiN9BnBKCUgWalX+Us8FNL4TAP9yyl5qv8582I1fe+tHWVH57B1iyUaq5REYo/QAKMh6B3NgJShR7TTd6wHa9vefafjEXh/DergvQm7uJxobJem4eg== 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=OHfDcEdVZVOJHvupseE7n5zjDtvZEF9X34YNo8Rsf3U=; b=HXwzjhI0wkwzMWeeWejyVEvNvU0hgnI0oKO7jlYhDY4VGCJeg9T27eS779GH4COtDqc3wDpi9SK+WW+d8mW8mUJhJlWj8I9e/ct6TxNOw2nquJGQKWK0WCVp5nKSuWn9fFrSXhPHtSqb7rduUo21V/WKV7B9TGxF1npbiq78OM0= Received: from MW3PR06CA0021.namprd06.prod.outlook.com (2603:10b6:303:2a::26) by MN2PR19MB3824.namprd19.prod.outlook.com (2603:10b6:208:1e6::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.17; Tue, 7 Jan 2025 00:25:13 +0000 Received: from SJ5PEPF000001EB.namprd05.prod.outlook.com (2603:10b6:303:2a:cafe::9f) by MW3PR06CA0021.outlook.office365.com (2603:10b6:303:2a::26) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8314.17 via Frontend Transport; Tue, 7 Jan 2025 00:25: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 SJ5PEPF000001EB.mail.protection.outlook.com (10.167.242.199) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8335.7 via Frontend Transport; Tue, 7 Jan 2025 00:25:11 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 564AB55; Tue, 7 Jan 2025 00:25:11 +0000 (UTC) From: Bernd Schubert Date: Tue, 07 Jan 2025 01:25:06 +0100 Subject: [PATCH v9 01/17] 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: <20250107-fuse-uring-for-6-10-rfc4-v9-1-9c786f9a7a9d@ddn.com> References: <20250107-fuse-uring-for-6-10-rfc4-v9-0-9c786f9a7a9d@ddn.com> In-Reply-To: <20250107-fuse-uring-for-6-10-rfc4-v9-0-9c786f9a7a9d@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=1736209509; l=2781; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=M3GcQWwOaa8BbwZh7SUIGaTx+lkvQ0F1YCuEjX2dKV0=; b=/TcddYdapSGIvwvi26FQV53HSeaAFbuQX7b58z06Bi3e9BFCdW3mDLI9euem4zeV4oCKfSL2Q 5iCnc/i3FjMDSYwflfxyp1fe61lRjnpk5Fw0XyHoHQwTRNbypvMvVeT X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001EB:EE_|MN2PR19MB3824:EE_ X-MS-Office365-Filtering-Correlation-Id: a8d650d0-e1fb-49dc-657a-08dd2eb1bfee X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|1800799024|82310400026|7416014|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?WDFLyH51HVZ1XZ3a95tZ2m06JDZF6D5?= =?utf-8?q?easUF3Spk0TWbXNxpkkfCWmy7NWGmm6WGg4lMu5/ReBetK225vTjHierHornzHjk6?= =?utf-8?q?cutG/H/dqbrcPKgoqmhbHaZ7PUChRzUOFxJ2HwT9H2lcp+VjM4ISHcgHxlXfW1KKa?= =?utf-8?q?f795yaF9IRUCm54XvykPeWPiD/bhsxLA32uFZvX2lhJz1za79JeYsYoHI5ooGWZYb?= =?utf-8?q?j9Dg2rd4lqhXPeUYNTmdO3jmc9UAuUx9rsLHAPzhTEPe02qFL98zcvFkWoajURoml?= =?utf-8?q?9TbMfeMHuSrFa3Xi+mDjYIl/4IppXC5/4bw2MJRCti/JRzUOxRdzoD44MaJhVd8TS?= =?utf-8?q?bxmM2y6+ibNKOoC1sd/RVLz0oAcxq2HOYihZ5/pqyHZrE9jUSFJH0aExQW9fFvkJT?= =?utf-8?q?oKAoAosyNohD1HBjp2CoqbdqxulPIlTliaNTA6BMlq6D7xMYY93exO1AkgSRtOo7x?= =?utf-8?q?JwEJPVoyAPgv9fxLdvRpxY1nwTHAj2T4rqw0qwaEK4z8cMXtoNuwEoMm8bljBCkJv?= =?utf-8?q?yo/GZlmKOMq0IHtOIxx7MVfb/QX3vbQxMCxFz/XTUg3NS4/L3xuRb2so9GJC1BISC?= =?utf-8?q?IUX8+P/rzjGxZws0KkqCLXNVP67CtLKp+6fy8gf3IJ4lmdnLkBne5VrJU6IA16LZv?= =?utf-8?q?eQtuOE8WCwKZEl2wLNWN2O/3kf/55vQRlXuSUwT+ZOXZFUPhhQr4LUkngzVwu3GKU?= =?utf-8?q?Lr5ClEPJKjiiXVhfbCZfUcqEYHNZFKFFx5DxGidQEbwPyNHCrWzi2Kz6RsTOnhgSj?= =?utf-8?q?XPvI0AyNRtnvQh2bxu+OoL8yuF8eMDuvykuftu1vo5Tggtghgk6+01C8DkHVtHoDL?= =?utf-8?q?wK/Np/YeOogGKz9yPbbBylFHrbpgBNdWpAze5M681h/+rS8Cz86n9kWn6AZyh9qya?= =?utf-8?q?jjTzluIang3ADTrIjf49gyyabQkrj+kDFRxNaid66dAX5ueJfoW8TbDHISQ7Nr0MB?= =?utf-8?q?TXFpg8rSNGgj8zKXJG7+TSrrgUi1zOf2hEoNNUpsd0Ve/2j+WMLnweA5cfWM8tqZS?= =?utf-8?q?MYI5bpg+VU9LRXqJLdOCaG+4GTT1eTg9eTVgEOujB/O9V+LKeoWDs6o+EMJX+QeLw?= =?utf-8?q?Ak2UCV3tl7nXLiC0x+dYV+2QzjqzMh5Fbf5Yklxj5i98IS4U70XrGjatr4fbohitj?= =?utf-8?q?iajzR7I+1SI+l3TX80ZlC49YMP7CaK4fVzGk0yeAyGlshqiSTLsINJAjEPB6k8C6R?= =?utf-8?q?bSpNHLLJNXvqCbcdPfkK/rjX70fKHGNXOlvgle+hN5ZWUKAMl2WSRVwlfMHeblEUR?= =?utf-8?q?SX7a6ZWyZXVuYbxvjVk1LAARAsKo7cbwQGv8Zwp3XdDAFFNk6k39+kL1+Ho8j+zfR?= =?utf-8?q?za9G1913vYYKbL63C1VOWrQTWjDKmjiEg130Jva7/ajN8EaHZKVPid2HGY9RrwQ9T?= =?utf-8?q?dshIvf+JfBd/ZSP7SxlmP1Viw46eWpbLA=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)(1800799024)(82310400026)(7416014)(376014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: EHmlyMXwR67kMHVrC1wSdxTgYnjvyMW6qsqc3uFnE+Q8WHu4weMib4rRM25nI0a86KegGKulIlnWWdWOEfYHDfnT7hoCE8j1BcMWIPAUQSt7TSB8B5JN5wuRuuW1bcmbK3NJgdZ8BpBYeDBr9IbKOLnmBlMmEyOkXAykFJMvN1nFfXTk4zcb3bJECIG5O0J45a9rBH9yLxTIcRJ1IW222db+jRXUec5mQ4uZBDn/U7subCIAXHCIIQf9ExOjsg+m1bD/qpAvZ7RK4cAsRBb0eyTLfxNUrM+6cv58fq8AGHhys5N6CkP2kDXrj3CQCzj63tWz/IQSqUoUpey3XCfaiQoXViRqBO0JCd7N5IFXCq+EHRLcLwCaglbbqkpVb7RbU8gUKgSwecSAkt6+VFNPSEEemxTW33J4llYwL38y1VR7RireT6Rmn+CRMEZmpFsG3XMSHAIsS45qrAdRhS+ZMVAbPv5x9lsRZZ4IOIkeH5/FQFz6SC3SX2rdzgm1NC89Mex8SHVkPwuaub6UiS6Vpjil4bTyGW5cEhX/H9EoEomUM4PRCAkZAg1inlOP40eDxGkEhy9dMwV0uLoZGpSRqK2MT4A9BiOoe4ljrEtMthjmyrii0QUTnhJI/0ZCf4/IMRvSjWKPxi1s3t5ckuL1ig== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2025 00:25:11.9545 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a8d650d0-e1fb-49dc-657a-08dd2eb1bfee 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: SJ5PEPF000001EB.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR19MB3824 X-BESS-ID: 1736209520-112185-13541-25340-1 X-BESS-VER: 2019.1_20241219.1759 X-BESS-Apparent-Source-IP: 104.47.57.174 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVkZmlgZAVgZQ0CjJLNncItHAwC Q5ydLcNM0wzczYJMXIOCUxKck42SBJqTYWANiVMFtBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.261635 [from cloudscan12-33.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 Reviewed-by: Joanne Koong --- fs/fuse/dev.c | 11 +++++------ fs/fuse/fuse_dev_i.h | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 27ccae63495d14ea339aa6c8da63d0ac44fc8885..757f2c797d68aa217c0e120f6f16e4a24808ecae 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 @@ -34,8 +35,6 @@ MODULE_ALIAS("devname:fuse"); static struct kmem_cache *fuse_req_cachep; -static void end_requests(struct list_head *head); - static struct fuse_dev *fuse_get_dev(struct file *file) { /* @@ -1885,7 +1884,7 @@ static void fuse_resend(struct fuse_conn *fc) spin_unlock(&fiq->lock); list_for_each_entry(req, &to_queue, list) clear_bit(FR_PENDING, &req->flags); - end_requests(&to_queue); + fuse_dev_end_requests(&to_queue); return; } /* iq and pq requests are both oldest to newest */ @@ -2204,7 +2203,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; @@ -2307,7 +2306,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); } @@ -2337,7 +2336,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..4fcff2223fa60fbfb844a3f8e1252a523c4c01af --- /dev/null +++ b/fs/fuse/fuse_dev_i.h @@ -0,0 +1,14 @@ +/* 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 Tue Jan 7 00:25:07 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13927921 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 49DB2208AD for ; Tue, 7 Jan 2025 00:25:31 +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=1736209535; cv=fail; b=k0Kxh6hesaFSIOb6UTrLpZch8th+2TFdOCoSkaksY6KJHzLlJbiha8D/nmZiVfEuiTnW5kOSzmdOfc7vrz6OId0BmlDU/48eOV3SlZBzsf85DObQ4wd1GIUeT5YnxlcsI3KM6MAR12wsRh61CgyeIciHIB6IlMVxsYGOgmGbJNU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736209535; c=relaxed/simple; bh=wxYO2fuIGkvqmeC9PNGhH5rOX2Wls8HlW08RzezL2Zw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=f0xN2EUlSfXlkDhCjnuuIFz0BODwlKR4bpn99fTRVvVq6Rn8G6Z8pnZli9zVRyPRmy+MabZa138EdGT+XtaSj0W6Ll9dDU/SdfXn6HWUMwcmuwREe4K3zZVU31wjisQXF8tOKygz/KLN/lp/sllj2NGJQKGcLIg93Ie1Mw9T4hk= 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=B8wZzpRX; 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="B8wZzpRX" Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2044.outbound.protection.outlook.com [104.47.56.44]) 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); Tue, 07 Jan 2025 00:25:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=VDy4x79QSxc5m71YtODBNQQnqrTCxw5a4QYiVsjuperHjPmjZykhMOEHIXtNs+fIB4/RYmH318vYnAvEqh7uls+CoDduOf1e5zCVp61KsPmXBPyGTComlOG/FQ7C46bmt6lBpGpI8tubZdDOe89V00+x2Vg7ne7ShbxX37tLYmeI/g978lLiPxO2TEPaWY+tx5OgOFJjw9zW2hofYJGnGCfnaE0+2RjYq/vDnA9UGkE8QrlbY/cEJD22apNgYyalbeyMiiHaYCAXHSh4ee6OqpSHur6c1pSHHBqtMK5I4BnuBOmEWXwI7iiEdiG+NOsW0IB96Uh1PaXit9/FPr3zQg== 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=hAgBjLWkV7oHdA35f4ET93Ocl3k2rLGZEn+8xfR4iOY=; b=sRYqBFbWa7NLUd5m0/BMfZhPt1E/j0hRYiXaO9NKcMCgTg5Pd8KrnEkCrEroIw5nQcs82dwRj5DfCiTJ8ju9AzXwW25x0icPPUWOxEe7DytjA6itUHDJNPZTz6hKZktHyMVjfyJZkegMKeecIacJ8lAk7ppv6mX6DzKstWgnU4biAPt7kCZwQ5bMn3/dWMnhB2uTgFzPH3JhRZr0/BeGKQz0UPYvKDHm9xE6ZXNi4ZeiNf4DBWTohlfMG3SqtCv7wiWiXCAMNEcpec8NhWhS5DXGoW1OTxn0tBPyC1TiR2ZryRIIfS+I8LaeLV+KOTurHHqc/+CvIXuynDVIevvqvA== 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=hAgBjLWkV7oHdA35f4ET93Ocl3k2rLGZEn+8xfR4iOY=; b=B8wZzpRXZJsxrFqO193Ts2ZjSrnSryTLJ2abvlnmIIAYic/0zoUETpJFECKEeV5w3HCDnXq04D9ze9qSR5nUsQthIGKTzojPaPlWAtZgukxogxnBGa8nmW8XBpWAeHBB/gbJyGMEQDy0dUgVYASCC1aUEqKBYQuFmsyd4sTs14E= Received: from SJ0PR03CA0266.namprd03.prod.outlook.com (2603:10b6:a03:3a0::31) by DS7PR19MB6071.namprd19.prod.outlook.com (2603:10b6:8:82::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.17; Tue, 7 Jan 2025 00:25:13 +0000 Received: from CO1PEPF000044F4.namprd05.prod.outlook.com (2603:10b6:a03:3a0:cafe::79) by SJ0PR03CA0266.outlook.office365.com (2603:10b6:a03:3a0::31) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8314.17 via Frontend Transport; Tue, 7 Jan 2025 00:25: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 CO1PEPF000044F4.mail.protection.outlook.com (10.167.241.74) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8335.7 via Frontend Transport; Tue, 7 Jan 2025 00:25:12 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 4FB3B1DA; Tue, 7 Jan 2025 00:25:12 +0000 (UTC) From: Bernd Schubert Date: Tue, 07 Jan 2025 01:25:07 +0100 Subject: [PATCH v9 02/17] 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: <20250107-fuse-uring-for-6-10-rfc4-v9-2-9c786f9a7a9d@ddn.com> References: <20250107-fuse-uring-for-6-10-rfc4-v9-0-9c786f9a7a9d@ddn.com> In-Reply-To: <20250107-fuse-uring-for-6-10-rfc4-v9-0-9c786f9a7a9d@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=1736209509; l=1631; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=wxYO2fuIGkvqmeC9PNGhH5rOX2Wls8HlW08RzezL2Zw=; b=B1IReqKRpfmf+1+csct4gaCWVicvG8oa01GHiOYfZkxMRKYayyYTG6qfyRRZEXxQx0LpfHdWQ RZsjf0YyfryArZoAKZrw9uWvN36wUREgLU1JzUp5ErODl3lKETRZToV X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044F4:EE_|DS7PR19MB6071:EE_ X-MS-Office365-Filtering-Correlation-Id: 89319898-9d80-408c-68c8-08dd2eb1c084 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|7416014|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?utf-8?q?k9qLLsEDEvNGWkxb31OxrdkVX1QHByT?= =?utf-8?q?FU4UkFlHKOKvp8PbogszpZOwKp8hCs8sG+PjpqlB+EF6eGYI6Gi5/B9uuRc1MbMPW?= =?utf-8?q?dg/bPr/NLokvm4hvwsAdLfmDZCo4Caa49CXMh6W4VKusGyycuCAAkHJrzOeisb5e6?= =?utf-8?q?URATG46U6d8al0O2RiFiVz654OhXkey9U3Y/I4Ri8h8MGg3AVb4fVPBLqWf3lblvA?= =?utf-8?q?NI6XMMifxmIMRdn5Vg0xcnbi7UeHQuvtyG1QT4+6C3RwPRhgut2eNAqWm9EG2wZ1W?= =?utf-8?q?YhPmZXFUjE0Fgv3VUrr0qthdmFvW7EldOeEgOmIx01j1/dDlKCb/6CGf9wLc+BlO8?= =?utf-8?q?jhLkLGjytIjrRyPSsLoRV9qb/CkEvPTv2lWD7E7CqBUUYSc12GDgEOgFZz36YADle?= =?utf-8?q?XKc6AN5qQnGeZ/0v8KMxGr/45/wkQ4bkDifpsTipVtRSIA3u/CLcklfMf6wltZ2VO?= =?utf-8?q?aDLN+kCibr4usu3cbBrkksfeyFYdLKQDpUB0PbwhPPP+fI5nW+60t4gYx7TZSunm6?= =?utf-8?q?B1fvTrBRRnWdhA8DIbtBAHnHLIYNWZgrPa1T6WGaRye+rnGxN4jOxE+TVH+alJpVp?= =?utf-8?q?h+Hw3GYqmfERyrI1s7aOycYBZyTmKeP3X6/M2n/SaTqLj9d78asEPAfB+j4govPS2?= =?utf-8?q?sil7tShN2jOT/ckGui34zlea7nkKmlAyeCp/hTK+xpdAHdFcqwugk4gUQwL3ec4IA?= =?utf-8?q?fnFRtFxec1BAsn/W0997E5lHYKbch93eCV4B5ol7wqOL/6qfs0B5dKbXtcDGz5i6Y?= =?utf-8?q?5/7BSTff4bdKu9RGy0xp2yhe99R2UJL0iX5SDex//91eZZuAQCwDwcGel6Pg9VZCw?= =?utf-8?q?hW6QeQpqChdfUQUoZkDwdZf+kYEBepLoy43+sdApIGZiHypvKMEyaz2cOqQvMSUMI?= =?utf-8?q?WCTIDLDuaaFlGXa3yXE/Z6QJXk5a0gBZJWmgVUqHlFoiNDSOt+reDkPxrIm2/6fLm?= =?utf-8?q?9+sLuVtWIT44wDUB/muJmcRzr6vHEoO9K1fOTa0GAKBVHx6e1qv27pzQxZdIjOHNl?= =?utf-8?q?U2hENH4r5UQvKdf80bZ7lUWkLiwC/lViPwYNrZaU3bSb8nkGdFjjPUfmJ3fzk3oLb?= =?utf-8?q?G6KDRVdvaSEJGXYqGYJlWnGAC53BUsPwQsVmQz9a2USN5ytpspQOI41sfsO38WBgE?= =?utf-8?q?KjMrrNuFGM30irm538WHP5VGvHCuP0pCJEhE9ouKtQF7X9JflKmMloHvOcPA6orbd?= =?utf-8?q?bRX2Qffx0FwRWceORkrWyEsKjZmyA3CFSxb/Y7PQ6u9vT6Z8Yq+fGPBdO4p6P306Z?= =?utf-8?q?xVP1xaxgEakYj7YWEYqaz0v7rZ1wXVDPfXtMfKT3EecuWsI/1A7qexUIMefFap4dO?= =?utf-8?q?PM9l8lBm/udly3MhvDsX6AnhNnc6kZcEHvZvlEqu0jjJUcP7k22aOXDTJZkSJJRul?= =?utf-8?q?4CH6dZ5xrD0wuVxVjsJKshKr8kd5DRGKK7qw4qmGsC7HbARkvuRKoY=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)(7416014)(376014)(1800799024);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: MCWwkNgW/TNx75A5XS8H5xj+eSlJKnGTB2C24fSK3F+mUzaQeBA3Kn6eFr5BkUUA8yg8E4yg+BZSUxAZOMc0VpM5C7CoyjMeR72/AITC4b9XARJLzVBHDubqbcatMLHgf/lX7yAhW+Zd3vwgM+L0G7hDt9Dln4S1dyMDXql02XpLDnbfX/9VJCvGLi89fpdmcAOyEcTt+evPR+f36xTmHVgdxUAWLz7p6JYgQBGYQcH9g5D6T9B5NzwgGrXo7mFNZ8WWDqxyBKcKBfSvvP2IEjPXRuZh0iFks/j27fkY4NKxWi3cB6Hip0emwx7SQi0BPvlW8eSvnhXynLT5KC8Y5yh2BwT3jyhS393qcOhVvOyuc6rEB+yF71BL4jFhCoW4vFsoRukaZeYElYczE2XZWmMr46+4JJY8X6oOLsFMf/q5SHMtVV9MCWg7ixyZ3OrK6ArUr+ikOgZ89XTtALYjCZHRvBHuKeuYrN5nGhvO05noOmaAGl6ceqpts2DyMpH+8uiEu7W+CLBYM//VuZQGdasrJPA1LJF1fb5kiHFcdd1aBC/ShhkXAOnwv8iQeCvTYfVe2gbcPCvXS71kidt4ETjk6bKWR6plski4x1Kwsa1Xj4eLC7pm0u1EGtAgVq4ydeuf4lXnpFMOuU9FCfhQwQ== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2025 00:25:12.9376 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 89319898-9d80-408c-68c8-08dd2eb1c084 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: CO1PEPF000044F4.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR19MB6071 X-BESS-ID: 1736209521-104050-19458-90164-1 X-BESS-VER: 2019.3_20241219.1759 X-BESS-Apparent-Source-IP: 104.47.56.44 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoam5hZAVgZQMDXNwsDEwMg0KT k5zcw81dDQxNgi2SLZ3CjVwsQw0chAqTYWAMycoyBBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.261635 [from cloudscan11-173.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 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 Reviewed-by: Joanne Koong --- 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 757f2c797d68aa217c0e120f6f16e4a24808ecae..3db3282bdac4613788ec8d6d29bfc56241086609 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -35,15 +35,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 4fcff2223fa60fbfb844a3f8e1252a523c4c01af..e7ea1b21c18204335c52406de5291f0c47d654f5 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 Tue Jan 7 00:25:08 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13927917 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 2F57C8489 for ; Tue, 7 Jan 2025 00:25:29 +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=1736209534; cv=fail; b=NHnI/H/yOMBvtTrga5OtEJx6pOIGwxmA/qXM8imEjPD2BA3Tc9FRvI0s87svM2ORPWX/sd4NuKR/M5pBZNbYzEowXApJIrZ3oujn6twvPo/GAUbDl2fY3/nn86X0EN1YjoBw37g5DNaPpJpJwywMmuQqJjJUT8kXQoV6J2Fo+sU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736209534; c=relaxed/simple; bh=bH7AXbAgM9O8WxYv19f8qiXoKWtYqGZmQxByq03RmGI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TroXkLqoVnDFophjlyxzp0hRdTGMguHRYDOJB7SiIK8a42hgh504SI/tX1rcium4bP0u6aY36mXbnlBwpTMQpm1mUZz9LLRmXjbZQlA2qp4BZ81zG0yzSu8OGD6/hrWwSLOfCMbdZCTW+ItSkRFr7oQ1bPLeFznp5WjzboUdgvM= 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=wA/vXoX0; 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="wA/vXoX0" Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2048.outbound.protection.outlook.com [104.47.73.48]) by mx-outbound13-31.us-east-2a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 07 Jan 2025 00:25:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PkU59i9LlJT7Pmqvn5+qutW8lPFBd87m+t95cnKtXAPqYovF99ZKSrWLg2gG+J8v+XQAA7Ki/3o+5ImI7VmWpwgxdvP3Oc3eQoiGl935K5Hzs/4FJRo8V/U03+SfN/ta9guxAOpMbrlOofWFrIYkEsZCfM92MBVpM+ivq1nog+xH+yt/xmj0pDpmRNXkvTxlUQJUhYbik81o7kh1k85F6n6xMz52O/fKWbY/q7NtpTzgEg02dOcxAgXbA2ILeTT1wn0jmGKE67/qN3OHy8R90pqCneLz7d8k9b3ftg1L8BZYfuBVHivKmsn5QwlBA0r2YKolqqiy4PgMEMha2bla1A== 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=jJz3+THbXTIKY43167MS2efTc2Qn1MdwFPpXT/QQ29o=; b=aCYfAxbSXSFaFHs3djuNjXco8rluC9zfxdshlYvhVD+hR3NpoI4qcryRojuRWCyqHwOOVFfgz76NjObfvf7YTfCNMdxWTBFihRg4OCqubIcFz8Wy9o5iiSKGxulwf8DzxuC2eyQQQU7R0NsZvHtt7aZjrBnPR9Wb1P3BDt9a1PR9YlLnkp4vWdR1hfIYLvJoiop8aeQ7+J3EUggGxWBygeIMkvbU0PBHmn1JLvuiwMH8vtjWGix5QPNU5O2VYGDyoGT9usHMMLjKtGUXMhOy+Rjjn4cGZO4zKaGWsd3yvzvdPu4cdrjKhhynsKsx7IZLfVnCOW9yzXTDpYFJfQvD+A== 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=jJz3+THbXTIKY43167MS2efTc2Qn1MdwFPpXT/QQ29o=; b=wA/vXoX0c2j52qWTrUJAXTUSYzFU0JbOWyCnzQ57yOlYLZgCHnu+ABb1z2uvy4Z8yO1UUWXcf9WcTExmBe/D615qQYy9NhlEQajh58HFmyJkwrQ0fV2kuDBD0NLOqdp4hfc4vivM/Tqibaaqse6auQR7u1VauaYfAjuXRSj8edQ= Received: from SJ0PR03CA0167.namprd03.prod.outlook.com (2603:10b6:a03:338::22) by IA0PR19MB7728.namprd19.prod.outlook.com (2603:10b6:208:40c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.17; Tue, 7 Jan 2025 00:25:14 +0000 Received: from SJ1PEPF00001CE7.namprd03.prod.outlook.com (2603:10b6:a03:338:cafe::1d) by SJ0PR03CA0167.outlook.office365.com (2603:10b6:a03:338::22) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8314.16 via Frontend Transport; Tue, 7 Jan 2025 00:25: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 SJ1PEPF00001CE7.mail.protection.outlook.com (10.167.242.23) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8335.7 via Frontend Transport; Tue, 7 Jan 2025 00:25:13 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 47F4F4D; Tue, 7 Jan 2025 00:25:13 +0000 (UTC) From: Bernd Schubert Date: Tue, 07 Jan 2025 01:25:08 +0100 Subject: [PATCH v9 03/17] 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: <20250107-fuse-uring-for-6-10-rfc4-v9-3-9c786f9a7a9d@ddn.com> References: <20250107-fuse-uring-for-6-10-rfc4-v9-0-9c786f9a7a9d@ddn.com> In-Reply-To: <20250107-fuse-uring-for-6-10-rfc4-v9-0-9c786f9a7a9d@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=1736209509; l=1370; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=bH7AXbAgM9O8WxYv19f8qiXoKWtYqGZmQxByq03RmGI=; b=1ZARQPuG3fSArHLuWXpb84n4hu0HBRmK/YZFjXtXdinpmZtdhrfFJzyaDiaO8GaWCbHiCCq/S CpUVDFB1XXyD0FbMM1K+Q7ky6oVi1/arbhEN2nqS3lNbcIHh04MW/58 X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00001CE7:EE_|IA0PR19MB7728:EE_ X-MS-Office365-Filtering-Correlation-Id: ac105c4d-4df6-40fb-9d49-08dd2eb1c116 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?t4bYnYmzgQKPaSdosabcrxgpqQtK8RJ?= =?utf-8?q?VEmDIkwXc8+XXwKo1BWi7YLKNyCWN0fBfuCjT7Em/kVBG5W0UDiAqorPruDVtSIBa?= =?utf-8?q?qvG/xDmie3hIf3mminUhJHufivS+hP7lElJnozU6yRo9cawM7JdNtdujtnLY6/qLd?= =?utf-8?q?aylBToWt4wkdDAy0DzRj2sMNwU88N1FB30vsbbwvICNOYu4oNsy77rRL7y5vRXcGd?= =?utf-8?q?H4M68smpOOV/+E+tjUPl5PNJJXYQKCnbkaXr7BhshNae1Mrmx9qEfPYDjvAnMAmCW?= =?utf-8?q?V9NasLVMau2OiXWPnmYLeJTHLE6aRDu4qJnSHlBu/bNZcNVu7Dw+8W1Lfjw6jTVbB?= =?utf-8?q?6JZEOeXtmsYgfIdRUDdRnGDiOijHTWDC0bJQLNdz5plgM1tNgXLuh7/NrHpfYUQsK?= =?utf-8?q?Nh+MFIOWM/tawgJczjVUnoLECfVL4HIZdqc2k+Yd/JSjKlnq01KRYQk37ZfX8j9h0?= =?utf-8?q?JQ07O0jGy4tFmST5+P353NSXQ+vwxMDoP5i6c2vMjNq5wW3+QMyFJvYUXfh0lrpir?= =?utf-8?q?lpatXOKp6+37bKl9ZqeaPOCu0Z1cRBTQSWslbhDmn3aMMwpLgM1ZLlP9DWLLG80qE?= =?utf-8?q?uYgxP5V7harsdxEe4wPg4/orzNrfdHQxV2a4G1lonjY7T6Wu0Vd/HJ7WT7zV5S1Ql?= =?utf-8?q?sVuXe1FCb/J433zqBLDTarWMra8gm0O52wd6k/Sw+dXh1ppWAyv6xsuhbd5wlYqlh?= =?utf-8?q?1c/+Kg8yjG1Bjhojget9+ld4lVVMWV4NUtC5RE/uBr8bNwtJyssValVTsVfmbXMbt?= =?utf-8?q?ZP4MU4XcfFxhlorvg3S3eyrZT24rKZpXT/RtdpCEJzt5QAnnh9NqLp/LpYQrye5Uc?= =?utf-8?q?krFgr7pBbQxwsL0Qw1r5FhSig8s3ug5xTa1KDh47qnbIVNepf0vCtn5tnUpN15Zs3?= =?utf-8?q?PbLy8ROkriXTAo4PuPBX3B/S74WgGbvfdv85N7r0LIdaknDPuHxy32VacPALlzRJH?= =?utf-8?q?SFxuJHqiREwfSvbfVbfYPqXsCWwuNxWNShm7LksR+w+gsNPTHPTdZVWnMLohTQH4Q?= =?utf-8?q?njOfeu+qioWgZb3sdRLj7szT8BWDOjQA6v05aTyF/vblPOAm9BMwpw5okbSjxNBUR?= =?utf-8?q?6hTRrRrK7S1I3IKULsbra50bS97kNqDR+a8GYwL6MqVXj7PQ5iB9yjOyzv1unY/8X?= =?utf-8?q?HM0EVadKIhMK66Vz7P5AqUoR8plMEL5LllOzAr2c/ytbOYmd2E18NdwlCT93znD+w?= =?utf-8?q?Yuo5ciSdEK121Y3ziRZAf5/Ax96AikznFUqcN8z3TX5+ADJtJFgDwpPKQcZrNFpvM?= =?utf-8?q?s/ijEY8LzfQFuoiUKn6vMu5HS7nufnzZYcWEiGyVQhQEzEnJlzMcfnyZBhmnxDwnU?= =?utf-8?q?GLSW4Bec+s4evDGPPEnyurGEfLXosSL7BNulNFdbbMe2VBnwpAAi86p6N4dWQrg7C?= =?utf-8?q?Rud828C2md+z5Mzu89/YXCBPPM+vKDsha3B56bndp5ZURT94SOZHec=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: uMDz1xTKZwe1aScBy7TnX6CZ1WVmFuyATpLCOG8Mh91k9Ooc1k4tlIjqCHpA3NjABps3gzHJ6qhNuDMga6q7vcjbJdUx+B8bp6mEnAcDE6HGFOskv0ZZDDD/0ay6x9zRmYMnAMxSMxDe4d0FSu6VE+pWa9ZbAYbsIKoE+7G2qs9/ikLN5YOUQsjmMBZZi1Tdo8oEIwceKhz59GdhNFdtTQK9YR9UEYRuDYzhRAz05Sx1yKrJeHm83PWum6vwyt0Ouj8EbZvW5OGuSKQzTyOSDnnfuEUj+HRIk96XuENUsqqrAWSbcQkbTMFKDTwHDekonzmcCIErIIGCB0CvSaa5yMBZmdjAcpjdZ/+tEuTlC5O3JbkfbIRDlXHT2PRvVOHSsGRwcx5NtnK0aXEpqyXVgQFTeZv7wyDdHyQVYz7hqRYiMyHekdqTrh6h4YOUc4TTvMpekDNZp3dAzTixY5I2/l7Mmgvw1tQ1SzpfUdDH2kXb8GzBelv9XRt0QpUSFHq0X6DxSRTxxloITGcyNjjZr1HTVe1PrP+PrDjF4IiyVbfzdmZlg25pnKKjehRJMbsqcqisPaJrve5bSHHPBYbITH42KWoerGmlUeFnPOrVxFhfnhCVLbESWrMpS7FZn0L3eKS9Cx4TxAFDiKN44Q5ImA== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2025 00:25:13.9114 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ac105c4d-4df6-40fb-9d49-08dd2eb1c116 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: SJ1PEPF00001CE7.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR19MB7728 X-BESS-ID: 1736209516-103359-13501-42569-1 X-BESS-VER: 2019.1_20241219.1759 X-BESS-Apparent-Source-IP: 104.47.73.48 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVobGRhZAVgZQ0DLFOMnAwiQ5Mc XMyNjIMsnEwjA5MTE1ydIgycLEKC1JqTYWAJk6n8ZBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.261635 [from cloudscan17-125.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 fuse-over-io-uring. Signed-off-by: Bernd Schubert Reviewed-by: Josef Bacik Reviewed-by: Joanne Koong --- 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 3db3282bdac4613788ec8d6d29bfc56241086609..4f8825de9e05b9ffd291ac5bff747a10a70df0b4 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -29,10 +29,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 e7ea1b21c18204335c52406de5291f0c47d654f5..08a7e88e002773fcd18c25a229c7aa6450831401 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 Tue Jan 7 00:25:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13927925 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 6B6008489 for ; Tue, 7 Jan 2025 00:25:35 +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=1736209539; cv=fail; b=RhqbfTFDaZ1HLx/LEYF78Nj7NwbNuDx73m/tx9suZM7FneGMv5PLSpHjTbYmbneFZ42c1zipWO4LLt/Z0f2s9Tw+FLT4FXZcXWDE2ktRrVS/tbxCNhK9/qz0wBo7gujGXv00ACxQzjxOMvpZZp3StuqARm7KnwpaBWNnIHJnYA0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736209539; c=relaxed/simple; bh=bpz9jYdZQEOQdBfiKXiZwRgnp9oHesOsIHgalszfXPs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RhCkL8wzbWwcf03/tN22fydNYcLUx7kajZI8DFY8qF7uep2rOU++rmqF3d63UJSjN5quF3J04otXH4HiWzDekyOBhfg5PTSQo2q4U8xbQhKQBvQUqx9kqTT66bsD94Z97WXmqr8kRyxzcF1qrBE95tRbYLi9a7ZevcPQ5rb2Wzo= 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=FbpYPDAY; 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="FbpYPDAY" Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2175.outbound.protection.outlook.com [104.47.55.175]) by mx-outbound13-31.us-east-2a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 07 Jan 2025 00:25:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=efvdhDF5tbENwYliJ7IkEpY6CEIcq4KpPh2mkr9GW4/xkpxUvGHpoAqnteFYazRoPAFN1wKRk4QKi/aX4Vc7Z5/NkhcmBdqvKwNaC+4RN1i8n5DawbXQSTnDwlt+kQG4loVltnBsgeK2nyt6Y/SdyOfuBI68rBZFFjinkryGhqCsVtmFLV2Kt10oTKaICIbaQKRanMnK00b80BJTCxfBy6WQRCOEIoX9y53Z6kibdldCkzacSdTcOeppmMnB427cFGZEYnR73f/7VL6kP7L3tgSICOc4x5AoDHLcLqy3OwmOB7n4ZBjwMSIxpLJgMyZKvki6l4L/hjuqLxGRNDtXTw== 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=OzB207LVFcHhSySR/O8OdAO8erEuw9C7AZx6YrWeNEk=; b=ID1wC12pKu8iTYs1nAsMPN2kP5gqT9pexAu9fqs5UOJbXBwG7t7dah8nAZ/wm3Rh8xW919GrHzLurdKV3nvF3aTcypgkjU66NJ7XWfheOqZIdttFzWwNO2X5DQ+8IYHfMuOFiuB8r09LkliWKMqMCYikknPf+wn9DfflB6b6JfpFDriSIQru5b3wullOGsmV3HhmX5w4m/gq6HLkaDjunONAAwp9WHCjQ8pMSXDzWFDlMLFBaMLa8oe4RJ6qi8PtVRFVqLqs6ntCR1SYB2T0fU+RxvkrmIjJQg2gecPKFZCyH8dblSPWu7G/dVACSOealKtgP6oxW53Xn5IMeC9WBA== 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=OzB207LVFcHhSySR/O8OdAO8erEuw9C7AZx6YrWeNEk=; b=FbpYPDAYXxmwcbvyEuu6ohI41gwAXHI3BRGOnQXxcWNkEna/tcLloztDFkn3k1oEhhstFnzZpEBWfKhnmjziSlrmzw1Lxu0ZvgEQIXoD6+V88mzuAU02qPFlTKoqZwoDfTuhAU1HlB27viWl3Le4PjjQx3Kr1Ng6wIebgXM0FJs= Received: from MW4PR04CA0260.namprd04.prod.outlook.com (2603:10b6:303:88::25) by SJ0PR19MB4745.namprd19.prod.outlook.com (2603:10b6:a03:2e1::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.15; Tue, 7 Jan 2025 00:25:15 +0000 Received: from SJ5PEPF000001E8.namprd05.prod.outlook.com (2603:10b6:303:88:cafe::e4) by MW4PR04CA0260.outlook.office365.com (2603:10b6:303:88::25) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8314.17 via Frontend Transport; Tue, 7 Jan 2025 00:25: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 SJ5PEPF000001E8.mail.protection.outlook.com (10.167.242.196) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8335.7 via Frontend Transport; Tue, 7 Jan 2025 00:25:14 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 4128A55; Tue, 7 Jan 2025 00:25:14 +0000 (UTC) From: Bernd Schubert Date: Tue, 07 Jan 2025 01:25:09 +0100 Subject: [PATCH v9 04/17] 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: <20250107-fuse-uring-for-6-10-rfc4-v9-4-9c786f9a7a9d@ddn.com> References: <20250107-fuse-uring-for-6-10-rfc4-v9-0-9c786f9a7a9d@ddn.com> In-Reply-To: <20250107-fuse-uring-for-6-10-rfc4-v9-0-9c786f9a7a9d@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=1736209509; l=4852; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=bpz9jYdZQEOQdBfiKXiZwRgnp9oHesOsIHgalszfXPs=; b=G7B1sLQ/y2nSkL57GcSfXTFBXioxAH8aGJQYI+uGoHOycHgpUrj8BMadzEQKhK7hn1sOAoOjy xeogM0YrdB2DVx6kHn9XyD/xwYoFUx2ZhLWMWRm8xofbTmtscWLR6VY X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001E8:EE_|SJ0PR19MB4745:EE_ X-MS-Office365-Filtering-Correlation-Id: 4993da01-bc4f-4b6d-a48c-08dd2eb1c1af 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?ag+c60dfYWc51pHa83t3+Ox+DcGDneN?= =?utf-8?q?2Vt1esKZf9gQLgF1LlArp5sDWjinpZ5t43oX7jj6wOeiVT48xMbo+9OjQBj2Iz0jL?= =?utf-8?q?zmEQXwyiLADxI9ojcc78eYs5mjCA9glI/HsWDqV6YXU0RcpBKz5yQFYs2MsxsuilX?= =?utf-8?q?NETFK+sc482lfalf1WdbHqlKhwrUDf8CnK2XNdkXLUZhvSijFJxzGCQp7AyAidffW?= =?utf-8?q?Tsgs9SsCs9hsUBaZBolGXcrGZhH0J02dlrrCtd1ue7Xloo9u/KwOJa49+qrG8NMDQ?= =?utf-8?q?SUQvOYxPQ5Xr9FqYufxrgbkhPEfnZAZZ/7gNSByJK1pBEw9bGFpzzTJ3r5ggRvh+m?= =?utf-8?q?5JQyrH2yiKHbJ9uioIYfDBFOt0o07Ave7TSqxHF36NO3yI1kCuRHaLIJ6t5QABkCc?= =?utf-8?q?fnekXpNll6T1UKU7vJreJDbWRYdRRJDCeNNEEV+Zk3nBxCqcp0cJ5EAL8LLgI2Q26?= =?utf-8?q?njtVFTnsEnpumvezqbraKDMFiNiqtP5f3WSRM9rRL3Qaq0lj64u3AEpH7l65bYHmA?= =?utf-8?q?8xn8QbncJvLCysIH+AbvG5RBUI3ZT3cpu0IPPowxQozJZR7MvILX0waZrs1/gGo9w?= =?utf-8?q?Z3UYes8n7lQW0H+x/9kM7KhUBbf1xOCulO/zKHoUmw05jZPFsVXGY30ZEiSWzbdLw?= =?utf-8?q?DV40N3fRJzLugJm+cT+e1Ajzn2GKgEQW8ryWN+edVYH9VIOHIrmOgZl3RKsUFEn+V?= =?utf-8?q?DIMB74es/uk3iLcf3izCymWRBt39X3wpXlK60G2YPb90E0xDJVVqbisupOUo6tWoK?= =?utf-8?q?Ps6DP7rCHFCcCkyXF4RA2kK7We+LsHaIaEMGN26D8++dzQ2OUg765lyN/hc4EsKY3?= =?utf-8?q?aS+NvfNHQjGdnqKWDQtud3evu879/7p2kRv98OLMqGcnHuZNHU6+t9Qc7VutpfSRO?= =?utf-8?q?j5q9MxGSIjfLZOiYTa7t2EPGPG08ucuM/0Lh0CgItCw+9ZWpl98g4k/pJWZrQBVsz?= =?utf-8?q?jsajRm6SCbIclEiZ6OdeVgOuC9riR+ESGoQ5nSPup1v4VcEKUOjzFZUlrlChMKVpH?= =?utf-8?q?qh9jcqg5HS6r+TBORd7kx/omyYk0P77NO4rABv4eqD840iGO2e9x/xPIIjxdEy2A+?= =?utf-8?q?lIer33jDpkyuR0ukOMiW9rve9Pdk9VD8pMKHnbmDeGmvx97X9kzv0w4W5o4DudjAZ?= =?utf-8?q?bEHlHS2hTRpBjdYC3+gmFVzlk4kV0Uv8evVe9P1bx8lHM58lPA2wDkl2dlYHNgjzt?= =?utf-8?q?GBR0QuN+JqMKrg3Iv16TfjnZwQ/8aFaSgCcTSvK2vZMLl0vZ4ohkr8/U/8US7/O/0?= =?utf-8?q?QV2b0yELuIClbt7pe7RXkW+Iy85jHY0tBJwxrYd35RRUVyc8VRVzditxK1r/AQGBd?= =?utf-8?q?zEi1NN4awkhvcr2b75RDoXEWIH0s6/I3De32N/AxQGSATxfVdOqLzrufsoUpgBxdH?= =?utf-8?q?E9FG4mbbWcmpIc+7G/NLdsPSWczb7bOrDBtQt3xG/TFbN4r0nW8jHM=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: CZiltpXed6QmX+ffHagWdXgalE1mwsX0J/N+KARWwK0uwEOTirV8vmKoChp0QX74g0idzXt16Su6pVotHZZpDYckTAdHuln04WmXxHf7TFEoVdgTqO49+z7LLo7qdDKyF3yC5oZK4H5iqtNtI4Srnxlo1s0Iv+N+oXmfS5bX6dF7BKz3fjcYZXHTZahmxW2gzDnNXFA6pGu4RQ/AgWSNgCvLUuhGp/KTpDl3hfrSau3z8rzrK3mO2fUs5f/pGLWUMe7IlmsZTw3UCttzIDNu1Pk3WuGG+QToGdDoyOslWhesmQ/VPjetC3k13hJsHzr/HGATG1SCJZ15MlNoajISUpbyft+61HMn6YK/C+cOr7hXCkQH4hcmWAIIZF2GmxXT9RF5YG7nK9E2OrVX7Vikp7HwI3srr2d9g8/I47/vF8D5UdUMS534UoyLuPzqJXIy4jJZWM6G7qFasospa9xx3Cja/Zgpbosf30WkAqmGg9V0w2TIeqRExWEHIp2tUO4yEgqipl7P3Z3WpQ9s0l+kDd2GyQqHVbZLOyiET5voLgf9J3ZtP+qBhsEjhbZMb4gRffdV5KkgnWK6XNrOA5cfG+KDOVe8Qt4KMg6nXC+32pOGGsux8737PD9FjL+xJKCfZiqj6jQ0hqp6Q0mGVu1BKA== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2025 00:25:14.9143 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4993da01-bc4f-4b6d-a48c-08dd2eb1c1af 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: SJ5PEPF000001E8.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR19MB4745 X-BESS-ID: 1736209521-103359-13365-8230-1 X-BESS-VER: 2019.1_20241219.1759 X-BESS-Apparent-Source-IP: 104.47.55.175 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVibmxhZAVgZQ0CDJIs0oOS05Kc 0kydAszTzRyCgx0dAiLTHZzNgkydhYqTYWAHzkAYFBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.261635 [from cloudscan10-181.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..6299b65072a8468f08cc4f6978c386546bb9559a --- /dev/null +++ b/Documentation/filesystems/fuse-io-uring.rst @@ -0,0 +1,101 @@ +.. SPDX-License-Identifier: GPL-2.0 + +======================================= +FUSE-over-io-uring design documentation +======================================= + +This documentation covers basic details how the fuse +kernel/userspace communication through io-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 io-uring, userspace +is required to also handle requests through /dev/fuse after io-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 io-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_REGISTER, 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: 13927922 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 2AD031BC5C for ; Tue, 7 Jan 2025 00:25:30 +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=1736209536; cv=fail; b=ZqlrvXM+D2wKsAhARf1pvovqmtl246dgD8Xe8/mT3bBI+eh09nGx4pEPnP14QX8sDUXO1InyZSl3kO6xy+tX60/YFA0ab+Q2uZooFjvkp7h4wCngjJU1t/PApa4TW8XZbGfzZWyxQgdPkp2NBRJvARCqwztCKzifp0RZQUpveA8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736209536; c=relaxed/simple; bh=MxfJjh+KWyLM/pBEqZ+TVduRkvAsbRDO2XTjnbrCNS8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UQmR6y6f/Re6ve43H4iKwZN/wDNk+hnZTI+Wo4yluvIVh8kIVK4BLOIR2yCwR8ePpGqrHQx8OjjeAufjWIdU5KupXZnpvGRHFXYh31OkjruZ7kiZdYLHQVsH7oURIjLtvcXOTobm/z8ZieSJR5F6VoBbxTir6UV8ee6XQHObD6Q= 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=Lo195aKx; 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="Lo195aKx" Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2173.outbound.protection.outlook.com [104.47.55.173]) by mx-outbound-ea46-177.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 07 Jan 2025 00:25:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=i5e/mLwl0wohpyVpUtvX+xjbu45kNT43+ay7RMl4zVshunEwyeku64lTcGx0aVrN40tvMRxtv6qH7yXzoUj5vs1CBdmYoLEHejb24YWV9sfQqBtIhxVuYwZujsBoLLYuuBE02Bag32k/cr7MvNQcD/rmsFKKcj1bjjEYiJbzwCpNw+thz/Q0A/DkABN2tuTBYc2MEI8N8jKsybIxH1RFSTkQOR9Z4Lfw7r8Egv6n5PhanRGwAGSqg+QKaFOErisqTOgIu/wlNTlylp/XQTPcYE12xd4Z+utvKwMcIZwmpVOHERjomgsJ7N9eq5uY15X1v1sRofvtldlH9033IyLAoQ== 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=ROJ/GyNgfYoF7z0FAlOmFhvKYoHCgYvO1Q08mJI7h60=; b=whKnNa2hw1Mut3bWTNcp9d1VxrX1AlkcXxoDxEnPg5nc6kc5KjxWmpYk7SXaqPKFQJOZcXePz46jAWzr0ap0FA5jxGPQ4nzFCqOI586aJkQmQDikUF/+i+0EvyWVJVhUqAj/7GQfKKK+ypxCXvdCwZJ7/8lfOPFfpEPfjyhonaqYcZH/FrwnLxCZEctwSPYZ8PzoHhYPaukL7RB2wIfzCDMyAPQ8QD5keP7Ykf7KMwlLvCm+fMxVb8hHf8G6jw0SHYYBT+rPKOJOgT0aaFwx2Hk4hznGyKcpg22qhWDHtcPQaXIxMBT+RWVLGWVWTuDl5gNjYEm5vl2OgRZps6AcWA== 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=ROJ/GyNgfYoF7z0FAlOmFhvKYoHCgYvO1Q08mJI7h60=; b=Lo195aKxSqeri+45WAsmxN9sKEhBOYyeNjIDi7GzFLabv+aFse+tfLyKXBiEvbR4VrdyMWTCe5H+teDjf9vEKOv0I9l0Feds2Uab0vUpa3CCbYaQGWjvHraPW2RAWPCGeQQL2JfWalw6nGN/8DN/wEbMrUZFgrADZ7ABT0U8+L4= Received: from BYAPR05CA0011.namprd05.prod.outlook.com (2603:10b6:a03:c0::24) by BY3PR19MB5220.namprd19.prod.outlook.com (2603:10b6:a03:355::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.18; Tue, 7 Jan 2025 00:25:16 +0000 Received: from SJ1PEPF00001CEB.namprd03.prod.outlook.com (2603:10b6:a03:c0:cafe::44) by BYAPR05CA0011.outlook.office365.com (2603:10b6:a03:c0::24) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8335.9 via Frontend Transport; Tue, 7 Jan 2025 00:25:16 +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 SJ1PEPF00001CEB.mail.protection.outlook.com (10.167.242.27) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8335.7 via Frontend Transport; Tue, 7 Jan 2025 00:25:15 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 39E414D; Tue, 7 Jan 2025 00:25:15 +0000 (UTC) From: Bernd Schubert Date: Tue, 07 Jan 2025 01:25:10 +0100 Subject: [PATCH v9 05/17] 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: <20250107-fuse-uring-for-6-10-rfc4-v9-5-9c786f9a7a9d@ddn.com> References: <20250107-fuse-uring-for-6-10-rfc4-v9-0-9c786f9a7a9d@ddn.com> In-Reply-To: <20250107-fuse-uring-for-6-10-rfc4-v9-0-9c786f9a7a9d@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=1736209509; l=6974; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=MxfJjh+KWyLM/pBEqZ+TVduRkvAsbRDO2XTjnbrCNS8=; b=X/Z+pTmLJSQyZkINYpCSdpTQDQc1c75LrCUe12sS+K2woqldpYc0PbYOLHIhsNDoAyG6Yu/M5 +YUlMs/7P4wBRRaNztvPLU1rZtVyaouVvIiLmhN28BG7kEWnrLF7hkP X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00001CEB:EE_|BY3PR19MB5220:EE_ X-MS-Office365-Filtering-Correlation-Id: 8900b0c3-0c17-4f9e-22a8-08dd2eb1c262 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|7416014|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?utf-8?q?0RSxt0MBgr/wCaDEZUBAY0wY16Zqfr3?= =?utf-8?q?s0bKFMYpHu6wf89Z5hJoVa2pLfuh4Z558DdnlpNodWdB9nJd3cL6sMkdKUoANDPkB?= =?utf-8?q?N039fEoCmxc2XcCrmymFSl8QsXiptEQlPg7cvQsArhs4LbkQknynJ3dQrUK0jhdkv?= =?utf-8?q?nedlFgT9gXyuD8OK4usAPi15jM1d9Mti97yGVbeuYKdjEMxvtdB0Hgav6fEY3GGN5?= =?utf-8?q?IfCSXBsM+/nW7UhUognoi82dpQR3UU4LfdBqKKwK3fttNeIBI/iQbQg2eAoRZ1V+5?= =?utf-8?q?q628+L2PjsQ/ienlEKstkjI3FkwGgMcuVD0T315CmOK8MoRG7a6ckPpnX8J/LDShF?= =?utf-8?q?5pdwUiJ+GUy++Dy3VJRojGAWUMr/mHz5f5p6QYvJNAdKvdBwFcUQp2WdEFQjQV7rT?= =?utf-8?q?WPsjfliNAt5Lh2K/jfnMrw1IwqRkT2Jb8uEb42I0RIdQHbWVj5fnry4UlSR70q9kq?= =?utf-8?q?5fELmnFKItqjTjmdLmhN0GluZilcf//J6LDuIsmIfcOZeryjCDHlKV101n76isiQs?= =?utf-8?q?bWonTJ2OajgWU6XB/Df/3WR1Tnd8r2UT1mlXlOf0tdomMUn4kMX7AWIK1dRY3w85L?= =?utf-8?q?wMqIDqaRWVK5p9iHbD1hrCzSFS9haxGAhpFP0LhkaOsJGmG272eYqT07lOM0IM5aZ?= =?utf-8?q?PcHDRM2caulqHoeXGq4cowBCtSh2XApBrBzoWgQRMU++E90HkuQzF+2x3ApQD/P4x?= =?utf-8?q?01OfaaykuHnBFfDzYL5Q9NC2IE2MErZ3TKO8TtV3VjdkYCWgKbBf1iaH2TJmDMUbm?= =?utf-8?q?/ZN+hCvWwHkPviJ4sKngIsdtHAF0M0+5DDV1x14b3OZlIAFMUj2miLXmL6/A311dI?= =?utf-8?q?JOD1BtMoiYAIE9dG3VNmAaeZ4sYr25eeVIaZfrXxC5YEpqQRo5rouLeVaf37jwiUU?= =?utf-8?q?RzAXaC8nvx+oT5BvbPP/mCoLLDG2ibawNsD8dwvXFmtHSgY0U5UyhSyjtZ576PC/B?= =?utf-8?q?SwF6LrIet/Mya58PqVWuSuwJopGj6htW06iW5tYfxkeACNDTG7JzzA1Xg7Suy0PZ7?= =?utf-8?q?swHA+bywrJCf/Sow24MyS9xlGpF5pLahs7tijx2hQMz8BgY9CungZwY8iH/0YgUAZ?= =?utf-8?q?5qle4A1H8HWahPIjZyZmYQWcR4Jf9tzSuTs0eYHMbjEkLv/ecnwPzZnuc3dDIy3uO?= =?utf-8?q?GFtldmuT5d0n65NeIF+kJ5yEHRKXIyNfMMG3hh10mIkRL0AKFBlh9VjjuYbItVS2h?= =?utf-8?q?r/CDN9ew9GzY0lIEUJieiM5wMbQOAtGmFsSBUnCp9E6qJf81WETQXEVViRW9BDFsP?= =?utf-8?q?CmU2GIjaN85QRQwDyx4icYarf/c5RwEv2feQGS4SvZlZ44RlAjjPylMAQOrH/HECZ?= =?utf-8?q?Z2HtPS9KfAi7oRMSyAsjDjW+YRaHbtNqcXOSx7VvMIUk5to1K0GNlsBYxW6g5T32v?= =?utf-8?q?3xYcgpa3RpFfmMnjamHkReTGsDAbJw+qg=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)(7416014)(376014)(1800799024);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: yMamfJ/DqhH3doeQtXyr0l4xWHA0AJvhOsk2WrrxUsLFpU0o5NeGr4O8oW9IljsEOjopSvAzAlyRkwwNbAH+Nj54GjCK+j8Zp/UQPVZXzUtWbFK3WITMj1FCeRfbelL3e3D+foG20BfCEB/nyrnBkTQKsr1W18E29NuS31etnmo3TaiIxQR4BVVAW61pB4y7T6NlnAoTl3cNO/IQmwGVhw81C2PEEotpefuIs10hD6o/KiBLNuWCslRMK9A2J99V8rfKLG4i4pVats/EBB+pQTGXxHXM6HWTVO7FEBC2xJWeDQ5fvnEXi5F+n6MvzzdssVK5kn2mJEnczPqNYo424j/6lxPg6OnX40hUcGOi039Atuu88wHklRb3KcsCt/J93/skBBlSs1IULJlxQryzb5F1/9rL7xxLz+MEhxWeF4PiSE4lvV3Qq4STsess60Wz469OIIPFuh943wFJuoQlOJqT+Fd6EIiDjTudOhHK62A/eIRPXKDPT6A5V9TBUZadwDEGQZykYB/B0Q5pIJmc9Oi1LFuIUnzWX8y3DEE7ihy31/TTmLC+zQTz5YnbzcVKnhkQKF5r1wQxqvbzkEv4cghc/hOaNAPphLbjX9zBvlZyVBnJBoY29kXFBwpKc+rvwwRt0kYWycnYslKNdGowEw== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2025 00:25:15.9278 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8900b0c3-0c17-4f9e-22a8-08dd2eb1c262 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: SJ1PEPF00001CEB.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY3PR19MB5220 X-BESS-ID: 1736209519-111953-10732-17239-1 X-BESS-VER: 2019.3_20241219.1759 X-BESS-Apparent-Source-IP: 104.47.55.173 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVmbmFuZAVgZQ0NAo2dDA0NTUJN UyzSA5ydTE3NQwMcnSICXJ0CTFKNlEqTYWAKK1z+hBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.261635 [from cloudscan17-177.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 always have headers in args.in_args[0], even for opcodes without an actual header. This step prepares for a clean separation of payload from headers, initially it is used by fuse-over-io-uring. 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 Op codes that already have an op code specific header do not need modification. Op codes that have neither payload nor op code headers are not modified either (FUSE_READLINK and FUSE_DESTROY). FUSE_BATCH_FORGET already has the header in the right place, but is not using fuse_copy_args - as -over-uring is currently not handling forgets it does not matter for now, but header separation will later need special attention for that op code. Signed-off-by: Bernd Schubert Reviewed-by: Joanne Koong --- fs/fuse/dax.c | 11 ++++++----- fs/fuse/dev.c | 9 +++++---- fs/fuse/dir.c | 32 ++++++++++++++++++-------------- fs/fuse/fuse_i.h | 13 +++++++++++++ fs/fuse/xattr.c | 7 ++++--- 5 files changed, 46 insertions(+), 26 deletions(-) diff --git a/fs/fuse/dax.c b/fs/fuse/dax.c index 9abbc2f2894f905099b48862d776083e6075fbba..0b6ee6dd1fd6569a12f1a44c24ca178163b0da81 100644 --- a/fs/fuse/dax.c +++ b/fs/fuse/dax.c @@ -240,11 +240,12 @@ static int fuse_send_removemapping(struct inode *inode, 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; + fuse_set_zero_arg0(&args); + 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 4f8825de9e05b9ffd291ac5bff747a10a70df0b4..623c5a067c1841e8210b5b4e063e7b6690f1825a 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -1746,7 +1746,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; @@ -1774,9 +1774,10 @@ 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; + fuse_set_zero_arg0(args); + 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 494ac372ace07ab4ea06c13a404ecc1d2ccb4f23..1c6126069ee7fcce522fbb7bcec21c9392982413 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -175,9 +175,10 @@ static void fuse_lookup_init(struct fuse_conn *fc, struct fuse_args *args, 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; + fuse_set_zero_arg0(args); + 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; @@ -928,11 +929,12 @@ static int fuse_symlink(struct mnt_idmap *idmap, struct inode *dir, 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; + fuse_set_zero_arg0(&args); + 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(idmap, fm, &args, dir, entry, S_IFLNK); } @@ -992,9 +994,10 @@ 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; + fuse_set_zero_arg0(&args); + 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); @@ -1015,9 +1018,10 @@ 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; + fuse_set_zero_arg0(&args); + 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 74744c6f286003251564d1235f4d2ca8654d661b..babddd05303796d689a64f0f5a890066b43170ac 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -947,6 +947,19 @@ 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_header {}; + +static inline void fuse_set_zero_arg0(struct fuse_args *args) +{ + args->in_args[0].size = sizeof(struct fuse_zero_header); + args->in_args[0].value = NULL; +} + 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 9f568d345c51236ddd421b162820a4ea9b0734f4..93dfb06b6cea045d6df90c61c900680968bda39f 100644 --- a/fs/fuse/xattr.c +++ b/fs/fuse/xattr.c @@ -164,9 +164,10 @@ int fuse_removexattr(struct inode *inode, const char *name) 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; + fuse_set_zero_arg0(&args); + 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 Tue Jan 7 00:25:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13927928 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 3D6BB4879B for ; Tue, 7 Jan 2025 00:25: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=1736209541; cv=fail; b=kQJBJrj4eJpIzQMlixV2Ic2N24x1VnTunk1gSyqUNq6n9wjjrdlDLcnOF7fqjhjZQw2UQiywllke+0+jD1jR1269oULytwhfz3QCf19L295YNt9MazOLBmYLjRTkk9ASSyzTPmO3hDNG8jcslszdIshobgvJMn+pKPYFPKKdhu4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736209541; c=relaxed/simple; bh=hbrqLrzVQ8p6pBRv8IEhG30OABD16GwccSapM1sxW5Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=L2iOUqh6giA+EhI397MTriVPyjh1xlpt8N7yWY+eEKF04RZuhDaJm4z7CkrgRX0ShtDHzK7/nvNBXx3VteNOWdE68xQyBMTLk34aXdO/VeJhH0S6R61MqtgLSTusJ4n+jJOW/McnOI5ghZCTgdIYid1V8G6CkwqxlUF9SPPivsw= 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=DXVLzWxx; 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="DXVLzWxx" Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2044.outbound.protection.outlook.com [104.47.58.44]) by mx-outbound22-77.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 07 Jan 2025 00:25:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ffLhA0AmcVE3HpK9s5llsW1eFke6k1TqvQjbLCvvfPFov2Pgo9QbyyaAA16z3IQ0z34rNOkeFVXzOVYuN1ZI1yv6nDJDvllzCbgMBLuIWdYZEVEGyiHilSXyKNtLJYVXwHZ91SQwptLH96TotZ60b61+M3NNCWmChMNjZTCekvgD498UBWXAaZLzeOB3P9zSqbHWzXFga2Xzco+4dJsaSBakVECJmSSC3lNDTjH+fwoRQpphDnt80l18ol9ktmSlZ2S0kPwJaj5+t5kLbpDnbjCnnqoEv1NJa9W0w5LmWJ9qkvBnzd3qqu+kdhc7Y64oONdOlb0s9Z1I2dm8XdXrQw== 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=Q2+Oc6tUk6NXTUSXsYpk5uTJfTakaKecuMbxhiDV+BE=; b=Mrz/HKRTB038Fk43lxgV1DkgvT3g7zAyVrwlWWURolBDqauzvLQ4q7GVLLSliX7aqK6tJIHwzGa0sbvxZbUyX7w4S5UBEnAysVCe+nr+FOb5l8N+3vG+xhQwf5RvCtIa0WmDSksKco3KX6VglC5eclklV/zKNEpEEyK9HSlSF0jgCKO/U5+91I+anuUuOrJ7Uw5QlXTll3fJWaX7r3OVbd6ZSXrVzZuu+gWq/06EI52bMbL/JpzX3q5Nof9fhbmoTtzE0SaNPJKwa6C2rELf9NB+pFSDY6vl7ZtpMW+mPKulyogGDrO7p3m1ysQKAoohfXl60f3orUZ0G3nY4mr7NA== 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=Q2+Oc6tUk6NXTUSXsYpk5uTJfTakaKecuMbxhiDV+BE=; b=DXVLzWxxukFMS6ZwpbWkdfw5AXYX+4UupGplznA5ES/fvbW4QJTX9ibGnpZ+rYt4gSDt5pHCFzoYd29xwxWzKdgU+XNHQlWOSjLTxI5n18Z9PVk/N/IhM43/4jbp4gwZPQl4H4X++PlDvPPQcsq24trTSVWRlEqddHjqWZwNNtg= Received: from MW4PR04CA0151.namprd04.prod.outlook.com (2603:10b6:303:85::6) by LV2PR19MB5864.namprd19.prod.outlook.com (2603:10b6:408:172::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.17; Tue, 7 Jan 2025 00:25:19 +0000 Received: from SJ1PEPF00002321.namprd03.prod.outlook.com (2603:10b6:303:85:cafe::93) by MW4PR04CA0151.outlook.office365.com (2603:10b6:303:85::6) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8314.16 via Frontend Transport; Tue, 7 Jan 2025 00:25: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 SJ1PEPF00002321.mail.protection.outlook.com (10.167.242.91) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8335.7 via Frontend Transport; Tue, 7 Jan 2025 00:25:17 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id E8B774D; Tue, 7 Jan 2025 00:25:16 +0000 (UTC) From: Bernd Schubert Date: Tue, 07 Jan 2025 01:25:11 +0100 Subject: [PATCH v9 06/17] fuse: {io-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: <20250107-fuse-uring-for-6-10-rfc4-v9-6-9c786f9a7a9d@ddn.com> References: <20250107-fuse-uring-for-6-10-rfc4-v9-0-9c786f9a7a9d@ddn.com> In-Reply-To: <20250107-fuse-uring-for-6-10-rfc4-v9-0-9c786f9a7a9d@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=1736209509; l=17357; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=hbrqLrzVQ8p6pBRv8IEhG30OABD16GwccSapM1sxW5Q=; b=RtcxEM181z3v1ABpuxlSmwAic7JuAcVx2i7Anc00CidYyjcJaprJcdhmLqeyQEPi7YsShW3un fOmun6X+3ieC1EwUqUBI6vKOIW34msGjIbFuArmOKxDMCrNDJ4wmlkR X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00002321:EE_|LV2PR19MB5864:EE_ X-MS-Office365-Filtering-Correlation-Id: 49a6f994-cd26-42f1-5d34-08dd2eb1c37f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|376014|7416014|1800799024; X-Microsoft-Antispam-Message-Info: =?utf-8?q?SkrrgIPKt44HB3Gj97tIXcn1uSR3li5?= =?utf-8?q?S0zoU2bvV4EAwYyM90zbBRS7HU7Bs1sk6iF5Pc3/bDo4L9suU7JjinmpVv5YrwtP6?= =?utf-8?q?mL9IzG1Sw+x6jtYDWsTlg0qLu8S0XFNUc4QfD2Uch76LdMF0wj1o/qo0il/h0jsDF?= =?utf-8?q?PBc6w8Ay3pXTpVOUI4AUEZCXMbToIUZDNUDir7zxyKG96/GDGHozFuA9GX/LpkYLX?= =?utf-8?q?KRqFqS3I0Hh6ynHzik2NEi9SZLonQa9sPbQAyNsTjeRY1fLPV2xyRV9mbfqTJTr0L?= =?utf-8?q?T4/QUVM2JUZpjDlhYxwMrYFfe0EHg8NW8eB7SPKra9JaeYEg8E26KR4UgD2YxcZrm?= =?utf-8?q?VgQSD+AiSzwIpquJcxKrxmSDMlM1Cb5K+KmDarMzoUzYfizDxQ9bKQhL6iov8X6Z7?= =?utf-8?q?IraVHF01oAB84ulOEpeHAGD7Bk2cU6y7j6Qo7YqEgllooDUNej5kWhOA7warUqHNx?= =?utf-8?q?IkMoFFMi4wJgHxcaYteO7FW8kKx8N2JB0lry6R//+5rlact9wjic6prp2PQ8vNdVa?= =?utf-8?q?6BjE1DxM6t6a7mZFczQFCpRS+I0utNL6w5Jy7NqjMbJvW8yQUs1d7EdqlZMGMgNdi?= =?utf-8?q?+141clBm5wwVlCCKFp1IbElfIdwc3R6nGkWY5GgbpvsFZmQ5vRi7AvhhhKkVbHVE4?= =?utf-8?q?ACaTK8lLDvcDc0eveaplUBtNaVvJosqhx1xblTPmvpxSOu3417gTqLGuY9U+tZFFf?= =?utf-8?q?cnyud2+FmJnW+JgfLHNSdsWwpI3IiyC3ZZe+bnySzY+aODGGLugU8Q8Z5mNHUH8jp?= =?utf-8?q?S6mH6rafAs+CJSA9gpofwc7PfTObM1xq1/dh+QLHHnlUrISk7gJJrmFArY0uSLo0x?= =?utf-8?q?nwXuvZA2DT63T47whcqGmbEgUAQjCox79Y2ohLXkbqdolMUamUHAxo8ukWbDJMBz/?= =?utf-8?q?VOreIaNI4bfgI6DL4m3Lk64oEV8BCa1kLMzE8sgu27W1u5mLQESGHfQZlapf/nazQ?= =?utf-8?q?CWooBvabm7Yb9Ew+d8j4856XoxkyF1bgsdMhh2k6Puwl/C/NlB/NEMp0XnLjtZyDb?= =?utf-8?q?K4GeEKmhPwNbJ+zOrLXGqvzLoBs5SXEf5gAXGb0ntrhyL09SL+qss+0ISw3YMg2a6?= =?utf-8?q?SSPH3MeUY9PyWwv7YEEOLUgfjNu3TFzT5ZIyR1wOFtduWebRxvLubEki3M9BvY9zV?= =?utf-8?q?c3XMxDi0FWiVZanB8R364RDGLXvhDvZ4iMdk2gevidvgpmIRcgTZ1x3M8iQyvEfP2?= =?utf-8?q?90lL9zaxiAZctU8jVNY67641qRiTdY5YBG0rxu/2UI4WI/WpAmq1/nZYsM4gTm5TE?= =?utf-8?q?NDS2OOccSR3KuVjkShm6J7I61W4dLtdm1uA0F80RJ2+BHeaABGMdgNEUUw0hYDT25?= =?utf-8?q?kwXyYkjcmjn/nybYY2Zp9OZT8Fy21L+jvf7eTQ4Isxf/BV/h4uY6p/AhhPwLGq1Zm?= =?utf-8?q?zyq6EHczYUvrqGFXK0H0J3nrMkKIhi1gCDatIsUwKOV4iZibS5WPgQ=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)(376014)(7416014)(1800799024);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: QSc8nRHLkjuXzF4+00mvYcuFhm5JtoVj3OQe9VZes/IJ6htj+7vGcud0FF7WigqcXIEojImXbTVVPxfqddaBYM1uMR5usiUnWIGEY98qvX+1+KiiEATSob1S6M31q0I2iiPhTkEYznMcdEBPu1YvzOMrXtXhYAKyhRndRXOII+sQISdd+8KeROytFcqwfKY5E2j1KJYYrcgjRjccgbj9rsWEqeE5o1sjzHGrKOGeWVsLd50WJL9mFmY79W7YVdEwLqoZaODkZW5+WmNYlUbANEzaWPP6DmLmCeVcvmRgRWV+cN0dVt3OorGKjLhc9bW3PMheSJRFmsRJf7kzB6icZElBCCkKmFYixn8xs266l0bCgsPzKR0mFqW02ZTcoAJvzhRE4TlGOszu4t47uqML7m2zUZVuTqj+69SevcmU6SCXJKYVW7GtEMoPSNkLRb689nL2ipf9CWc1FjREo3D+TWpwDOZhj+Nl4uNx4ILutCYJIR9q+WsWuUYwHmIhnSwHWDZsc8162AuNTBYD4IwXUHQc/QObk5YrjIrY7CP+3whbaKvcAgawd62gv+lIEUIUsBDV1HXnK6A/TX9ab0M0q/98F3Y8Yk9lkMxSMnOfqlqMV1j1cZtIZdUg7pzisZ7IpudAeHm/HeZnZcZsmemjPQ== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2025 00:25:17.8752 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 49a6f994-cd26-42f1-5d34-08dd2eb1c37f 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: SJ1PEPF00002321.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR19MB5864 X-BESS-ID: 1736209525-105709-13562-12459-1 X-BESS-VER: 2019.1_20241219.1759 X-BESS-Apparent-Source-IP: 104.47.58.44 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoZmZhYmQGYGUNTcIjHZNNnY3N zYxNDQ1NAw0djA2Cw5CcgxSzRKskhTqo0FAM0txRtCAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.261635 [from cloudscan12-138.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 basic support for ring SQEs (with opcode=IORING_OP_URING_CMD). For now only FUSE_IO_URING_CMD_REGISTER is handled to register queue entries. Signed-off-by: Bernd Schubert --- fs/fuse/Kconfig | 12 ++ fs/fuse/Makefile | 1 + fs/fuse/dev_uring.c | 333 ++++++++++++++++++++++++++++++++++++++++++++++ fs/fuse/dev_uring_i.h | 116 ++++++++++++++++ fs/fuse/fuse_i.h | 5 + fs/fuse/inode.c | 10 ++ include/uapi/linux/fuse.h | 76 ++++++++++- 7 files changed, 552 insertions(+), 1 deletion(-) diff --git a/fs/fuse/Kconfig b/fs/fuse/Kconfig index 8674dbfbe59dbf79c304c587b08ebba3cfe405be..ca215a3cba3e310d1359d069202193acdcdb172b 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 2c372180d631eb340eca36f19ee2c2686de9714d..3f0f312a31c1cc200c0c91a086b30a8318e39d94 100644 --- a/fs/fuse/Makefile +++ b/fs/fuse/Makefile @@ -15,5 +15,6 @@ fuse-y += iomode.o fuse-$(CONFIG_FUSE_DAX) += dax.o fuse-$(CONFIG_FUSE_PASSTHROUGH) += passthrough.o fuse-$(CONFIG_SYSCTL) += sysctl.o +fuse-$(CONFIG_FUSE_IO_URING) += dev_uring.o virtiofs-y := virtio_fs.o diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c new file mode 100644 index 0000000000000000000000000000000000000000..b44ba4033615e01041313c040035b6da6af0ee17 --- /dev/null +++ b/fs/fuse/dev_uring.c @@ -0,0 +1,333 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * FUSE: Filesystem in Userspace + * Copyright (c) 2023-2024 DataDirect Networks. + */ + +#include "fuse_i.h" +#include "dev_uring_i.h" +#include "fuse_dev_i.h" + +#include +#include + +#ifdef CONFIG_FUSE_IO_URING +static bool __read_mostly enable_uring; +module_param(enable_uring, bool, 0644); +MODULE_PARM_DESC(enable_uring, + "Enable userspace communication through io-uring"); +#endif + +#define FUSE_URING_IOV_SEGS 2 /* header and payload */ + + +bool fuse_uring_enabled(void) +{ + return enable_uring; +} + +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_commit_queue)); + + kfree(queue); + ring->queues[qid] = NULL; + } + + kfree(ring->queues); + kfree(ring); + fc->ring = NULL; +} + +/* + * 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; + size_t nr_queues = num_possible_cpus(); + struct fuse_ring *res = NULL; + size_t max_payload_size; + + ring = kzalloc(sizeof(*fc->ring), 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; + + max_payload_size = max(FUSE_MIN_READ_BUFFER, fc->max_write); + max_payload_size = max(max_payload_size, fc->max_pages * PAGE_SIZE); + + spin_lock(&fc->lock); + if (fc->ring) { + /* race, another thread created the ring in the meantime */ + spin_unlock(&fc->lock); + res = fc->ring; + goto out_err; + } + + fc->ring = ring; + ring->nr_queues = nr_queues; + ring->fc = fc; + ring->max_payload_sz = max_payload_size; + + spin_unlock(&fc->lock); + return ring; + +out_err: + 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 NULL; + queue->qid = qid; + queue->ring = ring; + spin_lock_init(&queue->lock); + + INIT_LIST_HEAD(&queue->ent_avail_queue); + INIT_LIST_HEAD(&queue->ent_commit_queue); + + spin_lock(&fc->lock); + if (ring->queues[qid]) { + spin_unlock(&fc->lock); + kfree(queue); + return ring->queues[qid]; + } + + /* + * write_once and lock as the caller mostly doesn't take the lock at all + */ + WRITE_ONCE(ring->queues[qid], queue); + spin_unlock(&fc->lock); + + return queue; +} + +/* + * Make a ring entry available for fuse_req assignment + */ +static void fuse_uring_ent_avail(struct fuse_ring_ent *ring_ent, + struct fuse_ring_queue *queue) +{ + list_move(&ring_ent->list, &queue->ent_avail_queue); + ring_ent->state = FRRS_AVAILABLE; +} + +/* + * fuse_uring_req_fetch command handling + */ +static void fuse_uring_do_register(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); + 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 struct fuse_ring_ent * +fuse_uring_create_ring_ent(struct io_uring_cmd *cmd, + struct fuse_ring_queue *queue) +{ + struct fuse_ring *ring = queue->ring; + struct fuse_ring_ent *ent; + size_t payload_size; + struct iovec iov[FUSE_URING_IOV_SEGS]; + int err; + + 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_PTR(err); + } + + /* + * The created queue above does not need to be destructed in + * case of entry errors below, will be done at ring destruction time. + */ + err = -ENOMEM; + ent = kzalloc(sizeof(*ent), GFP_KERNEL_ACCOUNT); + if (!ent) + return ERR_PTR(err); + + INIT_LIST_HEAD(&ent->list); + + ent->queue = queue; + ent->cmd = cmd; + + err = -EINVAL; + if (iov[0].iov_len < sizeof(struct fuse_uring_req_header)) { + pr_info_ratelimited("Invalid header len %zu\n", iov[0].iov_len); + return ERR_PTR(err); + } + + ent->headers = iov[0].iov_base; + ent->payload = iov[1].iov_base; + payload_size = iov[1].iov_len; + + if (payload_size < ring->max_payload_sz) { + pr_info_ratelimited("Invalid req payload len %zu\n", + payload_size); + return ERR_PTR(err); + } + + return ent; +} + +/* Register header and payload buffer with the kernel and fetch a request */ +static int fuse_uring_register(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]; + unsigned int qid = READ_ONCE(cmd_req->qid); + + 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; + } + + err = -ENOMEM; + if (!ring) { + ring = fuse_uring_create(fc); + if (!ring) + return err; + } + + if (qid >= ring->nr_queues) { + pr_info_ratelimited("fuse: Invalid ring qid %u\n", qid); + return -EINVAL; + } + + err = -ENOMEM; + queue = ring->queues[qid]; + if (!queue) { + queue = fuse_uring_create_queue(ring, qid); + if (!queue) + return err; + } + + ring_ent = fuse_uring_create_ring_ent(cmd, queue); + if (IS_ERR(ring_ent)) + return PTR_ERR(ring_ent); + + fuse_uring_do_register(ring_ent, cmd, issue_flags); + + return 0; +} + +/* + * Entry function from io_uring to handle the given passthrough command + * (op code IORING_OP_URING_CMD) + */ +int __maybe_unused fuse_uring_cmd(struct io_uring_cmd *cmd, + unsigned int issue_flags) +{ + struct fuse_dev *fud; + struct fuse_conn *fc; + u32 cmd_op = cmd->cmd_op; + int err; + + if (!enable_uring) { + pr_info_ratelimited("fuse-io-uring is disabled\n"); + return -EOPNOTSUPP; + } + + /* This extra SQE size holds struct fuse_uring_cmd_req */ + if (!(issue_flags & IO_URING_F_SQE128)) + return -EINVAL; + + fud = fuse_get_dev(cmd->file); + if (!fud) { + pr_info_ratelimited("No fuse device found\n"); + return -ENOTCONN; + } + fc = fud->fc; + + if (fc->aborted) + return -ECONNABORTED; + if (!fc->connected) + return -ENOTCONN; + + /* + * fuse_uring_register() needs the ring to be initialized, + * we need to know the max payload size + */ + if (!fc->initialized) + return -EAGAIN; + + switch (cmd_op) { + case FUSE_IO_URING_CMD_REGISTER: + err = fuse_uring_register(cmd, issue_flags, fc); + if (err) { + pr_info_once("FUSE_IO_URING_CMD_REGISTER failed err=%d\n", + err); + return err; + } + break; + default: + return -EINVAL; + } + + return -EIOCBQUEUED; +} diff --git a/fs/fuse/dev_uring_i.h b/fs/fuse/dev_uring_i.h new file mode 100644 index 0000000000000000000000000000000000000000..4e46dd65196d26dabc62dada33b17de9aa511c08 --- /dev/null +++ b/fs/fuse/dev_uring_i.h @@ -0,0 +1,116 @@ +/* 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 { + FRRS_INVALID = 0, + + /* The ring entry received from userspace and it is being processed */ + FRRS_COMMIT, + + /* The ring entry is waiting for new fuse requests */ + FRRS_AVAILABLE, + + /* The ring entry 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_uring_req_header __user *headers; + void __user *payload; + + /* the ring queue that owns the request */ + struct fuse_ring_queue *queue; + + /* fields below are protected by queue->lock */ + + struct io_uring_cmd *cmd; + + struct list_head list; + + enum fuse_ring_req_state state; + + struct fuse_req *fuse_req; + + /* commit id to identify the server reply */ + uint64_t commit_id; +}; + +struct fuse_ring_queue { + /* + * back pointer to the main fuse uring structure that holds this + * queue + */ + struct fuse_ring *ring; + + /* queue id, 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 sent to userspace + */ + struct list_head ent_commit_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; + + /* maximum payload/arg size */ + size_t max_payload_sz; + + struct fuse_ring_queue **queues; +}; + +bool fuse_uring_enabled(void); +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) +{ +} + +static inline bool fuse_uring_enabled(void) +{ + return false; +} + +#endif /* CONFIG_FUSE_IO_URING */ + +#endif /* _FS_FUSE_DEV_URING_I_H */ diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index babddd05303796d689a64f0f5a890066b43170ac..d75dd9b59a5c35b76919db760645464f604517f5 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -923,6 +923,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 3ce4f4e81d09e867c3a7db7b1dbb819f88ed34ef..e4f9bbacfc1bc6f51d5d01b4c47b42cc159ed783 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 @@ -992,6 +993,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); } @@ -1446,6 +1449,13 @@ void fuse_send_init(struct fuse_mount *fm) if (IS_ENABLED(CONFIG_FUSE_PASSTHROUGH)) flags |= FUSE_PASSTHROUGH; + /* + * This is just an information flag for fuse server. No need to check + * the reply - server is either sending IORING_OP_URING_CMD or not. + */ + if (fuse_uring_enabled()) + flags |= FUSE_OVER_IO_URING; + ia->in.flags = flags; ia->in.flags2 = flags >> 32; diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h index f1e99458e29e4fdce5273bc3def242342f207ebd..5e0eb41d967e9de5951673de4405a3ed22cdd8e2 100644 --- a/include/uapi/linux/fuse.h +++ b/include/uapi/linux/fuse.h @@ -220,6 +220,15 @@ * * 7.41 * - add FUSE_ALLOW_IDMAP + * 7.42 + * - Add FUSE_OVER_IO_URING and all other io-uring related flags and data + * structures: + * - struct fuse_uring_ent_in_out + * - struct fuse_uring_req_header + * - struct fuse_uring_cmd_req + * - FUSE_URING_IN_OUT_HEADER_SZ + * - FUSE_URING_OP_IN_OUT_SZ + * - enum fuse_uring_cmd */ #ifndef _LINUX_FUSE_H @@ -255,7 +264,7 @@ #define FUSE_KERNEL_VERSION 7 /** Minor version number of this interface */ -#define FUSE_KERNEL_MINOR_VERSION 41 +#define FUSE_KERNEL_MINOR_VERSION 42 /** The node ID of the root inode */ #define FUSE_ROOT_ID 1 @@ -425,6 +434,7 @@ struct fuse_file_lock { * FUSE_HAS_RESEND: kernel supports resending pending requests, and the high bit * of the request ID indicates resend requests * FUSE_ALLOW_IDMAP: allow creation of idmapped mounts + * FUSE_OVER_IO_URING: Indicate that client supports io-uring */ #define FUSE_ASYNC_READ (1 << 0) #define FUSE_POSIX_LOCKS (1 << 1) @@ -471,6 +481,7 @@ struct fuse_file_lock { /* Obsolete alias for FUSE_DIRECT_IO_ALLOW_MMAP */ #define FUSE_DIRECT_IO_RELAX FUSE_DIRECT_IO_ALLOW_MMAP #define FUSE_ALLOW_IDMAP (1ULL << 40) +#define FUSE_OVER_IO_URING (1ULL << 41) /** * CUSE INIT request/reply flags @@ -1206,4 +1217,67 @@ struct fuse_supp_groups { uint32_t groups[]; }; +/** + * Size of the ring buffer header + */ +#define FUSE_URING_IN_OUT_HEADER_SZ 128 +#define FUSE_URING_OP_IN_OUT_SZ 128 + +/* Used as part of the fuse_uring_req_header */ +struct fuse_uring_ent_in_out { + uint64_t flags; + + /* + * commit ID to be used in a reply to a ring request (see also + * struct fuse_uring_cmd_req) + */ + uint64_t commit_id; + + /* size of user payload buffer */ + uint32_t payload_sz; + uint32_t padding; + + uint64_t reserved; +}; + +/** + * Header for all fuse-io-uring requests + */ +struct fuse_uring_req_header { + /* struct fuse_in_header / struct fuse_out_header */ + char in_out[FUSE_URING_IN_OUT_HEADER_SZ]; + + /* per op code header */ + char op_in[FUSE_URING_OP_IN_OUT_SZ]; + + struct fuse_uring_ent_in_out ring_ent_in_out; +}; + +/** + * sqe commands to the kernel + */ +enum fuse_uring_cmd { + FUSE_IO_URING_CMD_INVALID = 0, + + /* register the request buffer and fetch a fuse request */ + FUSE_IO_URING_CMD_REGISTER = 1, + + /* commit fuse request result and fetch next request */ + FUSE_IO_URING_CMD_COMMIT_AND_FETCH = 2, +}; + +/** + * In the 80B command area of the SQE. + */ +struct fuse_uring_cmd_req { + uint64_t flags; + + /* entry identifier for commits */ + uint64_t commit_id; + + /* queue the command is for (queue index) */ + uint16_t qid; + uint8_t padding[6]; +}; + #endif /* _LINUX_FUSE_H */ From patchwork Tue Jan 7 00:25:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13927929 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 5C2896F099 for ; Tue, 7 Jan 2025 00:25: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=1736209543; cv=fail; b=cbbMBbWQq8oe5k3iqEgxFvS9zWmInndphY2lHIrZWsrjfyALxYMFb13fPwMIPTbWwkHReVeOoyO4OIs8x3493r4xQ5caEEVZAHepXJ1CzYBp0gwKgkrSSf6gcCPU4/qyUxmHrHh3iWam/6Aqpe8AlPKeoC6b3bKvqimugrABGRY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736209543; c=relaxed/simple; bh=455vpR6hkQ2u3HTcvd4tTICV/lcjLmUkyQgxI7osccQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MaxwLWO6GBqYv/DnfaiQ5ak3j/otRu9pgEt0swReZmRK39HYEsO0vYDdYKGVxfy9eKLemVYySHec+5WD4ehR164E4BBPJxBdfJUqAeoGeyd8vrr2eb4G4EnXZk8snnFD7WOhMSMCCr+fxQ9vhfdCNLJpD5UaqoGNyxe4c8bS6xA= 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=AHLy027o; 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="AHLy027o" Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2168.outbound.protection.outlook.com [104.47.55.168]) by mx-outbound45-144.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 07 Jan 2025 00:25:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SDhUE0dC6ndckVWVPjzGhz4hHMb9WVYxr2ncyn2GDZqUlLNO+rx2JjZFSLXsS21KKxzcYzQWSZ6Koxj5HhCApdJCW4/QDVMZPm74gRepr+wHuTBlPZa6K9LTRxCm/8ZXfkIkatKHKK3XQ+9DCYH7eDFZCKBMyA0JP+GEtejVNZxWphf+EBR99+7xi0sBYMACbPgre1vIp3WJ803M5u3/CZ1zd/Zha8+tdgSf/odmbPE6Yo8xcpODDs2RzemM5EQ7deydHZNtoT/onrLGbBH/xu7dExOLkSu03roQABkzDkGIwXkNskmNN0Cib9jxQA4mEetuzvphwA0MeyYjOjW+DA== 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=HuXSOUK7SIRmeDldD+kaeaGEIQyBJaCc0JTjXP0ob2Y=; b=Ik806x+IeFWkuAkIHx4XkSek4SR51WzTHi0uBw9sjqYobbyahlga6hpfIYsrLN3/6N37UODrAyWDK/2i+WMAO2RcJiwK4UnYqJVWaEo76sHvU1JWmjCP4ZkpItexS4jaKikl1Ll4BqcVVRsdQ/MMcS9+ogJ9B2pSyYv1rReoEYwnZArUGFTkv3fUeyZ9OKLMeVprO8BrUAPZL//VkSVOLclTxVWitrrYYLczXqII5+C/uDjJnFt24spoJTm8Tg8pxZsyYaZgtNlkhz0HOVAA6yosrmQOJwdmsGJZ3XQthQOEgC25Xsq6Xb6gDCSgKzFwcKH9BIbnGTUdxlKTN0xFww== 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=HuXSOUK7SIRmeDldD+kaeaGEIQyBJaCc0JTjXP0ob2Y=; b=AHLy027oKzeIUKkCUgsiOn4ALiELsNvISCPbStysP5dTTNhlpZhDmJALupf3Y+CYJ2i4slD3W+NTu5jvXzN+rNvYJCpreChElITBVSLKEtSakJC1Pb7cnIWWj4FYKRgnucgZVmHZ8TiJkRu/QKkyam/nb6jNaibJoEnbY8Ja9y0= Received: from CH2PR17CA0018.namprd17.prod.outlook.com (2603:10b6:610:53::28) by CY5PR19MB6217.namprd19.prod.outlook.com (2603:10b6:930:2a::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.16; Tue, 7 Jan 2025 00:25:19 +0000 Received: from DS3PEPF000099E1.namprd04.prod.outlook.com (2603:10b6:610:53:cafe::4) by CH2PR17CA0018.outlook.office365.com (2603:10b6:610:53::28) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8314.18 via Frontend Transport; Tue, 7 Jan 2025 00:25: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 DS3PEPF000099E1.mail.protection.outlook.com (10.167.17.196) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8335.7 via Frontend Transport; Tue, 7 Jan 2025 00:25:18 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 29D1855; Tue, 7 Jan 2025 00:25:18 +0000 (UTC) From: Bernd Schubert Date: Tue, 07 Jan 2025 01:25:12 +0100 Subject: [PATCH v9 07/17] 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: <20250107-fuse-uring-for-6-10-rfc4-v9-7-9c786f9a7a9d@ddn.com> References: <20250107-fuse-uring-for-6-10-rfc4-v9-0-9c786f9a7a9d@ddn.com> In-Reply-To: <20250107-fuse-uring-for-6-10-rfc4-v9-0-9c786f9a7a9d@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=1736209509; l=3717; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=455vpR6hkQ2u3HTcvd4tTICV/lcjLmUkyQgxI7osccQ=; b=TCWwmXzKTF8KHT7JdLy4Ewdm/RfRjcPH+Umz3B8+QwTnsmERDLvFE4ngYin9Fobh1Iu3UlXV3 MbL/KOLy2zKDfXr4labY/xqe2ylCW/lv0GJjzgghX8Q8P8h5eAJAYZY X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099E1:EE_|CY5PR19MB6217:EE_ X-MS-Office365-Filtering-Correlation-Id: 7df00a6e-9851-40f8-d65e-08dd2eb1c411 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?BAvSctiQCTAq2zxvdXYfZBYlBGyTqkm?= =?utf-8?q?IyB++H7stWegDcVYTbZP+ozBI00tNEMOoBFd/wQ8fpDxJL2ZOFL4pdu07xNl9//Lg?= =?utf-8?q?AUfJ4miBuGMAdiwSQhaheyHw+tYNWPr4kzjWJzNr0qCcAxBio+fuKBiSjxvgGVJIV?= =?utf-8?q?m9uEJ3Jqlbd+bz6eNjS1mVOn7d7Ux738+byd05Y+Z4XC23uyVdSQ5SKiCCkMgaATT?= =?utf-8?q?8Af1+2mkMNXc9hLxK639EIvpcteFMlQ8rjxbOLy/zQqhtXb5LwZMYwVn8r07w6ydo?= =?utf-8?q?JSesZpVCIG13crkZJVjmbq91TTfMkQa0e7lPJr79DASnXTLf0cC6ps5D5sKlQ3RJD?= =?utf-8?q?STirHpS8pjsiFyOR/hx6ROuieLhYgIAXHcC8wcGqSM1vOjnTq3O1fE2cnvsiThMD6?= =?utf-8?q?EeVpSNx/JquauEtCVkWpOa9sHB6X/mtn1KKDBoB9fr5jW1Gf+W44EMeMkb/4QJJfr?= =?utf-8?q?Nc+7kB9lLVQwhYWnbtQOmdSIr9iAglbAYEibt0BVucnAQFaD/GD6AmuREB/Yg3Ysn?= =?utf-8?q?BPsJbwH6NExbrgPhp4wI/K3I4g7h1K1bwaLi6ARpXKjXV/D/qDzc2kZIBS+gc8ZHl?= =?utf-8?q?kBOJzsKlN/CrRBiL8ECAfYTWoyF4IqabrIjatHzwjSPpdf9DDMyprtGDBJawtFQjP?= =?utf-8?q?NkGz/g6MzW8egsoJifrzeqInJlIyGk3LC4ESSIQBkYL3WxF7cmzKsS2cl7M83gp6R?= =?utf-8?q?2KLGdWYkWpl4xhz499l5MGU8wH1KDKUTKmq1sUPNl4tPy0uG+gmARD/vKxSt1h9PW?= =?utf-8?q?g1Hqzqc7ug7oQSmP/Nrn1VEn2GBX87wj/MCf6z3S7izUHtVNBtMC/n6YbCIcAFTNK?= =?utf-8?q?LMyBFipQQrKUXu0uQJE4QZWCoNOFId49jHyXgSJv29nEWCjvaVkdGAz93fCwB9You?= =?utf-8?q?Ov1yyxdP441x7tqp0NMJ9OtS2CYulD1TSmeqra5u9Iu3mWToGywnmvP1EHrWGmdXV?= =?utf-8?q?rhlE+cWtTDHzL/RXHKvtD5sq5Pior2ZFioPy8c3hKcYOJumiGIlpzW7n7urvj8wRu?= =?utf-8?q?3H/dUa4n21KKrsDSOnOORl58gsA9o+I8cTsNv44ZOkOMWkQvbzIgkDEAoTzrxNogq?= =?utf-8?q?q5y9oGCvUvb0wl0e7GOBkniqLdlKwiYays5x7oVylo7y2zjEwZqXkSUC2PAez4H6I?= =?utf-8?q?YkdPJGipxKOH/03/LxSzTSW+/ccUYqAS14l+EXFncF6DdFT8X6v/flmyS7DOmOP6f?= =?utf-8?q?6TVm29teeuThFMb/gMmd2Te+f2hUEL/2WXLNK1dcOPIpQY8AHCAYq/VkhilzG1B6S?= =?utf-8?q?GddoKmaBoynVswBpwqfydfDrWyWgxMvMQCOa5W6lz22TPsBOrWid2HYyPYH31zFTS?= =?utf-8?q?9wfIwS99PcUA1LztWs/Gp3VWXUmcpAvzjboEaiObst6p/MO9yndxOtKKzu0DQTwXr?= =?utf-8?q?rValTSGf3gXJzW/pGjJwUXSHI92ZFk2YAnb5qYe2ftXRnurf+k2HkU=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: hMK+iKxQJI96Jla1EYXDtk5/CVVDbWx3Y6W6fZo7D3S2Pz7D20AQLDt2Rvo9mHNQ6b2Rb2yrnHgUQGJBTvwu/4eauh8jEANhu/c+E3Sw+lvsMD9e4tETJufSz1AiB+ldFcc/fR7zPd+s2iw7ouudN1b3cbXzTZDkKNlV6Ung2SYUhVGr+ifzjhtZrXAOR9jfAMk8V4XSnm4t+RKYrJHYkGYRvhj6H+5BQ+UmmlOQ9NM9+ccMNv44H6mvqzdTy+ce0GXaYMjFqiyNtpNi1jatGYUOaj781MlyfuJF5mHitWUSMK+kM8ZUtbAabasoPDM5YQ15dC7pevabEpTTyIE4TzKlmwzXMwkdPMuYY1EfLi8IihcFxnoDvBGrAAsyFWSpRTmi80SGkqF8SaA4V7wbybCdf6MFWNimdOzX0kQt4jAc+PRv3pBfKtsyEMnQU9hdOP/18ymyeEhdD2jgS5aGVVzgWQyPFkjpt8wYEnaa7xPhFPGmWkQhYOADhcumUuAIgLOgfLCezBsdPUYygwflV6hWebBmCmZiCny52qpifN6xl3scx6p2iRVc6uAiTPzMDnHRqDHNgHAPTnxNMEUb2Th3OjY+cVKijYb5iiF/B6uscqsU7WJK3TDtBUmZZ/FiMA5aY+26wwZCwgsMY5Cz7A== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2025 00:25:18.8820 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7df00a6e-9851-40f8-d65e-08dd2eb1c411 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: DS3PEPF000099E1.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR19MB6217 X-BESS-ID: 1736209526-111664-20218-24697-1 X-BESS-VER: 2019.1_20241219.1759 X-BESS-Apparent-Source-IP: 104.47.55.168 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVsZmBgZAVgZQ0NTMxMAsydQ8OT k1ySwxLdXAOMXANDHV1Nwi2dQgzcJQqTYWALZTIqNBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.261635 [from cloudscan11-187.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-io-uring. 'copy_out_args()' is renamed to 'fuse_copy_out_args'. Signed-off-by: Bernd Schubert Reviewed-by: Joanne Koong --- 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 623c5a067c1841e8210b5b4e063e7b6690f1825a..6ee7e28a84c80a3e7c8dc933986c0388371ff6cd 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -678,22 +678,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; @@ -1054,9 +1040,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; @@ -1933,8 +1919,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); @@ -2036,7 +2022,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 08a7e88e002773fcd18c25a229c7aa6450831401..21eb1bdb492d04f0a406d25bb8d300b34244dce2 100644 --- a/fs/fuse/fuse_dev_i.h +++ b/fs/fuse/fuse_dev_i.h @@ -12,6 +12,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) { /* @@ -23,5 +40,13 @@ 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 Tue Jan 7 00:25:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13927920 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 D30341F94D; Tue, 7 Jan 2025 00:25: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=1736209535; cv=fail; b=suLpsJDzgj46KkUl5MwcLRMBBZbUCf/Ii8SseXHFHNbP2x7G3PrliEvwVYKQhBuPrOBODo9KbjnfLFb4WVVpimwEgov6NRvz8UhvR49jLjESsK9icCFw7o4fr/z1U3BR1YSx/iZxE64zMI8/gZfqKo53KhcJZ8+hpC8L44cjvho= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736209535; c=relaxed/simple; bh=XaOAR0F2EgLfvpkxN5z224zB/8pEgoSlzo5zWOXVVjk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rSaih0moZPxvwQlPAB3nKIGJuOa8Adiu34ZViddbcrLr9mDcq3OkKBNXOuL6RHYU6ZcVQ0SLVRnJhlIEsXNPMr2qio+PWZ+1jseghKS95iVCX6APj6SeCnyW3BKBXRZEvjZeQ8NswAVuUcJ+QPK/9vXySYslmDZ0hLJOUtcjlHk= 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=iB7fMF/S; 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="iB7fMF/S" Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11lp2170.outbound.protection.outlook.com [104.47.56.170]) by mx-outbound47-153.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 07 Jan 2025 00:25:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CLc7v4ZpajeFYe8RrwD685fMNbfhTfWlRhGii0wZBIHcH+nY2OsSG3Yuf+6HUh3fmzn82xhe7Uo9lch9QhkRqeh3P4IcBDkP/ZAdx8Amv3q4iUE9uoY5f3n7dDCTbZP0+PXnWM0vZWswke9J/pQVO0dOrsrQ4A3hdEEMKu+CvZecHoDJZzdeZjxA4XMzdsq1rJEbsGRZvJXM71t6m27efxZRKMzwB75KeExtMulif2QFC881VAiC5y14Q7y+uetqyGd3tkNRmz2G1BQhpFZY9iGA+fnkgkhZwLeBCdqwD0nYhXfg81VK2weC9GAJ3UXgDtQb/FhY+78K3hAoXqDmpA== 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=RlSVBDFakK5n6WKcIUNkf7zDr/gts/fhzdsUjhAC3Ls=; b=XTG21X5c9Hn7hfXf6YWtbaLgu6eJTxvRj7dfwRrC80z3DEVC7fER5wPyk73JKdZEV3Zu9TvJykt5j8RW5fVHs3zHg2Tt4KKX4nyfW3B1FK2G3OZghRN5nqZl8C8SXutpWvQ6sRyRnoYux6nC+lDouaN5c+yu3/BiYfex/Tvi4VjU2o9pluKYTM6z1hA14gpIfcRQBko+EMfmvYyGLYd09/C3NCMl0XNRl92soEYcD758RLFHDYFT1tk0mr+zpAHOadIGaB64fUO2qf3H6P3sfdW0fbiXxhQcp7TC5PkZIXLqilRKf8BHkWYEoq/S7KpiAkp1NeNOGoJiqLHW2wYtSw== 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=RlSVBDFakK5n6WKcIUNkf7zDr/gts/fhzdsUjhAC3Ls=; b=iB7fMF/SOXhVrau8as6GhCTySNz6bXN57NfX1n7E0Y43/QHdXjNTCA/B3MvxruDOLKT3fNiHZkAoynBnG8/qi9CC0CDIVmqWIJrauFj6UWACcqHMCPDMbrB3PIRgUcOlWTO6xnFpZiPCvaBCSi73ZzX5qIvWbsBMdIZVWBwGmoY= Received: from BN1PR10CA0008.namprd10.prod.outlook.com (2603:10b6:408:e0::13) by SA1PR19MB4927.namprd19.prod.outlook.com (2603:10b6:806:1aa::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.17; Tue, 7 Jan 2025 00:25:20 +0000 Received: from BN2PEPF000044AC.namprd04.prod.outlook.com (2603:10b6:408:e0:cafe::f6) by BN1PR10CA0008.outlook.office365.com (2603:10b6:408:e0::13) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8314.18 via Frontend Transport; Tue, 7 Jan 2025 00:25: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 BN2PEPF000044AC.mail.protection.outlook.com (10.167.243.107) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8335.7 via Frontend Transport; Tue, 7 Jan 2025 00:25:19 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 22DEF1DA; Tue, 7 Jan 2025 00:25:19 +0000 (UTC) From: Bernd Schubert Date: Tue, 07 Jan 2025 01:25:13 +0100 Subject: [PATCH v9 08/17] 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: <20250107-fuse-uring-for-6-10-rfc4-v9-8-9c786f9a7a9d@ddn.com> References: <20250107-fuse-uring-for-6-10-rfc4-v9-0-9c786f9a7a9d@ddn.com> In-Reply-To: <20250107-fuse-uring-for-6-10-rfc4-v9-0-9c786f9a7a9d@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=1736209509; l=1729; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=XaOAR0F2EgLfvpkxN5z224zB/8pEgoSlzo5zWOXVVjk=; b=UlEHVwUWysx1p4xIuHTTzm4dHhAgj2/P0DpMXdXtxX4KaWNtwIOpB2PmZhtKDJr7+940qYrkW i2RoCz6+u78BxcQLysVbAyE+Gcr463/Y8PL5FhILLHtNBY79sthKulc X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF000044AC:EE_|SA1PR19MB4927:EE_ X-MS-Office365-Filtering-Correlation-Id: 51e9b36f-aae6-4bc5-188f-08dd2eb1c4bb 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?ttM8BjfLjcXuAlgtBFBSd+rvfMfIjJS?= =?utf-8?q?mOhS8l13DY7Rq7ThqpM4kNOQP1nMK2P9aeMsXeQ7J55BoozgYpJHp2E8uSmsk2Wna?= =?utf-8?q?q+H5TmjV+97vqlk/Hmmlc3A8ZR5UN2yCtirMydVV/BG5EJfeACv721+Aypo/Z2F3Y?= =?utf-8?q?Haujq8L9bxSXjnZanTE6s+0PfZNeM+W/r5tmQ6s1rCzSp3PrObCcw61fYeBiXq98Y?= =?utf-8?q?T9t4tEvP1ZRT0otYSgIPmXGbR2zTePLo72ZMpXzW9VQJhl9QbpVTCXtHp2k5LV8si?= =?utf-8?q?ilxKeNLyk8CRX+A9YoMzUHw2/TW2vUa1VLWZKZMI8MY1xp45UZTIS6Dq+NRtYHsPQ?= =?utf-8?q?QVJNpFN3RxYS5PzOf/NIkaMMWurg6uLLdJro9+qcznglcwGcwMR8d1SwjsLCCKE80?= =?utf-8?q?Clu+8KbV3ho4q3/Q0xTFsopcpcZI4d/nPMFoD3l4VKjKRo7+nkGqQjb/pNu+EDY2s?= =?utf-8?q?C/RPKAbJ/xGmhA6GxUyQTAYgbugm3mzt2MfKGH6r2vSWuej3nBX9YFjx1ixxdggPJ?= =?utf-8?q?POQ7b9k9aqHnG8tic2169/S/tC8sVBF4tx8ERoMcsLiWf5psYw23yz8MDoAgxorLh?= =?utf-8?q?pkt/ooVORoZa6IPkmuad4ObVdpFIMjCB4rVYNudhvkjilC1rcpmZrT8Gw8BthUlQD?= =?utf-8?q?GVFRhmUz5hzWJaj+pehD0Ithxk9ErBNwgRCWVWoustr7VkTHrFHBMtM8fOJlayRoP?= =?utf-8?q?M5RbWbmgzs13z6YIOIqMlIrzfc8vCYZMt2kZc61UrQLgcEOWAp3lFs0QK0nwRfVJf?= =?utf-8?q?weNuszVMvzeNugxVYCi+pByWEPiKemZIzZ7xci6a83acW9289X+D/mDpPkBh9l3QP?= =?utf-8?q?ZLA0y8HQFEeQ+YpnBb7ggIsqegT3FukabhT7Dljt6Cv77j0hpbvEf8EBPzb517ssH?= =?utf-8?q?bLzYCgXJoJvz0mdYFUX3jalAyH8Gz1NVW//aD967GppO7yjdlygfO+UnsPelbMoTA?= =?utf-8?q?A/T0mCERypgMOmEppcyf0pNMl1WxewOUXRAlq7/wz/i52CDFRW0ul6P3zwm+//LaB?= =?utf-8?q?7npFn7x6jaDzlVCyj+OKcQE+P14Ure60DzsH80myeqIIEbrxKhjBxdSDlmuYe0Nkg?= =?utf-8?q?TsokzrSh4T+xL/PDUUqHA3cT7XjwhfIM17IM7mit991z7X3vejuDhV1A+Ffg3wNXS?= =?utf-8?q?0Oy0c6IINDmdwkWEv659tvVuptiZb3p/SGvZ2ebDWzq/vfaK2Wgs18kiTHKTQxeog?= =?utf-8?q?HDsTSIAP1wcJkev1XPFXnnlteOX6o27CYZ8yB00nOQExdKP/3MEDAvUeWruVvrSpy?= =?utf-8?q?Au4sFUPVyQO2h5r+1FUdfBvPn4Vcl6A2vreewrryCgGJKgjbKAxwad35nS6Ms53Cf?= =?utf-8?q?PF8onCdOdRe1D5NFONgKLzeI7Du/9RAzaCy2FXjbSml1XVGdNk7b1Ar+MaAHqkfTd?= =?utf-8?q?BwU0hyERGB1drb2oETXGwXy0jqCDyA1DEjPvLzG9KAI8clPXI00JOQ=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: kIA8qPMYhJBHF31zJzMmb8W+wQfz9fd5YhDcUCoQRRyp83FW69zcaItBypm0JcoEsW+Im+HXDLZgKz0Wo2ZZ7WTRINxycLpxiudnLpakzY8996Wr2irTa/8aZ3xpNtKilm7QYekeR8nNbx/Pk1G+zEWl9LasDuWO2zPR/ds7z2IDuCslSwNco5svrsuji818ih7p+x0asy4xVbMFlcjLZxvEBl4ZVNJ3t6INvwGtpsr81/HZ4FhoSFmk+tQ60U49s8bNAdtiEr0SeG2GkA+mZdrtrd+H2SyDDqQlrsu0jl5clII1IYkxJVqrloQKGhvNWjPad5U1kCSrsqD5oRSPRtuhKto8eHHT1/NDUeje2fDtWcreHgQ59TeVTGZVYPWuyKorqZtWUnFG9pl7JyFBg7Q4uSNKxLCL9Nxxz8TUdJI64zZ4GLkP8JNsOrkjKmYWtURs4YHSLJqG8ZatNfr1YkF+GyOvwTN1fW3Bo+ZQn6qCogPQ7jBb2beyeIK98I4rfXMXRUfBOccVlzKSHa+CmxkHmzsjr57ISMca4lHlKyDNdkQ4S1SCT8fm9+McwjdKA0c7MQgqUqmOYzD/W6HsXjNlbUgMHPZdTAeICk+tOGRWaUfrf3uPdFKRR0/jq+5k+OIfIPM7GbPWT6pBtz/4AA== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2025 00:25:19.9132 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 51e9b36f-aae6-4bc5-188f-08dd2eb1c4bb 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: BN2PEPF000044AC.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR19MB4927 X-BESS-ID: 1736209526-112185-13543-25353-1 X-BESS-VER: 2019.1_20241219.1759 X-BESS-Apparent-Source-IP: 104.47.56.170 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoZm5sZAVgZQ0Nzc0MIgzdIkyc DAIsU4LSXVwMTY1DI1ydDE2NAozdBIqTYWAJ8J/ORBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.261635 [from cloudscan15-3.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 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 | 4 ++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 6ee7e28a84c80a3e7c8dc933986c0388371ff6cd..8b03a540e151daa1f62986aa79030e9e7a456059 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -786,6 +786,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.copied_sz += ncpy; + return ncpy; } @@ -1922,7 +1925,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 21eb1bdb492d04f0a406d25bb8d300b34244dce2..4a8a4feb2df53fb84938a6711e6bcfd0f1b9f615 100644 --- a/fs/fuse/fuse_dev_i.h +++ b/fs/fuse/fuse_dev_i.h @@ -27,6 +27,10 @@ struct fuse_copy_state { unsigned int len; unsigned int offset; unsigned int move_pages:1; + unsigned int is_uring:1; + struct { + unsigned int copied_sz; /* copied size into the user buffer */ + } ring; }; static inline struct fuse_dev *fuse_get_dev(struct file *file) From patchwork Tue Jan 7 00:25:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13927923 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 3EA3C208D0; Tue, 7 Jan 2025 00:25:32 +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=1736209537; cv=fail; b=gD02Ib9xwJy5rth5c/lP0F26my8R6FPnQLyssGOoIAGuMor0FystXo/3Zmw80obb3eIHkaOTHrEvf6hvurXDVap2Uu+cpmIMRha/PdHtkK5b6zuMGsMnSOa86HVtt+DYpJQI96V3TCY8o4qgvGiwtZYwWh6Xtdf3CI4X4JkWKR4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736209537; c=relaxed/simple; bh=Ya1E+Ku/QRkwCEaIbyaS0TPDqDs2gP54NDs4ZV63gYQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gexK33vulGg7eR7/Js211e5PxuQHqNRvi4LDZuzYI4Xb5RRuM5OT0+Va5pe1/7YJzi29CULUpuXgTs5LNGAkN20pjH6eSBIKHpCgobZ7QZFGBWN0khRD0K7PJJ1OIQvYVpmvazonDxtkvhVTJhWe6V2xRA0zdP+0GoRDTmuO8ww= 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=XmJF+6jI; 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="XmJF+6jI" Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04lp2175.outbound.protection.outlook.com [104.47.73.175]) by mx-outbound47-153.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 07 Jan 2025 00:25:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hF43LKbcUKxQN3AsjfTlKsGD3952dOrB0xiZLg1VPoS6n2otY/b06KTTsSCngJ2ri6VNSNJnDS16QNJKJvW8nRVu65z5ginczwdL8WwFY3bAg+CDVEXU3mh7mArDB2LXAqdqJwuwjXSASOu/ehlr817uwruaIT9LSeY1poqZNWwTsYIC3PcAGPkz96gvw8htO3J3/oruMzKPmVfKnpFU1JXW3hexvqqJixpLQ1aYQae1hzQ+fDKxGfuUEKx5w8UP3Rb11ifzpgCQSMMPXB1B6ha4o2Ax1PSAZ7inW2H4B2pzglV8m8wTiVsEgF8pBacYGXs65h0ZNXy1AKpkFWpHeQ== 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=h6RfwqruhsUJ24uvHOhy9dXWf83Pkk0jDujN/3YHBFg=; b=raF7Ayppe1VGvh1D6Th8pz8s2mf854a04wnBXoJdus2GRRaNtASpEwGxOGA4Cuf8v0WrhvLX29WgYYofzSvvZr9lk9Rg9kkjU6zuk51ocOrITpcbVHrmTsgKnVgq9sK9GsKIPC8QoGjS4kgrWHsr2nSwE7c4AZUb/wO3HJ8vuq3jhAaVlvAjtbxnuZFQ+YQYvpYDQGreX3VO2a2s14uqxij5ugqfk/wqE89TwM8/n+PfPlG++qCuI/4c9wBz11pbf2bFSwI/22tm9UMA+2pUCDfHdkDoggUqre7mtODjPjEjbfnfWToexMK+taQTWaD0kQU8XxuJcfDRhUDH0m2Ocg== 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=h6RfwqruhsUJ24uvHOhy9dXWf83Pkk0jDujN/3YHBFg=; b=XmJF+6jIxGuULICNLDMJGxRRIyiMcxK3iJIYOzfgoZBnhPVSwRJMDEJcxTbepsHzw2Fw5I0o9EqGFTBG52zxLHn5b5xjc7EQN2ohpJiHIjZTofMY6uIkSbLxM0eChoZFW++bVz2yIHIUO6g9K1KkGzENkGDh3vpvMakoS926MTw= Received: from CH2PR17CA0001.namprd17.prod.outlook.com (2603:10b6:610:53::11) by PH8PR19MB7782.namprd19.prod.outlook.com (2603:10b6:510:23a::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.17; Tue, 7 Jan 2025 00:25:21 +0000 Received: from DS3PEPF000099E1.namprd04.prod.outlook.com (2603:10b6:610:53:cafe::d6) by CH2PR17CA0001.outlook.office365.com (2603:10b6:610:53::11) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8314.17 via Frontend Transport; Tue, 7 Jan 2025 00:25: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 DS3PEPF000099E1.mail.protection.outlook.com (10.167.17.196) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8335.7 via Frontend Transport; Tue, 7 Jan 2025 00:25:20 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 1B6F44D; Tue, 7 Jan 2025 00:25:19 +0000 (UTC) From: Bernd Schubert Date: Tue, 07 Jan 2025 01:25:14 +0100 Subject: [PATCH v9 09/17] fuse: {io-uring} Make hash-list req unique finding functions non-static Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250107-fuse-uring-for-6-10-rfc4-v9-9-9c786f9a7a9d@ddn.com> References: <20250107-fuse-uring-for-6-10-rfc4-v9-0-9c786f9a7a9d@ddn.com> In-Reply-To: <20250107-fuse-uring-for-6-10-rfc4-v9-0-9c786f9a7a9d@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=1736209509; l=3448; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=Ya1E+Ku/QRkwCEaIbyaS0TPDqDs2gP54NDs4ZV63gYQ=; b=BjDYJjaZ9JsrfKqh0x07R+WHqUT6iISdsNpjfJvCiyFWXc0XuBDt1xeW+IDzmkmBYvTJBhiS/ G9TtwXdyDXPAdTC2Iio+N6VC5mQEm7EM6qQoZQj/hwwI4CYHtBXHKuD X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099E1:EE_|PH8PR19MB7782:EE_ X-MS-Office365-Filtering-Correlation-Id: fa32dd1d-7b48-4b0c-7b5b-08dd2eb1c51a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|7416014|1800799024|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?Rr/AEM9RIc5FKDuL6FbQxFt8OD76pOy?= =?utf-8?q?JI9LNMZI5zsUnrHcgtIXv+1Wo5F323+ZHzVcauLBZ2Mk0ulZ9Q5kTucJ4HKxdeWYc?= =?utf-8?q?X2a17BO4IQidwbylj6jb2glk9983LNsjjPJMCWE2cLjFh6BTEBoZ95f59p66FdGV5?= =?utf-8?q?4S98XnFyZI+Nc8XyuToNtJ/hOcSHRsXeTW9EQ/aB5KUrdtwWLN034Q87qyBLZeW+a?= =?utf-8?q?ltxCGjr2wnXJsfOyyFz6XN43Hv5MhPqsfP8RR7tf9bsgkmW0gHTSYdZ6rsJ45L3t3?= =?utf-8?q?wkNoygLLojZ6LcBNLqpmAGoSju80LhAjnhcLzLPdMoZisKFj8gWd1/dKYDP8QEuir?= =?utf-8?q?BfY+hC3WiKGTy5xyunPJEn/9KgFLG5g3gfARbdYu1Ptbtho2igXjkMdoDOP6+Ahh7?= =?utf-8?q?+yBrNzvfJKK9HGJCsUMyW7jHB0VmuDQuXztPEp4DXoWXEp4vjFB/qLAvJRb4Jo7Wz?= =?utf-8?q?+m73SgEy+hCdBqM3yGvyJrmdt/7jFmCjQy0p6WzmKobgOyrnTjShA+9vp90XOrehf?= =?utf-8?q?96hxzbCoL6UrR08p3Q6TlUavbtT68LXyY1llksq9B9DYLgjN4L03WqCFVy9+YIc8z?= =?utf-8?q?OJsF13DhIeimxRflZBpAAwDS2xft2zK0eMmcqGFT1ZHjxHWTDJHPhxXYwWjgjsYA0?= =?utf-8?q?mivTJSFMLjPt8WYKIK9m1LQ0rjS/m9jvifMQAib05KevP7tMJC95Qf8cEoHnjaH4X?= =?utf-8?q?ySY3g3LR+cVq6kX2t480j8Rw8r2pdeOmfUXtWU01ij0+oaQtol/MoiWiFQTkf/VtP?= =?utf-8?q?qRQAGyGcwkaFGwgigZaAsw3qEUVPDOnq1xF+apvOVV/dSAcjk0IeuBAJv39rNvPHk?= =?utf-8?q?+kbFwksuIcjMyUMxvHSL8oB881xoHWU26mP3ePCcz1RiEmPkOSPYU1HRX9Y1Xg3t7?= =?utf-8?q?qYUdXPUaRdoTYazFB5snIJrHRp8/147LMXNKDk+M0mtst55nGryM5ZVe0evzzNTtU?= =?utf-8?q?OyhVFKJ0EpcdsXh8r69AylPVvYobOcfod+Shj3KKdw+mdK4pAS0TZnFOb30uUC8xY?= =?utf-8?q?GIKr8VGusL5RJsOXepLMUu9kYBjKWtyTwPFh9YZOEAvhLDydAMh3+2zg45voywOrW?= =?utf-8?q?TNfCZ5z6b7PNApoDtFNg0LhHFkvFfxYf6BLItArCaLOmafHGkd665gih27IAxvIy0?= =?utf-8?q?oBTNhl7Pwjh/DY+gt+VJUfAnhXq26u5IIGcpKx3kuMPhu4kcEq/hRu3SPiMG7UOJH?= =?utf-8?q?kxb2vjp59vGxZNaOx2jqvKlBB4PxPR4ybbQ7T7h/zZs9hl2kAIExkXykuWXo/S7ns?= =?utf-8?q?X4h2DqAwaWXvUgNiVKj2rLf/0CGAanxDFc2qtAsnTNPKyMhjTHdZIHwHQZcgnYhmT?= =?utf-8?q?Yv//8hLkYRUPjfZ9JE7DlOzL4stG2bT0vp2Y079BXrBzbAd9k+3glwVsJJD2g135R?= =?utf-8?q?I/4+Ouga0IYI7Js0lbY4D2iD98ErNGSG3KiDC6Vxu7bG3ZrYw6gEHw=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)(7416014)(1800799024)(376014)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: yxZ1wME/xdFWAbb1/cEyMVHtTf0vRAVvrprtJKF91d5MIoRPIABN4y3ZYZNR+/OVBC7hVqzRbjoWDeEIgk7heZRokyQh+Hl7EtvV2moRCgUWwSGHshfg7eJj3r4FkClHQyO/8Vqsr/LMjXsOvTwINj17jqcg6hnGiiMjS+eDTz2VCh1oFoeBEMWHVKbfBGSVV4D+CfkUFkCssHXxQJot5R9FAE5/YGosHVWgpxSlaJLDZ/8Sg3OGDqLblVhH8TtozJJzlgfvyh+7Uv7YID7zfhThraTT60EcBrw1XuYqui4CEdP8AnfdispY8nCxYAmvME27URrNIX/h6s3H2XkTaBAeW8d6jQrEDNnceCyLid8mmU1IRWMmWdwqsXQ0PKrwvyALWhjT2E6AM6bzyACFliC4rZn1vVvZbdtHcRLGwCH2yi8eo/yTAkxX45y7rf1Ws0LJEtLGgF9QjcQpJkHJYI3d1xi5vpu98FHOCpDv9K/rBaq9clZ/UE7d3/Mqhg9NFsXz1E3Im4sjy/K7/l5qbwb0r8cT6GRI9BZLlyq3WGiLBtX35xHGIOTKIsFPr660+RhyIv+xTWj/9ekQYxMLydO3Snu9lPJrFCRZaJcipysHgwWv64/+NfEVmW3Cu+Pwj2V4t4DH/Et/dTyM9eqsHA== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2025 00:25:20.6477 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fa32dd1d-7b48-4b0c-7b5b-08dd2eb1c51a 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: DS3PEPF000099E1.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR19MB7782 X-BESS-ID: 1736209527-112185-13553-25355-1 X-BESS-VER: 2019.1_20241219.1759 X-BESS-Apparent-Source-IP: 104.47.73.175 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVsbGJsZAVgZQ0MAyzSLFwsTIyN zEMi3V0CjVzNzSPNHcPNXSwtDczCRVqTYWAL2zPpRBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.261635 [from cloudscan10-24.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 fuse-over-io-uring uses existing functions to find requests based on their unique id - make these functions non-static. Signed-off-by: Bernd Schubert Reviewed-by: Joanne Koong --- fs/fuse/dev.c | 6 +++--- fs/fuse/fuse_dev_i.h | 6 ++++++ fs/fuse/fuse_i.h | 5 +++++ fs/fuse/inode.c | 2 +- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 8b03a540e151daa1f62986aa79030e9e7a456059..aa33eba51c51dff6af2cdcf60bed9c3f6b4bc0d0 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -220,7 +220,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); } @@ -1910,7 +1910,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; @@ -1994,7 +1994,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/fuse_dev_i.h b/fs/fuse/fuse_dev_i.h index 4a8a4feb2df53fb84938a6711e6bcfd0f1b9f615..599a61536f8c85b3631b8584247a917bda92e719 100644 --- a/fs/fuse/fuse_dev_i.h +++ b/fs/fuse/fuse_dev_i.h @@ -7,6 +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) @@ -14,6 +15,8 @@ struct fuse_arg; struct fuse_args; +struct fuse_pqueue; +struct fuse_req; struct fuse_copy_state { int write; @@ -42,6 +45,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 d75dd9b59a5c35b76919db760645464f604517f5..e545b0864dd51e82df61cc39bdf65d3d36a418dc 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -1237,6 +1237,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 e4f9bbacfc1bc6f51d5d01b4c47b42cc159ed783..328797b9aac9a816a4ad2c69b6880dc6ef6222b0 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -938,7 +938,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 Tue Jan 7 00:25:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13927933 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 4815980BFF for ; Tue, 7 Jan 2025 00:25:41 +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=1736209548; cv=fail; b=gP/M0V+cCqBJ6MhAX8JmrBro/sYu1o2XkIlgd71KD5D2hw2uHBIQq+t9rRzCme1/r9mQ6AmVvk9rMbi5AZGAGhfXhMZX9RZ9JcOhmn7cjoXhcwReww/7t/OWFo3+dElSfVarJEYABCh1ccT3zrth3bWVTzc7p/0dcOKaM4vopA4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736209548; c=relaxed/simple; bh=dSCAEfSgLkiYei/XmiPlLaIXgD77ZRwwbeQrvA8DELw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PtamK3nA3h13tImloHlMHqSg8pdkdOx7+Kg41Swe+FhXPgpW1yqWtVfTYWx1Qtdm1kd5ms+p7tUKV5qOsXnHk356+jY+Tw0sm9gFjVXw79tRYnklpEY3KyOQCiFTqecgIolho0cTIn35l+JKybRimsLmZie0LHQ8ON1fa5WWGck= 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=RleUVS2p; 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="RleUVS2p" Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2046.outbound.protection.outlook.com [104.47.55.46]) by mx-outbound45-144.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 07 Jan 2025 00:25:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nPdVFumbEEwsYltgl/EnyIZefj3yZHlAn9vZrmJ4utGsyAH5w8BwIbUbkjPT+Om6OwUyV+lPVEBGc1JTxhkJMCGqxI1SOmLuMj7Yjljm5PW/Y3K+KssvQgPgsStqNPKW6bNA7kqVaa9fNkYKV0EK3ZH+z6pYKw0kpNBeXkmcH53krZMoZ4SfgRponKZV+H6jQt/HCA3FOnOQokQF4kHp2D6tFlSszxMg7op2DxID52vNFplXENgzi/B6Vsb5eP+1lY0dJuaAccwSHHshxpSJBJUIbaKOzLHE76XFmPz5gD09gaRP4zEppRGSs/kVg5QgjfzExJXCOMI1aKPVDot2eA== 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=325DGlVwqkIo2XMaBUFl9I8Ms5qb5Pj43WbHrk7BX1M=; b=oPni5xqbC2umX3lP9j/eFK8kOhoI0QyS6M7Opgqn8yEPaycPxlcKLzT1+dp6SopZxh1AYB1++n4TkpsUnvk9XBmrdISTteJHtpRQwTlKvPYsePmwn0JtSA+jXyg2Mblm8OMKo0IiGmLUooaeCiXYS0XjLdrPRNGBdTZ1/SZrXCURA5EBFfpheEtyTOHjwPNLB33YZNUC3X3GinrWO6tnRR5rvUdqEGu0UBPhZvfEPKZCvEk+CGJYxceEBS3/Xytr0nc10aERLSiUrEag2D3T5HaPwUhtGa37btAjTbhGBdb906LtVjnrTpJTuzzbectx7K83VCVCOApwv7lfCG/Rqw== 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=325DGlVwqkIo2XMaBUFl9I8Ms5qb5Pj43WbHrk7BX1M=; b=RleUVS2plCeabe92h0hkiS6S3DkiQD2EuWLE1nEIaSzRYGp3EmnTqlVJ7BUOitlOj31qPDob11wJY1HGC8EHkZxaq4isR48jineR7gsqMCx1UuA4wYGfm+T7VFAOJQs66B6gzvNAw8a8KEX1vJ3diK9jY8yNsv5z5ndeiAPxKtw= Received: from DS7PR06CA0002.namprd06.prod.outlook.com (2603:10b6:8:2a::16) by SJ0PR19MB4638.namprd19.prod.outlook.com (2603:10b6:a03:279::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.17; Tue, 7 Jan 2025 00:25:22 +0000 Received: from DS3PEPF000099E2.namprd04.prod.outlook.com (2603:10b6:8:2a:cafe::80) by DS7PR06CA0002.outlook.office365.com (2603:10b6:8:2a::16) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8314.17 via Frontend Transport; Tue, 7 Jan 2025 00:25: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 DS3PEPF000099E2.mail.protection.outlook.com (10.167.17.201) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8335.7 via Frontend Transport; Tue, 7 Jan 2025 00:25:21 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 13F7D55; Tue, 7 Jan 2025 00:25:20 +0000 (UTC) From: Bernd Schubert Date: Tue, 07 Jan 2025 01:25:15 +0100 Subject: [PATCH v9 10/17] fuse: Add io-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: <20250107-fuse-uring-for-6-10-rfc4-v9-10-9c786f9a7a9d@ddn.com> References: <20250107-fuse-uring-for-6-10-rfc4-v9-0-9c786f9a7a9d@ddn.com> In-Reply-To: <20250107-fuse-uring-for-6-10-rfc4-v9-0-9c786f9a7a9d@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=1736209509; l=15633; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=dSCAEfSgLkiYei/XmiPlLaIXgD77ZRwwbeQrvA8DELw=; b=c/FjBv3MuoN/44I6pCadtnJ3iessvpuWUr8uUWsD0SDJ2BTN+BvLEuycFDlK3iZjJ8nbyKsSU RsLMiEOa1jmC+z/iGhVvmkigX/evI4KllSgDfQ6ZUJsrrTxBDi5x/OW X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099E2:EE_|SJ0PR19MB4638:EE_ X-MS-Office365-Filtering-Correlation-Id: bb6258fb-5749-47a8-6425-08dd2eb1c5c1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|376014|7416014|1800799024; X-Microsoft-Antispam-Message-Info: =?utf-8?q?AlYpkZVcVK0v5NcCro2mi9UkBhRwP3Q?= =?utf-8?q?cBK4JGSAQxLUOw3ztdxhcqpSUOQEfSKzPuIbN4AIYF8Bldz+qeGRsaNceO+fV8J2A?= =?utf-8?q?n0w7irqUXCBGDoBDqW/RzbE+mKi8luNt0jtpBIIu49F/KVxgY/CsyBzw/w6EN6HWP?= =?utf-8?q?7b5o8pNscMs/v2wlohjRw/iHdn2T0scx/YlsoTPoHvn60wdCys4m99105G54C7fVc?= =?utf-8?q?b8b/oBwrWt1FPERng0DGaJkjZXlSzkGCWLIqeWMPYiQgTUKLAQl5wa7F2IvgEIWVK?= =?utf-8?q?lXl3hH/p/54Q12ymBu9Bu1MVJCtzT26+BcWijecUNtZB/WNFqv5G7g4h0DEqwglay?= =?utf-8?q?l4dfycZnS5N2rCfpkKwdNO9K+ZcKsjjBo6zJoJbH4m+USUSVcDv/YZWiWCtdnp6DA?= =?utf-8?q?/flWRA94WbgL/dsehv4xkUVQemJ0rHP6tS9g9Rn0m2LUbN0AdnKPa+M6SAi4b9OAb?= =?utf-8?q?m3eALq2xTLXluT8iCDbD5ZSWWLWcTxlEXu2MtluBc1gyCPpsP1/oIc2TKw/JJHw5M?= =?utf-8?q?U4+gY/lPhwYOLhK+sV8bPzGtdqEtubo43zAwvDrqh2WfPzirgK8feLHuxi9qSXguL?= =?utf-8?q?o1Mjgmz2WXavLm+UBSs83E1UB2YJrZb54LzaZZ7RlWTtTsdPI93tjjkz/pL1DVp+l?= =?utf-8?q?WO6y/9G/FyHmMfT4sh4JjQe51FJ5S0RRfMEu38xkkTkhd7aUxdJZAvNvbYPKq1j1k?= =?utf-8?q?bbqpSdSgRMecyYcwJE5UszLGdhjCmmJRJDEFSWsGNcj/i4j0mjSBXBwkAyPzq8lTo?= =?utf-8?q?oaRL2wFB2sBquK/cW9Dt309roWr/iuI8Yb3oMePre8kHxXmnNcp0nYXJ25Nu529R/?= =?utf-8?q?YZL7KRji6nd1z+FEsyaH+IbnLtKvGwG25MqifQUo5LwwMiQLrRMAgisQ6Id8T4Wr6?= =?utf-8?q?IF7P3FeKyJ3CbuA52GQ9iDIUZufPoUkJqZWxfF/QX3L9nLOr1BToXH9v1ON/BsEOF?= =?utf-8?q?ZUquLNMVKMD/sQNYMEMT4V/evpfujo9guhKdmMjmQlvfzC6M06J+yM8ihpYmvj94b?= =?utf-8?q?Dcbsc9Mn5G+uE3xvUGMGzKWjYvnZUYX7w7U1hopYETzZo74TGwvfjt+z4tyWmFCpU?= =?utf-8?q?uhXwWG4cPdCEmMwO7WOaPogfygH608U+KD7gUWRRxXdsgm8w0uOu569tdrMGF8SHk?= =?utf-8?q?e4DR9np7HTyRjgY2FBkU72egvV4tOAjBDBeC0CK1hYu8O004WGzxz87m4kXCQSJAx?= =?utf-8?q?mm6ghhxqzsqk7zl8944uvE3fTM/mJVms3F+gS2DsEmyMr+RWJr+/pyU0VxThprM1b?= =?utf-8?q?eqlYtTF6slQNdZ64pvcWJ6onMg483sru3hsJM1+F/2D650X8e1ZkAQIxBIL2P/xVY?= =?utf-8?q?Q8ny0/38xQLq08Tc23P/yCnHICMTQ0QvsX9mCzSkY5Y+fF5ktjTHkGMpWVJiqNHlB?= =?utf-8?q?SWms4sD0HDIJYBH9zw0hrH5jSGsDCSNMqQGeJJjJXZfRPbtK94slHc=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)(376014)(7416014)(1800799024);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 07A0DFYzdIPRzz9SFzNeu8MhseBQCoccxpDmu1ztgQx17nigO+HATfbo0uMBao12DXMsQMUYPysbXLsvsY26AssTUIPaZsI0fRuIw+VoX+lU4LWy6rHpUEKMwd5t2RiHj9ghc5gf/aC0Aae0LT0mZMjoC4nD8y+3Py1+URBlgKj05i88rXNZeOYsda02qOMkLWcKEpY3kqU+HRoFx3pZjViQ9rK/3tyfg8k0cbqgFjHEZ82R47POiiLDw7sjFMvZ4I6/h/M3yM4yf/KQlQFG5dzPLey+6XiOSFUYJ7IjE4tg3e8DygF61+/jFrnRUTudLlnlPFqxtPo2k2q1iO+zw4Jf8ny266UGQ3RKFAECH0Zo5dqvs0qkPkNJ5Uz5D7zQZbl0TEXto7dvGa2U5Ps5fBvV5TauozF5SvX8x1DoTkMRa3nXwdc2cfrDre0+LxDPAbMIqB4lK284KFKWSnwL05YOvM9IdW23bia49kYI8Y2QeGl0WV9Mau7jAjr1fGeML4hqT3Fz8tYu1bGbw/yLGZPcNF4J1pJM339F5zaTbDGHAkvpfKm0G24dJXNf407FWZcqLu2araY/C3f6PorBVjNO2l3jQ4rJd5l+FCSSgXhxtxALNf7U1K/X7LvvYeo/teK4914K8SspZcb8J8wj6A== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2025 00:25:21.6321 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bb6258fb-5749-47a8-6425-08dd2eb1c5c1 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: DS3PEPF000099E2.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR19MB4638 X-BESS-ID: 1736209528-111664-20223-24716-1 X-BESS-VER: 2019.1_20241219.1759 X-BESS-Apparent-Source-IP: 104.47.55.46 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoamBqbmQGYGUDTZ1DzZyNjQOM 3C1NI4ycjIMNU42SjNIDXFMskyMdkyWak2FgDg04/zQgAAAA== X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.261635 [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 This adds support for fuse request completion through ring SQEs (FUSE_URING_CMD_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_uring.c | 450 ++++++++++++++++++++++++++++++++++++++++++++++++++ fs/fuse/dev_uring_i.h | 12 ++ fs/fuse/fuse_i.h | 4 + 3 files changed, 466 insertions(+) diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index b44ba4033615e01041313c040035b6da6af0ee17..f44e66a7ea577390da87e9ac7d118a9416898c28 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -26,6 +26,19 @@ bool fuse_uring_enabled(void) return enable_uring; } +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; +} + void fuse_uring_destruct(struct fuse_conn *fc) { struct fuse_ring *ring = fc->ring; @@ -41,8 +54,11 @@ void fuse_uring_destruct(struct fuse_conn *fc) continue; WARN_ON(!list_empty(&queue->ent_avail_queue)); + WARN_ON(!list_empty(&queue->ent_w_req_queue)); WARN_ON(!list_empty(&queue->ent_commit_queue)); + WARN_ON(!list_empty(&queue->ent_in_userspace)); + kfree(queue->fpq.processing); kfree(queue); ring->queues[qid] = NULL; } @@ -101,20 +117,34 @@ 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 NULL; + pq = kcalloc(FUSE_PQ_HASH_SIZE, sizeof(struct list_head), GFP_KERNEL); + if (!pq) { + kfree(queue); + return NULL; + } + queue->qid = qid; queue->ring = ring; spin_lock_init(&queue->lock); INIT_LIST_HEAD(&queue->ent_avail_queue); INIT_LIST_HEAD(&queue->ent_commit_queue); + INIT_LIST_HEAD(&queue->ent_w_req_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_lock(&fc->lock); if (ring->queues[qid]) { spin_unlock(&fc->lock); + kfree(queue->fpq.processing); kfree(queue); return ring->queues[qid]; } @@ -128,6 +158,214 @@ static struct fuse_ring_queue *fuse_uring_create_queue(struct fuse_ring *ring, return queue; } +/* + * 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; + + err = -EINVAL; + if (oh->unique == 0) { + /* Not supportd through io-uring yet */ + pr_warn_once("notify through fuse-io-uring not supported\n"); + goto seterr; + } + + err = -EINVAL; + if (oh->error <= -ERESTARTSYS || oh->error > 0) + goto seterr; + + if (oh->error) { + err = oh->error; + goto err; + } + + err = -ENOENT; + if ((oh->unique & ~FUSE_INT_REQ_BIT) != req->in.h.unique) { + pr_warn_ratelimited("unique mismatch, expected: %llu got %llu\n", + req->in.h.unique, + oh->unique & ~FUSE_INT_REQ_BIT); + goto seterr; + } + + /* + * Is it an interrupt reply ID? + * XXX: Not supported through fuse-io-uring yet, it should not even + * find the request - should not happen. + */ + WARN_ON_ONCE(oh->unique & FUSE_INT_REQ_BIT); + + return 0; + +seterr: + 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, res; + struct fuse_uring_ent_in_out ring_in_out; + + res = copy_from_user(&ring_in_out, &ent->headers->ring_ent_in_out, + sizeof(ring_in_out)); + if (res) + return -EFAULT; + + err = import_ubuf(ITER_SOURCE, ent->payload, ring->max_payload_sz, + &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, ring_in_out.payload_sz); +} + + /* + * 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; + struct fuse_uring_ent_in_out ent_in_out = { + .flags = 0, + .commit_id = ent->commit_id, + }; + + if (WARN_ON(ent_in_out.commit_id == 0)) + return -EINVAL; + + err = import_ubuf(ITER_DEST, ent->payload, ring->max_payload_sz, &iter); + if (err) { + pr_info_ratelimited("fuse: Import of user buffer failed\n"); + return err; + } + + fuse_copy_init(&cs, 1, &iter); + cs.is_uring = 1; + cs.req = req; + + if (num_args > 0) { + /* + * Expectation is that the first argument is the per op header. + * Some op code have that as 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; + } + } + in_args++; + num_args--; + } + + /* copy the payload */ + 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; + } + + ent_in_out.payload_sz = cs.ring.copied_sz; + res = copy_to_user(&ent->headers->ring_ent_in_out, &ent_in_out, + sizeof(ent_in_out)); + 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, res; + + err = -EIO; + 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; + goto err; + } + + /* copy the request */ + err = fuse_uring_copy_to_ring(ring, req, ring_ent); + if (unlikely(err)) { + pr_info_ratelimited("Copy to ring failed: %d\n", err); + goto err; + } + + /* copy fuse_in_header */ + res = copy_to_user(&ring_ent->headers->in_out, &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, + unsigned int issue_flags) +{ + 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_done(ring_ent->cmd, 0, 0, issue_flags); + ring_ent->cmd = NULL; + return 0; + +err: + return err; +} + /* * Make a ring entry available for fuse_req assignment */ @@ -138,6 +376,210 @@ static void fuse_uring_ent_avail(struct fuse_ring_ent *ring_ent, ring_ent->state = FRRS_AVAILABLE; } +/* Used to find the request on SQE commit */ +static void fuse_uring_add_to_pq(struct fuse_ring_ent *ring_ent, + struct fuse_req *req) +{ + struct fuse_ring_queue *queue = ring_ent->queue; + struct fuse_pqueue *fpq = &queue->fpq; + unsigned int hash; + + /* commit_id is the unique id of the request */ + ring_ent->commit_id = req->in.h.unique; + + req->ring_entry = ring_ent; + hash = fuse_req_hash(ring_ent->commit_id); + list_move_tail(&req->list, &fpq->processing[hash]); +} + +/* + * 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) +{ + struct fuse_ring_queue *queue = ring_ent->queue; + + lockdep_assert_held(&queue->lock); + + if (WARN_ON_ONCE(ring_ent->state != FRRS_AVAILABLE && + 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; + list_move(&ring_ent->list, &queue->ent_w_req_queue); + fuse_uring_add_to_pq(ring_ent, req); +} + +/* + * 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; + 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 */ + req = list_first_entry_or_null(req_queue, struct fuse_req, list); + if (req) { + fuse_uring_add_req_to_ring_ent(ring_ent, req); + return true; + } + + return 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->in_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 */ + goto out; + } + + err = fuse_uring_copy_from_ring(ring, req, ring_ent); + if (err) + set_err = true; + +out: + 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, + unsigned int issue_flags) +{ + int err; + bool has_next; + +retry: + spin_lock(&queue->lock); + fuse_uring_ent_avail(ring_ent, queue); + has_next = fuse_uring_ent_assign_req(ring_ent); + spin_unlock(&queue->lock); + + if (has_next) { + err = fuse_uring_send_next_to_ring(ring_ent, issue_flags); + if (err) + goto retry; + } +} + +static int fuse_ring_ent_set_commit(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_commit_queue); + + return 0; +} + +/* FUSE_URING_CMD_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 = READ_ONCE(cmd_req->commit_id); + unsigned int qid = READ_ONCE(cmd_req->qid); + struct fuse_pqueue *fpq; + struct fuse_req *req; + + err = -ENOTCONN; + if (!ring) + return err; + + if (qid >= ring->nr_queues) + return -EINVAL; + + queue = ring->queues[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_set_commit(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, issue_flags); + return 0; +} + /* * fuse_uring_req_fetch command handling */ @@ -325,6 +767,14 @@ int __maybe_unused fuse_uring_cmd(struct io_uring_cmd *cmd, return err; } break; + case FUSE_IO_URING_CMD_COMMIT_AND_FETCH: + err = fuse_uring_commit_fetch(cmd, issue_flags, fc); + if (err) { + pr_info_once("FUSE_IO_URING_COMMIT_AND_FETCH failed err=%d\n", + err); + return err; + } + break; default: return -EINVAL; } diff --git a/fs/fuse/dev_uring_i.h b/fs/fuse/dev_uring_i.h index 4e46dd65196d26dabc62dada33b17de9aa511c08..80f1c62d4df7f0ca77c4d5179068df6ffdbf7d85 100644 --- a/fs/fuse/dev_uring_i.h +++ b/fs/fuse/dev_uring_i.h @@ -20,6 +20,9 @@ enum fuse_ring_req_state { /* The ring entry is waiting for new fuse requests */ FRRS_AVAILABLE, + /* The ring entry got assigned a fuse req */ + FRRS_FUSE_REQ, + /* The ring entry is in or on the way to user space */ FRRS_USERSPACE, }; @@ -70,7 +73,16 @@ struct fuse_ring_queue { * entries in the process of being committed or in the process * to be sent to userspace */ + struct list_head ent_w_req_queue; struct list_head ent_commit_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_i.h b/fs/fuse/fuse_i.h index e545b0864dd51e82df61cc39bdf65d3d36a418dc..e71556894bc25808581424ec7bdd4afeebc81f15 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -438,6 +438,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; From patchwork Tue Jan 7 00:25:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13927927 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 02F79481C4 for ; Tue, 7 Jan 2025 00:25:36 +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=1736209540; cv=fail; b=smIHUDTOy/ggWnF/oAeFon6XYiKWoG0Hcr4t6mo6do88O/nTp/DhcDTzBjGJAAPxJHTCICCvzP5JJUtJ5VWx+CW306YyDCyc0VHX37OBCTi5Bufxmo1zv1nqLfyHwl+QLdanmRfwg8vAQDSv8S5ipkLev+QVYhBypLVl4rKawgM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736209540; c=relaxed/simple; bh=raf6CgBujJ2M7YlVi6vdDhGBoMyGB4azvfrJzcZzmzw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fp0iavJot58Em1NrAzPfjvJMskqHSB5ygMvMIX1eT+IInbgFcxOFOioPs8cF0K/+qazrcnRF4kpr3x5QFjM0aw57B2yvbCk77UkPuG7ZjPDK8d4oDAwL1geCSuZ0ud/BUb4wUbcZ1uNsf8x2jLGulTAtbmWZxQaahM/JtOx+Ltk= 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=Q/SKvNQg; 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="Q/SKvNQg" Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2040.outbound.protection.outlook.com [104.47.66.40]) by mx-outbound13-219.us-east-2a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 07 Jan 2025 00:25:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=A8K5yUlJiBM6WifH/X1MWP46r5E8RjMLfw0ckbxD0SDdAjuk5hfIfbaSqR8cS79ke7ydnV6MNhx/GamDNk+LbxQ6WaM5vCJPQTAI5Usv4QMQDbv9GT+BlTTjPp3qrsmQ2ywXj2TEZaKHnBRIZWnCAaWLfubTf3Happy0LhC6KX3NcaN7FeVIme7EHhwIVE46pU+Sl9W32UAeRwBHegJNzDbjKOmv/ssfF3GLQ6eJv+4LWENYXg8uu+NfPHRQU+4yUu7l+yAMMpF4XGGIG5JqeMWAvrVVHxVSW0GK6wgCk2OeTPZycD5t2SsZU0dPNNEVevErr605tJyMqoo+NLIDWQ== 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=0KmHuPvxHgleuHsdm/S1FN6pWuiP40/gOcp3ZK7K0Xg=; b=egGYHMrZeASe1mKaR2ML5HunQtx7350KIaPKuFIQ72HG5qxLngJfIzZEjW19tVZuDpdfukSpSUm5n9wK5aWtflfllISQnvFblJTtO6BhVytdAiujZ1Gnq/Ck9GHgBmceCq6QcLCa8UFZ8Nv4dhripbXqz6AOgE/vZkZU3Ij+S+x/VAznTZbNTUXIDEsWDTxrhTKSEqhkydavPd01XjdgiI5aFiOtMWL/eVkxF2mkpicR6LSOHuntThS3tyIZIQgeRcjfb9xxWcI/vimsEwjEP4B53Nw99Bz6JzPNdA/NsWtr7UX7GfULqtFJf3/gg2+K2bhmCii9dqvA+VW/KpqKaQ== 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=0KmHuPvxHgleuHsdm/S1FN6pWuiP40/gOcp3ZK7K0Xg=; b=Q/SKvNQg9VZAXoEQ3VbxdLstZTFnPb1umv5qq3TxUSi/O+pRtAygJRK7FFbRIwXGQBBqhnDhQ96jNvATgwly/WQZT8CKXJx5BIQnIkyATNvWFLWGJRKMtzrYXJGKWUr+0wyqsxwroV4fyxGVor/kHh95F4tLimljljehLTQSBZE= Received: from BN9PR03CA0115.namprd03.prod.outlook.com (2603:10b6:408:fd::30) by PH8PR19MB7757.namprd19.prod.outlook.com (2603:10b6:510:259::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.14; Tue, 7 Jan 2025 00:25:23 +0000 Received: from BN2PEPF0000449D.namprd02.prod.outlook.com (2603:10b6:408:fd:cafe::f6) by BN9PR03CA0115.outlook.office365.com (2603:10b6:408:fd::30) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.13 via Frontend Transport; Tue, 7 Jan 2025 00:25: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 BN2PEPF0000449D.mail.protection.outlook.com (10.167.243.148) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8335.7 via Frontend Transport; Tue, 7 Jan 2025 00:25:22 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 0D2EA4D; Tue, 7 Jan 2025 00:25:21 +0000 (UTC) From: Bernd Schubert Date: Tue, 07 Jan 2025 01:25:16 +0100 Subject: [PATCH v9 11/17] fuse: {io-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: <20250107-fuse-uring-for-6-10-rfc4-v9-11-9c786f9a7a9d@ddn.com> References: <20250107-fuse-uring-for-6-10-rfc4-v9-0-9c786f9a7a9d@ddn.com> In-Reply-To: <20250107-fuse-uring-for-6-10-rfc4-v9-0-9c786f9a7a9d@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=1736209509; l=11467; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=raf6CgBujJ2M7YlVi6vdDhGBoMyGB4azvfrJzcZzmzw=; b=tlddwqOZTPcdut+yzvm5nuEqTDxrDhkIp6aDwe964FaIF6/aJervu4yCtaUnZLOv5Zb8rHjLt ryP5bICdzZfCHl88qPR81MUaHEt+wLxjC5wF8kYXmE5kAcRzEaRyIXm X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF0000449D:EE_|PH8PR19MB7757:EE_ X-MS-Office365-Filtering-Correlation-Id: 938602d6-e46a-4cb4-53e0-08dd2eb1c67e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|376014|7416014|1800799024; X-Microsoft-Antispam-Message-Info: =?utf-8?q?uDu9O+utc0nLiIudjay4VTeHGkF1FnC?= =?utf-8?q?4Xazz4ysisNPntkPrMCKLnWsVp2QGZIKiqwjwvUUtm3xRX69QHuC3dtFjsXv7rZKe?= =?utf-8?q?GeS26uUdZhIZzMSUGbhL1dC0fqCTakJDW/plxszk1DSaUnTEqcq4eukDIw0Rl05gX?= =?utf-8?q?9fXAWt+tG15hdYXJALOKEFEtOBfHfUwVoDT8AMHa239Cbpzl9k2EcK7Yh7oGPnF3v?= =?utf-8?q?Du3HBKhkIAL8Gzifp8NNQl884aBa91nZs0EE6xStC4IRm4SuOWhBpey9wL/f3LkRT?= =?utf-8?q?MS9lROm7PqWIDLiI0xatVsBOnfm2O6NFiYggpn0FWklOrF4o4a/+QQfAGf1WTR6P/?= =?utf-8?q?riylU+YMJB3IU+KaYhAc6908IVpBEWehLa6Wydm0u7UYIxXgZqdxEX9eP8166YRjb?= =?utf-8?q?hj9JNdFfzWtyZfSFTSK6MYt6ZHtX41jLIou17Jw59fphfltm7M1uOzJGTQMaQ2FsS?= =?utf-8?q?R7Jqh+GB++h964l3RZ1dWZr4GhLmnMTgkBnU0KCbLS+wT7t5xswd4claTVvlLM8Hx?= =?utf-8?q?yoOwu76W21WFKrTy38Z8MIRhEuk9NsGd0PB10K1arcxfqD2RcrG3ORAyasCH2yc5w?= =?utf-8?q?KydkMeWaPL8Zsyue/DxxeeOuPWzsVASvwU3BoRRyR1ZTdhAWRSvPlQthOfz10fa7r?= =?utf-8?q?pHbgVnla2eIU8qCh1soRk8KQrn8yaiTw29QwcjQseQXxiGeFxnBxqlWO7qMl97aiK?= =?utf-8?q?szF4AXTI8PBUkwsrdUEplM2TEZC5FLNo7Nn2EzZMaOtYhx66AzR26od3zKtMPbB5B?= =?utf-8?q?s19+xr66A+L2VIS1dCXB58wmn6bJVROeZOHmXxB8ICXFmajN2fzFIDvswM1mu4ztL?= =?utf-8?q?Ik+2hYsobaKYLtU9/1gMZxK+G+3vxawvYyiJ+t41ZFx1CaegaPXXqEanip7Rj7wz2?= =?utf-8?q?at/OJv0J9hS/Rww9jhUGU0lkK1BYjFU5bs5pIoxkNfmYG7iIZKyhIiQj02AEBA3yJ?= =?utf-8?q?rdySDyGW1NCj6GBJzTXEDLSzezuE/aYIyxPtq37usLvXMdTIJF4NYrSUHbKlS5Xek?= =?utf-8?q?ksFAjouSJKVJKloRe55wWnZGBNFaKvCuqRV/ZUZAY+btZRz40PBVDmgOUjbr2On0J?= =?utf-8?q?RPF5/AJgKNyeCgTuTklcSWnkzarhJKHRI0kUdTqlL7UqrcuQOrKk75xqQGY60N8Xh?= =?utf-8?q?sdq0z2sc/N/hp5IRRSdJfzfvFMDYDfNtWn37OC49geQCK1Tof7SY/wfOZJeYfpcny?= =?utf-8?q?HyeTBMjOmNA/hpIn5cV3SOhzb8LAbvokDnI1OYp6lm5JQig2LAFIAPkxLZgJMFdGX?= =?utf-8?q?aJIQ9bAj9SrOzWIs5bQnCHP+ws6KsiW8GubLzEjOV+3KCE3ErLlaa+9CxKUmvTMY2?= =?utf-8?q?tfqLNqaqoy3y7wW4IzkPJGnUnOYu6X0it48Dzz2p03lij5crFnbUJBBmjSlyZz5rd?= =?utf-8?q?TfrcPL+ibBSdrOOU/K/STn2EuoBIVQSK3AFLrxfkPE9lW984zDv2pY=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)(376014)(7416014)(1800799024);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: DeDI0/QubzwJrEaG4XfTjytIHbHgn4JEtcLVFzMJyJFaXmZUXhAphSnApXhzJfp5TRQiMGcbJcMcf+AlNPEKY2Ju+Va5kbbnbniiGDBux3XXiVMTuwciqZKdnksFMTC++8X2TX2pgGRWbhsf+kF/CtnMOmb9IMOUPW4br1IHYd+mwMOikyhoNealhvcJE/ZwasBNjFBy5U5ci8sKSKnS+K8HXXnAbj4ktXkQ42dydKOORbY/Z+TGdJd6zJmqaBAJVTP9b4PJk5xPhKQjNXO719cGpgPcgAp6mokLV381fVtpgPmF2MYu+mhvI8fdHWseH0ZseL4p7L2iFzWB3pVrCx3wIUt8t+Paewvx6dLJxF3DKVOS248oMpnSeOJjC0VjhEvsZqkuXUF5RfuFbnXFfwRqEpNsAxHVulj5AQy6yA3i0sgAnmrBW1XP8AkcAsVckgXiVkjN33GlVRDBpTxH0jpl1i4zROXQ3NMjPlf5wLXmusFIkSbEK4U2i5CuOFJTV60rLMgJ3ZTG9knNbSclZc5SxC6yLE8qF2NVP6pVnwUvhRCARkPdUbpnyQ8sCS3FEeuvoXrjb9z0mDmdAWcsTp0vMaXErivFahDp7LwGByNh/sMwJX+so5jLfMzk6KAOCHYnQoWSZn1TFNDF5D5JQQ== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2025 00:25:22.9329 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 938602d6-e46a-4cb4-53e0-08dd2eb1c67e 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: BN2PEPF0000449D.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR19MB7757 X-BESS-ID: 1736209531-103547-13336-42566-1 X-BESS-VER: 2019.1_20241219.1759 X-BESS-Apparent-Source-IP: 104.47.66.40 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoaGBmaGQGYGUNTIIMnIzCDZIM kkOTHJzCI1OSXRwCjJIsXSNNkw2cAoUak2FgA2CXOCQgAAAA== X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.261635 [from cloudscan19-251.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 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 | 9 +++ fs/fuse/dev_uring.c | 198 ++++++++++++++++++++++++++++++++++++++++++++++++++ fs/fuse/dev_uring_i.h | 51 +++++++++++++ 3 files changed, 258 insertions(+) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index aa33eba51c51dff6af2cdcf60bed9c3f6b4bc0d0..1c21e491e891196c77c7f6135cdc2aece785d399 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" @@ -2291,6 +2292,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); } @@ -2302,6 +2309,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 f44e66a7ea577390da87e9ac7d118a9416898c28..01a908b2ef9ada14b759ca047eab40b4c4431d89 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -39,6 +39,37 @@ static void fuse_uring_req_end(struct fuse_ring_ent *ring_ent, bool set_err, ring_ent->fuse_req = NULL; } +/* 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; + struct fuse_ring_queue *queue; + + for (qid = 0; qid < ring->nr_queues; qid++) { + queue = READ_ONCE(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; @@ -98,10 +129,13 @@ 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; ring->max_payload_sz = max_payload_size; + atomic_set(&ring->queue_refs, 0); spin_unlock(&fc->lock); return ring; @@ -158,6 +192,166 @@ static struct fuse_ring_queue *fuse_uring_create_queue(struct fuse_ring *ring, return queue; } +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) +{ + if (ent->cmd) { + io_uring_cmd_done(ent->cmd, -ENOTCONN, 0, IO_URING_F_UNLOCKED); + ent->cmd = NULL; + } + + 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) { + fuse_uring_entry_teardown(ent); + queue_refs = atomic_dec_return(&ring->queue_refs); + WARN_ON_ONCE(queue_refs < 0); + } +} + +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_AVAILABLE); +} + +/* + * 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_w_req_queue, list) { + pr_info(" ent-req-queue ring=%p qid=%d ent=%p state=%d\n", + ring, qid, ent, ent->state); + } + list_for_each_entry(ent, &queue->ent_commit_queue, list) { + pr_info(" ent-req-queue ring=%p qid=%d ent=%p state=%d\n", + ring, qid, ent, ent->state); + } + spin_unlock(&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); + + /* XXX code dup */ + for (qid = 0; qid < ring->nr_queues; qid++) { + struct fuse_ring_queue *queue = READ_ONCE(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 = READ_ONCE(ring->queues[qid]); + + if (!queue) + continue; + + fuse_uring_teardown_entries(queue); + } + + if (atomic_read(&ring->queue_refs) > 0) { + 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 */ @@ -538,6 +732,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 @@ -667,6 +864,7 @@ fuse_uring_create_ring_ent(struct io_uring_cmd *cmd, return ERR_PTR(err); } + atomic_inc(&ring->queue_refs); return ent; } diff --git a/fs/fuse/dev_uring_i.h b/fs/fuse/dev_uring_i.h index 80f1c62d4df7f0ca77c4d5179068df6ffdbf7d85..ee5aeccae66caaf9a4dccbbbc785820836182668 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 { FRRS_INVALID = 0, @@ -83,6 +86,8 @@ struct fuse_ring_queue { struct list_head fuse_req_queue; struct fuse_pqueue fpq; + + bool stopped; }; /** @@ -100,12 +105,51 @@ struct fuse_ring { size_t max_payload_sz; 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; }; bool fuse_uring_enabled(void); 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; @@ -123,6 +167,13 @@ static inline bool fuse_uring_enabled(void) return false; } +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 Tue Jan 7 00:25:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13927924 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 4E95328E37 for ; Tue, 7 Jan 2025 00:25:34 +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=1736209538; cv=fail; b=timMKUyGysuoW3t5Es5oYMhcEqdL7zQ8QGzl/aibUiZUqEDfQNZPRt7jUuNLM8Moi6drUAo5nWqvcGURE++iTUtA/ZsAaM3OzGnOtv5zDDz7i6ZDGRaFgkelLu6DC5cmqCUtsnx9y6z8cyZzzy2ABneE7PYSwFaV3yJxB9q/Ae0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736209538; c=relaxed/simple; bh=1c8nwG+AvizMXYL6lMtMaTcWJG4uUtDdhcv5gi9lF1E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rLT54EIt+XYpSf1pRgHCiQZ01aK+dSzDet+qcmWHxy/shzv2/w3oHkiwOBknAGYl45LVEXOJFKzeTACU/UWYKFMd0sMVsLHxPFTSBucE5eimpopqKD8DdEtAFBUcU5Ja6NcrSHj6w4QPeEcBDx73BnnbR2hoU7NHMySpMOHB/Y0= 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=i2CfzpUi; 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="i2CfzpUi" Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2043.outbound.protection.outlook.com [104.47.66.43]) by mx-outbound-ea46-177.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 07 Jan 2025 00:25:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fzQ4couGxgkijeBxosLsi9blpZUe6/2Pa0ugIN4OxuwmuiNFf7Na/ChcF9Mpr8lP2M2U/ttoiGg8bFHtG+ZSx0MujvZvg3rnhfsFlRCR6Snl3u7dwjljVrRI9CS77GORcdPi6YUVCp4M91qGPBCaoSZV4aYPWHSTm3tuGARmJY+wXWFMS/UxsngXjx8ktpMRZZbtlXqWiR4rd020sryqOgPB8v6M2i2hs5AI54biv3s/6+H7w4DBWooEjZ0to3LlZ09atOo5/mBgcrKJFAW/2i/umrTY4uB7Pc1sGrJCNUJMMxpSGNFABRra33Vm0zFCXmorlPnFhcLYPB53Z+YEiQ== 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=KUliw8EoMQP9g855liKYfhxuE58FbYehdsrFaAXSFjc=; b=I6ASgoC+eeguJC1WJzvxZri4RrHMQa6dpkrGVzYCrtHSzjFH0D+BfEUMVV8rBkgDBTU+uhzhiuYqvCkk6L6q905oIBJx7OQhELzKWhKv57Fh4H8Z5xhY/ArF1K9vWG771ozPf0cLXFVOuarMDsmT5H/OhGoseCjVMkiFgLttg7atmZYu+yBYuRP1XL9SUZQEvfT65l/57YLEN9sf9vj3fvikUYt9D2j/nJo50An944ykYmtu9n2Cyd0PaWvJp1YRoDDILZfkWUZ7HUzRgtioikYSUQqImWqtxIV6Pa6ifu1a8ISA1ywMLWrkPlPyRDsTEbm62+q6oxO5HRUjRFphuw== 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=KUliw8EoMQP9g855liKYfhxuE58FbYehdsrFaAXSFjc=; b=i2CfzpUilokoLmKzcefFwG8FggoMFmI1B3wZPiFoAJGhdS5j52aCNy+mH9spy2AHrHM+lVx8uQk6m6e6Ih0UJ2I+lj3PI7WbB1tmj7ckPHGjoQy2dGWJe1kda6RmhfMA1IP5ELS0ftMSpXCu7Xm6QaZAPuphGeaijkt87blf+ys= Received: from DS7PR03CA0278.namprd03.prod.outlook.com (2603:10b6:5:3ad::13) by SA0PR19MB4223.namprd19.prod.outlook.com (2603:10b6:806:85::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.16; Tue, 7 Jan 2025 00:25:23 +0000 Received: from DS3PEPF000099DD.namprd04.prod.outlook.com (2603:10b6:5:3ad:cafe::7e) by DS7PR03CA0278.outlook.office365.com (2603:10b6:5:3ad::13) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8314.18 via Frontend Transport; Tue, 7 Jan 2025 00:25: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 DS3PEPF000099DD.mail.protection.outlook.com (10.167.17.199) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8335.7 via Frontend Transport; Tue, 7 Jan 2025 00:25:23 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 05FE855; Tue, 7 Jan 2025 00:25:22 +0000 (UTC) From: Bernd Schubert Date: Tue, 07 Jan 2025 01:25:17 +0100 Subject: [PATCH v9 12/17] fuse: {io-uring} Make fuse_dev_queue_{interrupt,forget} non-static Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250107-fuse-uring-for-6-10-rfc4-v9-12-9c786f9a7a9d@ddn.com> References: <20250107-fuse-uring-for-6-10-rfc4-v9-0-9c786f9a7a9d@ddn.com> In-Reply-To: <20250107-fuse-uring-for-6-10-rfc4-v9-0-9c786f9a7a9d@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=1736209509; l=1912; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=1c8nwG+AvizMXYL6lMtMaTcWJG4uUtDdhcv5gi9lF1E=; b=dCy/grhtyRwjxqSqfg4mMKq1+23Q25iF+uB+1xjeQVP5bNRlqyHuKy9ANb8LeHqx/YKM8wTiY 6RlcjJQB45mDWxZ0Vm1fv5CvmgDrrCPq05qE1ZxsNj8hjwixhZ5hr4/ X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099DD:EE_|SA0PR19MB4223:EE_ X-MS-Office365-Filtering-Correlation-Id: 1e46ae08-40be-4c5b-e8f6-08dd2eb1c6e1 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?t9udxYlC5BcVIHfxMeagO8blaJmRUKH?= =?utf-8?q?VaILQE1J0JwDkVBLe+ezcotPE3teHmMkZqd/jc9VJq1/jMxWeh4+5lEAK1PXG+rmk?= =?utf-8?q?nVEusW7Qtujf2S7m07CVD97UG1OSwaha/OstfxJZq4e9nfjZ1f6KKRfeRUYutSJWx?= =?utf-8?q?wccpP+dx6yACjF7peijvX6cKDtdbd2EcydllBW+BUZLc1bG/AB9oMaR13uBPE/dPS?= =?utf-8?q?vU90I29YWS14hp88h//HAKTlOGguGtJxXXmb9M8B9mbjvb1t5oWHfdqO/Us5qZPQa?= =?utf-8?q?FP1WJF/unyWU5lg/0MHcItV+EaSB+QM4Ipgx8QfKzPb1VQaX6jkRR5ob0kokFinQ4?= =?utf-8?q?AhsrZdKtPvWO4Vz02xzSv7rAxnKpLf4O7kurSbzFkMCrrQ/lPbV/AMx1lwgw6csDn?= =?utf-8?q?sOU+LtdVieKubsBpMYvn2vuutgYcj8+HEjIUM0Y1dxOTgcetzNJ/LL9P/6MAoSCIr?= =?utf-8?q?o2bNJI5hcSrjWRbmkFhM12nScgEkMrcmtp38ByxgR7PBMxHRwXqUj1tcRBhe1fQiJ?= =?utf-8?q?Eni7uPHVsPHtYNVOmWzd5ugWOh+NYSGlP5JaonP+99tXRp4XhCaa9YJdAwBWWBglK?= =?utf-8?q?jpCweQQ2+ONCyipZnGNeC5ZKmBD91/NNpKO12ZILNyJAw1p20Bt5daQl1hJbV1Pg4?= =?utf-8?q?JRDMJpgdj3Q6GgYTBW6eFc2F96QNdC6VvliTfp14rbd0UGQkHZRFkAwyp9URW/pLC?= =?utf-8?q?FaZB9MjuJJI73KM8Dl6f9TwPwTXF5C6x4nHpnP0tlu2MSBpKRIi08HZS9iXeDUIQP?= =?utf-8?q?Gn7Hm5w2GKMmc4wLGjiCLcphF/Zyy9hcjgFC/EqdBvYgJBEYqQWmg0HW8+ugv/yVc?= =?utf-8?q?cuuwMYkdoYisb6c1c/gTk5Rz5ptpNuzLhYCD9UhbE+UeFAXafu0i3HFDoaLSynKz5?= =?utf-8?q?adI+JVbqk3drodqrCEKV4Cy2aMmHUL0oYjwdjf/FLFpqE03PC7sqS4XGqFhX4+qw0?= =?utf-8?q?G4q73tXcSpfr4lY6a45YNexdxpvim4lP0/tP8Gj9QnSKsKp1TMTQAJ0whMvS0N+5s?= =?utf-8?q?mOLxcIhFawhVFFjBVPpP9DIknJt9Go7MHzodul3OccoSVrJjIHwHY3CLhSnym4D9i?= =?utf-8?q?E0l8sWGjDKONgcWXYO/4ddEm0WYKeP3G1ggGkfLRyqs1d6MF/e05ncGBeahA+fdvy?= =?utf-8?q?zH6qtz1Xg8F868n0/hBJ9NsxvbmFd64jYs8lpAF5j5pd6eQChvK6JG2UCXFIw2V0g?= =?utf-8?q?5XbKPcDMYAk6U2t0R9VDxCXLHGN6CxM8vzr0NQBNhzxrcZjS2uPiUvrL3F62cgAHB?= =?utf-8?q?qelPf5ZFPRj3LG9fjsrb+VsEWwoOYYgrtSjuiNU5pR7EWneh2Ddh1NVmCZ1XdeyJW?= =?utf-8?q?qFrZ8jke6hkfIuLGphbFxjOpqvuY7BfSvFEQjJ9Sq8cTzlwSZUN+xsC6H6BnTJjL9?= =?utf-8?q?9aRVDV88oCNCp2VClv+ikrUIG2+IYCqOKcUAECRWNhhFL4YP2aKlZQ=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: swirHN/V2Ngt7ngOKoxvuAj50LLnQldIoITnCAgm7lEJdfaCdRoFqCjNGOb3Z3V7Zuy0O1ueSSwKTcnnK3G5WGWJwpMK1RXfGsLrLvjYXzZ6VoIS5ky14Pdb0T8mv73+dQU4HyYJze/6F7DFocBmjVVh+ot6pCUcybZP3cnVAaZWQEG3RC0eaulqUqAENVhEos3XFITBHfboewlehE0RphIZ/5oCNvVXzECb94E5egjZ0g3HsO+1/d8jRnk4H8NdCRXPwzLu/XQf3F1p1yyJ+Kr+daF2/jHW9I3NxTKZ3RUg+Os1TWLMc7nnnBzQckB4Ui6WqajWOt+BzMmgGErRBM4btILvr4J9QaYvBIJqdRX++c3La60PoPbPRgb2g8iVlcm4oDhKhBATZAeKo6IJHr7HEouDrODYgoIONNiArkOpbWVqmvdogkJ/+KkXwoYxnAEdW6wzkc9iqFqZ9gO1VqJYm7jCqBYD4t/GrSnOoTBRPNWk+MZJLUq5c2c9/DQBYwjI8gzGn0iIEDVADmUu9M0NwQu6lpvhnqKekmf8Yn4BtGIfm7cXka2vcOklI65r4Vf84mvGFn4u3WxHdDg1GKwzwIqDjzvBCkVRKVfp9P0gscHmafhLb3wF//q7aL6Vc0nYSfpPw84bCTo9T8A4uw== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2025 00:25:23.6011 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1e46ae08-40be-4c5b-e8f6-08dd2eb1c6e1 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: DS3PEPF000099DD.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR19MB4223 X-BESS-ID: 1736209530-111953-10730-17279-1 X-BESS-VER: 2019.3_20241219.1759 X-BESS-Apparent-Source-IP: 104.47.66.43 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoYWpmZAVgZQ0NLM2MDI0Mgs2d Q41dgkzcLCwMAkLdHS0sA4zczUPNVYqTYWAOzGOQdBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.261635 [from cloudscan22-95.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 These functions are also needed by fuse-over-io-uring. Signed-off-by: Bernd Schubert --- fs/fuse/dev.c | 5 +++-- fs/fuse/fuse_dev_i.h | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 1c21e491e891196c77c7f6135cdc2aece785d399..ecf2f805f456222fda02598397beba41fc356460 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -237,7 +237,8 @@ __releases(fiq->lock) spin_unlock(&fiq->lock); } -static void fuse_dev_queue_forget(struct fuse_iqueue *fiq, struct fuse_forget_link *forget) +void fuse_dev_queue_forget(struct fuse_iqueue *fiq, + struct fuse_forget_link *forget) { spin_lock(&fiq->lock); if (fiq->connected) { @@ -250,7 +251,7 @@ static void fuse_dev_queue_forget(struct fuse_iqueue *fiq, struct fuse_forget_li } } -static void fuse_dev_queue_interrupt(struct fuse_iqueue *fiq, struct fuse_req *req) +void fuse_dev_queue_interrupt(struct fuse_iqueue *fiq, struct fuse_req *req) { spin_lock(&fiq->lock); if (list_empty(&req->intr_entry)) { diff --git a/fs/fuse/fuse_dev_i.h b/fs/fuse/fuse_dev_i.h index 599a61536f8c85b3631b8584247a917bda92e719..429661ae065464c62a093cf719c5ece38686bbbe 100644 --- a/fs/fuse/fuse_dev_i.h +++ b/fs/fuse/fuse_dev_i.h @@ -17,6 +17,8 @@ struct fuse_arg; struct fuse_args; struct fuse_pqueue; struct fuse_req; +struct fuse_iqueue; +struct fuse_forget_link; struct fuse_copy_state { int write; @@ -57,6 +59,9 @@ int fuse_copy_args(struct fuse_copy_state *cs, unsigned int numargs, int zeroing); int fuse_copy_out_args(struct fuse_copy_state *cs, struct fuse_args *args, unsigned int nbytes); +void fuse_dev_queue_forget(struct fuse_iqueue *fiq, + struct fuse_forget_link *forget); +void fuse_dev_queue_interrupt(struct fuse_iqueue *fiq, struct fuse_req *req); #endif From patchwork Tue Jan 7 00:25:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13927930 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 2C1337082F for ; Tue, 7 Jan 2025 00:25: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=1736209545; cv=fail; b=UIJ/UWlbgvV3peRN9G2l1d/swg++CRGtR4Q1JoUY6A6NQIbFrpOnD6Hcpp8H967pSl5o77iL2YGKyaqickNzOONtgEPx6JgNcDgqKaHfDZTGkNMQZcJ13wINdZAYwI2HSFjmjm17hbQPiHyWOv1D/fRKVI2o7326xQz0EGrbsHA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736209545; c=relaxed/simple; bh=fNUg9cOsdJKnBFTm77Hiz1GjeOlvcY8Sl85YUhusxww=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=aKyBfoAyrpyI5O2ilOAGfsyx/8VvdgRlid44eJYjUFPCTjqk6AiERRmG8f31AzdyNjK6Ie/Ei0E2S1Y8R8Nv9cn1HZLaBrjNh8dXpqVkQjvgN0QMdEXYdAI7KHeFruZGJzvCiZqRAZ2awn6O9+/gjAlCt6IjQlUkiiY2pszMLq4= 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=pdAjUUqT; 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="pdAjUUqT" Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2040.outbound.protection.outlook.com [104.47.66.40]) by mx-outbound13-254.us-east-2a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 07 Jan 2025 00:25:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wFYKGEjscjQEeuxLidMxxPOQCg78yER7FOl/6GTBJ/d+jfiloDF+upySL3PXwBTgEjPwT1Z0OXimHHIsmm38yMJMkC8BYwj0CljzIWtc71+BBlX8Y8W1H/zYxeOlZDNiuWqVlRh9qG9+4/9m0r9AeAQzXGXdDrrVogLHyG8DKh6g5QaIdoGMIta+79Ako1YSmxwXKimPOW+tVWbSx4kZASB4PJBigszi/4OtHgKV0iCoYBJHc6SNfIDpDgr46hj7ESEPrEjXBaFMmAfiPi28Y2U00MPEdh7uTixBWUSffAc7A/QFiycsitEdj4fYptN/f7gXlxPPMgeN7ka0HCpmVg== 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=8RnVUc/3CuQct4SpjwW7lsWhltUe1uCWqWgoWz/N8Bg=; b=mkpAWaazW1aiG+TH3tFamZgStG3qpankMI5FGwfaImCZTd3MlahCU3eKp6rPMywQJGvp86kLkB26cFF7h57AsWxDsD5jPIMBOobzXp9E7ccKIJz9FTyHjhtmVh0PoHLnW4+FticPwuNUYeYguJG3LwWE5hoifx1WCq1HfXRnjJC30B96+dkatW5ZUc5o1cKPBx63JaCF3OShTgL+/yl4pDAFFHWRckNkF385+ufffJVkYY4fT1+4BF5bGXqoQOZjgReoIo9/WtvSi6uo9QrtGvbLTkbEhBL/nvTRkdP4AMSuL3Gb6sRgjyWaAFmJULidhRAsZF0lpLxfO69D0yXU/Q== 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=8RnVUc/3CuQct4SpjwW7lsWhltUe1uCWqWgoWz/N8Bg=; b=pdAjUUqTcR7/pEXuEB6txqPglcHghjGr8oOosAwHSjmXzaVtJC4dSh1mQatF0rP1Lbwe9gVzgsO4AV4l2BC9v6ZBOn1allODGWIjPnK9bCc/K7VBGzxASUgPeXQHqU3cEGrG0i6zJ7y7LWlKeV9gfIRWNxePHxicw8ftyGDyg6w= Received: from BN0PR03CA0019.namprd03.prod.outlook.com (2603:10b6:408:e6::24) by LV8PR19MB8517.namprd19.prod.outlook.com (2603:10b6:408:1f0::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.17; Tue, 7 Jan 2025 00:25:26 +0000 Received: from BN2PEPF0000449F.namprd02.prod.outlook.com (2603:10b6:408:e6:cafe::8a) by BN0PR03CA0019.outlook.office365.com (2603:10b6:408:e6::24) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8314.17 via Frontend Transport; Tue, 7 Jan 2025 00:25: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 BN2PEPF0000449F.mail.protection.outlook.com (10.167.243.150) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8335.7 via Frontend Transport; Tue, 7 Jan 2025 00:25:24 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id F33B24D; Tue, 7 Jan 2025 00:25:23 +0000 (UTC) From: Bernd Schubert Date: Tue, 07 Jan 2025 01:25:18 +0100 Subject: [PATCH v9 13/17] fuse: Allow to queue fg requests through io-uring Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250107-fuse-uring-for-6-10-rfc4-v9-13-9c786f9a7a9d@ddn.com> References: <20250107-fuse-uring-for-6-10-rfc4-v9-0-9c786f9a7a9d@ddn.com> In-Reply-To: <20250107-fuse-uring-for-6-10-rfc4-v9-0-9c786f9a7a9d@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=1736209509; l=8153; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=fNUg9cOsdJKnBFTm77Hiz1GjeOlvcY8Sl85YUhusxww=; b=4a2z1AfKwTgm3rE0gvTza0ZS1U+Bw+41ScNwg+8MpN/d7UCxh6jsKj4n6mQ/PsanE3s4B+qIj 1ikOqwYfbZzAKQ1NLfgHvfFDsUepvy9IpfhtTYLar2Qa8FITcxRmtPZ X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF0000449F:EE_|LV8PR19MB8517:EE_ X-MS-Office365-Filtering-Correlation-Id: 9217b921-9223-43bd-96cd-08dd2eb1c7a4 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?SrnnAib/qufkFTju9wUcIFqKismV47/?= =?utf-8?q?LM0T5wxDFQr/dYb+kElyILkvYeqgWUtRaDBVtTe2kjO2jaF9C7JSbjItZdtRGZxGI?= =?utf-8?q?xpCgrQ3KZuqHpjyk8wS8GxCTov8CdNiQflCrdJhdydP7V2fjJ3Hh160TQ4gmRkwQ/?= =?utf-8?q?nMbp/jQ36erYQ93/q/Hph9/RVFHSx94lxoPk5wNnFqLOO5oXTlAa/+d2kpy+WcoB5?= =?utf-8?q?gh5IbYPwDU78cNvIWd4hhytW2lmwBo7caT6UlKQ6OGlOaNydsotaTD1HtE8oH6PhE?= =?utf-8?q?QA5yhTx56dPsyW8g9NFP86Ey9ViqWfHCXarkKRIsqPd3QkfS8lXaJhkeePyLrDul6?= =?utf-8?q?8WQ6em+W3/jChFPAx43Vj1c54pcb7sHDLCbb7Z+lsxKCKAK68t+G5xGE8y/pTxxjz?= =?utf-8?q?KkZ8XkhskkPp0bUgHBUZ37fm/VxXpn6WREaKAKm1YuxzOcD0OzIUg6UW/W2f3Q2T0?= =?utf-8?q?gqXtC6UV8GClxKahkWLjvD7k05HQmh+AxwVo2amPmJa39R2tYx85Uuq+6C99SFP1/?= =?utf-8?q?jjDqgI4qg5pWhbrvHCd33psOzopNUeFGq8QKjVFXeMyZitHOxaygnvrCnHosYEFQ+?= =?utf-8?q?fYbqf5PbU0FXyA6HyeNms4Mwi+AubjAkgSFXk8zXEl7SgU7JH7E4CYntT01Nmdk4F?= =?utf-8?q?QlF+JWWlmTh8qasWKIUR5218fkvR2YUV43q2QxypDsI3ETWlQNeHzE4RpbZLHHbwO?= =?utf-8?q?YvKhovb8atoi/MPIth64Tox7Tq7tlf8kz/A+xiCHGaDDtHprELuSfnzTkzGWu9zOP?= =?utf-8?q?QqqZ02sYf0USJ+H328Sa6dhNHixJjvCfFd0kUZHQ+azz1VBuX/M6EVnhoKPdG4wsp?= =?utf-8?q?Aq5z6NI+fqyoQBsgiL9hrXCj+8vmwsuO6ny6MRWSdf6c1LetLJdPE5IQLTXoBvINJ?= =?utf-8?q?6e5rsmnAg0dpcnL+C8pfUAExUqMEcwKr0+fat7QpLUYFnUJAJj7d5NM26xiLrGG/x?= =?utf-8?q?nnG9cBX4xDmTFpR98Xa56uwnqkxUy53sBArLPH7HOv1IDs2SE612Xr7klJEqv7ntm?= =?utf-8?q?+qChSgNDJ6AKn3yA9hiM+1OQvvovjBn8a2viQgFD9qbLjjcj9k8VOZXqhWrpjAPP+?= =?utf-8?q?KTVEJI+TaK6e4w/hbuaAQKuvYjx23A3GWflN6OGXIk9irYaedyq+pBbG6Nev2fDxF?= =?utf-8?q?iaDbZgCBl5DzWpJdanC/dUFgBt7F7f1DCUi+vCxDCUiVbY3Kw9Gi6gfeXxbXZOF9m?= =?utf-8?q?QM6ijlNGLQNJVOxaomtANsi98TxzIHFidsmbug3ygdpOZbIlvlM5vAal8d7POM+7x?= =?utf-8?q?Ds4hrgX8ctOuzaMFU0UuCykdAhq2BzT+t3DkxEWU0FGqHe8iu7y+SSydKA2x4U2PU?= =?utf-8?q?SmbiWhg6D/RI2nnfE06Aw2RzeMnGIeM6htVNzCLrdxAJrQlXl68MmRv3JhvpVKbJ9?= =?utf-8?q?ILb1y5W3jcQjWBd5CAhPQf5CFz8teVAGOznUA8IFWrk65BSK5mWD4Y=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: 2JJvqUnB5t5TzyFfeuoyg+M/iRVqwKJwNgjx1/xLxeI+alE7YWpDCHvz2zj8PLdlHrAbftM07yWFIeyfrNKmluoivLvkjCMspKcD3xeiwWmTMXXeKfb3tPEiAITKGNr5Gk2YN8r0ss3QXkYZVgdgxpq6qfWXx3f6xwZhnsCO1UB7fbS+yaZceTsHiKV5AeAOPQPEl8Yv1DOw0rpe1AvrPldrGTraT2F/+LD8Uv1SdV/FRw31KmTYvM924MIVAvbFGHENW5EobWGNd+eMY3lmhZ1xj82B37G7RoXKjxHaapLhA1yqsWqwjz7GF37rxXnPl/qnKi5w2uJmxNRZskmDGcisCMqkD9Dsz15yzE0w1rpLPaQNuyOkCKUXYH5Hj4HFHv4cyrR0DY9IawjjdxVHmV97No2UBoiHDzxDuUQ6uiHrGNlFM1uFngfuAiUcEAN681IPlqNBZ6yeoyApJ2rUpYKNf8lytRiQOPHojew0BOFbHr8r3zlm8SAv+rlqhiir+NwhRh1FsuwNhoUW6Tq9dzYbw9T0tTHKra7uZkA4zFyqiN+SfJTA9zwwvidMlhYr9YQ/t3p3qTlRKTqGgqmYHtA3uo/kruaFoQhrH0cTPvDgPQqi9hJdFgdYR+plWPuTcjaU22Ph23gFH+ZO6/kXbA== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2025 00:25:24.7988 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9217b921-9223-43bd-96cd-08dd2eb1c7a4 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: BN2PEPF0000449F.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR19MB8517 X-BESS-ID: 1736209534-103582-13345-35158-1 X-BESS-VER: 2019.1_20241219.1759 X-BESS-Apparent-Source-IP: 104.47.66.40 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVuYWppZAVgZQ0DzVxCjVJNEo1T AtNdEkOTE1zTwtxdIo1cAoGci0NFCqjQUAWojgr0EAAAA= X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.261635 [from cloudscan15-13.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 prepares queueing and sending foreground requests through io-uring. Signed-off-by: Bernd Schubert --- fs/fuse/dev_uring.c | 185 ++++++++++++++++++++++++++++++++++++++++++++++++-- fs/fuse/dev_uring_i.h | 11 ++- 2 files changed, 187 insertions(+), 9 deletions(-) diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index 01a908b2ef9ada14b759ca047eab40b4c4431d89..89a22a4eee23cbba49bac7a2d2126bb51193326f 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -26,6 +26,29 @@ bool fuse_uring_enabled(void) return enable_uring; } +struct fuse_uring_pdu { + struct fuse_ring_ent *ring_ent; +}; + +static const struct fuse_iqueue_ops fuse_io_uring_ops; + +static void uring_cmd_set_ring_ent(struct io_uring_cmd *cmd, + struct fuse_ring_ent *ring_ent) +{ + struct fuse_uring_pdu *pdu = + io_uring_cmd_to_pdu(cmd, struct fuse_uring_pdu); + + pdu->ring_ent = ring_ent; +} + +static struct fuse_ring_ent *uring_cmd_to_ring_ent(struct io_uring_cmd *cmd) +{ + struct fuse_uring_pdu *pdu = + io_uring_cmd_to_pdu(cmd, struct fuse_uring_pdu); + + return pdu->ring_ent; +} + static void fuse_uring_req_end(struct fuse_ring_ent *ring_ent, bool set_err, int error) { @@ -441,7 +464,7 @@ static int fuse_uring_copy_to_ring(struct fuse_ring *ring, struct fuse_req *req, struct iov_iter iter; struct fuse_uring_ent_in_out ent_in_out = { .flags = 0, - .commit_id = ent->commit_id, + .commit_id = req->in.h.unique, }; if (WARN_ON(ent_in_out.commit_id == 0)) @@ -460,7 +483,7 @@ static int fuse_uring_copy_to_ring(struct fuse_ring *ring, struct fuse_req *req, if (num_args > 0) { /* * Expectation is that the first argument is the per op header. - * Some op code have that as zero. + * Some op code have that as zero size. */ if (args->in_args[0].size > 0) { res = copy_to_user(&ent->headers->op_in, in_args->value, @@ -578,11 +601,8 @@ static void fuse_uring_add_to_pq(struct fuse_ring_ent *ring_ent, struct fuse_pqueue *fpq = &queue->fpq; unsigned int hash; - /* commit_id is the unique id of the request */ - ring_ent->commit_id = req->in.h.unique; - req->ring_entry = ring_ent; - hash = fuse_req_hash(ring_ent->commit_id); + hash = fuse_req_hash(req->in.h.unique); list_move_tail(&req->list, &fpq->processing[hash]); } @@ -777,6 +797,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 */ @@ -785,10 +830,22 @@ static void fuse_uring_do_register(struct fuse_ring_ent *ring_ent, unsigned int issue_flags) { struct fuse_ring_queue *queue = ring_ent->queue; + struct fuse_ring *ring = queue->ring; + struct fuse_conn *fc = ring->fc; + struct fuse_iqueue *fiq = &fc->iq; spin_lock(&queue->lock); fuse_uring_ent_avail(ring_ent, queue); spin_unlock(&queue->lock); + + if (!ring->ready) { + bool ready = is_ring_ready(ring, queue->qid); + + if (ready) { + WRITE_ONCE(ring->ready, true); + fiq->ops = &fuse_io_uring_ops; + } + } } /* @@ -979,3 +1036,119 @@ int __maybe_unused fuse_uring_cmd(struct io_uring_cmd *cmd, 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. + */ +static void +fuse_uring_send_req_in_task(struct io_uring_cmd *cmd, + unsigned int issue_flags) +{ + struct fuse_ring_ent *ent = uring_cmd_to_ring_ent(cmd); + struct fuse_ring_queue *queue = ent->queue; + int err; + + if (unlikely(issue_flags & IO_URING_F_TASK_DEAD)) { + err = -ECANCELED; + goto terminating; + } + + err = fuse_uring_prepare_send(ent); + if (err) + goto err; + +terminating: + spin_lock(&queue->lock); + ent->state = FRRS_USERSPACE; + list_move(&ent->list, &queue->ent_in_userspace); + spin_unlock(&queue->lock); + io_uring_cmd_done(cmd, err, 0, issue_flags); + ent->cmd = NULL; + return; +err: + fuse_uring_next_fuse_req(ent, queue, issue_flags); +} + +static struct fuse_ring_queue *fuse_uring_task_to_queue(struct fuse_ring *ring) +{ + unsigned int qid; + struct fuse_ring_queue *queue; + + 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 NULL; + + return queue; +} + +/* queue a fuse request and send it if a ring entry is available */ +void fuse_uring_queue_fuse_req(struct fuse_iqueue *fiq, struct fuse_req *req) +{ + struct fuse_conn *fc = req->fm->fc; + struct fuse_ring *ring = fc->ring; + struct fuse_ring_queue *queue; + struct fuse_ring_ent *ent = NULL; + int err; + + err = -EINVAL; + queue = fuse_uring_task_to_queue(ring); + if (!queue) + goto err; + + if (req->in.h.opcode != FUSE_NOTIFY_REPLY) + req->in.h.unique = fuse_get_unique(fiq); + + spin_lock(&queue->lock); + err = -ENOTCONN; + if (unlikely(queue->stopped)) + goto err_unlock; + + ent = list_first_entry_or_null(&queue->ent_avail_queue, + struct fuse_ring_ent, list); + if (ent) + fuse_uring_add_req_to_ring_ent(ent, req); + else + list_add_tail(&req->list, &queue->fuse_req_queue); + spin_unlock(&queue->lock); + + if (ent) { + struct io_uring_cmd *cmd = ent->cmd; + + err = -EIO; + if (WARN_ON_ONCE(ent->state != FRRS_FUSE_REQ)) + goto err; + + uring_cmd_set_ring_ent(cmd, ent); + io_uring_cmd_complete_in_task(cmd, fuse_uring_send_req_in_task); + } + + return; + +err_unlock: + spin_unlock(&queue->lock); +err: + req->out.h.error = err; + clear_bit(FR_PENDING, &req->flags); + fuse_request_end(req); +} + +static const struct fuse_iqueue_ops fuse_io_uring_ops = { + /* should be send over io-uring as enhancement */ + .send_forget = fuse_dev_queue_forget, + + /* + * could be send over io-uring, but interrupts should be rare, + * no need to make the code complex + */ + .send_interrupt = fuse_dev_queue_interrupt, + .send_req = fuse_uring_queue_fuse_req, +}; diff --git a/fs/fuse/dev_uring_i.h b/fs/fuse/dev_uring_i.h index ee5aeccae66caaf9a4dccbbbc785820836182668..cda330978faa019ceedf161f50d86db976b072e2 100644 --- a/fs/fuse/dev_uring_i.h +++ b/fs/fuse/dev_uring_i.h @@ -48,9 +48,6 @@ struct fuse_ring_ent { enum fuse_ring_req_state state; struct fuse_req *fuse_req; - - /* commit id to identify the server reply */ - uint64_t commit_id; }; struct fuse_ring_queue { @@ -120,6 +117,8 @@ struct fuse_ring { unsigned long teardown_time; atomic_t queue_refs; + + bool ready; }; bool fuse_uring_enabled(void); @@ -127,6 +126,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); +void fuse_uring_queue_fuse_req(struct fuse_iqueue *fiq, struct fuse_req *req); static inline void fuse_uring_abort(struct fuse_conn *fc) { @@ -150,6 +150,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; From patchwork Tue Jan 7 00:25:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13927932 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 2D4317083F for ; Tue, 7 Jan 2025 00:25:39 +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=1736209546; cv=fail; b=RLyGrZnxtkJ32kJBca+ovYiZoDwaksz9v0SADCNx1sDKxFMGBVFJGVPSWpZNzgPpR3pB/dexpQIak4dFtHewSk/plj+ieba8DmiIpoVJK8JcqYCXV5N4i04/N4vKWbPgxo3dyPviR69qTvn0lLh1xQBj5QDCy+CoBhCXzTKVRUM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736209546; c=relaxed/simple; bh=jEU9v9MQqjXXNTVqVE/JQKAEP7TCQNGW6wzND3gEIJ4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MB41JaIjSggXfeZ4+Nab4lp8bR75pQkCBustDlufYp4RGzUMdUqWBNXybn+Bzr2qxhLHMwFoZHSuVslFMb2bY16xB6zCAsP4k4i0crd61H6hl9IaSBGZHwQPqleVIx8DftgiX/Sn5REDOmqcLS76W8IL2rYgiAG79kcBqI1yP78= 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=rO0NghWH; 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="rO0NghWH" Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2043.outbound.protection.outlook.com [104.47.55.43]) by mx-outbound-ea46-177.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 07 Jan 2025 00:25:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Hyyq0jv+1n7w2Jd3YfHQreI9joca35tpf6I7pSRvlN9s/0sbCotcevsGb3Kv+T/Cjot14cXLDwjw5o7qJZwJQrgWY1DxRmQ0HX9eND1FMtirIjlGzXs4hk6Iij1SxmULgc1+PG28uxWqRjZsLgMhVxkFKqdgQR2BV28HQrQX/L9wQxASupDeRYYFXXKSfSo9m71dvURDch8pQny1k0KthiNIdbTiQv37AVzBZcjTyy9xJPRY6GnMNfzfWhECnb6Udaf9CISy+UshqmWZVeL4oZ/SQfqvCd6hjTqhckrZRC4r1HPFp3Nt76YEbL8JsNRgSfaV/QOZTRTROO/N4VpJjA== 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=F9CwB0kRTb+2ILbnV3fElttG8j1HgxbuxfCXYQMvVng=; b=F03RU3i346EDY+3dIHyhsjisVYuwQ5bckdOcm7m+HjMzVHPVvS5YUC7BFrY1ocFIntx65Y2DGgnP7RbP14BVIG31dunW3Vu97UCjf21kdmo4q1aDUmoxQ1uguZVCEpzXy5ZIvRq7UnvEsFB4fS27sIWE+5GC1qOmEXN5uvJz2UuTUvZXsIHdWNLWwx6E5wXWfiTzEbaeE/tMNtCjkV1v3j1JWbm1/6aT2tEQtcgOPGM05xW5gz57cH6CEkUpVnQDKeW4xtndKsX3wmbUpQmxeHqG8kXMom4Gb+tG5HX86UrrdnRN6gyOGqNg0hJRQPQA9TuksV07uf1ZaoiCUL5LnQ== 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=F9CwB0kRTb+2ILbnV3fElttG8j1HgxbuxfCXYQMvVng=; b=rO0NghWHABodpJw3C+QddHr0u5BnZZS1dWyhmbsbBoVMBkjyiXunjBu2zS/rt9eLZCLuEpcA0ndZqRMFIC2/bLh/fBrIY6rjOQDtaqv/maQpnHyY/cBeXojDp4Skx2lq/FFz8gKmaFI+2biIh9RP1ini36mUOseAYsfCGHGX2IM= Received: from MN0P222CA0008.NAMP222.PROD.OUTLOOK.COM (2603:10b6:208:531::12) by BY5PR19MB3827.namprd19.prod.outlook.com (2603:10b6:a03:225::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.18; Tue, 7 Jan 2025 00:25:28 +0000 Received: from BN2PEPF000044A4.namprd02.prod.outlook.com (2603:10b6:208:531:cafe::34) by MN0P222CA0008.outlook.office365.com (2603:10b6:208:531::12) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8314.18 via Frontend Transport; Tue, 7 Jan 2025 00:25:27 +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 BN2PEPF000044A4.mail.protection.outlook.com (10.167.243.155) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8335.7 via Frontend Transport; Tue, 7 Jan 2025 00:25:25 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id EBDB355; Tue, 7 Jan 2025 00:25:24 +0000 (UTC) From: Bernd Schubert Date: Tue, 07 Jan 2025 01:25:19 +0100 Subject: [PATCH v9 14/17] fuse: Allow to queue bg requests through io-uring Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250107-fuse-uring-for-6-10-rfc4-v9-14-9c786f9a7a9d@ddn.com> References: <20250107-fuse-uring-for-6-10-rfc4-v9-0-9c786f9a7a9d@ddn.com> In-Reply-To: <20250107-fuse-uring-for-6-10-rfc4-v9-0-9c786f9a7a9d@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=1736209509; l=7364; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=jEU9v9MQqjXXNTVqVE/JQKAEP7TCQNGW6wzND3gEIJ4=; b=UDwmPC7iXfU+uJPvryzCzfywSg5q2n0bJyJuZfSBnpSOpKCbjHfPQUKTXz0yBX88aUp/iOF5q 8LfMiCs6ehfA2Ul8aj5oTcDH9Aqj5wcJeoZdbTJGs5joopYNDA+46bg X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF000044A4:EE_|BY5PR19MB3827:EE_ X-MS-Office365-Filtering-Correlation-Id: 9b42fd24-f591-4854-030f-08dd2eb1c835 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?YU4Igu04zEtpspbFuM2pN4EGSXTnI7L?= =?utf-8?q?yKBOdYR0BLHyWG5VpZkinNtFp3wt/HKFKLk8w76MhyHzpx71ERX9qvwibIA0gB9f8?= =?utf-8?q?lbIMgjfqCvNPYB2cntzN6h5l0FOE5UimhImZIInYi9jckpjuR+/hzphgPReMpc+Z7?= =?utf-8?q?FajxgPiuGQfWba4NlxfiiPFatIRQ6D3cPmZnplFDzbRlUtB7HZ9EeZJreD7IK9rT5?= =?utf-8?q?jqpJmEPlzLWK/bcXcf9rlCTjWbMS/SCLz0TjFP5hLSeG9BP6/XhqgMWJWZ/H30Vsd?= =?utf-8?q?sovW4OLb1vopMqU3AOVz8iIDmyzbsRNGGOSDO04KQFTX9jPG0g7CzVflmZlEih8lL?= =?utf-8?q?mvI4CWMZGr7yh77U2CY4Lyut9rtNKGO5H4gccDluBbKSssQ4jzZLcYbRafb7z1NUx?= =?utf-8?q?fYIpKwCz32TpIoClJHP1J8OwqU0e2z+eoFJQ+3MpCGR3q+B3Sub4uHgNIEFDzTUDW?= =?utf-8?q?IFrMbol4VQMahP13HPWX3m0W/AF5gVw84tYgNDBpjZvurYitLERQxxB39d9EzpYyf?= =?utf-8?q?0QXvAxpxZLIk1MSAhGRXGtrwtMebGt5VHfllKCK+9oQagTuqJiTmXkt/i+fLIj7gw?= =?utf-8?q?rLtzFwNor0xa3kqe4FNVjX4y/tPOVg84KcXqeB1SwBXOFw7xkFZhpmmV82CydJIcg?= =?utf-8?q?C6TAa7jL/qfUB3h2t9T30J2vXhJcx4uNnmxg127wfIbiX2MQqNIj1cvqdz8Dp3tlG?= =?utf-8?q?26cJr60AeLO2i/C0yHunFw4M8SRpegis3ySYoMv1h98ckGpwwkUxfwrvbxs3vsK7T?= =?utf-8?q?/0RvZFtkDvhjNChjWTR7IFv0mxDJD8TPgnLjAqmHzYLUz4qtCcjATxZ3YgMRMF1R8?= =?utf-8?q?0+mZx2DG2m4BsGSFOoQpVXk/foW1IGMtLb++8UuxX4/ytudRAoPj2KC8T6ClDe8fz?= =?utf-8?q?tOaNvaocLLSUJ7boe3buvaDsBYxCAqxubhADwzYxrHOGTiLXq4GfH/6wwIbTtJgg5?= =?utf-8?q?BN0tlGFTvi+uyYl5AbQy16VEAAuMHYgc7VX+chH/Hil+RpbHIZqWB5VrtfcfMoQns?= =?utf-8?q?/te05jHrsaV7L9TqzoIXB5kmX0aW/56jDB/iibUepr6To4031y2Or6qRtxewSu2Zh?= =?utf-8?q?zNjUMsvdvfIyjSbccZ4YWRUNO6riJ8ZDguV33wz87q6DNE6kGCcClXZRm17zaCOC5?= =?utf-8?q?tiBFERTyDxBjszpV3Y18/jYDTL1wbqjvmdge7rh2RTjSNRSLY+he+n/eDrMQ6niuA?= =?utf-8?q?o6MAUYjywtUzquBGOY4M8OuPez0u86u8hB9vkfKBsmrBDaBSrW0ALMK4huBcssfJ6?= =?utf-8?q?kN9/uGo9f4xyOCgM3FWPFwT+O1y5NkcJbnu0OBVsRSe5nMWnVDGO4Sne5Tuwpp0eo?= =?utf-8?q?k2Xlrd86Gtt4wH02o+m+bLiBLmQCEQqtQIWgtP/2HHq2At/BV+KUxvwOXD5NV/mVQ?= =?utf-8?q?oLHQgjgOebLpkH63qW+5Ix+NNfQItV0eVql+xFThUz5OGL+3mf59s0=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)(1800799024)(36860700013)(376014)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: ZJ/qgS3daBMEtsqT1fqvGB2ZmDoWUJiTGI2XBcEUyE4itC1zCMGjkCgFcqmTIrQPUYH7cPIC0kJbXruzOj/7xs1lcJgR+nhkA08Lk9xNpGwlyk+dxqIzAYOdw72WP0vLSxvlcasSxxHCWv7cHAsOBPeJ72SqpZLNQ/1Q4bcMWPu5GlVpBpToEtWHjaIZsXiQd+pijB0zgiBK+9D2uWFM8OHQj2fD5+91c4M6dVxuZ4RRvPJio6v7tZMUETCWmZuW04K8iSfGDLAg6X3xd9wPqjgiOLc93y8AvBC1AhLUNuessx9pED+TwMhue3SZ17RrmR0LsNdoX9DPeVzWPqV/bpaxKH8yKnk7g0yHDJgkvTiMqEJi5dE32VJYv9kjzEXQsfbsaWSGS30nycjx+auNFjY7EqtKfBdr1DARQCcZqS9PGq0TO9lGI9hCdIdH/fdfvlkqHfQ2ogmklPvlNgZHNbFCEwelqd8kI4v7vtPGO9SLrT8c+zwTqCEM8eLHdzgpWpJ/uszeMScYCFlvA+LnuxZiz/rC/lerunBIuMTXB9najGGn+pc6z+bItK7VH85WB13BOiHBhchV3WmtUSTcx7BOZDnLLDL2Hg3PtJMen6/y+vRvv4wCZ/HNDcxmFEphYVSwY6okSiMiAf/Mt53hGg== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2025 00:25:25.7922 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9b42fd24-f591-4854-030f-08dd2eb1c835 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: BN2PEPF000044A4.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR19MB3827 X-BESS-ID: 1736209534-111953-10730-17292-1 X-BESS-VER: 2019.3_20241219.1759 X-BESS-Apparent-Source-IP: 104.47.55.43 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVuaGRpZAVgZQ0MDAJMkszdTAwt AyNdXcyMLYKNUo0dTEzCjZwjgtzdJAqTYWANB/gWxBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.261635 [from cloudscan10-191.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 prepares queueing and sending background requests through io-uring. Signed-off-by: Bernd Schubert --- fs/fuse/dev.c | 24 ++++++++++++- fs/fuse/dev_uring.c | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++ fs/fuse/dev_uring_i.h | 12 +++++++ 3 files changed, 134 insertions(+), 1 deletion(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index ecf2f805f456222fda02598397beba41fc356460..afafa960d4725d9b64b22f17bf09c846219396d6 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -568,7 +568,25 @@ ssize_t __fuse_simple_request(struct mnt_idmap *idmap, return ret; } -static bool fuse_request_queue_background(struct fuse_req *req) +#ifdef CONFIG_FUSE_IO_URING +static bool fuse_request_queue_background_uring(struct fuse_conn *fc, + struct fuse_req *req) +{ + struct fuse_iqueue *fiq = &fc->iq; + + 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); + + return fuse_uring_queue_bq_req(req); +} +#endif + +/* + * @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; @@ -580,6 +598,10 @@ static bool fuse_request_queue_background(struct fuse_req *req) atomic_inc(&fc->num_waiting); } __set_bit(FR_ISREPLY, &req->flags); + + if (fuse_uring_ready(fc)) + return fuse_request_queue_background_uring(fc, req); + spin_lock(&fc->bg_lock); if (likely(fc->connected)) { fc->num_background++; diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index 89a22a4eee23cbba49bac7a2d2126bb51193326f..4e4385dff9315d25aa8c37a37f1e902aec3fcd20 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -49,10 +49,52 @@ static struct fuse_ring_ent *uring_cmd_to_ring_ent(struct io_uring_cmd *cmd) return pdu->ring_ent; } +static void fuse_uring_flush_bg(struct fuse_ring_queue *queue) +{ + struct fuse_ring *ring = queue->ring; + struct fuse_conn *fc = ring->fc; + + lockdep_assert_held(&queue->lock); + lockdep_assert_held(&fc->bg_lock); + + /* + * Allow one bg request per queue, ignoring global fc limits. + * This prevents a single queue from consuming all resources and + * eliminates the need for remote queue wake-ups when global + * limits are met but this queue has no more waiting requests. + */ + while ((fc->active_background < fc->max_background || + !queue->active_background) && + (!list_empty(&queue->fuse_req_bg_queue))) { + struct fuse_req *req; + + req = list_first_entry(&queue->fuse_req_bg_queue, + struct fuse_req, list); + fc->active_background++; + queue->active_background++; + + list_move_tail(&req->list, &queue->fuse_req_queue); + } +} + static void fuse_uring_req_end(struct fuse_ring_ent *ring_ent, bool set_err, int error) { + struct fuse_ring_queue *queue = ring_ent->queue; struct fuse_req *req = ring_ent->fuse_req; + struct fuse_ring *ring = queue->ring; + struct fuse_conn *fc = ring->fc; + + lockdep_assert_not_held(&queue->lock); + spin_lock(&queue->lock); + if (test_bit(FR_BACKGROUND, &req->flags)) { + queue->active_background--; + spin_lock(&fc->bg_lock); + fuse_uring_flush_bg(queue); + spin_unlock(&fc->bg_lock); + } + + spin_unlock(&queue->lock); if (set_err) req->out.h.error = error; @@ -82,6 +124,7 @@ void fuse_uring_abort_end_requests(struct fuse_ring *ring) { int qid; struct fuse_ring_queue *queue; + struct fuse_conn *fc = ring->fc; for (qid = 0; qid < ring->nr_queues; qid++) { queue = READ_ONCE(ring->queues[qid]); @@ -89,6 +132,13 @@ void fuse_uring_abort_end_requests(struct fuse_ring *ring) continue; queue->stopped = true; + + WARN_ON_ONCE(ring->fc->max_background != UINT_MAX); + spin_lock(&queue->lock); + spin_lock(&fc->bg_lock); + fuse_uring_flush_bg(queue); + spin_unlock(&fc->bg_lock); + spin_unlock(&queue->lock); fuse_uring_abort_end_queue_requests(queue); } } @@ -194,6 +244,7 @@ static struct fuse_ring_queue *fuse_uring_create_queue(struct fuse_ring *ring, INIT_LIST_HEAD(&queue->ent_w_req_queue); INIT_LIST_HEAD(&queue->ent_in_userspace); INIT_LIST_HEAD(&queue->fuse_req_queue); + INIT_LIST_HEAD(&queue->fuse_req_bg_queue); queue->fpq.processing = pq; fuse_pqueue_init(&queue->fpq); @@ -1141,6 +1192,54 @@ void fuse_uring_queue_fuse_req(struct fuse_iqueue *fiq, struct fuse_req *req) fuse_request_end(req); } +bool fuse_uring_queue_bq_req(struct fuse_req *req) +{ + struct fuse_conn *fc = req->fm->fc; + struct fuse_ring *ring = fc->ring; + struct fuse_ring_queue *queue; + struct fuse_ring_ent *ent = NULL; + + queue = fuse_uring_task_to_queue(ring); + if (!queue) + return false; + + spin_lock(&queue->lock); + if (unlikely(queue->stopped)) { + spin_unlock(&queue->lock); + return false; + } + + list_add_tail(&req->list, &queue->fuse_req_bg_queue); + + ent = list_first_entry_or_null(&queue->ent_avail_queue, + struct fuse_ring_ent, list); + spin_lock(&fc->bg_lock); + fc->num_background++; + if (fc->num_background == fc->max_background) + fc->blocked = 1; + fuse_uring_flush_bg(queue); + spin_unlock(&fc->bg_lock); + + /* + * Due to bg_queue flush limits there might be other bg requests + * in the queue that need to be handled first. Or no further req + * might be available. + */ + req = list_first_entry_or_null(&queue->fuse_req_queue, struct fuse_req, + list); + if (ent && req) { + struct io_uring_cmd *cmd = ent->cmd; + + fuse_uring_add_req_to_ring_ent(ent, req); + + uring_cmd_set_ring_ent(cmd, ent); + io_uring_cmd_complete_in_task(cmd, fuse_uring_send_req_in_task); + } + spin_unlock(&queue->lock); + + return true; +} + static const struct fuse_iqueue_ops fuse_io_uring_ops = { /* should be send over io-uring as enhancement */ .send_forget = fuse_dev_queue_forget, diff --git a/fs/fuse/dev_uring_i.h b/fs/fuse/dev_uring_i.h index cda330978faa019ceedf161f50d86db976b072e2..a4271f4e55aa9d2d9b42f3d2c4095887f9563351 100644 --- a/fs/fuse/dev_uring_i.h +++ b/fs/fuse/dev_uring_i.h @@ -82,8 +82,13 @@ struct fuse_ring_queue { /* fuse requests waiting for an entry slot */ struct list_head fuse_req_queue; + /* background fuse requests */ + struct list_head fuse_req_bg_queue; + struct fuse_pqueue fpq; + unsigned int active_background; + bool stopped; }; @@ -127,6 +132,7 @@ 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); void fuse_uring_queue_fuse_req(struct fuse_iqueue *fiq, struct fuse_req *req); +bool fuse_uring_queue_bq_req(struct fuse_req *req); static inline void fuse_uring_abort(struct fuse_conn *fc) { @@ -179,6 +185,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 bool fuse_uring_ready(struct fuse_conn *fc) +{ + return false; +} + #endif /* CONFIG_FUSE_IO_URING */ #endif /* _FS_FUSE_DEV_URING_I_H */ From patchwork Tue Jan 7 00:25:20 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13927957 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 3C9926A33B; Tue, 7 Jan 2025 01:59:29 +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=1736215176; cv=fail; b=hXbJ/cuR/vzWEP+WXRiGc4Vqag6BAOwIQpdApxEDPrB/3CbugC1TPc/o0NmzPXfuhOr2sBtp7xudlmKM5MF1wxOLyHOPdEJWbAcauHvR9YT0EZFv1+HmZGjukS/+qoQJmUtxVLiwwxWnGxIFlF2t4zCAXDE/AyaL+nUogDMQGrc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736215176; c=relaxed/simple; bh=/n0orAFJWYNWXnGFjoIDCECjocyPkeP3dloIDg3Ba2E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=id0UFmsgb294EuArx+osox95Bq1m0V9BtW9rMar4oZgfAdDWwNV0Jsy9kYiTKsCwRlT/9/cW+YNcMKX3wfdi/iStDy+WJw/ELawk5Zfw7vD7ZhARR8DbheEBeuCtzLEA74lbfY2snyYwBdQUH7hg+FJ1ep+E2tFfBvol2pcXDHg= 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=MNWAwmHG; 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="MNWAwmHG" Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2177.outbound.protection.outlook.com [104.47.58.177]) by mx-outbound46-163.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 07 Jan 2025 01:59:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=a10gko5aMSPCkPCFEb/CbfJBoHbjVVBWGUkqmZY+yWzli7mVfJeAxgUoTm14cA8JlQH8G8dHSEg+986Yva8/rALVn/WGD+m2eZZzILPrfPs4AfKJfNDSNqGqMSFEZE6nXfPGOtB5kJcGaBNh8yPlEnMelChR9ltzdIYNvfOnz1eflaySCZHWVZbp4QggRECm2TW/rA35sUV46O0hFprFnW2sa6+Z6zBzot0BtgsVqY5TNWn5xgkIYzc4U0OgjQvK8nhjPFRrjCK/q1kd/TlX8eletoLYPc69yAzkIGm6Dg1aeIeM5mf0i1eWqJNl3yH8MF36ni6uicmNOeWXJWvoZg== 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=37v6F51AKJv6PuVx+uDKyOz5jwsA98RjICcfcJAtH4A=; b=uQ7p2efRyxVQGvUAX91Yv9vBjyCqiMLDQfEM7EaCw4pj2T5xgDqZ+uI+RVuL9YoWVUN1LEGUy0lg5IOOYMwkySMZuNtJOLecVrhnbuipsN2Sv7Chsxu/VSE+HABi7V88ZydcSEAkq56NKzxvHUkXXM6sutf/Zw9T+KPEvnpLedyyCrerANFIceWorhWts04KyH+CMP4O4ol8amvXFAfUcJNznGnfTihIKBiu6rtUF6XO7murULsIuHLEO/LV3IIoT8o+EtUGd7jnB+ZOU/vaZq+hXzt2zGuZ426b8KPuuNdmsO+qebb/GprcJ4TDZd6+pzjffUSRg98U1xhY4grg9Q== 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=37v6F51AKJv6PuVx+uDKyOz5jwsA98RjICcfcJAtH4A=; b=MNWAwmHGzKAkO/RlTfANCLW8WL4gDCHx6AmBuRki1sDkko0KuJynEiA2aPQU7m7x6TfWhoDOH7ZGBJS3w9WwhiuaS9RJLj5p5GwTa3w+SPYEEzoS5RV3WOY8dRulYFU37tO6EJLBhljkvjEt8aA83J2vCysIq3z7ToaZsTE4ZF4= Received: from DM5PR08CA0057.namprd08.prod.outlook.com (2603:10b6:4:60::46) by DM4PR19MB6271.namprd19.prod.outlook.com (2603:10b6:8:a7::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.18; Tue, 7 Jan 2025 00:25:27 +0000 Received: from DS3PEPF000099DE.namprd04.prod.outlook.com (2603:10b6:4:60:cafe::f) by DM5PR08CA0057.outlook.office365.com (2603:10b6:4:60::46) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8314.13 via Frontend Transport; Tue, 7 Jan 2025 00:25: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 DS3PEPF000099DE.mail.protection.outlook.com (10.167.17.200) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8335.7 via Frontend Transport; Tue, 7 Jan 2025 00:25:26 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id E54F01DA; Tue, 7 Jan 2025 00:25:25 +0000 (UTC) From: Bernd Schubert Date: Tue, 07 Jan 2025 01:25:20 +0100 Subject: [PATCH v9 15/17] 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: <20250107-fuse-uring-for-6-10-rfc4-v9-15-9c786f9a7a9d@ddn.com> References: <20250107-fuse-uring-for-6-10-rfc4-v9-0-9c786f9a7a9d@ddn.com> In-Reply-To: <20250107-fuse-uring-for-6-10-rfc4-v9-0-9c786f9a7a9d@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=1736209509; l=7033; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=/n0orAFJWYNWXnGFjoIDCECjocyPkeP3dloIDg3Ba2E=; b=PWryG5vHhDud2kHYhD7xVrqK3SGBMa1T97CJ9yB0N4vCUD+1KiHilN/GhsJRSWAG8sx44Pifv oTRf3RA8nSpCMWa9ZTEWPERcKQ7NTz0y1UoBxO7tfjjV9+Hw1PeYIOi X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099DE:EE_|DM4PR19MB6271:EE_ X-MS-Office365-Filtering-Correlation-Id: a5aded1a-c614-4dc5-f5d7-08dd2eb1c8a7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|1800799024|7416014|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?q?zd1tgYCg3urus4KJCgHDm4waF2UN55J?= =?utf-8?q?waSU/1wDXgG7kJJGqRyPKGl9MBLwMmcmMQye5JKF0QwvtDP3j3bSrpYCggwY2UKj7?= =?utf-8?q?UBa0b4AbwoMJrWoTsE7GlzjHzmZykEQPjavMUAzaYW3FYXZiUB3IaeZBb5Y3/acdl?= =?utf-8?q?jVLTruDFjrK1URoXQtBJkNJx/lB/inwcFY8BgwHJyZQU5fnCYVPHeiZEXMt7z0mRF?= =?utf-8?q?tsllqVOKmtBF1S2S194aZz1oq6P+Dce7K6RxQSKdU0BNMtPGgKJYwcgcxj55DPnaF?= =?utf-8?q?btjGI3b2yYheLKWfnxm4m5JDSmQswwdL4SHHI3NlfLdIN5IuGjxkIePfF1swD2D13?= =?utf-8?q?zxT3M2DSeA9F5k9WTqV5fcIv2P5IgXztQpbKeg9AvPWpa7bHSKPWmkqDlgvr54OSb?= =?utf-8?q?Ff4nbbYokdRYWSfRTG2YvNRY/q1axeKn42vwbusDKjNXdeP42oyWiDiGczkjuinPF?= =?utf-8?q?KUbtnGKYqAwIkThG97AGI2v5qsD45r2YIVMtJ1aTfZZj/h+YU3nVLdblsRyQWw4/P?= =?utf-8?q?YLTlbk+wvdztpZTufWjyA0hLoVKe5w8nkfLFlN5kBXM7khkYRz4B1MHK0k87hSRd6?= =?utf-8?q?qcV06/XKqBLp/RDCLq88VFu+QGDMAAelOQvJ+RMiMIZp06hQFepEQ00Bkvlj+iUad?= =?utf-8?q?2qIZemJ2pMv8ldaWSy9Pi6NMzmwThfKe2M1AvnbRSpomPU9LXIQCBFgWz7gqpH641?= =?utf-8?q?8sL6kcSwvynKx2cAuRvVpvd7/HPKzS9exnpHxCbHo0vkg8ri+i6evPeyk6BSpYP6h?= =?utf-8?q?QtxzW2fou5rCP/Hfd9XBrEB0ZBfXBPoekK6CCdwv4kqUKOv82aCHqK5vVAAJ5HwI7?= =?utf-8?q?vTopATuGlevmwsKeFUxMuTA7kVOG38hUs/wVO1ZlbSdz6AWl1Z/fpyHCHbVDbiyAO?= =?utf-8?q?upSRqHbM2gMwF7TvsPNNRYOaX08U7yCs7Zgy2ge/+EFPB7OY9fcdL8cRJYPbF/+fL?= =?utf-8?q?+mZnrCKdr3BcUsn4LFBtfZY1/tlVKriJxn0ACwa67NeoZ0Xv8Qb/gInyZcRorMXal?= =?utf-8?q?lOrpj6ejqcMInS1VVdxGNoGXki1V3sPg9wK5VWWWRcQDRSVGzI6iNRR3QPDOs8UOI?= =?utf-8?q?iTUqSWvB+Z/7RZuTwo8ncONDO45XxKG5CvNSvtd2sY/UOd/6BIbQihZrRAUiq++kZ?= =?utf-8?q?xScibYYjGxJivrx/hzClBrfTVBPjoFfgSeEwcS4kvjAFuzQVURnr88NYqwcO9iCe4?= =?utf-8?q?salSG3NpFvw3l3XOTXFQ7ZsSF5Kmt1IMCOXx0PRGO889O1bYs+x7RaYe4tKq2EA38?= =?utf-8?q?PYJNypTZrwUdaj6+yMpbugQt4uINcPAXV1LoIGZslAF1PCis7RJuDVe/Jkv3LYzSZ?= =?utf-8?q?aRxwzB2RRHt3DIfNufC8am1uXErhLTZL7D/ejwDBNOXLnANJBALUPNgbeqIJmCxvr?= =?utf-8?q?kDVyBPIFdClayPgqQun9yN5JK82hNX5a/2O06VT7kcwrSx5GfI9B1o=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)(376014)(1800799024)(7416014)(36860700013);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: l6exJyPWjNvJiAKk9jW20w8pxVLSCGsdu/aa9hYliRJI0qtIetJqtOCU/XBElBwgtMqcpQ81K0K4heSzDoerIO3QfKuiV39wdzwyPSHkn90ntpaDqKcHaV7y0jvph7MxMHjQhvEjd+ueTfKdGZhTAk7udB2MxgMFRsSf1Hcw+Xm2ux25icoODlMhcz0b5cwMJFDv2sp9/hcZ06VG743kLvjcjXcaNNACvfhttQrbDJVxxG9k7P5e3PGOBXLQsKqAtamxSlTUAsSqc/H2yOnDKGvLxkm72RANddY6rCcm6WB2u2e/umwiFKeN6zxD12yGKP0YFtNxOnlBALxhme4TBx60e5f8aLjq4dg7TavR9YpQBfVj2PE8xWWg9GhfmdcnLaTkVqV53z25EnPwm5oukaF4eQZe7LrpQTu2S7872KS4StpO1TOB13ffiTxGYimV6WkygEjHRhvYsgtyF2sVWPgNGw/YJvQXOg90QTnGB64v7EFe/p6hnaWDT5VHMzwBfUlObL8qduNJophV8li6PgWjrPPb6syzFJfXPdP2e3IlH/vlFy49RNirkYnmXhvnWI8w+nqS1QFwDpRJA0bICW3Mm8CgUyX7shiL8Lpo1TOU9SH4I1h5PVlF2dUIKIKL5lz9QlSCA78TtYjFN2N7Mg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2025 00:25:26.5455 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a5aded1a-c614-4dc5-f5d7-08dd2eb1c8a7 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: DS3PEPF000099DE.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR19MB6271 X-OriginatorOrg: ddn.com X-BESS-ID: 1736215163-111939-13335-9904-1 X-BESS-VER: 2019.1_20241219.1759 X-BESS-Apparent-Source-IP: 104.47.58.177 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVmYWRgZAVgZQMNnIItkgLcnA0t A8JTUtJdXCwijZJBUIzcxSLU0tE5VqYwFJfpTmQQAAAA== X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.261637 [from cloudscan23-178.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 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.c | 2 ++ fs/fuse/dev_uring.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++--- fs/fuse/dev_uring_i.h | 9 +++++++ 3 files changed, 79 insertions(+), 3 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index afafa960d4725d9b64b22f17bf09c846219396d6..1b593b23f7b8c319ec38c7e726dabf516965500e 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -599,8 +599,10 @@ static int fuse_request_queue_background(struct fuse_req *req) } __set_bit(FR_ISREPLY, &req->flags); +#ifdef CONFIG_FUSE_IO_URING if (fuse_uring_ready(fc)) return fuse_request_queue_background_uring(fc, req); +#endif spin_lock(&fc->bg_lock); if (likely(fc->connected)) { diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index 4e4385dff9315d25aa8c37a37f1e902aec3fcd20..cdd3917b365f4040c0f147648b09af9a41e2f49e 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -153,6 +153,7 @@ void fuse_uring_destruct(struct fuse_conn *fc) for (qid = 0; qid < ring->nr_queues; qid++) { struct fuse_ring_queue *queue = ring->queues[qid]; + struct fuse_ring_ent *ent, *next; if (!queue) continue; @@ -162,6 +163,12 @@ void fuse_uring_destruct(struct fuse_conn *fc) WARN_ON(!list_empty(&queue->ent_commit_queue)); WARN_ON(!list_empty(&queue->ent_in_userspace)); + list_for_each_entry_safe(ent, next, &queue->ent_released, + list) { + list_del_init(&ent->list); + kfree(ent); + } + kfree(queue->fpq.processing); kfree(queue); ring->queues[qid] = NULL; @@ -245,6 +252,7 @@ static struct fuse_ring_queue *fuse_uring_create_queue(struct fuse_ring *ring, INIT_LIST_HEAD(&queue->ent_in_userspace); INIT_LIST_HEAD(&queue->fuse_req_queue); INIT_LIST_HEAD(&queue->fuse_req_bg_queue); + INIT_LIST_HEAD(&queue->ent_released); queue->fpq.processing = pq; fuse_pqueue_init(&queue->fpq); @@ -283,6 +291,7 @@ static void fuse_uring_stop_fuse_req_end(struct fuse_ring_ent *ent) */ static void fuse_uring_entry_teardown(struct fuse_ring_ent *ent) { + struct fuse_ring_queue *queue = ent->queue; if (ent->cmd) { io_uring_cmd_done(ent->cmd, -ENOTCONN, 0, IO_URING_F_UNLOCKED); ent->cmd = NULL; @@ -291,8 +300,16 @@ static void fuse_uring_entry_teardown(struct fuse_ring_ent *ent) if (ent->fuse_req) fuse_uring_stop_fuse_req_end(ent); - list_del_init(&ent->list); - kfree(ent); + /* + * The entry must not be freed immediately, due to access of direct + * pointer access of entries through IO_URING_F_CANCEL - there is a risk + * of race between daemon termination (which triggers IO_URING_F_CANCEL + * and accesses entries without checking the list state first + */ + spin_lock(&queue->lock); + list_move(&ent->list, &queue->ent_released); + ent->state = FRRS_RELEASED; + spin_unlock(&queue->lock); } static void fuse_uring_stop_list_entries(struct list_head *head, @@ -312,6 +329,7 @@ static void fuse_uring_stop_list_entries(struct list_head *head, continue; } + ent->state = FRRS_TEARDOWN; list_move(&ent->list, &to_teardown); } spin_unlock(&queue->lock); @@ -426,6 +444,46 @@ void fuse_uring_stop_queues(struct fuse_ring *ring) } } +/* + * Handle IO_URING_F_CANCEL, typically should come on daemon termination. + * + * Releasing the last entry should trigger fuse_dev_release() if + * the daemon was terminated + */ +static void fuse_uring_cancel(struct io_uring_cmd *cmd, + unsigned int issue_flags) +{ + struct fuse_ring_ent *ent = uring_cmd_to_ring_ent(cmd); + struct fuse_ring_queue *queue; + bool need_cmd_done = false; + + /* + * direct access on ent - it must not be destructed as long as + * IO_URING_F_CANCEL might come up + */ + queue = ent->queue; + spin_lock(&queue->lock); + if (ent->state == FRRS_AVAILABLE) { + ent->state = FRRS_USERSPACE; + list_move(&ent->list, &queue->ent_in_userspace); + need_cmd_done = true; + ent->cmd = NULL; + } + spin_unlock(&queue->lock); + + if (need_cmd_done) { + /* no queue lock to avoid lock order issues */ + io_uring_cmd_done(cmd, -ENOTCONN, 0, issue_flags); + } +} + +static void fuse_uring_prepare_cancel(struct io_uring_cmd *cmd, int issue_flags, + struct fuse_ring_ent *ring_ent) +{ + uring_cmd_set_ring_ent(cmd, ring_ent); + io_uring_cmd_mark_cancelable(cmd, issue_flags); +} + /* * Checks for errors and stores it into the request */ @@ -836,6 +894,7 @@ static int fuse_uring_commit_fetch(struct io_uring_cmd *cmd, int issue_flags, spin_unlock(&queue->lock); /* without the queue lock, as other locks are taken */ + fuse_uring_prepare_cancel(ring_ent->cmd, issue_flags, ring_ent); fuse_uring_commit(ring_ent, issue_flags); /* @@ -885,6 +944,8 @@ static void fuse_uring_do_register(struct fuse_ring_ent *ring_ent, struct fuse_conn *fc = ring->fc; struct fuse_iqueue *fiq = &fc->iq; + fuse_uring_prepare_cancel(ring_ent->cmd, issue_flags, ring_ent); + spin_lock(&queue->lock); fuse_uring_ent_avail(ring_ent, queue); spin_unlock(&queue->lock); @@ -1041,6 +1102,11 @@ int __maybe_unused fuse_uring_cmd(struct io_uring_cmd *cmd, return -EOPNOTSUPP; } + if ((unlikely(issue_flags & IO_URING_F_CANCEL))) { + fuse_uring_cancel(cmd, issue_flags); + return 0; + } + /* This extra SQE size holds struct fuse_uring_cmd_req */ if (!(issue_flags & IO_URING_F_SQE128)) return -EINVAL; @@ -1173,7 +1239,6 @@ void fuse_uring_queue_fuse_req(struct fuse_iqueue *fiq, struct fuse_req *req) if (ent) { struct io_uring_cmd *cmd = ent->cmd; - err = -EIO; if (WARN_ON_ONCE(ent->state != FRRS_FUSE_REQ)) goto err; diff --git a/fs/fuse/dev_uring_i.h b/fs/fuse/dev_uring_i.h index a4271f4e55aa9d2d9b42f3d2c4095887f9563351..af2b3de829949a778d60493f36588fea67a4ba85 100644 --- a/fs/fuse/dev_uring_i.h +++ b/fs/fuse/dev_uring_i.h @@ -28,6 +28,12 @@ enum fuse_ring_req_state { /* The ring entry is in or on the way to user space */ FRRS_USERSPACE, + + /* The ring entry is in teardown */ + FRRS_TEARDOWN, + + /* The ring entry is released, but not freed yet */ + FRRS_RELEASED, }; /** A fuse ring entry, part of the ring queue */ @@ -79,6 +85,9 @@ struct fuse_ring_queue { /* entries in userspace */ struct list_head ent_in_userspace; + /* entries that are released */ + struct list_head ent_released; + /* fuse requests waiting for an entry slot */ struct list_head fuse_req_queue; From patchwork Tue Jan 7 00:25:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13927931 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 D073F7082D for ; Tue, 7 Jan 2025 00:25:39 +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=1736209545; cv=fail; b=AcKPdmE5p71M9yvUiTZ8pXn5aaxwFylbYEt56/FPC6pY7JEzjFOHvD5ML7y4L78r8R7emGpW8Ak6HDCu/iehJoifEAQnBRUFlCYgUEZpe/Kb3e1S38FNbQmFtCYk8ry4K4PlPS9nhM0atgj7GsyUL6akBmQqG32RHIYCe7ZiILc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736209545; c=relaxed/simple; bh=AvsBUPQfhNKAli9QrA4nArV8nI+dbIIZOg4iPrMRRVQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WzF9FtWL0AmIWsAthlZkzOkX4g5gmhCJSUOZ0TkrL8OuyFtUTJMqjGPpqX4TSQ/yebQsRKEel8L+G+m272RKhtZULhMt1TFf7W1YruVNGiz00piJGMHDO2+VDZocHXv++szOSS7OSLbPxFkb/Yl/z9tFHF4oEZTFJGSQMbZJ3Xw= 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=RQuHq97C; 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="RQuHq97C" Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by mx-outbound-ea46-177.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 07 Jan 2025 00:25:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AKGzkzuvqCZ3Xii7xuU56+rUbvvyLDJIFN9nOAwBeR7jKD9HysPo5YlKABsvnCkmDAPlmGs4ZSe7be761utUb8NRu0lEA8GFxKKptgc8eojKtF7NwWqV8i1cjSB3aD+L8SxjgV0IPWPKf04Bpz/R39rtveNLpSrORPcpfSYRJ9oaW0ABOQD1oCQTqtmFebdQtxbDAWnvQAU6d1rObt0txfhZ5PmNVk3PDtHZkuMCrnW9DoCOn8ZJYIYIknZSTv5AIjRJl4MUq4TVuCD2MhJHU4InaL75abHrwLMeuu/mSunmt4opQXz4SQvSNy+geqGt+n04X27RiPU02RpRpu8OPQ== 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=4y8bmvGWbSK87f4CPhigqrP+Vwk8f4NI1+JX7qr0avY=; b=I7r4es8iKLX/J0PNUgwZAwGf6ZbM04Ft/C7LbcZRBm4YsSIiat8SzQi8zeOxBKl/9beEpGjSJZ2V+3h3358jdYfuwxew2gVpazkA3dljDjiQ+Sk5iy4S7KOM3Wb2nyJ7t9H74jclSa0ZhhgR9lojO1rXKNZgTpB50x/QxywrruHBnvjvMzzfZbl/HJ+YRRtssJV33N5kiM/S+aMZ8hXb13yzKsvG9YEeA5kBvp+hB+0ifyqhs38nOEW6o+6Qn6kbLIQ2jWtMx7ur1Hom6jo9WxP4GIhPue24fzRL+rUoddeHwnbyImcyf2WpfbqUHpKvPsL5Xhxw3mePb3W8Y3OohA== 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=4y8bmvGWbSK87f4CPhigqrP+Vwk8f4NI1+JX7qr0avY=; b=RQuHq97CWlzgwLlzB+YhkDGOaBvZXy8Tvpakv3LedJ9WNijNBOt07Pufw79lpn1UP2kJ3j3McVRo4HxWBJSlWi9lPu8ILUwJperWCKGJQgbe8BHSOe6sQ9vgb2zOgGbH+CTvArhaYqOXMA4ETFoZndusOO/XbC9NhZOIcRgm+I8= Received: from DM6PR02CA0092.namprd02.prod.outlook.com (2603:10b6:5:1f4::33) by SJ2PR19MB7487.namprd19.prod.outlook.com (2603:10b6:a03:4cc::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.16; Tue, 7 Jan 2025 00:25:28 +0000 Received: from CY4PEPF0000EE31.namprd05.prod.outlook.com (2603:10b6:5:1f4:cafe::9) by DM6PR02CA0092.outlook.office365.com (2603:10b6:5:1f4::33) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8293.16 via Frontend Transport; Tue, 7 Jan 2025 00:25:28 +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 CY4PEPF0000EE31.mail.protection.outlook.com (10.167.242.37) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8335.7 via Frontend Transport; Tue, 7 Jan 2025 00:25:27 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id DDD0B1DB; Tue, 7 Jan 2025 00:25:26 +0000 (UTC) From: Bernd Schubert Date: Tue, 07 Jan 2025 01:25:21 +0100 Subject: [PATCH v9 16/17] fuse: block request allocation until io-uring init is complete Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250107-fuse-uring-for-6-10-rfc4-v9-16-9c786f9a7a9d@ddn.com> References: <20250107-fuse-uring-for-6-10-rfc4-v9-0-9c786f9a7a9d@ddn.com> In-Reply-To: <20250107-fuse-uring-for-6-10-rfc4-v9-0-9c786f9a7a9d@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=1736209509; l=2651; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=O/2YNgt+Vne/zwL4Xkn94aO/pImf6Sji5SRc7zTLOqs=; b=5tbtVDbVpbHE8beRDl0/o2O4rDaOEbLLZiawyLCobl4woFu1FFe610Gl0ZoV81BduxtkeTuMf TmDIa77Xm42DKTVc31vST8YPiFm0i0Nekv/yRLSa6k8F4TvfxSvZBYt X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE31:EE_|SJ2PR19MB7487:EE_ X-MS-Office365-Filtering-Correlation-Id: ee87f84e-d356-44d4-2234-08dd2eb1c914 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|7416014|376014|1800799024|7053199007; X-Microsoft-Antispam-Message-Info: =?utf-8?q?JmVNPlpTf0UNcrrZoihYulFeDqV4QeZ?= =?utf-8?q?B8OTXD5i0x5pzrurBH/mi9GFt6vZzcip7oAPG9nvAIrUP8xQZwDhMiMRXN0ZfOs85?= =?utf-8?q?CO3UI4+6v2ecuJNsWf+xpNg0eKAiInY3fk/uocTtpPj3lNhR81fOR/HvqFHnKz6B8?= =?utf-8?q?k2yQjUlpR47/2QuiqeSTmwR8IqLsfHjrcGj+GWYJcDtL1Vi7jR6xu6/45+YjAC7qz?= =?utf-8?q?j4MhnlaGKHVrwWQ0hjFA5IYYDCU6WUh3eO72ZN9SWoWv2KmNMhXy9s7+nXwGenT/E?= =?utf-8?q?3vY84J1jByyNED3ZJheakRX9aL68NbkT3kI14tcBhxYVHxqbdsAcsvErcqqy+jsLE?= =?utf-8?q?z10cF7PB/5r6aBBpotdJ6ZKi1vZXPjWSlEyfe4G0m5utW84jNKzOO5mOb7ujOT5yJ?= =?utf-8?q?CDmNyULqSCQPrE/bhFAMRZNVujSv0vi4oK+Vp1cdYFAEyKIrtnb5HbTRfZURo6k4s?= =?utf-8?q?clbR5qRh2FxZf8dC80v2bV550+Sh5CBq5PJxd/DD1s2msN8SH66eQivmxSQm1qTGQ?= =?utf-8?q?C8MG/FNBJaaGRyK00FlcTRkvo27t2/Jx6OCHstSS0x44evbfBhyBIFF82DZAqNsZI?= =?utf-8?q?8wNTF8/LxiIfQJSwweQh5/WowP+Tx7Pp1ZuXTzZ2tdWppiSFbYaruW/IQh7K0gKym?= =?utf-8?q?LrVKmlEdc2bpVZSAPHvfdfmEalkBrhzqYc59+aKoArW8GD5ddt6X74z3aPPLUn9XK?= =?utf-8?q?OXFAkFXyIo6oOknY0i86gU8pwl0ROKS0/n+8Icr+ABANnpBfhywm6/HVGguuDNsYa?= =?utf-8?q?29Yfjt19sJIYUbCk8oV0EIhqhRsv6diFMr1N+C8SXKxzWV7G5ibhQZuvE6/UWqZ+Q?= =?utf-8?q?XABiVK2lLJnqk8NzAYSCXNafk8VYnpYgqD/IgP+l/0Gu4qaikH2QMbKoKC1myaIw4?= =?utf-8?q?va/wYgx4iZ4IylN9k5CvMRyrvemKR1ALQcfhW4YWjrAz0wHqntyPtdg6ay3sLSeXn?= =?utf-8?q?wlZxMwljHWAHXvlNv4I06+ywHklzmtJTWvbFsWtvqo0q5eNkofycNEKR3Updz1h1v?= =?utf-8?q?wkaVeb+XLyNjgINekU9mgPcucS/0DzRAqvNzejFOOqTB4JexW/0bkko7rRJ+zTk9Z?= =?utf-8?q?kyK13MPW5Q05kgMlK1e8q9yyHlJLfyp7dqIA9YxMKQszNsBG+pBCQd+6MLGu4uhIY?= =?utf-8?q?nfUF3GH8yJrau+w9Bn5x4+pYh5mSmLlPnLM0tEO+EoHmIhcvmamMVaUR/CoDfBxrn?= =?utf-8?q?wwDwvKMH0Nhf2QoY3/ygrgWi7AI9IR5GwCUrTGtRxBX5LrRulS4pr8B8cjb5Sij05?= =?utf-8?q?MNJxQWQQOCxQsVn5BC0V8u//DuSLUyrzGmotM4BKM56Nk9+yLSFlsEBB/sfi8NwJ1?= =?utf-8?q?QidvIGIOKPksRXXPwN0MGty+F27F1BVd1z2xfDskr3C2sDnvMWrixCbtE6XsqoE9C?= =?utf-8?q?oOeL/oSPKt9hBgBUSpnYClJGTvAB9rh+tytcFZPi/vydcEZn0oMICU=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)(7416014)(376014)(1800799024)(7053199007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Use26U0+VBkRoAyBzAIH5ev4gn9sOK+DhkQfc/Y67goXkOKi8tDkoEvafxDWGtQWuoSJ+2yKRsaRHgKG2/oK4+uFdN9yi1LRDClzgEUYE70W836edwtqyw3WUeaD12ttwTNBbwrwPCge7oMcgAzZbymhyDFcrBi1oIbvR4+IqS1842JbjLLSg1afWXRlVC9AzD0xXolJV6SeTCvkbh3CVQ1NR4CLxCXItsUtNGpnT+tZsgNAt9QxahibcsTfuMJCs/PRhA78FYucVoffNBJx6bqBUDfgJZjWcpad3TcVpLNTMpmsEizYkqDtGSKXOkhL7iTQRhegO8CzU0R5Tpfrq/d1iCHsFqrvJXGV46OiGo6qeVNCH1FTazfjky2UGye9bPT3ED28EvTiCSXAjxf9YcWRaSh3wHDhMCQpvN0VmlXmxAT4A5JDMpVW+Q9eZH9UkeiDauAR4PEdOzUvkJuQ5rtSRXFPrAyn10DInF0HlPdpy2VGnxFozzIa79Eg/QLKCnH6v4sFxjWrk2kVkUYKP9yq+INcG08+Lcnu77D06HQu5NGi4olt2CsffcISNiIvZkConz+93p7/vNB7VofTl1VYw4d7zf54pTFSSmHv+t5+6JyHlFXh1r3kscATCVyZqhzhqC1J7cr1lU8fC3vA2Q== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2025 00:25:27.3169 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ee87f84e-d356-44d4-2234-08dd2eb1c914 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: CY4PEPF0000EE31.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR19MB7487 X-BESS-ID: 1736209534-111953-10732-17295-1 X-BESS-VER: 2019.3_20241219.1759 X-BESS-Apparent-Source-IP: 104.47.58.168 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVkZmhmZAVgZQ0DLFONnMMsksLd E42dzSzNzYMDnJyMDM2BgklGiRolQbCwCCYJjpQQAAAA== X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.261635 [from cloudscan22-44.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 From: Bernd Schubert Avoid races and block request allocation until io-uring queues are ready. This is a especially important for background requests, as bg request completion might cause lock order inversion of the typical queue->lock and then fc->bg_lock fuse_request_end spin_lock(&fc->bg_lock); flush_bg_queue fuse_send_one fuse_uring_queue_fuse_req spin_lock(&queue->lock); Signed-off-by: Bernd Schubert --- fs/fuse/dev.c | 3 ++- fs/fuse/dev_uring.c | 1 + fs/fuse/fuse_i.h | 3 +++ fs/fuse/inode.c | 2 ++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 1b593b23f7b8c319ec38c7e726dabf516965500e..f002e8a096f97ba8b6e039309292942995c901c5 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -76,7 +76,8 @@ void fuse_set_initialized(struct fuse_conn *fc) static bool fuse_block_alloc(struct fuse_conn *fc, bool for_background) { - return !fc->initialized || (for_background && fc->blocked); + return !fc->initialized || (for_background && fc->blocked) || + (fc->io_uring && !fuse_uring_ready(fc)); } static void fuse_drop_waiting(struct fuse_conn *fc) diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index cdd3917b365f4040c0f147648b09af9a41e2f49e..45815dee2d969650efe0df199cc3bd1f3e2e08f7 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -956,6 +956,7 @@ static void fuse_uring_do_register(struct fuse_ring_ent *ring_ent, if (ready) { WRITE_ONCE(ring->ready, true); fiq->ops = &fuse_io_uring_ops; + wake_up_all(&fc->blocked_waitq); } } } diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index e71556894bc25808581424ec7bdd4afeebc81f15..886c3af2195892cb2ca0a171cd7b930b6e92484c 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -867,6 +867,9 @@ struct fuse_conn { /* Use pages instead of pointer for kernel I/O */ unsigned int use_pages_for_kvec_io:1; + /* Use io_uring for communication */ + unsigned int io_uring; + /** Maximum stack depth for passthrough backing files */ int max_stack_depth; diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 328797b9aac9a816a4ad2c69b6880dc6ef6222b0..e9db2cb8c150878634728685af0fa15e7ade628f 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -1390,6 +1390,8 @@ static void process_init_reply(struct fuse_mount *fm, struct fuse_args *args, else ok = false; } + if (flags & FUSE_OVER_IO_URING && fuse_uring_enabled()) + fc->io_uring = 1; } else { ra_pages = fc->max_read / PAGE_SIZE; fc->no_lock = 1; From patchwork Tue Jan 7 00:25:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13927926 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 4CF433FB1B for ; Tue, 7 Jan 2025 00:25: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=1736209540; cv=fail; b=GID523y1vKJOYs9noO44pKvQPdJN8dN4Qr7gO+tUfasC1hxU2e6EZKe+K73U28HrVp0wEvD7Hcvdk7sd0NNh5Mu3wZd6/bkxrEVMpwMuWwzc2Ml1fPu63+4ttSKVPkBxL91GPLA+KMRGhEB88yN1drHIe3zWwIcXgczGwDPCHb8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736209540; c=relaxed/simple; bh=dQutDZUt3SL0iDOtLH4tYA2LbMaI3JbibTNcglIVU9g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=E0u8VqxUlhINwbTaHfRBQLREQcH9qtjOl3YxW6rQZYRiuyTGW66fDudd+Q1kotpYgbXyeXoKsdZy/M73bUjY0px4lHeMTTdRiRcAjAK7b6QC41yLymqmQl7ldCNDJ9vFT6BvaLZdclhxkdulu4FNXf1jQzZfRlhlK4Et+zqJl+A= 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=iKpWla4x; 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="iKpWla4x" Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2043.outbound.protection.outlook.com [104.47.73.43]) by mx-outbound18-108.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 07 Jan 2025 00:25:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=astEywwfQAKdODoc5+vJf9HSlQVRNsg8Qlg/g/KtjBnU0R1CvlfmgaIMDT0kzlYX9JQmJ/06QadvBEBNJkL/itKewpgtHh5Ro06nrooZbKUW15z1y7GmxEg3mkJaRjcfy9VoV8h6kQRs1oIplkVdX18C8MXsqUe9+wDK8weOuydsVRrIorbfqdzi6dlSGiwla6541aOQfVSf+2ff4sCG2TvNKa8Zg8glLcsujaXv45MnMPL8oOGPJOvXGYCFetjLQ64tJARB8/faW+rD48snFNZCtlAd1PjZnUMoF9L5iQQYgkFCEwTWalfma2h+kyRTnF2P4H31IJt+S8KAc9xxHQ== 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=HY1B3FX5iLFwEpv5V1hMiSYUnwO73xOTjLBvps+TfJ0=; b=fRLXfk1kj9Ivou2HDZHKkcOvyEF4YgmEYu6SO4/i6J1C5rHjHHzPYTWnedMIGI5oZON7xe7ao3njCYbdc2K5Q5kVj3kmYS02jIBgCoL/o4jDyfGm/z6eClRBIV27pi5T2bMzSzktaUwsBVz1/kafaGuFo21ZwpLsmxW4cZaZm3Cve3irCstZcrFIZ6dI/81VZZ9qB+2BAXyPDO9pjT7JubEpUwjUloMBC/F/l233q2lCqGqDkKQYpuObY2On2mQ81nUCPR2kL7SStk8AfwzudJbIjJnKDQbEJJr6XSKMOn4r7uJsob17cfmGGlrfdix6RpLk9AerZacp63NUV88awQ== 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=HY1B3FX5iLFwEpv5V1hMiSYUnwO73xOTjLBvps+TfJ0=; b=iKpWla4xY2Jq2dyWn5v2ALnBgrbLHSpwOHz7/xlUEDrIiSj2RUrgUoCYdajDSbNMiu6HosyW4kUqRy0oe/Dm8KLqKrQQGuir0pwlMHYp/ri5Ty8PevgxSLwLGsN7Me01zHpFwel/4YXtk2XyD1RuNBiify8ZyLZ4CdNOmS8/T+w= Received: from DM6PR04CA0014.namprd04.prod.outlook.com (2603:10b6:5:334::19) by SJ1PR19MB6258.namprd19.prod.outlook.com (2603:10b6:a03:45b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.17; Tue, 7 Jan 2025 00:25:29 +0000 Received: from DS3PEPF000099E0.namprd04.prod.outlook.com (2603:10b6:5:334:cafe::a3) by DM6PR04CA0014.outlook.office365.com (2603:10b6:5:334::19) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8314.17 via Frontend Transport; Tue, 7 Jan 2025 00:25:28 +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 DS3PEPF000099E0.mail.protection.outlook.com (10.167.17.203) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8335.7 via Frontend Transport; Tue, 7 Jan 2025 00:25:28 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id D6D684D; Tue, 7 Jan 2025 00:25:27 +0000 (UTC) From: Bernd Schubert Date: Tue, 07 Jan 2025 01:25:22 +0100 Subject: [PATCH v9 17/17] 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: <20250107-fuse-uring-for-6-10-rfc4-v9-17-9c786f9a7a9d@ddn.com> References: <20250107-fuse-uring-for-6-10-rfc4-v9-0-9c786f9a7a9d@ddn.com> In-Reply-To: <20250107-fuse-uring-for-6-10-rfc4-v9-0-9c786f9a7a9d@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=1736209509; l=1366; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=dQutDZUt3SL0iDOtLH4tYA2LbMaI3JbibTNcglIVU9g=; b=JlOC1bXJK06sKNpeeVQdEGNtPprCaGViGxnk0rmSt17Jaow8TFKeIZ4Ru4uZ/LFIswTKPnrTL yQCSn1hgvniDoR2NNwmdO3WoYJCyySTaoIUros9rGzQfxcB8mRjI9qL X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099E0:EE_|SJ1PR19MB6258:EE_ X-MS-Office365-Filtering-Correlation-Id: c93d05ff-5178-4aa7-80f3-08dd2eb1c9c6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|7416014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?utf-8?q?yV7CbaI0smfWgQBP3ZCEH8HTdZvMr6I?= =?utf-8?q?DaxT0CmLoYp6EKjtRvM1MhvqtzfMKklh2D3JzjL61R5edlw4ukK2+FDLv+ZxTpPgx?= =?utf-8?q?J+QVqcRNkV60gDyAtKblbqZVx4M25jas8LnpB/4UDF2tmJIdru3u6lFAggd+YTo8S?= =?utf-8?q?PePRu+RpDFh7bWDPGrtxHemxGpmKkRnJrAgcVNzemmBv+TRr6h/wMZ0NgYdjlIKAT?= =?utf-8?q?e2OTDoeTJ69s9eTQiv6W2l00sbAYGR1IeXT9fC9m4aSYZMR0qIbj16T8YgwSYGe3v?= =?utf-8?q?b2seJ8oWvs9vItQqDZOoCzt9NZUxkofkCmdJH9a5rFZRS5kAFjQcKrFVCRqUs5/DO?= =?utf-8?q?Fvna3F0iMox/U4i4dLpAU2i9vujhigLn+QqQnC7uCItB10GoRO04w4HVhiRhCyDWB?= =?utf-8?q?L5i4na3GI71NWQrsbWsY7UnSTph6xkoI2WRhuxcoi9gDXoxM4WbW3W0qhX6ki6G//?= =?utf-8?q?cQVDblE3ipUoYDWEXLHJBvcFnW6t0BeBxryl1rufLyHobuasL9ZvpeuDazFmyccHj?= =?utf-8?q?FDLSV0jhXzVZ/q+w4umU3ocuz6WfD8V+QCTuWB+Pbg4xqpORrPQWF1yzHgFadZqaa?= =?utf-8?q?VgvhIZzJHBke+s+gdT1mchcOVg7y2fvFOkjCUnnoYw03iyrwW3jo4FBFdAHdHSeox?= =?utf-8?q?bzyFJq191+qH4Y5E5mYN14bo6hlcydNRoUegFTW3Sb8s2vmEozrA5no1C1kDfAd1o?= =?utf-8?q?jdzqTK3ttEb/Heh/v/dTG2OuGkZiUwBwVx4TPXth63AoteZcZiVBMzff5vV75vaYc?= =?utf-8?q?xAeoX2R/T9yGeph2pvjj/M5mzlb31I8xDaas7G8jX3dzeB5GSnaMDdmcmLfwcW/0d?= =?utf-8?q?B4JevLZa6lTguH/7lzQj6oID+WuA112+lGPOybdBsuQkKFa/cbQ6dDxHehZvpEVoO?= =?utf-8?q?0AlfUBsXu+b2pVufcAJu4kjfxog1gLrZm5UpXZ38xJa8ItqM8YNBFbjK+u7omXrlt?= =?utf-8?q?ktK93k9/zfZbnAxw5gBQFtEUZPnF+tQ6O/xz1h5K21tR7qz/coaChi6w8pmXhoGUZ?= =?utf-8?q?iGUm4eaf5/uvs8wzgqJwMuJYPutf7I7bn4tTtXmrRuv07ist2En1OmnYaTGTBNwUl?= =?utf-8?q?hASoYk+dwYqvuCX/uhtCbuh13stALGgAwbAH1PC6MLfzKt0JGcUGhj/AsS8mQg4xu?= =?utf-8?q?IppmrZkmz0M9zptHzGdG1tM35+8GdQO6OkOPv91xLK8iXJ1V0aTC8SWOFGyEtPifd?= =?utf-8?q?M4N0dF/zHCBcNDVhD1OVkGcePAHt8oT9VLXg7I+Xb5KitXt4qiJaXQT1vixFhPDQl?= =?utf-8?q?6/LHee0vG4aQ8yEsVcwJFxeJ3fdLlBv4UDLyAKWHUSjjirZbRZRO/LseK+Iwym4Cb?= =?utf-8?q?ewGVl8CTXvKjn8dtJiGTfdQyXwWjvSfaXhleeSCsBblhYnJ9hKADLiGU4B1bls9Fj?= =?utf-8?q?WwPnhx9G+6v8PrDWFi59Os375mBtQwqLz9s5w+uBlBzzlMkyoS+6DA=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)(82310400026)(1800799024);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: e/x0JizAjYSxz+0sR2duiCSVo1NTTA1B9O5KgFl8jz21/LEoqnPml2Kl4lPmuY0dqgF7CYaILHNA8VvDFx+6nxTTPD/xQzx7wM99JHXn2nz/gkdiD05Arlnci/niuSM+ZwVpNj64Z6nLfgw6FGv3YSd/fptsSDwQc8JbS4l3oDrl1SkY60ELx9R/zihtv1945NvimrdmMDirP3eprJR62nf2mYiZtS17/4rL6W7TrUStPknq+k3b/0eZr6yTvaU/HCYFm8oTCAPAY+CZTOfvjwJ0aCuM7w4QE8v/h0Jmaimh2lv3cPWjQ/rO1U2LddzSVeipUvMMyldxY4pnTz1pgCPafaRqjNkVOw5tD+BPVamoy23/sHuqdgqIyuIggN4SvS7nOTI22+j/8xxr1gs02RCcbxqJmTylmyjGE7MRbrpkiJ3tzIMpX0eCFeSIOWBQ+mkFuoYVvAnWQwQw9/liYv3PLgNxBG2P0smqBklmxVefgxbsfY2RpprQW5kYw16l6WDEVyjP6AWypX5X7Ub1P2eKct3VlgltnlgyqICEUJgkiuF99A4cuvdHkIfH1pw/HPKGlNucScdy8l7b7hbSPsQO50osutnPR9ZkFpfC/p0NhPE79vQTHZpusFWc3VzLo0ogsXcX9VC5wkcuEA95QA== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2025 00:25:28.4859 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c93d05ff-5178-4aa7-80f3-08dd2eb1c9c6 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: DS3PEPF000099E0.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR19MB6258 X-BESS-ID: 1736209531-104716-6286-12657-1 X-BESS-VER: 2019.1_20241219.1759 X-BESS-Apparent-Source-IP: 104.47.73.43 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVobGRuZAVgZQMMUo1dAixdLUzN TY3DwtMSXZIsU0KcXUIMnMIiXV2MJUqTYWANwvbpJBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.261635 [from cloudscan11-89.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.c | 3 +++ fs/fuse/dev_uring.c | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index f002e8a096f97ba8b6e039309292942995c901c5..5b5f789b37eb68811832d905ca05b59a0d5a2b2a 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -2493,6 +2493,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 index 45815dee2d969650efe0df199cc3bd1f3e2e08f7..946b8468959c14de9e0698d63b52c99fe6ad352b 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -1090,8 +1090,7 @@ static int fuse_uring_register(struct io_uring_cmd *cmd, * Entry function from io_uring to handle the given passthrough command * (op code IORING_OP_URING_CMD) */ -int __maybe_unused fuse_uring_cmd(struct io_uring_cmd *cmd, - unsigned int issue_flags) +int fuse_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags) { struct fuse_dev *fud; struct fuse_conn *fc;