From patchwork Mon Jan 20 01:28:54 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13944635 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 CB35E17C68; Mon, 20 Jan 2025 01:29:19 +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=1737336570; cv=fail; b=MluuZbOQmoIWzMSadag8e9RhC4/tpwXN8HpswN8OXMTLFoKNjgahTEq7UhrrSJQSvXmzc8RcwwRpRRwWVIHXo1Jh0R4juC9bcmDfTOA6K3p1YUok3OhwHGsCz04ENW4Quvtg9rLWPbggSLMTqD+nXT493G2I6ke+Z4ATnwmgXb8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737336570; c=relaxed/simple; bh=M3GcQWwOaa8BbwZh7SUIGaTx+lkvQ0F1YCuEjX2dKV0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CO8PfX+yvBNBV2ItUF2bCw5m2Pl46JflZwecOe36R8dcaDWNrVSNtzb2vcDwAG/i14yP8mJykdwKYAwb8EK7NYdgalJi2FXKtWFOY4+ZnrBFwhIuGcrJ37/zUPPtuF0C38yBKdVFCG7wjH4OtPjX0dJ6SAZz1ZNfImRI/r21pyI= 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=FFKGaz53; 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="FFKGaz53" Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02lp2042.outbound.protection.outlook.com [104.47.57.42]) 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); Mon, 20 Jan 2025 01:29:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bvxdSwrWbddF9lZriDt7yULaxXaRxSJWa+mjW8kcdE/GBzgkVqFKgaGBDBilQ3fY07HwUTw5JmEVlknWS4oIhuHuO9qZ6/FNi+wwXrUI8s4gWbs3Sxr3aUjVRC7geyMKBGTgqsibdgM0nln/VHIH/80qBC4RpeIGS09C+CvXEXnekneV4GJ+ue3lbTnGJuZWuwhNq3wJ1LJQp/Z76qaxlnM05KPtAcJ0JK3jdAIbE7DH71IZCpW4+WYYDGxWCC3KBo4+ZOA7UBxr+8WccEisri+wdwuQ84Lsuo7rygXCyWvV4qKin/QUJekoT6SH4ecTQLAme0WtX6xjL127LjVqlQ== 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=PHFibcW1MdN5f8O++LW0dloYLr+atPnC5GOQaoKrpsbDlgObgeVv8uw69K6aJyH0OUrekdr5nXYHaeGSgOC36O6z9XAEbLdRlk01NCsRqcZl9el6Kpx4sHDwfXFRlHNgcR0L4ptkrmlrn0IfaMjAUE9zJDQcSQmyIncZcZNjs+AZ2quc7cjaYErY9jCDvTJ2cAWeFX0hxVh5FHi0Aihax9z7QazlIBPmzzVXNj7QnXlJasRYt7UUQKN2CJ4vnwwEYO/YBblyzUqZYyPP5Z6nKLMRQEMaeRVdHocafHSxZpgJcUd0N0CFe2f/564PeEEYkutushWRDsRA5hPbYYPHfg== 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=FFKGaz53bfde8I5rkFWK+SkcgLvaLS9iXI56GytIMh9em5CEqL0Jn2VLHCpuCn4C+zVT68KR98G1wrNPuk0q0iR6mabTfVbr8+RvwSX5KzNug3+N19EFr1jaLV8U4uf9brlISiQ85E1caWKelzujsF4ZnEcUjJGbUalurn1MY9k= Received: from CH0PR03CA0338.namprd03.prod.outlook.com (2603:10b6:610:11a::10) by PH8PR19MB7167.namprd19.prod.outlook.com (2603:10b6:510:215::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.21; Mon, 20 Jan 2025 01:29:04 +0000 Received: from DS3PEPF0000C37C.namprd04.prod.outlook.com (2603:10b6:610:11a:cafe::5c) by CH0PR03CA0338.outlook.office365.com (2603:10b6:610:11a::10) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8356.21 via Frontend Transport; Mon, 20 Jan 2025 01:29:03 +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 DS3PEPF0000C37C.mail.protection.outlook.com (10.167.23.6) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8377.8 via Frontend Transport; Mon, 20 Jan 2025 01:29:03 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id C9B114D; Mon, 20 Jan 2025 01:29:02 +0000 (UTC) From: Bernd Schubert Date: Mon, 20 Jan 2025 02:28:54 +0100 Subject: [PATCH v10 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: <20250120-fuse-uring-for-6-10-rfc4-v10-1-ca7c5d1007c0@ddn.com> References: <20250120-fuse-uring-for-6-10-rfc4-v10-0-ca7c5d1007c0@ddn.com> In-Reply-To: <20250120-fuse-uring-for-6-10-rfc4-v10-0-ca7c5d1007c0@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, Luis Henriques , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1737336541; l=2781; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=M3GcQWwOaa8BbwZh7SUIGaTx+lkvQ0F1YCuEjX2dKV0=; b=FRL4YYzsraxMHAFWeKKqcHvRdbRVTPTkKM3xK6nAsHMkO83hTd5WzKF98qMiJI45youDKJWem v+Y9xvLIWYkA4Go7YFYTvpjhbv8yYzz2GFY8wkUhrz1ET9nK9Gg/eD0 X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF0000C37C:EE_|PH8PR19MB7167:EE_ X-MS-Office365-Filtering-Correlation-Id: 238af49f-e6f4-4ffc-5f9f-08dd38f1d2ff X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|7416014|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?KiuoFGUdz5iYssXMT7QIEgkKCZ8rLPy?= =?utf-8?q?V+hEMDRq63ByUEz3Bgr647QPO91DThUVu4S+mUK/IzQ+93WZn6Ao8MtvQkI0BMbgl?= =?utf-8?q?iP6F1dQt8RVf7nx6/WNLAbZN3PkQFdGjTmDevrooloxATDxAfKsCI30sjFkDmfOtn?= =?utf-8?q?G35Ka+BFxhiwyr9nljwfZRaXTNMcbSpUhFyj9wwnw5ljQax46SKKSpDe1pJIFW+xD?= =?utf-8?q?aqaddwN2pqBc2Rx0G4TXavgjMlkXYD2k04MY+9ej+Vne0ZqqQ2XplE9eVyGmzTlBU?= =?utf-8?q?OJZ5PYd326OJUAcqU9uwkJI5sJgBBBV+4P0B+ZlBQJC7S/0S0Jgc/XO8q7p/uTvpD?= =?utf-8?q?+jKx5UnGksNss1+VqtduNEfPwT6+KNApkPK+C7sMS/KZRvDiXjDIvWwYSUbTHrUFx?= =?utf-8?q?gynbDynG0RbtYll9sFO/acBtI/vqxKPleSMC/JbFWuxCUHw9K6ieomPKmEMqkk9H0?= =?utf-8?q?ln4xRgmQlQgrvstvp2uSGgDnEm9Tx7oswmELNJERt4eajcLUyg7MWWwpoqBwQ/1wK?= =?utf-8?q?FbOBOwnP6pdYmS+QWsmjRUu9NLnVbkL0TOnLTHFOqpYLa4fFycNOX3Xmhuo9R2M0V?= =?utf-8?q?K90ZP9rA+56HT5N/bI9oD/m8/rC4uUh5XjecEdBKq8ISZyGj+IyyFdKyOPdxjWWC3?= =?utf-8?q?skKxSOcxZvrNJJF5DeIFxVSqZGQogtyoiI7sIJqW984avW0tA3AsGTyKpKNlgDkTH?= =?utf-8?q?BXL+AW3cTQWYX/vuE6aCT4eKvC5ueN5HhK/VIth2gsyoIjf/sbQ+4CmoXivGuTywv?= =?utf-8?q?2HqeqMY9/nLG+J00ee8ZPHEtKkjbx6XjGnbigk8KcsioZ3XY1TauGkWomLSFoSWPu?= =?utf-8?q?/9DSScOAb2tfYSjhLeDpT6/LtS4nVNIb30OzPw/KmM/CFROm2aAVaLzFs4vcR174a?= =?utf-8?q?VHsO0E4yr1tfA1L4JUtyCITmE6PhMAuym1bPS9TAtX7Nc7do1OS3N1Sa3A6Sx6KfB?= =?utf-8?q?2MlDeVrISP8hZcXwy9LEHb1+QXFXl/NlrNa8acd4eHMXbRl1ae6JSUndF/wVJznY5?= =?utf-8?q?wHkJ34DaPOaOcK3f7+A1Ngq4pOsbz/sAfZCrbefDPdZ7nHvZjVIggDilaJfM8+sL9?= =?utf-8?q?hcI/zVUmedpVOyhA0rId0Ae1WuBquGS+0/yTNgnOhc4gbyl5ZWGQEBRW/2PhCelh6?= =?utf-8?q?VtCqX1AKzyABekuzN4LXkEgKCVcORH7//rvSOIvr3Gr0cM5nVeb5Za3eXfLA4iME+?= =?utf-8?q?P0sI1wAUF6BEz3s97Rt5jL46ZzqHiYSuucwya0zPbJBSLB61TDvUM5ezROvn0GRrb?= =?utf-8?q?vti2AVpnMbUn8WTFRrWuGwxGHX7DRN/zXq7kxwBBrWpH4qZJ0UHCyd9RsCZXuXk6r?= =?utf-8?q?Mtql48DF3R9VPLd3dwCPZjYs/sPN86sRX1qV7yjH2mZNZjGfphsxHBFx1MSDTe5L+?= =?utf-8?q?MIsa+ZSEU03urfIjbXSZhQmmM+Jyq7ohg=3D=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(36860700013)(7416014)(376014)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: XP9cqDSJzX9GM9GYCAPGRYzdvu0pJcYcOMdl3TA6QVdDmDr/EUP2AgoWYHp3epMxTOFk4n/+FrdCAEb1ycT6qxfo8Xj9WtAkI61KSBHDrUwhTeZcEnP7nBLQcS4iwgifDs4Bef7zgy3SnC/ony6kkYwfjixf7VnRyFD0a7SYPiC4nf2tl7uidEz/iM895w+OQ197Mnu+8+InlZHWijJLZJlA8BStS9JMQvIvdvSP2LRUfD6dQEBgrKmkLHmEqSIz+fttWisi0aZ1rScWBIgZ5M6NxXOpDfi++ll/9+ylRLAzJs72gbbMeAoWFv1AJ2l5l2yjCfCAxAN7yVoipOZYbMWtYK2Nkc+F2KTRCJQDjKCtyQyEJp7wxCfxzOO/aAMU5pU18pe9uEkJdHn52HnBg7jXm9YMwu6xTnbMQijIhBxl7JQZN4Ioplc7W6c7BxIt01z/wwORFoecw7ugSyWwgqDAnf8TkYhb8UiaWaEgOCh9s7qkj+D60KuUHB+rUIbVaxghiHeWUxBLIZwqjrjFO0B7zIMjSV7O+VYhIWaYgKFJ8qDTPLp1JcZQ5iq6yvJ0CShgIJOeCTdmup+S/RfBBkKn0UhbSwsO4BlZutXOUCCHUYy05ANmiRkIyVRmg+5YISJA/gukk8UmrSeqQ6C0Zg== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2025 01:29:03.3610 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 238af49f-e6f4-4ffc-5f9f-08dd38f1d2ff 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: DS3PEPF0000C37C.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR19MB7167 X-BESS-ID: 1737336547-111953-13367-191410-1 X-BESS-VER: 2019.3_20250117.1903 X-BESS-Apparent-Source-IP: 104.47.57.42 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.261928 [from cloudscan20-58.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 This 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 Mon Jan 20 01:28:55 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13944636 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 C9A1F17BBF; Mon, 20 Jan 2025 01:29:19 +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=1737336571; cv=fail; b=dwbQjcpyq3aHXGbN5wgMlhx8mq3v87h6HieFB0qfaVmzdZtI9AJXgUPWpefkcOY3jgCR8PN1c6hnlUf/wuUWpgpolxvqkrT7utZJI2f+WphykhZ9m3lT3ZivIKubFIXq4/c0NM3Eeuszu3wPDy/2JgAoyn2zbCDP8wDcAM5kA8c= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737336571; c=relaxed/simple; bh=wxYO2fuIGkvqmeC9PNGhH5rOX2Wls8HlW08RzezL2Zw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FcJmjayDfBupWbGNB6C9pLtA0IZCiUu1OS90drvMAsJ23wTQ2pLP7t76dfkDIk/8EUHHsjoA+mwr/fJr61RwVzJsAL+FI5OqBWigCWMPpevKRCMprTLUf+MlUKCh07GO4/0BytEOkZMFbfuzl8tYxAL9TGOBSUf+PFnS1L5lcIA= 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=FxYoBaDX; 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="FxYoBaDX" Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2043.outbound.protection.outlook.com [104.47.58.43]) by mx-outbound23-227.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 20 Jan 2025 01:29:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=K9qsWd2jf1+YX0gSOlz1VYwLYXF0Yg2NJTNPH4BiG+IWOE9xDwJ4hDOMxsrJA4DoGkV08smwDuO0Iy04t414DQEZBAhTCf3cIUxEfrqB4RIR6N4Oj2EXyHrGiooVGam2OWbo5UNlSP7KEYbATFPg244CjWQDSLPHpddckQHpcJB7vODhwbchztk6jH5DSQKSPpGViL6qdiBXM7ORPPp1xfqWwNJSCOdhXwlNivEJnTNTC7+YvO5Hra6a6cxk0nNP9EHSoTXPFRuHvE7kfB7vy/ttc5DEQCJ9OzhkPFgTXMWZeuyQ9cw6srir+JYmNwfCCEacPm4TLj2SE7zvBdDXMg== 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=UyRENuGBoZ5OB/Q/gThaVRbf1dq+F8gDQm77sKfBTswSF8AK2Nn0GM67PEf51QOykiDA7Xac5nFSO/LDJ1xfb7ewYwd7X+AXDRH4REkvic79CWasXQsCzXzrA50zGR+UtIlr9/5ePHcdg9WQbcwtQ1eHcddRm9G4oHf5qncfGE6haCjRirqwnHRoS14rqdVweDtwxidk9wt3PL+Xen/E6GFJ4J6OS8u/ermLByAzr3KPVqjb6BzAyv4BZaIJc1cRKXLN3Bb33XPT82PlO+TLTa8oarDSfURNg+2yLUj1OBJyp8tPwiRzEfTasQqlTAP+nzzJNvboyrDPH60fmZLkdQ== 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=FxYoBaDX+dciVY2H7ZNnhrkrQyUsnbgU/82fR3mlPDY9F9O3nrgEL06P1ErwWi3UScM1MMs90Zu88FQfL94gETwxvAyzHxTLc5vOZVTs0IAnp2qR7KayXVQgOqp0u6Iv6OI4hzUx45EowBy/AMeeFMXnivXRLVxO3em2j0GHdwQ= Received: from BN9PR03CA0876.namprd03.prod.outlook.com (2603:10b6:408:13c::11) by CO1PR19MB4981.namprd19.prod.outlook.com (2603:10b6:303:d5::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.20; Mon, 20 Jan 2025 01:29:05 +0000 Received: from BN3PEPF0000B074.namprd04.prod.outlook.com (2603:10b6:408:13c:cafe::b7) by BN9PR03CA0876.outlook.office365.com (2603:10b6:408:13c::11) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8356.17 via Frontend Transport; Mon, 20 Jan 2025 01:29:04 +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 BN3PEPF0000B074.mail.protection.outlook.com (10.167.243.119) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8377.8 via Frontend Transport; Mon, 20 Jan 2025 01:29:04 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id C3C4B34; Mon, 20 Jan 2025 01:29:03 +0000 (UTC) From: Bernd Schubert Date: Mon, 20 Jan 2025 02:28:55 +0100 Subject: [PATCH v10 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: <20250120-fuse-uring-for-6-10-rfc4-v10-2-ca7c5d1007c0@ddn.com> References: <20250120-fuse-uring-for-6-10-rfc4-v10-0-ca7c5d1007c0@ddn.com> In-Reply-To: <20250120-fuse-uring-for-6-10-rfc4-v10-0-ca7c5d1007c0@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, Luis Henriques , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1737336541; l=1631; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=wxYO2fuIGkvqmeC9PNGhH5rOX2Wls8HlW08RzezL2Zw=; b=Lnz40p853xfFVldiMhE5s2BuVOY08WK61NAfyWpHGObnO0YrcLRshIjiub8/GjAow5kCMiWLw ZPg9iEagrdxBJWy8iFJh8PAf2ypwpHq9lsthXtrQ6v9jVedbzbNWac2 X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B074:EE_|CO1PR19MB4981:EE_ X-MS-Office365-Filtering-Correlation-Id: c7c840da-bcb3-4647-7baf-08dd38f1d3c0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|7416014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?fbRs23EtW7kwMraww1v2ReWOuEKsPLy?= =?utf-8?q?nLMR+Lq78bfzTmbTOfxAkRuHWNycw9RTR9+U9VrtrOMfwCfrH7wPcS0/YlP3sCs38?= =?utf-8?q?A5aRThBpbMxCz+uNrKJgjHE82fIYzyZKyJopWpo2xt+cYxUM+03+tjTovkY/HY9ru?= =?utf-8?q?R3uvND70booJHG8nHNrc8qG6wrj2G3lguQ2dmGW25PUURr3Ck7LO+iTd6/VWt76M3?= =?utf-8?q?1dj4KtwlJm24Snuc1MNnA3IZC2FtCq6x5ZkwqoQyn//e1Rrp6TZFPjiSCACUIeyxw?= =?utf-8?q?N9hDwtd79txrfo5hAaNckEiIw51Ur1bqHhnCfJa/7TaOWYuU47gT1fMuPrBfXUKFt?= =?utf-8?q?cB3YerE5sseeu8/d4OQgyNlwhLoc+r5OSYyMtcNReE39NHj42H0jdEuThG8DxDRWL?= =?utf-8?q?6JUENdbix/qDFBDfJNHqpRdMatP6De+27oBH3t9mt1NtB2qGFc2PH2Fiwjen76iAD?= =?utf-8?q?345+ufYfwNoyknwPo0tV7dmvd4utEAEsZkHY9dSRb6gIHvgSODTZn1+MayV1hltVk?= =?utf-8?q?DP6fxhlx4Nzouhe121qk9S35TQVPPd4H1ocuwyMbVdhgjXwtoPcifHddl7ol8rp91?= =?utf-8?q?O48NpLYty5YPBSO+4Nh3q5yEvGXcYbBEJLlHbVoDvSLj/z/XReIDY/aCuHKZJizY8?= =?utf-8?q?LBagvD2amHjPeUVvBEflCsQcDUYemZNwglkf7Wgaw9NRPBaYSXAoAOXm/yvfUkYNH?= =?utf-8?q?GpSxTWlEjK1883srT5UpL5/ItSunekE0FBUyDyd5WbwjjtMV7LKi2GN0o6tyD5BH8?= =?utf-8?q?7FeigqUOHZhyUbf/4vEz16wnsZbqnsPGKfMMq1rz30Vjgg5tjsGo49T+rtsFwYytO?= =?utf-8?q?4rBCYymTFlEbuwa0fzAnSYe+15g8FPqOb9W47SRZ196YHeoWooRXLVV5Pi3QRl65g?= =?utf-8?q?mFahfDZoX1liymMquTBB+GUJuG61z7wnwDmto1Bme4kV3cwD9o3P5uSMot2my1FZS?= =?utf-8?q?kzEAmTZ3tSsKGIDlLoyvdZ7bBipfcCe6skttWm0EYdBNWYFXMxNeR8FE2OvHa033h?= =?utf-8?q?fIho+GHuoENQTzaSkkrMQ56cLC4p+Xv8blCWfE02DGs5alRkqvIZ39ISVuzw3KrAt?= =?utf-8?q?uU2AEmGq6s4JN97EuN1ALcqy0pN6CszUF623kefP2SSSvIwEMbnq5hCUu0Wcw8FuX?= =?utf-8?q?vCjkDp2KBrpk/hAV4h42BkmqoPFwfXmSdW5SD9KGZJO+17P9jA6XBHixq1keogWer?= =?utf-8?q?QL060NC05L1ZhjvPDZpvdiMpTLwtrwmHCYhURmqc7IhTVZnP0/MnDqAGNj/wI//67?= =?utf-8?q?lo1XKbFFQzKPcOlMzHRxwYo2q6NffmveVbKlsit96kg+AeaY9Spet90jaV5gHqbGM?= =?utf-8?q?4unxyjBhbXm98MQNgpU3hCXiKdoIbDNX07sWds9M+X33z9LXNwoSSTJQx4m3vYwrM?= =?utf-8?q?RYhSbUWioKa9Rqc9BxN3B+j/qI/7Oz1fTc30hwgf6NQOnlmB8CxRkU=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)(376014)(7416014)(36860700013)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: xiV/8LbqKYVXOkTGDoxYiPHO6lejcL0IDkFLK/vj77VkytYrUaXb2QJU4C5iIEiG6/CetCPpP0XWk6d35pcOYHAC+OdLDOE8Ji3OV+Lt9DDiAuR7tedbvtt8xcVVPXU5VudMk2B2ajx3snNTsmwnIQEXSGKO4i09IkcZVOFyQI3gXyx6CbkkF49mDbaKv26BHK0gxnWLHt0Z2O2MZRrZGbIfmQBKMmDHn79LzydXzPeQoP+g0XHTO7XOfq4x6twGqO0ZPJna6pEjWGWhl4FjGEjKuxHpBcXgL0rtyFgiBA8/9CcWzCaNTiGp23o28byw2GeaFCaZbkkYN2txvBs9EISU4zEayW7tIsF6u3cGYWek5yd/HWuqC/k8QrniPUbX6/5tL9mQXj16OyyQDVFiqbA06emERwbjvwsO9oSrf7DHTkSe3xm3qWoVsIeeIAO4PYFKtHZ/4DUI3pz+CW/0c40lYSx77gYA/Gd5S/5DiVKruNtXIQ7qJ5RPJ/9sH90KNxMEQckAXZy6TlEuNDLLMthNPdTSbOxAyGwUDSKntHrTMdqDIFhlUGeLes5giUeStFmonjAjbBYXW5pZyRGek4ahGuQFgCwLwA/AKtJ1iHIOzXEIkUPvoYsATopnOC3E93XnaGYAbxOHm7l/yGwgnw== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2025 01:29:04.5953 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c7c840da-bcb3-4647-7baf-08dd38f1d3c0 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: BN3PEPF0000B074.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR19MB4981 X-BESS-ID: 1737336546-106115-13449-10989-1 X-BESS-VER: 2019.1_20250117.1903 X-BESS-Apparent-Source-IP: 104.47.58.43 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.261928 [from cloudscan23-253.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 Another preparation patch, as this function will be needed by fuse/dev.c and fuse/dev_uring.c. Signed-off-by: Bernd Schubert Reviewed-by: Josef Bacik 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 Mon Jan 20 01:28:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13944637 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 EA411182BC; Mon, 20 Jan 2025 01:29:20 +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=1737336572; cv=fail; b=WkrE8zDryEyIoWOYbqCWToUv1iYRPRIySRsBg6d5O/o66KKKd+poX+W3CR4I6YG+Wn2bahPAtr/3a9G+URTqgzY+bg6Wk61ong64DtgG7kbryoZixNoUT3UMMCimAYNSg7G9x8fVtPnuP9k7bD04//qscCPIcSpNy15iebsZK/0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737336572; c=relaxed/simple; bh=bH7AXbAgM9O8WxYv19f8qiXoKWtYqGZmQxByq03RmGI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qGnU/rYJ0A1Ob+T5uiIuvSrcQ3P8smI8FPxoezRWw0pWu7815cexl1hw7On67rtRlnTs22hHXY7m6tU4dYXveQZkRgpvd7DcrwSzfo+gTNexW5hRv1rgrIZ3C5XSeZyY9HJ0X+Q1WvDPYY0QbLzfadd78aUaMtzAR21uZUS60Ng= 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=WLARAkL4; 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="WLARAkL4" Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2043.outbound.protection.outlook.com [104.47.55.43]) by mx-outbound44-119.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 20 Jan 2025 01:29:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PRPdkQXLnJjR6gatVDKpGHH3Lfokd/L1FRjvvy0dbHYU5ZaTL9lK8sPV6og+gk17u213q3FdNwRu4BcaAocXG9y4yPjx9/4nQAhgAqm9eL2G7RByayjYpr1Yuv04gtOZCeXKMWyZSXrPzhgOIe3gUD8xNBdTuV/hRD3pVXa6kJFUN3rLVG0NnDPWNCZ+v9UNyStGD+RphYugVTpDA8kDtqXuzpGaE1E5LY2DIW1aJRWWnTBVgTeW4sOz53jyTUWIqvowwRO0H8B0fnAKGJpp04B8a9nd1qH87MHK72qGxwfXQQpI2vnxix0AW4icdM0an0KcdIrBINMaqfY/xgI5gg== 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=cwJ+kj4mbFGTddtYIiQhtO3ZfRcjdKzYL+/O7sc9iAXSyCmh3iXB7tiQWL4SukqrxpCvUkMr9k+oS2emjvjjamc2pBtPELp6Ab+gIMMj4GIBMTrfTKudnghO6LvzpZjZx7k2IGpayfatu+1nYREpIYO2qe5NIkigOZjRh4Zs89Mz7fMQ6904ZvOTbKPzH0G4KGGx6Wf64Bf7bBJujm5A5/tVGFALJxuLbTg9/CHz3xWA9m/jslxiOgq6cMkj8bbkvgh6hv0Z6gP4yiDOP1HGV6zVqwWVZX1VwV/g4zv1P+ZuZ2/kktRqArIFg+reEmaMk5aaYp+7qx0J5g0q54K8TQ== 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=WLARAkL4Ea0xd28s23uxl4t5IEZ2NO6s7QkEAMb4S5j809GqAmqB2r3uYXDzy0Yx7ch55m8PD9jSv9Cx7OWxILxXQBcQMsJA9a0R52rkjIdFclabUTWeUZHjTKBqnMmCKrdarLxTw8PrWie9i6sT5U/Z6qSdoZ7TEo721R+mzBs= Received: from DS7PR03CA0153.namprd03.prod.outlook.com (2603:10b6:5:3b2::8) by PH7PR19MB7052.namprd19.prod.outlook.com (2603:10b6:510:207::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.20; Mon, 20 Jan 2025 01:29:05 +0000 Received: from DS3PEPF0000C381.namprd04.prod.outlook.com (2603:10b6:5:3b2:cafe::30) by DS7PR03CA0153.outlook.office365.com (2603:10b6:5:3b2::8) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8356.20 via Frontend Transport; Mon, 20 Jan 2025 01:29:05 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by DS3PEPF0000C381.mail.protection.outlook.com (10.167.23.11) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8377.8 via Frontend Transport; Mon, 20 Jan 2025 01:29:05 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id BD0534D; Mon, 20 Jan 2025 01:29:04 +0000 (UTC) From: Bernd Schubert Date: Mon, 20 Jan 2025 02:28:56 +0100 Subject: [PATCH v10 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: <20250120-fuse-uring-for-6-10-rfc4-v10-3-ca7c5d1007c0@ddn.com> References: <20250120-fuse-uring-for-6-10-rfc4-v10-0-ca7c5d1007c0@ddn.com> In-Reply-To: <20250120-fuse-uring-for-6-10-rfc4-v10-0-ca7c5d1007c0@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, Luis Henriques , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1737336541; l=1370; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=bH7AXbAgM9O8WxYv19f8qiXoKWtYqGZmQxByq03RmGI=; b=OTc5oGqGHD0gEZTakjGBJDWxeQhoFBRM9CEzKSxoupDHnvnqbLR1Sl+om/GroxVeG3TAis3vn IzQHgp/twWfDtB66Qv/SgSjmwdy+wUPZ7U8WXCAuDaQSXhul9iCQZvk X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF0000C381:EE_|PH7PR19MB7052:EE_ X-MS-Office365-Filtering-Correlation-Id: 0aa8b180-8128-43fd-7c32-08dd38f1d439 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?20jEmPWkJtuTlMVyCnDqktqpFUcM4dP?= =?utf-8?q?o4gGwjulgrfKAbiwk0CuexVj+UFePOEMHqMVHUS9tOYfFTo6yAJ2GaivJcL9KoEMw?= =?utf-8?q?p13a0/Hjd+6Voivp281AlbwfEv7J9J+R5Iv+LIpEZ+M8YeK8tLXEhIj5mWLtAw02r?= =?utf-8?q?YRgN1jLqOwdmvakEX8RGsntSvmonhTwabn1zF1cscrUEs0l4YLMewMfNglmXY+tO4?= =?utf-8?q?NqkvOWP1zcdAM+yibX+C3kVUp64ioserbpveYu9KJnGDzP7c0BI9zxalWgwXvwk6S?= =?utf-8?q?i7m3xQdZ0p6htlMCKxFX2+dlABbIEEFdJrh7VV/kMZZl+FXbgzb4QGWpqJ/bGCQ/O?= =?utf-8?q?hErHdVUIcY1eO/B7YVY6nvdMZ3bHozi6TlC95/E/vGj275YC+VrlSkMhXeSbrJuEo?= =?utf-8?q?XSt4PlE0BJmh75+PZ7Yt8XzqTJLLnpI9jad4krmOnJZY+mV2RtIO/i2PpfJ2tLmvm?= =?utf-8?q?u8o1++LozHeo4FQ6n6QpqphzYP9z0jL4nz6Gx5GbNTPDjwm3YDM7vqMdi92CWHKNa?= =?utf-8?q?b0bFV4G0sH6Fz0qiS0go8LzFj2kwd/iAUJ6xs3XT4steRk9tlX1xUF/cDu7cvTmF4?= =?utf-8?q?XZoW2EYxzBLzpMYPb9VheVYkAaxqGkjnTn4SLU9aNRLtzYXaYUpwipITMNmzKlwJf?= =?utf-8?q?g9nA+jYnduYoQVCbbQNNjaW2aFW1stOxwaU3rYZYvAHOjwK9nQeJvJ5gm0OcJTokE?= =?utf-8?q?8XiQcpyOW168Qmc8pi7QB7RjIbEQa93YfPDdgl1JvmXXOLsCrFzoOs2szsWHv8oHa?= =?utf-8?q?3j1DUcJTJG6NcXA0N4ck5ZDY0sXSLlFdZDxkBi0Keb2LkXU4ed8QjTrKwDM6l1TKd?= =?utf-8?q?qI7kBSsVOOpPzllhpKdRokJBuN/mCNaJfcFjoNYYrNPShOXhwp2T6XF1GxOL3ZloS?= =?utf-8?q?+0r+fxJaahfewKP1YfFtAIkEz7B3LfiBSS2iL+FLKXSVQ8oTeSxZPXCShUJ0GHHzr?= =?utf-8?q?gGHI3IwES5QEJsC/ka4UvZNjdF+IQ01jkEGuPP0Nage+PeWB15mK5WuIAPXEBKApN?= =?utf-8?q?IUioSvNS82MFs3qZMpQtOLTErMaEX3/L9qLn4WaUawdtwnC1PPJCxvbAWyR0FM/RC?= =?utf-8?q?g/9YzFiMH7QuDQyyrAJM7pKNMQD6l5/PFOKfxfsns6uXVacmhb1knOc3rQ9YY0afj?= =?utf-8?q?aeshB0dpEvvYDliovbsAD7uzpmYGvYcfW9/siC8fhjbBVUpxIpDuo65XizCVTZUQy?= =?utf-8?q?XHYrODipoRDSR1H7mnUDH3erbJ1YfH18/2E8pl8Fwntueoic9QsqlaK25uYRlQBcA?= =?utf-8?q?k6nJIpR80YaHF9B0oWeI5qxb0nVQRlhq/ssLte/p0aiOd3pgeu69mPT3LEbasGgeN?= =?utf-8?q?J8xlJbkE7e/Jg/DVCPV4herG/FSW0ycZbM6jqCXLBNCmTstZiE8e7b0X5Z4LjWBZq?= =?utf-8?q?Dl+HSnRwdv/hpVNKgfHSXLuEZx/jJ2vqkS9ifxYJ8BJCx1i+oKWCxo=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: 4ASi1gdd4oE5xPBwh1Q0RY3PtgAsSWp8wVhm6bZsKoY3vnDc7RgzhOm9hLktQhwCk+YxEzpyjnzkkJdFvPOckmxloEWz66LYFSY5E8JyqNE0+WyyUi3TL6bljdcO7JtOb8o2QDVLupM64eK1XrK2OjJeeKp1hLd0XRAeE6e1Su0LoN4TBdtITDhxWPwKqKXLxmnWWnGLWr/RAsZKHh4WH79HJz+gRRf+47Ejqg5mRz2XrbfzgRJiZaOwdY3moA+dbhVx0m0iWQJvWKNp1RwKBdWg+RPBNQvVfsjZHJlpRMJ02Y6PIVWnagwknPYhkOkeDDMP32qK/gG1GMLR/61QC3TEppQtptdocQQ6cOThSRl88hJqGytg3Swrl7Ejr5YJL2xkO7+Hk8LNbEFWT/7YglFG1jfNKtP3uEtP2x8nOQJwSlLSYhqwEp4gAYqrIXYROuXh9jgwuP18y/15SqrdE+VbM137MqTa0lp8exBKkybCeDqral7BsCooMw3/lLL2rRwoasL1vjLbf4JoYfGWXxPRwbrLA8IfVdJKzGQr5Lh+jv8zOqFBo3CKr9w9AmGPj9XSwY0ngImLOe2PjxIp6hZ4VMR5N77YUSqStU2rzsOg4asz7/aRbl1cqJTDBm31cHa9OHWI72LMl1Km2D0VxA== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2025 01:29:05.3570 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0aa8b180-8128-43fd-7c32-08dd38f1d439 X-MS-Exchange-CrossTenant-Id: 753b6e26-6fd3-43e6-8248-3f1735d59bb4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=753b6e26-6fd3-43e6-8248-3f1735d59bb4;Ip=[50.222.100.11];Helo=[uww-mrp-01.datadirectnet.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF0000C381.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR19MB7052 X-BESS-ID: 1737336549-111383-17567-36664-1 X-BESS-VER: 2019.1_20250117.1903 X-BESS-Apparent-Source-IP: 104.47.55.43 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.261928 [from cloudscan12-184.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 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 Mon Jan 20 01:28:57 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13944638 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 E51E01802B; Mon, 20 Jan 2025 01:29:20 +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=1737336572; cv=fail; b=dmYT3f35tSpjBjvkjq9CLi842v9naC9G7ptvxcOmEEuQULB3BUAnEIAhNSDsIWrmo9CHSwiw4zz5YQYGYY0Md93AA0KA0acDRZKlhUceJFHpnOvzvelmKGYnRzvuCZGbp0FsDsC4MprsOcKauJb3vQi8qY1ZY+OabgBVdj+F/tY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737336572; c=relaxed/simple; bh=9BrSyfWSSxLbGoiiPy+ZsQVkgMofKZdyjdQtV6Kq/EY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=idYNz8zFmZdjAXLHG75NSniGCjEFscP+wJTQUsaCy6CwfqIdRHUFBiTHEEimpl1xECdrXgXwzxf+C5hsYqsMFdo3aXMVUiDwPNH+o9X8trwuNx9xNUriGR9yVCw1gO8ZpzkzEDKXx1HQGscISYoLfes54D01LcXmtKF+Mu18SN8= 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=qxy2V1ka; 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="qxy2V1ka" Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2173.outbound.protection.outlook.com [104.47.55.173]) by mx-outbound-ea22-15.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 20 Jan 2025 01:29:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MfbKv3o74AVk/gRzfBw4Jz+PA22J5ZNPH/XMulqgsUtn0IOgRgdFGiL0dEzH/ODATmTqMu3kd291Rf1bAVJnCEMdk6Tc1Xd7zRmuB0NVNnFvM9mo2WYzOPWaEeQxK40FUdl356VZwLYKm1olIzrqjZOrp3UWIwAr49upYZiN/+87gH4vgxHCITzeC/8GeR8s1/b/ob3dngjm0znpCK5Z02oEFXeiI3d3xaCvB7GwCuHQajG3oYoawGablcdERx1qVj0LmnCvgAbbuBCJREF/F8s0TJjNUziLr2yO3jzs1U9MMASDgPGS14/0oi+w5lHVGIH2HF1Vk39eWNDgxoMmxQ== 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=wbvoq23j5qXFs0VeGHVv//ZhH/h1AVJ9J7gm6cUP6Bs=; b=LvKcAz8hcU4V26urhumoI5BdnYQly2RoRZj+B+1VoWMZ82m/D0DU4AgQNbeG/IFgHIJz1BC+N53lHaTj0R6ofVYBWMxZh+m32YGKueis1+ag/bDJsAOVUi2tCV/wv5NZUDjO7xowKy6pz6P4u8H4tj0bMfW/hdqFWYBrHplWpFNqnhTtG8xs1YZi8Z5Nxkj9XEv2nm22QDwRLJ5Or4lphZlv20blehKbtq5UhlUM6O9mdFULJydsrEyWYEjICTkME8otsQ4rRjyESNb+yaskMVMOetuRUCHwkaBBstEH2kHKa3LPQKCnnzQajCaQVdgDtcT0N2fz76mr0yl0CmqtIA== 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=wbvoq23j5qXFs0VeGHVv//ZhH/h1AVJ9J7gm6cUP6Bs=; b=qxy2V1kaWppi2Q6uN1eHZAf1zKzKvZbNXN3ht5xEV+1kHDC4exK3Agbm9ROBCQt/QLCQINz7fWyHRX6iQVL7BwRDjKC+Dz8dodMbOWeNY03eRF5zOrzQ5o5grbBRb7+5DQFcdaFVjlGDo/w4AR9zdZ3KPTlQGIhOT5njiRQsVeo= Received: from SA1P222CA0006.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:22c::7) by SJ2PR19MB8204.namprd19.prod.outlook.com (2603:10b6:a03:55c::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.20; Mon, 20 Jan 2025 01:29:06 +0000 Received: from SN1PEPF0002636C.namprd02.prod.outlook.com (2603:10b6:806:22c:cafe::1b) by SA1P222CA0006.outlook.office365.com (2603:10b6:806:22c::7) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8356.21 via Frontend Transport; Mon, 20 Jan 2025 01:29:06 +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 SN1PEPF0002636C.mail.protection.outlook.com (10.167.241.137) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8377.8 via Frontend Transport; Mon, 20 Jan 2025 01:29:06 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id B63F134; Mon, 20 Jan 2025 01:29:05 +0000 (UTC) From: Bernd Schubert Date: Mon, 20 Jan 2025 02:28:57 +0100 Subject: [PATCH v10 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: <20250120-fuse-uring-for-6-10-rfc4-v10-4-ca7c5d1007c0@ddn.com> References: <20250120-fuse-uring-for-6-10-rfc4-v10-0-ca7c5d1007c0@ddn.com> In-Reply-To: <20250120-fuse-uring-for-6-10-rfc4-v10-0-ca7c5d1007c0@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, Luis Henriques , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1737336541; l=4855; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=9BrSyfWSSxLbGoiiPy+ZsQVkgMofKZdyjdQtV6Kq/EY=; b=rvwvl2HXswd1t7SG50x2a72JEFIwAlXjqwmTfvgqFHTJytGvoXyezm1o6YMpmV2OcfY3rhuV4 UVB6aLo9y+lDDACFCI6RT8+1Ws4yqV7Q3q0q3Jkx1xtVnRFGmAYChSj X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002636C:EE_|SJ2PR19MB8204:EE_ X-MS-Office365-Filtering-Correlation-Id: 811c4f69-a74c-46ef-d7b4-08dd38f1d4bb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|7416014|1800799024|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?yJz6Ar9Cx3T/o9BbmeglaipDeB/FEuB?= =?utf-8?q?ECbQqrLBZmz+a6cIhhJguKP2ObqjiB6Bu6kO8SvABdpnBSEJ6ALNXnv3uX+n17vYR?= =?utf-8?q?jsIopeqAt+BNBuKrhFEtnNYRCLE3Oob4+WOqlSjXwiBCe5GppnRGI1MdaGq1wCngw?= =?utf-8?q?/4uU0GE9qA8mtbVth5pqhX/qX/cf/pYaLt42rOi97t2olV64EPibMJ/PphF7rrUpy?= =?utf-8?q?bcwkvElPskxB36DTlftYEwaTpJ8neJv8H20bKpff72KtADj3TJ9jHTI0z9vFJzYk9?= =?utf-8?q?UVC0jBFlXFfToV5YkzlMSKreW7Q+YZNU9H6U+YSpaduKL5e3WFf1jGw3+sI1Zhiii?= =?utf-8?q?bzWhq87ubxYbhv/J/7lT9ptHHep/lm1XOyyS3Xm0z4dRuE4bNSbjwBNOwp9ZJ4yYS?= =?utf-8?q?H7okiGIDmG4QTSISp0DZsvx8W5Jza4y7PJfYrCnYXzeGj0dECPSpNdju0AKmu7A3O?= =?utf-8?q?mAt3YEgqobepCvhYVm+o7LJ0g6TZ0uVNwRIOPCJeHA/bGTUqXfgcKsSVPEmEYO20d?= =?utf-8?q?hLMLxyHmxWn9WuUKxF8iUZRAQTFKKb0iY1o5YdMhbD5M+uMtrSsuNdDX12Anjlgw2?= =?utf-8?q?L77ZrlbEa8sxbM/izRUdFE/HNtScalsUsnt7RxXlds07HAsffPU9hWQ28XljwLZ+O?= =?utf-8?q?uQpvDqQYnr9fMlzZsGy9Yi+AuXo87ChZtNVP2d0lrp4IEwPdWODsxKhtUl2rripKE?= =?utf-8?q?7oOwgLByBhIALEfBPmNDFHWC6ofjNBrXBNTSYFrgPXUskjjf2+8ZIQxwlcKoprats?= =?utf-8?q?WDeizJT4BtLPlf+hYSiTlNmzWVFtfxwaj6lakSxlQT0Wr/oCJxn/qVhPah1W9KJ5v?= =?utf-8?q?5hLQW9H83iwIMPW87IpLh8Epm5ro+GdL8/JPu8n51m+472+Q7pKZc7pJcCpD0q5lg?= =?utf-8?q?6YG38BSi7+eU42qXbFdaNLTEmOL8onk95Ch3MxKUw4HqbQWQs0S7u++fCkvCtAbi1?= =?utf-8?q?hYn/wrKdAEw7lcvhbk5/EK0B+C/YE3zvlcNQneDtXYCNHd1lcPgQ2BWWTIf+WRpDQ?= =?utf-8?q?EXXkRGjYIr0Knu9zoy9yVxIvupjrB8a3KQPkac1HspKDB1kYlOnQfKuHAwWR66N1m?= =?utf-8?q?vGMupPnSNNEXE3qwIPko0mQR3zvyyEFGz5jYaklJlCGWSzBC1IF7TP6/IGCI9OTL7?= =?utf-8?q?5ZL+X+qGki3+BWc/Lj/D3BWgzC1SWcltqZ6krvvPF6BQxff3llhlfyi9xzpBrZWv2?= =?utf-8?q?FK0JF6E2Xm308HKHHMsRQZHzfODca/XzSSdQ3o5XvpE/GL+yd/EX4QP1VxDo5H9HB?= =?utf-8?q?hbAnssyjXa3Vh4aMVq5frXxY2wDOl0dIJo5idPhuO1ZUBqjPhlpmJeuLqskMAZKZP?= =?utf-8?q?/m54kycSnxLUOVwQTSXGmY02p7RLkeyXaYrBdFEGxnjOURzhYO9eeKrqt2mVrfT3N?= =?utf-8?q?P8ZrC+TkJ1mO2OtsxQtZJWzDsLNJF2vVWvGy0xFtcrlGDfi0Y+DqO0=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)(1800799024)(376014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: M3a0lHiaqj36+tqGRgubbs6SVxppOfs3CHErpwgybkaVmM2fQNDwu2WFavMQ4DjT8KV54UqxBK2RnfTUqFv1iTjUOo5n2l3+3XrxeCQ7MeL43tW0TNQDWbdrqOUwElvcAoQCkkQ1XXCcGTqA968GqrL5C7tXUpo9713wMLur1sKrkJNkZnUAu+toYhEtTlMtJw6y+US9ccudGuFc5cYLkgPDxddGo+YsSY9vlen5HGFocBtOgxwbkIR1Hv/0qQYZ0XmRItSAPcJHkgXk97/Ue/c/emtNYs8lCJ64WfCkTCakXtJRo8dl/0/D/4PgjMiSIu1Sc2hWewChcIi1HRYvO+Nwr66fQ9C5dGZpAty9KHFTJLgKSLQR6vGUUJZsV+8lE0mBMQ7fAk4LU8EW6N8YNm3vKfdtLstpBSMRDPUBs+8U76RmrmFP4bDOjYu6HH1IqXyXW8nRsfDt6LM7vAf7pyHjB1kVB+WZQrkFLlaeknjXdvLQlO0GC52jLVJ3nxcGMmHrHsRIOgaNTGgjxfMeFBiLdoCMpvZdJnaGzNk1Kp5JfLZ0ws9Sc7w/XilJ6osAMbGItl9jxVsMI/c5MLrVuSuBdRcwXtnNWjp0QrW305PL6Ky0iJoSJVGgO1PRJOLaMxflONYZJzqy7t1ZdGW9ow== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2025 01:29:06.2894 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 811c4f69-a74c-46ef-d7b4-08dd38f1d4bb 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: SN1PEPF0002636C.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR19MB8204 X-BESS-ID: 1737336549-105647-17571-264310-1 X-BESS-VER: 2019.3_20250117.1903 X-BESS-Apparent-Source-IP: 104.47.55.173 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVibmJoZAVgZQ0MDM3MQs1SLV0t jUwMAixcI82TAxKdncwNTQxNA0zdRQqTYWAEnvPKpBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.261928 [from cloudscan10-106.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..3c6b127d68a78e2fb7caa6d980e6cab27af4945a --- /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_CMD_REGISTER + | | [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_CMD_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: 13944641 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 AE8381A260; Mon, 20 Jan 2025 01:29:21 +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=1737336573; cv=fail; b=mDpT7eCSELdBW1M7Z0L7Uq1ZG4wWVPv030JoqseNO/oCL7Q+Y9/aBp/0n0nCv8Qg8S/euVNOwyFr7OJEXCXIRjpFHs0Df+A4Q4jAj8rk3W2ytl5p4/cB0uXrOf/QAT1MLLinmmmhqZ/52IoPyB/2CoTWpO/cK9dlpR0Z7C/BEK8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737336573; 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=NtRLiFGu5wE1WR+VQICQSKHWlmRtcfo8ZkASxWGCHMjz7/0Ved/Q6uehnqZSTMCWSVAa0y3fP8FyWdtxb/2gTjsJZOnpfDJV07G6uimnQkjUyl7WpFhsNX7YEmTK2Hfhia9lOZHALoG5xG+u3bVbOEkaYRkTdgt+7rboqpnETqw= 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=vvR3oXrU; 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="vvR3oXrU" Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2043.outbound.protection.outlook.com [104.47.66.43]) by mx-outbound8-131.us-east-2a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 20 Jan 2025 01:29:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=s38ewsImeswYFuEKjg0si+vQmHQiDSeDrZhL3wFfHEb8pvpS8qfwV4zBDWnITw1V/GtjpeBgPWDahDSdrniYmdV+3/bBOJ8iiZ5+Lu1cmXQSxRLoo4HuY2CBlh+5BxGZV3FU+ZXLzS4DaK01jgdhvw/nAdDNNlRyooWCfkeG7vme0rprByKFh7Ol/WJC2U5DpqbzQ3CQLyMLbIkfl66pN/5Af4LPO9oDnFiBt1pLABedPMUssHhTnNkxIrsoFzQQFdQuvWnWxfwznizssHGaxtDRBKSVqBdbnbzXkyOrfSPPcwylOogrTOJoU122+jkaZhryykX8TvhIU6jYg08CXA== 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=d6LigeH1Ntm+qq9SaWUFYtNSIESQ4RvhijvObPOoQZ2dGL5DZTLQZGO4Mlba+Tm+5RfY4vD2VtgRlpgSc2IAGkoCwkS6s77Oc9/OJKxFldEZRKyqvjTtkyhHQskfkOEP66D3hXUp4mmnARG1CdnXnJmwsWhH0UzufhR5e+f4218Tibc/5MVAoEqHTI9W5RZI5bIFilmFm681LpQw43jMi8cNCzA14wh0y56SWuXffuTZqCXLesORS6sF9MtaOFiHxIpqStgD/R5Cu5RrT0Aou5tRkhSf2StKJiVB18DGg/2O1jvTp9bM4qKuwngxaSpGVr8IOX4I81ha4Bq6+vlrrA== 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=vvR3oXrUt69Z7VFDOgthL11fywYp1ZYHe59XW00t5x5VLjiYqXN08npNY2I+Bin2SDLLvU6gtmJpDaVOmdBjEf2PpwBLpFqf3Ajr9HV9LcUoftDZfVkuzCP1Op8Fb4jiExTcOXPlxtox7bhG12JEVxpMAKk06x7OwJzX+4rsRZo= Received: from CH0PR04CA0002.namprd04.prod.outlook.com (2603:10b6:610:76::7) by SJ0PR19MB5662.namprd19.prod.outlook.com (2603:10b6:a03:42e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.21; Mon, 20 Jan 2025 01:29:07 +0000 Received: from CH2PEPF0000009E.namprd02.prod.outlook.com (2603:10b6:610:76:cafe::24) by CH0PR04CA0002.outlook.office365.com (2603:10b6:610:76::7) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8356.21 via Frontend Transport; Mon, 20 Jan 2025 01:29:07 +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 CH2PEPF0000009E.mail.protection.outlook.com (10.167.244.27) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8377.8 via Frontend Transport; Mon, 20 Jan 2025 01:29:07 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id AF07C4D; Mon, 20 Jan 2025 01:29:06 +0000 (UTC) From: Bernd Schubert Date: Mon, 20 Jan 2025 02:28:58 +0100 Subject: [PATCH v10 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: <20250120-fuse-uring-for-6-10-rfc4-v10-5-ca7c5d1007c0@ddn.com> References: <20250120-fuse-uring-for-6-10-rfc4-v10-0-ca7c5d1007c0@ddn.com> In-Reply-To: <20250120-fuse-uring-for-6-10-rfc4-v10-0-ca7c5d1007c0@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, Luis Henriques , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1737336541; l=6974; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=MxfJjh+KWyLM/pBEqZ+TVduRkvAsbRDO2XTjnbrCNS8=; b=S3Ln79WZS1iYYtyIL72Uj+OjLgjKmk3esU/xfWoHm3Xqna/PW8E3Em66iy9u3rywyxRm55nwT TUL3OaO4E/ZBv1gsAJcGY0m9c6+/wKRtNkMiJJHyFWtCBxvXeV3uRZJ X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PEPF0000009E:EE_|SJ0PR19MB5662:EE_ X-MS-Office365-Filtering-Correlation-Id: d3713432-20b9-498b-d80b-08dd38f1d56e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?8AYYBgek94nNG1k2qppBy0KnUTFor9u?= =?utf-8?q?AdOulZTlatfl3z2YRoCVMx8mOUVypXv0McYeBMARdQ6LiABueE6aLGHJCdzLdGIIb?= =?utf-8?q?jZT1c4eJ70B4pq4asrMQeafxp+BJtKC0+ZlJXlha2hRiX1qqcohhVlLGcxGx3ECNU?= =?utf-8?q?mef5n1JPd6tHHyrutxAjNdoTooeuI5e7VCy3AIzyiF8Wae03ZSVUgOZ2MCuZDG7Fi?= =?utf-8?q?zZ/HjJlY5Bi32hUkalpppU6xTOvIdeiYcuiFAU0p/RVNvKzwUubDSqi6CLlsEEnfr?= =?utf-8?q?kScusUWhGk2X/p1/poYV4kZ9Ohl2CExL+e3ei2/HsJfo7ulRnUMiNSPArgRx33Y5T?= =?utf-8?q?iScEE43W30eoCzkKqNXVixgXwV/Mp8g5Ia8LW5lLh1GPD8YlnGw9nYDZTAaaEaGYa?= =?utf-8?q?NPCIYoPiVzURz6WN9fUQj8MaQ6atNGKZBsLPDybRLPMezeWWPm01d1MxNp7aInkz5?= =?utf-8?q?xYuOow9YefYK2wRpkiGyUVFuH/v3Bf8xbt7C+f7aaxnFPY77OedI4TEs0kDfgH/3e?= =?utf-8?q?42o343eH0/aDQEwU+1d5CrXKJqKxm2/ThNIayP+qkln1L0aPQC4rtHPzIq/b5Ihpb?= =?utf-8?q?x5NSMt4kjnZ3AHs1qvmn0SEoGBR7wlOVpziDX6kmltBTue0uxKVzNYg8JGYdiYGW0?= =?utf-8?q?jYwydf2l+Db1qwqVgpwHolGtWLQ3ITr0aiRZkdJ4oIoaXjmE84uh8RVqURVg1vJvD?= =?utf-8?q?LCkdPbnMXwGwxNhsw9D6IrIDF9WRvVA52IA4hol3d17tpeoTl9vV6lO1xDVARUZ8i?= =?utf-8?q?QhM2JPXLRrAfT2iXP1+xezQ3Ro/a4OB2RYfo9v1ucSqv2hH1KCUcZAHZUWewDVuMB?= =?utf-8?q?elkywLDpgVGv9g0xn61KZ9CZtt4wfLh3dTaB5Ysey+Tfaic3FCudP4p0keJT1nVe3?= =?utf-8?q?E3fcMilc1mpLrp7i0wfDPCXNccel+MZnKzRzSWnG5L9TT1JoFT5lpYgv0FAoWAo8L?= =?utf-8?q?UIAI3KGDbPPbY3U5Kq7oTavXCD392BEQ5hp5MKG8CYY1V7Nkldp267gn6X5Ew9kAA?= =?utf-8?q?I1WjBB7uFc0/oEHYE5ngKFepqAZZlhZn3P2BIsv7b4CZLwFDL+2NWJmgbYIUUg5wC?= =?utf-8?q?7bIrncMgB8S+A1eXK4GOT9m+CIQK/HQq/HvCMHISouwrRxg2GOWLJlPOdcTMs5syV?= =?utf-8?q?1ywr83XBUhgcFNLAyuZAiDQf8g1ByWoYbd5eCY7oGycTRtAwNURKW7zKD7M/yKpf3?= =?utf-8?q?ApKKOIRS6v6LY/hpj66qqiO2YPWZWwXHt0FBrixtLleA4ifOZwQLxuSIwhOigeEGj?= =?utf-8?q?57ahQPVhAZ8YnIZaOCtQr9Fg1izFLjkEcPGYux10BdP+AuqgpuwzFhk0yM1QlDAko?= =?utf-8?q?Y8NZ2F+VM2UlCftiHOhAeN9kvfDNhi5CGvLFg+mjqXBiMM1tsoM0YCQk4NXip/Ezs?= =?utf-8?q?jXrdViIiefxGn9Ky+MQm+Mjqia5DN/NFg=3D=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(7416014)(1800799024)(36860700013)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 9M1/hVR+I2qH0IH8qfYaksMKdqNzTeE6ijwrEs2xHXTa37Gn9zOKlnpdtj1Mk2a/1FVaQzHtUyEb2iuD0SkAsvthrgZlFKGFjJusyWgfu676gGowcrI8Qd/Yq9pciybLBFObsEemPNqKn/LZXByAlzAh18TDgrnhwl3YaAqwx4w6G54PjqiH646AfMco5hI+59WIJ6jHUYYsgjwV4n5VMysKMlPLU+xnSI5HTrTr1QZ5O6x9vlrBYANs+uxPdRORyVwLwIu/LSqiDdOUWJ9ImxU7lLcHgg6Nilv777OVsv6H4NtslCMLHegHEWIz6f2apVVoum/+s1PdmZYBVIpaI5/RnjTYhgdqKCgjus+k93yOeeanq5RAgeL5oX9KfvL6usO/EKqvTWRnMGLi9wzQTZ2r5+5Z/bzUgm5FXXaeaDAB9Dg/IiWaYhf02IB761Nn+0JnF31f9VmZUuEWzgqOHbFegHAnFevXj2dIcGE12my9HmkPe6ae0JBCSXO1pDwkoICMSe+LPgN4aF+2eiDj9yQjDwkYisVCvUrMmqAht2BPW4m1F9PkvwBiQ4hsoVvNq6f5u0mayX38tYtvIZ33LgpZv9/6/38o/nzNF+/qsghgLdgmDRXsMhfdn0fug7r8+ncS4leblJNH5TAAKr5XNA== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2025 01:29:07.4313 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d3713432-20b9-498b-d80b-08dd38f1d56e 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: CH2PEPF0000009E.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR19MB5662 X-BESS-ID: 1737336549-102179-13329-11575-1 X-BESS-VER: 2019.1_20250117.1903 X-BESS-Apparent-Source-IP: 104.47.66.43 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.261928 [from cloudscan17-25.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 Mon Jan 20 01:28:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13944642 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 ACB811BC20; Mon, 20 Jan 2025 01:29:22 +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=1737336573; cv=fail; b=oFWWPh1BOxz5e252yS7ooCgOzMhXx4NIbm9dcHDoVcDMJquzLcZApZhKeAhRJnvNkT54WL+UGoWMW3HTAkBNIx304vpX6Ho7I57AYWD1PoH4HdYmfn/ovKdOo6WASnK/79/8FGl6erQKRV0RD06wmc3M0j7dunbO08nD2CgFsp4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737336573; c=relaxed/simple; bh=jThg05zJUL/eUd1oNdbYL3LkPpFfiaUWamdr4PZZXsc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QsJZK9LUUNgczPwEIvJQaVmAkA5yKDsas6BNSvGlw4xAbZeIVd0beKuHSXqpF2VjR2eBvcRJEQ6+GwTQpV6B5WkYE7yce7wbJh+ML29OLeLGTutVi84Ywj9gNY3z2JJRzmQyWDGdAKeMH72M3uCecmokiz6gUxgjI2kKHltfFqI= 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=BNwwba7y; 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="BNwwba7y" Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2049.outbound.protection.outlook.com [104.47.55.49]) 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); Mon, 20 Jan 2025 01:29:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=XcN1CDFkUG3dpQA/B8smrnziyjNUDp06IQ3fb/znFVZUGhRdZVGGAx4bO96jSD+p4t9dI3boA0ozSnPTkN5DWrpMTZySnqn5rZwIAcpVwXDoBc2jsJH2Ekj0IWZl6xBx/kKik4Z5VTK9QEYtH6C2DbrasshNlHFswdjOGCLsxjVhhZWn+gfuBBkXAAbTSogyGFtp5WzdpBcbwyZebUipy2fbih8BbygqRuKHIS6gA3Fua/vneLcAe9Ard/cKFHhqmQfMu/rnm+bUCgFi6EWbtiaHaP83OMu5OJtTGYKlzJQnu2EYJ+aeOAdlTk+7nospljMgkSuYpAaaDnBcmb27QA== 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=bGn5Rqedju/4N1gd+zFusbMwFN7UcIdy62aqJ6ESOjk=; b=wvGZopFnRAH2MfdKfWqgllI72IndtG2YxQmsKcyPp1sKg10+w3QLpIs5YV9THOAk7zpsI2B1ABV1fjIxL8vr6EU8gdu0Igam6y1rLsgcEDvujInTi5+IGm7SFSqzZ2UkWcaPJCg0JhyrgMk9GTigX53hk7LqCXSa/g1FcoAiOynpczvnbzkV0z5J8VB92wi5xOA+8GtUTiZx4SZ0RmFHaeAwgLzYVhoqTJQPqCKVhReJZTj1lQpylJyA33x9o0C07Lv3yV8hVJObrYYLi1Fguc9k752wI6tjbetOncZrbcAR8Z2wf0hM2DNJ0hP5ez0abJertlOcXCEQA80PX03Q2w== 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=bGn5Rqedju/4N1gd+zFusbMwFN7UcIdy62aqJ6ESOjk=; b=BNwwba7y7CKKdG91U+NYkTzDqE+82RI5Xvtj1gQGcpHBeBy/fgJvPlPSIfND+i+ZCm1YdGO0dmltMwolS3Gp8bFTVdExXK94RzgsPYgo2irdAdbT805InsBovImFPPh3T9ocoKg8w2OWzyuUH+0Al+oqCs6v7QZW7XKBL62Dvxs= Received: from SA1P222CA0177.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:3c4::25) by PH7PR19MB7148.namprd19.prod.outlook.com (2603:10b6:510:20f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.20; Mon, 20 Jan 2025 01:29:08 +0000 Received: from SN1PEPF0002636B.namprd02.prod.outlook.com (2603:10b6:806:3c4:cafe::84) by SA1P222CA0177.outlook.office365.com (2603:10b6:806:3c4::25) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8356.21 via Frontend Transport; Mon, 20 Jan 2025 01:29:08 +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 SN1PEPF0002636B.mail.protection.outlook.com (10.167.241.136) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8377.8 via Frontend Transport; Mon, 20 Jan 2025 01:29:08 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id A898B34; Mon, 20 Jan 2025 01:29:07 +0000 (UTC) From: Bernd Schubert Date: Mon, 20 Jan 2025 02:28:59 +0100 Subject: [PATCH v10 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: <20250120-fuse-uring-for-6-10-rfc4-v10-6-ca7c5d1007c0@ddn.com> References: <20250120-fuse-uring-for-6-10-rfc4-v10-0-ca7c5d1007c0@ddn.com> In-Reply-To: <20250120-fuse-uring-for-6-10-rfc4-v10-0-ca7c5d1007c0@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, Luis Henriques , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1737336541; l=17119; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=jThg05zJUL/eUd1oNdbYL3LkPpFfiaUWamdr4PZZXsc=; b=VoxHIB3w0KlFFFJzZ5bNSLmcxw+1RKpjjw8XatoELKJFU7UlUPIanm4600lzR91NauZRmb1sX eHA93CZtsmoBPS4T1rRCxZKW0vJW0eCrm4vGDF3C8pCTkMcNClqBn9m X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002636B:EE_|PH7PR19MB7148:EE_ X-MS-Office365-Filtering-Correlation-Id: fb2ec544-9e31-4e0c-ba3e-08dd38f1d5f5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|7416014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?Xt4bjvv26+lrPxpwxhVuVK8Zrlq24jZ?= =?utf-8?q?X6H/ZgO5O0jxt0F+7yHINjgeaFrJRI/D5MNsD+zP/y7lVjJ14hneWH93F+XPIBgrQ?= =?utf-8?q?hw9MOU7nQD1ZWna+981gxUpCfZgr98gakYrq9goklIp5e9medDFA6yNAXl86R4ls7?= =?utf-8?q?1/yYf9mV8gEgYxFyiDEcedIhGdPhh/Hpmgg5bcgiTuvNZ/j9Lx+fzrLOq6O3wVriN?= =?utf-8?q?wQ2NKFpk6G3B3zOKBZSUrsqfQAjpGzm5BBcD/0Rnk306X0AsXJM4DZCfXkdMhJWQH?= =?utf-8?q?Smdt0ixbWu1/dLhOvp53Vj/uQBJe2cwxOPimm12l7ITxCP2fjhWA1aI9ET2t1EnEg?= =?utf-8?q?8jE+U/9YHyXJAOdDmxkSVQrTEKyMPmcbCb4HY3pQZjlI8acM9RFLciWkrB4WwGySV?= =?utf-8?q?nydgMAPmgyxMpBVnwm4j369sEATpMo08wxe9T/sPi3wtNUArWLzpuXUSkxJnAFDUd?= =?utf-8?q?0InxH3LFMgFcXLsmZencqEzz9wqGP45YOVvwm0Z06kQTYPn6ydviVjydKB+5XK86/?= =?utf-8?q?g6AsgXZoQvs68BiknXsw8Pq6hUxwbiRn8ZOKIbSsYmEwoKQwradweVZN4pDp/DR4G?= =?utf-8?q?rP6eSjJ1I6tJ0qkgC+928uJc3EqBKge7yF3F069Filo0cwrRfg1PFYpfP3z+GNmbb?= =?utf-8?q?gAasnmHJMChYm3WKcMPnoVc8sMfTDAl90LOapckQWp1cyLaTpKgmKt1OhKfQl+ZPe?= =?utf-8?q?k8bWrxVReM/fp7gLZD0+4P3KXbYY71Z688p4wKeUlqNvT3kC1Lm9Ru++Nug3DzZVv?= =?utf-8?q?wEJgrSc02Y3rJiTtHvowGrEDDzho2DbcOdAQ7mIGlkA/14EIpJgAh/KVcYq7tgnGm?= =?utf-8?q?WiKvya1+mz/2j07v2pANsY3PXFLr6WHT5sN4jueX3PfSoADq+/UEK+SVeuIf9WUac?= =?utf-8?q?BTgkpIHuyb1ldZaI9Rkt5ieAGLpSOngTPaowDcNajZNChs+keDEGrsEYwDq79IJT0?= =?utf-8?q?W41p6wLlDo90jIJZhQo3p/TRjLouG16wYpfq7aKR/XxNBtj96L2ZnqI5TLAfILa28?= =?utf-8?q?BVmRBwUDp8VB2GGAsUlz1yG5LKj7RXJT1ky9jJij7q//lidpxSk8sBkjVBmu4OFSy?= =?utf-8?q?w7XH8e7Iowcha8XkAXl66/1WyBCVXRM2+lmLXUXEte/05ShIz0SdD8+3I3xtgwFxe?= =?utf-8?q?dpV+lM4wJqvohBamdDyv1vCjvUeotGmAncWC7MB43ma7HC5PgZw2iuUgLjuGLSuYL?= =?utf-8?q?oXOgeq/YQn0JhfQmJTU5P67EhPtn7m7jAIta9O9iVi/67WDCg5QbDkOGgkVUaiT8K?= =?utf-8?q?MmB04FbAfgLfQ7aZBPAZw4F2NcdKOZ/agciauz7TUfzd+m5+dXxWPQekwQxt6VRrY?= =?utf-8?q?pCs6kpy1jGvGJQ8eutkY1hZcABc6PjVOwElyUv2kH2CBa3r2DmpounogvkAl/Pl5O?= =?utf-8?q?KZcqvx+QVoPKnw5+bZwjdnWZSzqEzDCttjmgkFQ7xfnBsbjI8F1JQw=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)(376014)(7416014)(36860700013)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: tlmg68nTstf6rDWI/S9XhnSEpII0ywx+Awmf5wOYDQeFn9N2mKJd+2LPKrOv9XTYfJJuJTE3qHP4ApkPdEI24ZdGLyDTZP8/y66O++90iVtjC1yehW8J5nUjHhBE6e0rg1Aq92hTQT2bfxX4umk3WdG8aVMHyHCcSP4Mdsq/orRRA0b5OoEygT1q21RnGk+MwAuUs/EKqmSz/tlbgJH9vXfs3OW2jVEXzw9MRLVD//Fjb4xNKDKDELKrLh95IxEtm2DcpFUb6LcOHhUSurt6NAUmtyoc/xp9mlZ7d0Vc8cZnE6MNYYngONYX6BbzDTqPNJ+DaaD4lqtLV42sJ5lKeSgx3B73oMOqMUsoWS4XKR+mJx8R61DCV0V0Kcbs5RTWdUBH/6vKOwf7FQb+rAXJIUeasCmRegm6n9d53+l0xFcMriXicL+xV1vU7XEe5TrUm0BJaAANW8LKtqwqA1Xe0guIL6ievYaqGDrtaUtS3MNzqYXHdGCfHtgUPj39IzvC0cWkqUW9XOPXJ3NyqG164GuSph6zKBem4Fu9cbst0pcND1XgsLoBZ+v5Qg0fJFCs9TusMmdtaqbBxdsD7X4yFmgtY5/q54dtYfcRiHdskNOy6oveip+ucljYSJhlQGKCtzxNkA6lcIpuVIyv6EVWjA== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2025 01:29:08.3309 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fb2ec544-9e31-4e0c-ba3e-08dd38f1d5f5 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: SN1PEPF0002636B.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR19MB7148 X-BESS-ID: 1737336551-111953-11879-196394-1 X-BESS-VER: 2019.3_20250117.1903 X-BESS-Apparent-Source-IP: 104.47.55.49 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoZmJqamQGYGUNTE1Mjc0NLE0s Iy0cTcCMhONDY3NDY2NjQ0TklNMjFQqo0FAF9J70BCAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.261928 [from cloudscan20-49.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 This adds basic support for ring SQEs (with opcode=IORING_OP_URING_CMD). For now only FUSE_IO_URING_CMD_REGISTER is handled to register queue entries. Signed-off-by: Bernd Schubert Reviewed-by: Pavel Begunkov # io_uring --- fs/fuse/Kconfig | 12 ++ fs/fuse/Makefile | 1 + fs/fuse/dev_uring.c | 326 ++++++++++++++++++++++++++++++++++++++++++++++ fs/fuse/dev_uring_i.h | 113 ++++++++++++++++ fs/fuse/fuse_i.h | 5 + fs/fuse/inode.c | 10 ++ include/uapi/linux/fuse.h | 76 ++++++++++- 7 files changed, 542 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..60e38ff1ecef3b007bae7ceedd7dd997439e463a --- /dev/null +++ b/fs/fuse/dev_uring.c @@ -0,0 +1,326 @@ +// 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 + +static bool __read_mostly enable_uring; +module_param(enable_uring, bool, 0644); +MODULE_PARM_DESC(enable_uring, + "Enable userspace communication through io-uring"); + +#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 *ent, + struct fuse_ring_queue *queue) +{ + WARN_ON_ONCE(!ent->cmd); + list_move(&ent->list, &queue->ent_avail_queue); + ent->state = FRRS_AVAILABLE; +} + +/* + * fuse_uring_req_fetch command handling + */ +static void fuse_uring_do_register(struct fuse_ring_ent *ent, + struct io_uring_cmd *cmd, + unsigned int issue_flags) +{ + struct fuse_ring_queue *queue = ent->queue; + + spin_lock(&queue->lock); + ent->cmd = cmd; + fuse_uring_ent_avail(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); + } + + 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); + } + + 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); + } + + /* + * 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->headers = iov[0].iov_base; + ent->payload = iov[1].iov_base; + + return ent; +} + +/* + * Register header and payload buffer with the kernel and puts the + * entry as "ready to get fuse requests" on the queue + */ +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 *ent; + int err; + unsigned int qid = READ_ONCE(cmd_req->qid); + + 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; + } + + ent = fuse_uring_create_ring_ent(cmd, queue); + if (IS_ERR(ent)) + return PTR_ERR(ent); + + fuse_uring_do_register(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..ae1536355b368583132d2ab6878b5490510b28e8 --- /dev/null +++ b/fs/fuse/dev_uring_i.h @@ -0,0 +1,113 @@ +/* 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; +}; + +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 Mon Jan 20 01:29:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13944644 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 5E3CC2033A for ; Mon, 20 Jan 2025 01:29:24 +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=1737336574; cv=fail; b=EX2QXPJ2U2kBbGuC8R2ZL34XJEsqpXGgRl8B/Ew/56TAZ2nAUbOhVYre+bM2MBCdzr3E49vxZqKhtLLlvUg45kqQHGNwZ3VMIiBEuT8twVuC3wCJjkXRcXlwmDhMxZvTCo+Oiqze+AH8FHAj63z7toH/pT1wIb187Hl0oLQfukE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737336574; c=relaxed/simple; bh=455vpR6hkQ2u3HTcvd4tTICV/lcjLmUkyQgxI7osccQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qGhuiLmAWGujkR47dyvB8eYE8fPN3KUtlqgFVd28nBrOhV4VXb3FLx3Vwiwk7fOYK+XxEXic151rqw7Q9qxE9YakvjiuD6yBFfNqC+nle9SO5hjPAWIY2mWDRcfu942yUGI4Zh3KmY6ZJQXmW0CTBxa/enCqIP5+PdpN2H1Joi0= 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=y2vZCgYG; 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="y2vZCgYG" Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2040.outbound.protection.outlook.com [104.47.58.40]) 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); Mon, 20 Jan 2025 01:29:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=XGjlogpVT7ag1tFrw5oDvRFG5U65fRl/vFqWwQSJO6lPmxh+ePQ/H+4SzC4zMCiTDaBXau5nCeemDbxdupPKUATMngCFcQILCoZN7eCvMCqcgAY0K9XGeVVceMahuXVO8jEasrtyT6GfghB5fAZWWJ48pTgSggD42XODZOOMG7JUGwGAlrBCFdUSfJC9ZTY4ug9TH9sf3SJGNwB0i4Q/lNvYvHA14HWRLNSl/J28s4KeYGnoA+qQcFEUCW92/pNxwqO5hyyUw5cxoXeFm5yETYihncUIQepPwmgnV9x2UeR/hyUxXLvuyaNzPhrZ9HhTl1kDcW9ml7Hzv3UcQd+ioA== 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=bX75g25jiZd71umNXJwWyXjC4yWOs2SXB3LwrqwPHXFH3h6PIbl69xIM2MMgbSdgURhMyWPoP8jeFFy9nEN6suoJW2pFH6XqdWWGsRCCdoeYGOy1iKCIdzgxz8/QsIOWv22ih91OGD7lLCFyGIdDl3lDDmIVJRCgXK7IaPlnpmcf7rZMPe7s8JmklZsPLQqjeKzYR6jiSRd+UU4vNgKDeOHXYD+kRUhxlfkT99MFGmx2sRVjkdP+c+JhZgwLLBUvdUS1Kot7MEAhWbiH6RRV2L3I2kdXFDEK4uqIQcLo9XpmkmjoVFhp/kB7fwX5vZHVCtUQ/tMBAPmwAkJZv95irA== 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=y2vZCgYGumdD6/bbNuUDs8LVvqftUHR70UH9L5oOZY+KsZ7DhYv9O93zKyvXXtrmlHHJV4n1jxvjZ6tcMLvxemZfUO5ioDbaw0aeL2ZW0Z7dVg/lSZ6zsxT/zznLbkCEms7IpadGmo4KlccHZmNe6KYNF8Bb3VFWh2uu5mIk/34= Received: from BN9PR03CA0568.namprd03.prod.outlook.com (2603:10b6:408:138::33) by IA1PR19MB7879.namprd19.prod.outlook.com (2603:10b6:208:455::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.21; Mon, 20 Jan 2025 01:29:09 +0000 Received: from BN3PEPF0000B075.namprd04.prod.outlook.com (2603:10b6:408:138:cafe::7a) by BN9PR03CA0568.outlook.office365.com (2603:10b6:408:138::33) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8356.20 via Frontend Transport; Mon, 20 Jan 2025 01:29:09 +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 BN3PEPF0000B075.mail.protection.outlook.com (10.167.243.120) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8377.8 via Frontend Transport; Mon, 20 Jan 2025 01:29:09 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id A75884D; Mon, 20 Jan 2025 01:29:08 +0000 (UTC) From: Bernd Schubert Date: Mon, 20 Jan 2025 02:29:00 +0100 Subject: [PATCH v10 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: <20250120-fuse-uring-for-6-10-rfc4-v10-7-ca7c5d1007c0@ddn.com> References: <20250120-fuse-uring-for-6-10-rfc4-v10-0-ca7c5d1007c0@ddn.com> In-Reply-To: <20250120-fuse-uring-for-6-10-rfc4-v10-0-ca7c5d1007c0@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, Luis Henriques , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1737336541; l=3717; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=455vpR6hkQ2u3HTcvd4tTICV/lcjLmUkyQgxI7osccQ=; b=AO6b3Ej68anZt8Umb5lLHd3PNQLshEImjiesItBszWlZo5XVSKi0sEN34351i8hFC8ZRIc0Zz +A1FdhOW9J/BsvYw0/AWeTnxLKGHQb0pABjLMC6rn9iusqGk2R/FYOK X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B075:EE_|IA1PR19MB7879:EE_ X-MS-Office365-Filtering-Correlation-Id: fd957916-61e0-4eb1-b4a6-08dd38f1d6ab X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|1800799024|7416014|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?GuxGHX5zFKxutyDgRG6/brnMDohOAGK?= =?utf-8?q?4mq4OgU/sLlafvvnAe6wgJ7/BABR8GD3ySh1IZ4Jc4HjZkSyuKEDKu4BREZXyVA93?= =?utf-8?q?XlGcM/D7MVn9Wgg6PRt6n+PdaE7SttRWKyRZyK239PlswAtDDUqhYnDgGcUxOmS8K?= =?utf-8?q?zlMtMLu9KbRpXRsW8E9+jFIIvVBMelCXzm2osVwWarkQI49HWs8sryhtnIeWNfx4x?= =?utf-8?q?4t5SH+fYfcTLhpS50DJ56CFJkdHjMTqrNbHCXCy0lvooAFONDrAPT5H/fl5SLK8R1?= =?utf-8?q?t9qHKs/wgrWyhSKRO9GJj5EUUnOGxNkxZ6TbxZKWXYA/D6klKA4vODLQof7kU3xWJ?= =?utf-8?q?tcPgUfrQwgNUJw/5TIvufiSW9fnoGfPmyS7uCMy7XAJIdbkPM2VSaL8Wjvf6d3G2P?= =?utf-8?q?KoBuOJrsQK8zJtWqsh6W1C6Jb1+J87dV01mtiHX12+MIlBEn8sYMQ50PwMa4vE5Tn?= =?utf-8?q?LfSVC0zNLM5W0KsCuKPQ5vrHoGGRF9m/12/3z6rtwMcBExg3pq2F82rC8aQgw2PWa?= =?utf-8?q?PnAs95VMvLKCDOOul9LuTeHFWvNypTOhmemTei0aY5XAVuQslXeqMbf24TH2k0J/h?= =?utf-8?q?i8nGeEEqt2nL7zAQjNrzjrSEfn02JvtVmuwwUfBRIEMuZgmrRZhNA71lkiaGv6TLx?= =?utf-8?q?A/Tu/oM0jJJUQtG21/Mt08woTMwP/OOWCNmOgZVm3AFsINiALYvyoN2RGFYtMJOBZ?= =?utf-8?q?kbp11j3/PhStPbNZmjIc/FfUIhoLZF8TwYbzFFMKlOGEJVZCST9KePnkkjaaXSSTr?= =?utf-8?q?2BA6StEpkv/U+MsDqoRX2mSJMm5KDbwWSqgcA8HqxMrdpBjNQ/Jpt2GU/eJjiZ+S7?= =?utf-8?q?PnRaAYXZ0AgPeY6mvnZTybaeOvnHdunc6nknqyFC2z3Bkf8ekY97WhzMIA0DXmcmL?= =?utf-8?q?0LAo/3alu+2XC6l2TbXjsWq4R+Wy/Sf3nSIWhHFCb8U5l9wy5+JwVN0yKD1BtNkEG?= =?utf-8?q?4t87WtxG9yA/sOrp5VFVecWxIeB/tlWdN3uif77UyICfN7I8ACPO5AIDlYmbg1aaQ?= =?utf-8?q?H0ayL33SMA/lsEjne/Ae6MKNBShd8E7CR8v7W+YxCMMhIcZx0NOtXNYnzet+KBlBS?= =?utf-8?q?7B32FVP78L7fJQnN9AVifX2Jg9qLRWoj15SWqGqO2f4UCBBUQGmrvytdrUYmREUS+?= =?utf-8?q?2L79aTvCrYwNYwiV0oyL3CozzxgKP0+easJc2tXH/awV4CwH6VKuATernZ/L5Ri5K?= =?utf-8?q?kqRcFiA34Cqt/tWr16PQ3R8CMM6k4BysxDDXsRgXnrPPL76gHdjoAyCZLhxC+hH0y?= =?utf-8?q?IhPE0b8mfDra0GXvxFPGjd4iwocyHfY82+eqgZoBDBf4vnZ9qGpqTBQ+GRzCRwvyH?= =?utf-8?q?rs/23A8l7gCpKUQzXPKVJ+mc6ldagJ2M4D176CeFNij5R0xl7ApbFkFCqy6Wm9HtT?= =?utf-8?q?g62ouBNZNsdGbml0l2Mti4uvWVBl8xr3emZukbj6MoEXQYhWTVhZQQ=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(36860700013)(1800799024)(7416014)(376014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: ohtI3r1gytwdI/1Ds/oQH3cWglxA+xX5R6k8lEgd72NQKaLkIZt2Kg2MKYqmKZwWv2QiFuM8gUfRIQz3ABBHVQYX7+yznm5hM+Nl0uRxmpd9X7cIWjExhd6Zh7vJbgW/fyJSjtiVx5+mmNRLlxPSUHGuMc7tidLy2bTERaT//i/5ee8BIoIN9B5SVz2KskUeSLYYhm6JCVNlV/bHRNIva8xCojdzIGmbXHwev7wKZxpfxJBJoNxy6HVxhUcuSsZW7f0vvyvAq0IFMoybPT7I4ZxiYsAqxmbkex/jTOS7sJDZ8pz+npaJYCsDKtCqGoHy2i48ayg1X1WiHtY49LaAS8GY+a1qQqRIhJLoBlPk4kCgVwVZPgjtZfGxoeDD4BXomGAsgWgXHDJlKw6MnW8701Ljxi7HSbRXlUfOvvgAJR1WYynYdPw0wE+AXdyrA/nCMFQ1GNBTMrpF79N8b/Tn5ZQ/LbbZ1TN8KiDDvRUFnNn7hxgKVbsj0YgHpY0H/vFaYkNCzTsdvrcaNDC9EhPfBQJxPhZbu/gLaAr/JASgUPDn7pnGOGyFDCOFx88EIBLD3Fh15PgKKA5qmGMaq3jbR9FmEc4XqFc4W//PuWv4kEmaoNOrizr7KnHxy3+zmHKlOD5erpY8ff4+2oU/vv+OTw== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2025 01:29:09.4923 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fd957916-61e0-4eb1-b4a6-08dd38f1d6ab 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: BN3PEPF0000B075.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR19MB7879 X-BESS-ID: 1737336552-104050-8393-313461-1 X-BESS-VER: 2019.3_20250117.1903 X-BESS-Apparent-Source-IP: 104.47.58.40 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.261928 [from cloudscan14-7.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 Mon Jan 20 01:29:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13944683 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 6BE67182D9; Mon, 20 Jan 2025 02:02:01 +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=1737338531; cv=fail; b=MO5AamB2s3ww1l9vZ/lkoAm1mpip+xFekhfOE09Sxi2o/YrugqyFBMFAaCcdWmyWOMtYwbwMuN+rd65MDrGNw8lwgW25F8hGfzo6rTu0CcvnuFkUMW0vQZbDzHi3XNXLfEsZLQV0XfbsuA0o9lwSz2+frUdxF45SJYvAHW5RCVw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737338531; c=relaxed/simple; bh=XaOAR0F2EgLfvpkxN5z224zB/8pEgoSlzo5zWOXVVjk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pyX9vKTplBAdjZJpvPbro6TW/4+W2P6Ny8fKWRqGBrzMMIJ8Wp4hn/W64QA9HqB+Gyhauxk9Apsrz/8nlUtJk53GfsrGFPELaPoaEPxoItaj9dCdHmW/XTsoB96f7POlGx6BlSFCtAqb0I++W3L4/y55gIyRi5VIN3C64/Xjzgc= 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=wUBuml5Q; 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="wUBuml5Q" Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2042.outbound.protection.outlook.com [104.47.55.42]) by mx-outbound23-227.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 20 Jan 2025 02:01:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=N9kXTDVKxEXyby/fDV7DBD570Dk9S00plREmfwlbB7u0vpub49Gm+ihBSAm4RYUZ+BWmChi2yhjHtI89lBC6kQo5zSloEszEv/9vsPI4g3be5Beyz6PWBfSMwFgbSG9p1KUxKOnCJTuU12yqYz1Bbcmt6XkpcFrW/rk8AxdvWpsSq+5XwyColXgSSoDV4ESq8IRek89Lx6XFYom6kfAv8hTI1aaRN8L4JheL4cHbrnVQbh83cKohMWneaoMbh0pMeMkXzhE/ZMAeAx/z4xpuDgcMy+oMRr0g7TDNmNZh4alJRarAEeCgrsxinym6Mm6W1NHir3r0qVqzH3yQ9UgiUw== 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=Rd7Hya2zFLG0hfyvlt2c1RihIhUNxVenm9I3zD6w2Trcebq+4i6lKAG8lWFwxs/F7fei41G5HzbCBya4iXyiPOZmccTZWKG+P/d5NbaRBhrlNv8CMyapw9HcFa416Z+OGwTndOV349YW7QRRAFsx/+DBnKJ5sF/8m+POXuaVZ+cQGLlaUztFXMHpcRKSELks0Zojpl7TPbiuKJc4A45H+R6yixtT1V082Q6fg7+Z4oiZlRlZW43fjCDMa9KzgpDt8l6Elpg6+AUZGvsSNWPdYSYjKDTLxul6GGeWntA8OA4i5lvQTdoCSfOvvXqdC4Avf11TKDUFVMDKR9xJGyvM0g== 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=wUBuml5Q+mcwBYaSl2HuGFOTHRiQwRr6tKCklPOZ1Ixgt7M2k3W6CjZF3ifAwsnzQIytwjwPdRdmRuLcbCsl/+LpXRIoepjtQGo55IdrhLsCwWXenPugSiwfheG/3n8W3qKjVpvF+PClWnXVwLI1FIdZAZdZQ6MRgMjtnOkK5C8= Received: from CH2PR20CA0009.namprd20.prod.outlook.com (2603:10b6:610:58::19) by MN2PR19MB4112.namprd19.prod.outlook.com (2603:10b6:208:1e1::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.21; Mon, 20 Jan 2025 01:29:10 +0000 Received: from CH2PEPF0000009F.namprd02.prod.outlook.com (2603:10b6:610:58:cafe::ed) by CH2PR20CA0009.outlook.office365.com (2603:10b6:610:58::19) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8356.21 via Frontend Transport; Mon, 20 Jan 2025 01:29:10 +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 CH2PEPF0000009F.mail.protection.outlook.com (10.167.244.21) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8377.8 via Frontend Transport; Mon, 20 Jan 2025 01:29:10 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id A162D34; Mon, 20 Jan 2025 01:29:09 +0000 (UTC) From: Bernd Schubert Date: Mon, 20 Jan 2025 02:29:01 +0100 Subject: [PATCH v10 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: <20250120-fuse-uring-for-6-10-rfc4-v10-8-ca7c5d1007c0@ddn.com> References: <20250120-fuse-uring-for-6-10-rfc4-v10-0-ca7c5d1007c0@ddn.com> In-Reply-To: <20250120-fuse-uring-for-6-10-rfc4-v10-0-ca7c5d1007c0@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, Luis Henriques , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1737336541; l=1729; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=XaOAR0F2EgLfvpkxN5z224zB/8pEgoSlzo5zWOXVVjk=; b=e0LQtvrVgGUCy2vFiSPBGWyUqeKBpvteTJsBKDqsZdqMYIchRtbJxTMpD9P7BLJpK1sWveLQf xYP+PXEUUjHDnsiC6AOiavytXR5bxS7vIk0PjkZBG0sM9UFv10rKkqI X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PEPF0000009F:EE_|MN2PR19MB4112:EE_ X-MS-Office365-Filtering-Correlation-Id: 8ea4ac69-d1e6-4a00-c628-08dd38f1d71f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|1800799024|7416014|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?GnJ7CN55NE/cehqq4E9A9xdEJufSBca?= =?utf-8?q?YeWt1DhB8duIfyhv+j7L4LVrqrkkDxVnHFH1OPK1vCl79cmoaEHtr6u3Mfz6xFgEr?= =?utf-8?q?n5ImQ99qJ6OQLPDeXvjCys9dI0rhFtzRxjZK8bn7RfiSXV5OnlmRNOplsmgptHU89?= =?utf-8?q?BeMhmBHS1rdLLNGUxj3fcJByShZm17LtGCBTZbj5CeL/V8xa7iKIzIkUJjIsk+yVz?= =?utf-8?q?xYqjP+oIU7iq005xw51UOepnC8SOYPu+/bFVSG3+PXEj4aGI53QnWBwuLzFFDgTic?= =?utf-8?q?DSwecnIOPhuSUCjQAx0unUUD1lnjhWNpo7Ou1L8huJrSjtiq2wtpzJ15x8oV6rXom?= =?utf-8?q?VXqc/B/y38szRRHeDQgzTYIEVyw52IidXpu6k7l0Fogh6TSEJsB32WJeD4/PAYI5/?= =?utf-8?q?4aLoSnB3jw7TKu3eUy6XTj2twrIPQANmoqLG3Bj35Pt9ATuUgKcHGKePmC4X9ZCQL?= =?utf-8?q?jSFxJqs/N6Y0RbsrmyYJ7wu46cGO8EHq4ysUE579It3/A62URYxQj2/r1SNnmeJq7?= =?utf-8?q?KdwXFi6ROwJouV+ks5pvXshMgujPv2rXq+OE4RUAj1/G7CDR2qyGMazrl4kZkXG5M?= =?utf-8?q?728pGcT+DCaDkAvIsFt+KwbTPXLQfYbTmeDIHRZ63YH5SvE4ZrbXK6MhBwM+wRBa8?= =?utf-8?q?/ZWuOOtiAOwOvxfHPBbmhPaRdStPCb4e86tMjTq6LlkpL3LX+6XT5Xhj7X91MxxI6?= =?utf-8?q?lr64WnhdQD2I9M43fYqGdMGdY7yHBt0GHTJKb7I0V/1y8o4VnhENn4qn9WYfyWOdN?= =?utf-8?q?7ACtuNB7H+D5jTIcJTL5Bs+BwIng9M6UJhgeIrxWn+uPzd+SiuNVHgC+92b1M6Bsk?= =?utf-8?q?byEIh/okgDNQ5mJr1Vv2IkWPp1Sld32+WngvI19UdQ89uhInrS8hp0S8g/s0Ths+Q?= =?utf-8?q?WRf0WDWIm1zhNFZU7K9HKtOelZF3pszzGZCq4Cm4eSmY7Mll7wKk8vJI5t8fX3TvO?= =?utf-8?q?Yx2dQI6RqXkmPnOzM1arDbyDYPZPEZ2TMio9n7Fa8+Tbd0e+uQ31aF+yBsRoFKpCJ?= =?utf-8?q?u3pvkCjJ9K6t1SxSeoP3rq/RamyodVHfFvsdAL24+QeBdpNyzOhKhCavlu78Sz/Yh?= =?utf-8?q?8FDhFDlB2peld8B806J5iMt/201u/zPCAWY1C+tMK0ZExfze8hAEmaAWLpQ68Tozi?= =?utf-8?q?GW7qcJ4NyODs/tKjriPnBr6ghK5PQ0K1EbpcOXIj2Ll0ev2VJzlhieWxLBqN9kEdB?= =?utf-8?q?Uxwhgl7YBz+K05ZjnqihcsTDwec45BmA725dPGb86zjGJ2FBWJpBkN/saDTbL4Wyi?= =?utf-8?q?IKd2pNFS3fk/4QhFAsPDikSnHfxq0ELoe0Ha6b8xXBa5Tdsx+nz6GfSHGtPeoZolW?= =?utf-8?q?xCGDDNR7kRBRyuboZ3qpRw353Xch+cbQc5Zro6NAfYIW9rE0ZhQLyzvk31y3FbMlG?= =?utf-8?q?0e25jA2HgaleqQrCQoYwDn34GEPOtDcrP6ItMu1kXdG96NKbpMui70=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(82310400026)(1800799024)(7416014)(376014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Y6peLv3bHsnWdeBznvFw7W+QQSpeXmY86K8gbp5hwCcng01TKzcVXcquvAljmK7eIuDmfDpTHvBH/qQYFZdao305I0WnJtIiq6zh+9XUh6D/pctc5tJ5WiLUPMEwFZyxIDge317EfFriVs9oLgZzO5mgZTWhi4Ic6i5v1OA4o8uTcrPuuzgUcbpgFzh4rzwOqgQeq7bdVqB4nUHhLjPeCQKia3OdvQQnBpQUYF5D1huWb8SIrfdE8Pc7K3HZ9oYJmLZa/UU6buwjEPeE6QBYY7YvE59tQBSaMjsroqKBQTf71JLGZUPzwDWYEE4ws/x5tcuSnGNp/lc2qM4flLpQZt7Y9QXX+92ng7SGXm1Wj7zOtBukf52FnHyD3u0w4yqslnJqyx7qFhsVNZdUaLIKBGDTDYa9U+KtU5Sxv5hC894uH45IQawNxQ63FyJCKjG4Adm7TLxxWEdtOUa1JUCVHDPJ2FOzgQ+MGlHgKivU7PuwAPrNdBjKrfFHBOi94dfhsZVPlvJgyt00odTT2M7AI95a4GreCZnVdLF07DQumcJz/0AIaGp0ZoAu3D4FL1xDeD9Bh+sWU3eeK8h4Dqs8eHEJATu3U5ocxJZZKMF4/kOip1afFu/aATC2qwdklVPO6yCVPcViYiTF92TDjTrFvQ== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2025 01:29:10.2998 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8ea4ac69-d1e6-4a00-c628-08dd38f1d71f 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: CH2PEPF0000009F.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR19MB4112 X-OriginatorOrg: ddn.com X-BESS-ID: 1737338502-106115-13447-16000-1 X-BESS-VER: 2019.1_20250117.1903 X-BESS-Apparent-Source-IP: 104.47.55.42 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.261928 [from cloudscan23-253.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 Add special fuse-io-uring into the fuse argument copy handler. Signed-off-by: Bernd Schubert --- fs/fuse/dev.c | 12 +++++++++++- fs/fuse/fuse_dev_i.h | 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 Mon Jan 20 01:29:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13944647 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 DE4DE4C80; Mon, 20 Jan 2025 01:29:24 +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=1737336575; cv=fail; b=cvJkR1PIdxqnQlOLrLCUOnuoX7/RSC+PzSTiGKmgpgxGaze7T6VCs/a7fZCr8+r/Kmo/s9VTHfchNsc/kgGYTZtd8NcA9VCWSme8zClhkqj41fLUFQ60ie+p5093evGMni8KlO/pFJnVmYLXBsgJO2aLuJQOD1EhjPZVrQsndtE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737336575; c=relaxed/simple; bh=Ya1E+Ku/QRkwCEaIbyaS0TPDqDs2gP54NDs4ZV63gYQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=AMjd97v6W9jE9V9paji1Te3M9YwH4TVygH01uIuzTfNf3Xj04pM1I1lO4paQybb2IVr36Na4hEHk3iKvlleTerEwAJEKQPqamthNzAxulFtUfYnCG3wOsNEiDmp9eB7IdlxL/xvndG6k+MH+2oaXmV3W3QKjddZECu7+LgMeBU8= 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=b+VJaEJT; 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="b+VJaEJT" Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2176.outbound.protection.outlook.com [104.47.59.176]) by mx-outbound43-175.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 20 Jan 2025 01:29:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=J4kDhdc+9MbSczX7DQGf2Shoh/yo14z31aTq/i7h0XUJ6z5Nyu8M21IZfLStr2zU6H38NCoS5hB42sSjGBrEoRCbgrg3RyToinDw1/FPcXCQmgJKh+HYjBi4m1ORWCwDIXl7CfXmnN7LwWG0jvDnBl6/UIGwm7EPROwcIzK8Fh57eFS4K8DwfyCfyskXMdFVwEJHG6kATQt0nhy4kGWfGy2AjtRXRS81tB9YgFt+ewWZBGj6eGCSgTEAhV4jWKs1n3MDzWCsVvQPvD15PqeIRBsefAXrFxFTSxYsDWjfUZPE+u/PoHx13gyyMAOIs42vkRhU5exp6THfgXPIuiASig== 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=dDu2AlSHzDY2kg7cn2nW4UvVO1yE+bPF9NBfb+7XExthBrTHwU5bEAowVKvc0zV81gMxPUyLjZNKLOLe4hO1XiHF7NhJrr3F9uD+tTHsOMe/gRYPnAlLwApYUQuy1g607otS6+czCTe9rfw9BqwYG48redeCv7S0MHNxeiUqYkiBUN8fXIbwouun8KxrPsNxCxJKdEnQSW3nBPqWalHcibH/kLhzUNLlwqmni73xp2Nu8lCc0MnfQAiQh98+uGyD54iV/q02+F8KOcTBH/h6PSiA0BqHx4xrDS/TjBpKLAEWy8m314TdKcceK94udy9DA+kvSVN93x8ckvNDmmQeRA== 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=b+VJaEJTVYMnSX7o6VIuQtiO8hzJCOuxZj5wsey+Vxm5Xrvo9vsTdzp237Wbp2DDczAQK90QmRwpKNlfraueRf6LPxc5JJX3W2MSTenurF6E9UByUorEV4AM3Y0vjJnfuhaAJbvK7T6n4xv2+XQxicz9cXMPiSoC8A1EFsG0rtA= Received: from CH0PR04CA0065.namprd04.prod.outlook.com (2603:10b6:610:74::10) by SN7PR19MB7471.namprd19.prod.outlook.com (2603:10b6:806:32a::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.21; Mon, 20 Jan 2025 01:29:11 +0000 Received: from CH2PEPF0000009D.namprd02.prod.outlook.com (2603:10b6:610:74:cafe::b) by CH0PR04CA0065.outlook.office365.com (2603:10b6:610:74::10) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8356.21 via Frontend Transport; Mon, 20 Jan 2025 01:29:11 +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 CH2PEPF0000009D.mail.protection.outlook.com (10.167.244.25) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8377.8 via Frontend Transport; Mon, 20 Jan 2025 01:29:11 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 9ACA84D; Mon, 20 Jan 2025 01:29:10 +0000 (UTC) From: Bernd Schubert Date: Mon, 20 Jan 2025 02:29:02 +0100 Subject: [PATCH v10 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: <20250120-fuse-uring-for-6-10-rfc4-v10-9-ca7c5d1007c0@ddn.com> References: <20250120-fuse-uring-for-6-10-rfc4-v10-0-ca7c5d1007c0@ddn.com> In-Reply-To: <20250120-fuse-uring-for-6-10-rfc4-v10-0-ca7c5d1007c0@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, Luis Henriques , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1737336541; l=3448; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=Ya1E+Ku/QRkwCEaIbyaS0TPDqDs2gP54NDs4ZV63gYQ=; b=qetoywlwrtXLnPyBQzMU6wpQjIWrwG2pLO+/pD6jkAk7gfOpYcXiTnmSC3WG500B8LM/jKKoa PM6qPynkQp/CBnI2tPEt6ywThV0sXYvtSWLjrbZRPQM0q0mOUB24FI+ X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PEPF0000009D:EE_|SN7PR19MB7471:EE_ X-MS-Office365-Filtering-Correlation-Id: 0cf06c3a-2e15-4d1f-caa4-08dd38f1d7b0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|1800799024|7416014|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?Xp7KU4bjU2dAFo7YqfKDHnOFb5KLL9/?= =?utf-8?q?vXFD/yPgQviaxqCpx4MGBMNgo2hUx/JI53BPmTQGSH5ZRiLMHN28l64D5hFrJFMHH?= =?utf-8?q?9Bs5OCjlwyQF7++OfOGxhdWDH9lSC894zjfSnlIzzW2BKvacjhvD1CQE8j2+Goaj6?= =?utf-8?q?s/MTM24UI6r5JuJsED7H3FEiCXSSeiNWokYEU4VQxnFbOx5IFfBeag7iGiqqAcjQ9?= =?utf-8?q?8cBoID2emJRvHsQOUW/5hHgzpAuejUroz2R0EHaRnEN5REZigxDpDFS708UiuM1KQ?= =?utf-8?q?tuLYtehTa6MFZqvmt7yKfwhB0wqD015+UpdmzJN9MGe+mPiLdBg29drLOiA6YJTp7?= =?utf-8?q?DCwytCt6hX4YGcZVUTWh8yY9bfyM79RY5lJvwRvN1EscSrpTIzUC61QDG+OVm5HiT?= =?utf-8?q?9ZjGGTHRDq68TRjYK59UUzcbhz9WSk+ANZHqkPmWRrwOIuX2RbkAepLWUj8IjD6Yn?= =?utf-8?q?D+OKKsBgu0ocm8r2dcZKrGGixMfDnBE3CWuHSadTKsb0KtTBS0rZ/pEl7pelHvzBH?= =?utf-8?q?6dH9cGxefTI8ewjjOIuPodCBR9lG+oU58beeZdoqDmP76lpXIdo4F4gyNZqL6wyIP?= =?utf-8?q?kpDzFcrgN5kuINxEDDWhiJUdHdoi7ZlL1jq48uNXq5thxmBXdWMdhhPZA3RhXnv7G?= =?utf-8?q?2k01DGjk5V7w6Z9CoSomY14Uo5q/KINqExLd4M1QUySHHAC5MlJ3LSw7G9d1cKj5h?= =?utf-8?q?14JeJDrmQy6giWh1lqJFZ+Jxke0GlbcAu8SF7gsFnKEYoOGDTI3LlOee8dcuat1tX?= =?utf-8?q?nqOzXHQowszUGJnlE8jK1d5jr+QfwtkAReOYui1HMCwYLlIm7TXdkgkzW7hDWavY5?= =?utf-8?q?OIJ+OsjvIN1MhI6sapJ7R/whbpaaZ+CyIms2GSrGV1fPdfyg0iq+UdAunzuSTu/+x?= =?utf-8?q?GGUV3KIFLXVQ63vTIYDBvENf8oabhOrcSfBLZHIfvuHNcsFz8iVjBnAztQId4n2Sh?= =?utf-8?q?IuBBc3Sm93pfwZyGI8af6i2k2IUT7ZhTTBjInV3VF3mbQAwO2UnlAUp+HgCzr+tv3?= =?utf-8?q?abIrtDsqtAqj8UfKGaPbcHsu4VVkouLx3A30c+wgR2GkgAm93QRpATT6C6KOgvbmK?= =?utf-8?q?rmnXNXvbAAyh+IsAeAhG3TsGrKmPUBU5gYpp2SLR/zyj69EpGM0bg9qrq9H80RAZb?= =?utf-8?q?sJPndGSVnc5Idjmxl+ualdNGmPhIgvtotgpRI33Bk0klHOOX8KaQHQqzB/TMul1Lm?= =?utf-8?q?GmhRGS6MOdN8unSmic+kdeWFT5euQHriH7uU9kUXnqg+B199mfZMlLp7A04pz/xxX?= =?utf-8?q?eEoE4bgrCI7whJg0Goe+lBLyJttEx0DrOUYzWYdyevbIQlEwurJQqDMQNY6QoBFPR?= =?utf-8?q?4eKWkQg5yKHsmbtpw4yKk0oWhVzMGBQt5BTzuchho91baJyruAz+GQn54VvTkMA5q?= =?utf-8?q?2fiwCrrG7zK+jX8klK8PDPDxpFzIEhPTXZss6IEOln0GfFq6WP/LN0=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(36860700013)(1800799024)(7416014)(376014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: sC/adklkETGxGDcso7agvvMym6OO5iVF7dyzoRBGwiYEFlZoRchtms81g14g/rVbUDxQGFnf0FSK8ENu/+XGbR0gqmvI5c6ynY8wkfYqCebXxM1l/Dip8qeh07A8DFg4Cj4sZ0AfWcZrthMn3uc8HN5o3P/VvhSjEUtGwD/Dh5Zo9R5ioYZSWc7cAvJTIVwExjafUX/lrH7js3sYqZPoSuePDod4SOYYRex2qUkp/YL5mZDYXPIDSg4LLV73We+YehVU9vsvHH7iWCcylBUMcLeGneJ72jJSM6At7bXHb0DrDlkuIKYIgUIbKQ4CgD9G8LphgV6W0NhPTgkEXyUWanqNlLYUPDl4I+gNUl5DRTEHGe+hV6QEHJ8P4REJ5R+vVzsHQ+NEMonUjvABkWqPgOjK3PBMnHV67WijNY4nErdMs8vwlJPeBXWG+Kam3cTTa5JHHHyrNUiJCExNlKxXRv2mdJu7FJrvkJsNh01fJfWPZqoCzliNKyKD5D1D8LGCUfBTwhMlcn3OHbNhglzecqdU5YnFEmQf7sOvbaRg+Wmllgm7s/WwcNfTh0H+ar54euRHZbfiFOYvkqcCQgrcK714TWJDt62vQM/RqEXwyCx+89qLx414hjDX+SkCh5saZQRRaxF+MmmyiZcCSwaerg== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2025 01:29:11.2346 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0cf06c3a-2e15-4d1f-caa4-08dd38f1d7b0 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: CH2PEPF0000009D.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR19MB7471 X-BESS-ID: 1737336554-111183-13447-2043-1 X-BESS-VER: 2019.1_20250117.1903 X-BESS-Apparent-Source-IP: 104.47.59.176 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.261928 [from cloudscan12-163.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 Mon Jan 20 01:29:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13944639 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 9B64A199BC; Mon, 20 Jan 2025 01:29:21 +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=1737336572; cv=fail; b=LsEv1crRDnA/w2kOFdJWiHSaG99S09/y5K8WXbNLSdnthGvzGkPfuDTKXiSXCB1+qZ7DAArWoyX7wwqpy4JdX/VkXDGX2948nZjx9PtScXbxbH7nTbMuH3PbRWIZeE21X7Pce4UuDYs02wQymeVP8TRO9lcKSVSg4/FcAgU6gAY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737336572; c=relaxed/simple; bh=Bb62cvtV/o9ssfWt19sVvk+kkAD7g49zLvyeTxykUlM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VpqpHaYOm9BO5DdWZp72ujTCqI9SDgLEV7P72l11fOImWSn7oWKO+TfGuRr7uP3Ctjdkt9X+YXqFkaEHd///xBgmXywBGSLM86/PKqujASMDWC72o0hTUtIj5tRn1l1csowPvpVShArLUch+//LK2u1nBNgwn2hkediPmC8BGQQ= 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=IIGiWUY3; 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="IIGiWUY3" Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11lp2172.outbound.protection.outlook.com [104.47.56.172]) by mx-outbound19-105.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 20 Jan 2025 01:29:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vkgfoXRWdPqdugGeDSuxwPuRC5GakPMPTLxRCa84QOgttO4uiqJTOqqRdvubu8y901mum0jfkiE9EYXUYNtfUmwFnlELD/9yaRHjYO7PNVdrL95D4E2G4TxxQKjyYKmvED/EB5LGG7Ft70V5bB77EGqEnNrc09eCGFnKtqO/OjMaAlRHgbcSztQRoopM0LOTpHZNr6hhfOkW6fnV+7z1B7mcknAtFJ4He5ZwZZlv25KwxJlWBMvN93d3zWy/majJY6az82JFKw3hw7hs01l1WsAJu9qHtjgMUhzFUb4ijq7JZvyv3D8sRjfJhFDbZGCFFuesRkdsRizjtT3mlPXm6g== 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=piXLzTrofLN8IVqKi2dc457lad8/frs5TR/+4yP9fSY=; b=cM7MPVsPOWFA9bzhmkZUKZqvIvlktpzFX2BZjId3BzLYlr4rBxWU2T4IUC7DNYZAF4tHZmSvUazvmQT2VrkUnF+EFuYz6i0qcElxLJjjKsP7pF2+dNyKrdUHiey4MKwT6HjVHuF/pc6AbSs91kLx8nlM9SOCD3bMfpsiChfukjc0B5ECPAt50d6JxYmT2KI34Z81Lzaj+1d21zbpA/VlzoD9IinOuLcdVe+CiAhWy1aWn1F7RB3LOubnBBQHG48AWmEXe9xVzbhAaoZz1ILXkufG7GjMiEMerkrlfOAgi/+HjqQ8IsSvjiqFLYyiP71r07TxgowBlnsQSh9iFynszg== 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=piXLzTrofLN8IVqKi2dc457lad8/frs5TR/+4yP9fSY=; b=IIGiWUY3AQzKIkqc7Hp4pRkJop5Bo3doMdISPpA9UowB0vIgM/rohllXRQcYAK0vxnwEMMH/MO5E37Xr7Y9owdsQSPTKYpDDKYNa9ZRoJE1cfKmGlVrMwU5VfKwycSgVgGjX7LOQE7ddsxBm3u3WvBVwdQ/JbsH5+RDGtZG1eaM= Received: from CH2PR07CA0046.namprd07.prod.outlook.com (2603:10b6:610:5b::20) by MW4PR19MB6649.namprd19.prod.outlook.com (2603:10b6:303:1e9::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.20; Mon, 20 Jan 2025 01:29:13 +0000 Received: from CH2PEPF0000009B.namprd02.prod.outlook.com (2603:10b6:610:5b:cafe::c1) by CH2PR07CA0046.outlook.office365.com (2603:10b6:610:5b::20) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8356.21 via Frontend Transport; Mon, 20 Jan 2025 01:29: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 CH2PEPF0000009B.mail.protection.outlook.com (10.167.244.23) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8377.8 via Frontend Transport; Mon, 20 Jan 2025 01:29:12 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 9553D34; Mon, 20 Jan 2025 01:29:11 +0000 (UTC) From: Bernd Schubert Date: Mon, 20 Jan 2025 02:29:03 +0100 Subject: [PATCH v10 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: <20250120-fuse-uring-for-6-10-rfc4-v10-10-ca7c5d1007c0@ddn.com> References: <20250120-fuse-uring-for-6-10-rfc4-v10-0-ca7c5d1007c0@ddn.com> In-Reply-To: <20250120-fuse-uring-for-6-10-rfc4-v10-0-ca7c5d1007c0@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, Luis Henriques , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1737336541; l=15453; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=Bb62cvtV/o9ssfWt19sVvk+kkAD7g49zLvyeTxykUlM=; b=7Mrl6BhmOCh8GuboR2DRGNGO/sAO+kO8O5I1pEk0SHZRPcdhEyRAwkh3J/auZK6bwKkULsg6R 092XbbLBsnjDooyrKTZtC7vaU4R1C6zEjPkjVNKZNOvldY9JYIQnuKP X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PEPF0000009B:EE_|MW4PR19MB6649:EE_ X-MS-Office365-Filtering-Correlation-Id: 66620804-f52c-485f-d3bb-08dd38f1d86a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|1800799024|7416014|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?07BZYSBvEd2gLBHz5+1FD+ePYHBLTHT?= =?utf-8?q?CNImuihb+H9Uahtg/zykNXBLQauRusfIDk4IaayqBQJ83hVRankR5Rbk+S+5IguIY?= =?utf-8?q?pq1iVBFCkMzKer899t24m8wifBw6XtIaAV0DFCJY1EiJ4ApAq54EKE/YiDFR3HsMB?= =?utf-8?q?XiFolygi8unvut7kEHaI1xlkhJ5i80lbqloOcyNA+qV27Fvmt0aQ7bt0+otGSW0jI?= =?utf-8?q?rNEeejekIVr9XNgSIxqdPuw72+VLJedTk1rcdkSVSmJNSCLxGHwkADVaKQpo+YePj?= =?utf-8?q?LPHRX+aCOaaoy2wq3oxGQsedMlRvgysvkfKzoUh9K+om9c/2/oJAQU1HwUYUzZ7St?= =?utf-8?q?qfnTUw8KJrG9HKrz7L72tNjTcdKqg54U4rbcW2kPWawbyyHwJG+McQiMWDBGAdBkY?= =?utf-8?q?Hio8FOWl6+WWEBAx39atWTI9pvLHTreKZ+2oweQpMUHFCSs4st4U6HWyXEJ46Zfdb?= =?utf-8?q?LeREgHDyKyqdbLfcL4NvtP0ukJbGSOw5I3yr6gZUntmJ5BoxSyGANL8b2/ycmZg6P?= =?utf-8?q?iMuEsHopfw2tEtafFfeiRYaOXlwilGFBu8V77MZv63WNizJRPhHDFgs+ZVlzh+4QV?= =?utf-8?q?NizD6ZxHYqIg+NZZ0Loa3sOctGia2PB3GBdSlMrN4EPeLoKuI+Hn6erLOttZL072x?= =?utf-8?q?zdXz7MxjemvWq/o30JF8hvqDvfysb+Z1yOlrv9duPeSHCi2WhMbrcAOhCVPLEekGI?= =?utf-8?q?r8Oiaz+neHCmafnJPBTGGoQ7m9xdQR7WqvHE70aH6aTk38bXzzrkkbLgq0ugnqloW?= =?utf-8?q?9H8a1RyO502HZPC0yzYWG3aGAuAn4LL6KbR79KDI94yY+H55KLfSoBF8vBd1UbEF1?= =?utf-8?q?IEiZ0C04Z2qtTR59ChTT3jOTgW/iKcFUqSMLz/gOlrOHpl3TukSJTatVISItJ0Wd0?= =?utf-8?q?5h96m+77rB3loLDbNLmxeSRjUVHU5lRrbcM7giHaCdoTIzHZjKhoQoO6h9wG/bgwQ?= =?utf-8?q?YvWwL739AtBkTcKdAspv8DeOGgNwWDMWsOFVbwwcDiomW0KSrvPa24Jxc4W5Xnad7?= =?utf-8?q?bw7UceMZ4Vr8jdk7XTV7NmjFhJZ4DkarT1zILzPA15peEX7BGHyF2K0zsVEtnWFZq?= =?utf-8?q?Ng+VrYjY/RO9PfYNxyJ33odeuJRxsNYeFOJyuYO0jFwtgOQdH+SRVF6Fxd7Fd1y73?= =?utf-8?q?/ja9YHMjYe+BAgEjOUwDDAHrDfp6hkMlc1pODjGEYn6lYYwbwPVySecJ0QW+ifpoi?= =?utf-8?q?CjECYWOEEty6DrMBQr7Y2JRP9cjTutKsBKxrWBK/pM8yF0UZ6fIPBRe4EkUOv649R?= =?utf-8?q?XZML09/xUqho0a4Mtkl8zEpzSH5/pULGrRBzMTdDQKiCKt+AEa+cIYyzN3BBBLjLx?= =?utf-8?q?cIh8ZwcWQvNkGdaZLM/AvbT4ht+Cf0w8lI+lXfRKY7sz1udlFa64UnNQPg4QLMIHl?= =?utf-8?q?HZTiKIpLM5x06m6fYeFMpiLSxUoZ94yTv4P6a2fVSYXIqFf5eBlIxg=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(82310400026)(1800799024)(7416014)(376014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: NnR5iQS1f0w5h82AQnBXmBFAEEcczNls4SNbAc6MR6KsrqLFr056C1nO/kj8HDpqQbEo/Oqv2U6Pe4U9jrnpWWEU00//bCvLTvcCbIuCZtn5cDMpt55UjzvvY+D5ytayvQ1dsAO32jVRaP5fWG3jxMhwX6PpKVZrCoAUeTWnmn5vgdSFFgzszmCffoyVP6k6calxXH2Og4VEfyWj0R/QnV4Ixn3fuN8hEVtvplNOMd0F/J0fmaJFzL+Ib+uAHkuc6hZB0HNK7ZRjxvU/j+PObjQ0sTkVbDnyvS+JDKHlEBo4EhCY7EN5P89Oin8hoUNUZMtPY5xhk/kT3RX7xOS65MHuCLIt4DwNHt2eJvfvaIfjpVVJyu19ay9I1nXUj9sOuWSN28plPWSIS/JnxIRQ8C4Fb8OO9fqm2RJgiYtb/m/ap3LVRlVRy8lndvRZISmesSHFl2T4OPkp+3z/20+4LiCJKb9Ls6m6b2rf1q7qyJ8DIFHtRyowFhlFSdgSI90ZwgBn8AAFG5662Z3U9g+nV2dpjJrotg4+LgQ8TwQO8r6B7QNkMdUhgmRri/HDb/4AcrrV+25UswWnKZTqQNz3Yw9f9mNDf8RMetnx+4uErWv8hhA3ll0S0T2PhSOhMxUkAZBI0bzjr6JD8BiTsiAjaA== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2025 01:29:12.2663 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 66620804-f52c-485f-d3bb-08dd38f1d86a 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: CH2PEPF0000009B.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR19MB6649 X-BESS-ID: 1737336555-104969-13364-2412-1 X-BESS-VER: 2019.1_20250117.1903 X-BESS-Apparent-Source-IP: 104.47.56.172 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoYmFuYWQGYGUNQg0SzZ2CzJzN LcMtXYxNLSJDUl1SDJ2MjMMsnUMMk0Uak2FgDPcuOjQgAAAA== X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.261928 [from cloudscan9-147.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 This adds support for fuse request completion through ring SQEs (FUSE_URING_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 Reviewed-by: Pavel Begunkov # io_uring --- fs/fuse/dev_uring.c | 448 ++++++++++++++++++++++++++++++++++++++++++++++++++ fs/fuse/dev_uring_i.h | 12 ++ fs/fuse/fuse_i.h | 4 + 3 files changed, 464 insertions(+) diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index 60e38ff1ecef3b007bae7ceedd7dd997439e463a..74aa5ccaff30998cf58e805f7c1b7ebf70d5cd6d 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -24,6 +24,18 @@ bool fuse_uring_enabled(void) return enable_uring; } +static void fuse_uring_req_end(struct fuse_ring_ent *ent, int error) +{ + struct fuse_req *req = ent->fuse_req; + + if (error) + req->out.h.error = error; + + clear_bit(FR_SENT, &req->flags); + fuse_request_end(ent->fuse_req); + ent->fuse_req = NULL; +} + void fuse_uring_destruct(struct fuse_conn *fc) { struct fuse_ring *ring = fc->ring; @@ -39,8 +51,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; } @@ -99,20 +114,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]; } @@ -126,6 +155,213 @@ 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 supported through io-uring yet */ + pr_warn_once("notify through fuse-io-uring not supported\n"); + goto err; + } + + if (oh->error <= -ERESTARTSYS || oh->error > 0) + goto err; + + 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 err; + } + + /* + * 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); + + err = 0; +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; + struct fuse_uring_ent_in_out ring_in_out; + + err = copy_from_user(&ring_in_out, &ent->headers->ring_ent_in_out, + sizeof(ring_in_out)); + if (err) + 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_args_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; + struct iov_iter iter; + struct fuse_uring_ent_in_out ent_in_out = { + .flags = 0, + .commit_id = req->in.h.unique, + }; + + 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 size. + */ + if (args->in_args[0].size > 0) { + err = copy_to_user(&ent->headers->op_in, in_args->value, + in_args->size); + if (err) { + pr_info_ratelimited( + "Copying the header failed.\n"); + return -EFAULT; + } + } + 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; + err = copy_to_user(&ent->headers->ring_ent_in_out, &ent_in_out, + sizeof(ent_in_out)); + return err ? -EFAULT : 0; +} + +static int fuse_uring_copy_to_ring(struct fuse_ring_ent *ent, + struct fuse_req *req) +{ + struct fuse_ring_queue *queue = ent->queue; + struct fuse_ring *ring = queue->ring; + int err; + + err = -EIO; + if (WARN_ON(ent->state != FRRS_FUSE_REQ)) { + pr_err("qid=%d ring-req=%p invalid state %d on send\n", + queue->qid, ent, ent->state); + return err; + } + + err = -EINVAL; + if (WARN_ON(req->in.h.unique == 0)) + return err; + + /* copy the request */ + err = fuse_uring_args_to_ring(ring, req, ent); + if (unlikely(err)) { + pr_info_ratelimited("Copy to ring failed: %d\n", err); + return err; + } + + /* copy fuse_in_header */ + err = copy_to_user(&ent->headers->in_out, &req->in.h, + sizeof(req->in.h)); + if (err) { + err = -EFAULT; + return err; + } + + return 0; +} + +static int fuse_uring_prepare_send(struct fuse_ring_ent *ent) +{ + struct fuse_req *req = ent->fuse_req; + int err; + + err = fuse_uring_copy_to_ring(ent, req); + if (!err) + set_bit(FR_SENT, &req->flags); + else + fuse_uring_req_end(ent, 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 *ent, + unsigned int issue_flags) +{ + struct fuse_ring_queue *queue = ent->queue; + int err; + struct io_uring_cmd *cmd; + + err = fuse_uring_prepare_send(ent); + if (err) + return err; + + spin_lock(&queue->lock); + cmd = ent->cmd; + ent->cmd = NULL; + ent->state = FRRS_USERSPACE; + list_move(&ent->list, &queue->ent_in_userspace); + spin_unlock(&queue->lock); + + io_uring_cmd_done(cmd, 0, 0, issue_flags); + return 0; +} + /* * Make a ring entry available for fuse_req assignment */ @@ -137,6 +373,210 @@ static void fuse_uring_ent_avail(struct fuse_ring_ent *ent, ent->state = FRRS_AVAILABLE; } +/* Used to find the request on SQE commit */ +static void fuse_uring_add_to_pq(struct fuse_ring_ent *ent, + struct fuse_req *req) +{ + struct fuse_ring_queue *queue = ent->queue; + struct fuse_pqueue *fpq = &queue->fpq; + unsigned int hash; + + req->ring_entry = ent; + hash = fuse_req_hash(req->in.h.unique); + 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 *ent, + struct fuse_req *req) +{ + struct fuse_ring_queue *queue = ent->queue; + struct fuse_conn *fc = req->fm->fc; + struct fuse_iqueue *fiq = &fc->iq; + + lockdep_assert_held(&queue->lock); + + if (WARN_ON_ONCE(ent->state != FRRS_AVAILABLE && + ent->state != FRRS_COMMIT)) { + pr_warn("%s qid=%d state=%d\n", __func__, ent->queue->qid, + ent->state); + } + + spin_lock(&fiq->lock); + clear_bit(FR_PENDING, &req->flags); + spin_unlock(&fiq->lock); + ent->fuse_req = req; + ent->state = FRRS_FUSE_REQ; + list_move(&ent->list, &queue->ent_w_req_queue); + fuse_uring_add_to_pq(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 *ent) + __must_hold(&queue->lock) +{ + struct fuse_req *req; + struct fuse_ring_queue *queue = 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(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 *ent, + unsigned int issue_flags) +{ + struct fuse_ring *ring = ent->queue->ring; + struct fuse_conn *fc = ring->fc; + struct fuse_req *req = ent->fuse_req; + ssize_t err = 0; + + err = copy_from_user(&req->out.h, &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, ent); +out: + fuse_uring_req_end(ent, err); +} + +/* + * Get the next fuse req and send it + */ +static void fuse_uring_next_fuse_req(struct fuse_ring_ent *ent, + struct fuse_ring_queue *queue, + unsigned int issue_flags) +{ + int err; + bool has_next; + +retry: + spin_lock(&queue->lock); + fuse_uring_ent_avail(ent, queue); + has_next = fuse_uring_ent_assign_req(ent); + spin_unlock(&queue->lock); + + if (has_next) { + err = fuse_uring_send_next_to_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 *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); + ent = req->ring_entry; + req->ring_entry = NULL; + + err = fuse_ring_ent_set_commit(ent); + if (err != 0) { + pr_info_ratelimited("qid=%d commit_id %llu state %d", + queue->qid, commit_id, ent->state); + spin_unlock(&queue->lock); + req->out.h.error = err; + clear_bit(FR_SENT, &req->flags); + fuse_request_end(req); + return err; + } + + ent->cmd = cmd; + spin_unlock(&queue->lock); + + /* without the queue lock, as other locks are taken */ + fuse_uring_commit(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(ent, queue, issue_flags); + return 0; +} + /* * fuse_uring_req_fetch command handling */ @@ -318,6 +758,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 ae1536355b368583132d2ab6878b5490510b28e8..44bf237f0d5abcadbb768ba3940c3fec813b079d 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, }; @@ -67,7 +70,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 Mon Jan 20 01:29:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13944645 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 98DF3199B8; Mon, 20 Jan 2025 01:29:21 +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=1737336575; cv=fail; b=dfghi3VuRtpB7nryAjvgjnk2ByZMRjJsQqZvM+q7Nj9mqD2Us2iEfiBzxwh3hwxqwVm9tJ6MPr4RMjp2H4gTn1eqf/nJq+Ki28r/xyYGMFIc0qJ0J4byvSLh7xsjtjX+QcxoD4PKUI3wuq5QfXNsvGI9TsHVZ2Qs8MKTyY58n9I= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737336575; c=relaxed/simple; bh=lGgU/6mKYjWx+26uCYFdN2LgH+8yA8kYYPtM6i5hKbY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OUUi2xYPcSzGSLoZjydA/pnk1CvH+7LGf1aN3/BdzsQVJSt5f2HLQDfIUz8SVQsihRkGf0Ral5D1SODON6kG0B/P6uQNRwFheXkdydD6BZYIGf4E/BK3z7pk+ijjlEF/yNOVQHc55KKA+J382Etju2f9ERr1G9m46FYALYia6bE= 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=f48jXWw7; 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="f48jXWw7" Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2049.outbound.protection.outlook.com [104.47.66.49]) by mx-outbound23-227.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 20 Jan 2025 01:29:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=jwFcIjwaaOCD1DaM44rvDQgRngAVik7PE6j96meLbNOZDJH+wUZ2AgB6yafjsusZ0qUaNHijVlTpbP2wQQuNI3BNajf23JotLmwMP51TEiTcfiOTLrymnL8X9JY7O+OdpkpTiI2ppeyFt3Odu+HK20CwKIXrIazMVIVug95oWRRMitvERNjFuG/zt+VEsRbqv86h1dG6jLh52ybpxR0hJplm08m9Y/Q9Lzg7luJbrk43bp1p8zR4kgc+Hyv43ZZVpI1Gzta3qguotP8HgbLuPol8pELscWFESmzKBHtTOUHe060byFAMWe16CkcRf0KcOw6EI3s1ZUi8qUsVbq5RzA== 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=SczpqaghsQ24i9qW4T/+7guNut3vKv0OD/9PTH4CLZc=; b=NHn3usgHisEZQPQMQRPIi7LvA0gciVh6OV5Nsn/9hPZoB1W6sRTkXXT5GtL6HZDeIvbPqVEDt3w6XBxWtaZGgjOdepKV8ccDgmzovsP+HPgvZfUTRWMOOo4Tf/6nxQYjewHxObVY78c7CbSLGfqeasZj3Rlsh6vswuZJx81fOqR9R/6AwnY1PK/XMGfe4Y71Q4foVceZBp9/S+Emf9DchUZjtQiIDaAiMkztCO6AK8UkF6U9K8mUpOdwsC8rwyU4KmpywviN/gEnkHhXzgSa/4c/XOW1dFllA/+XhTp7fnf5wjGIccnmo6SZoUENXS/c6s+g6GQnvYD9p/4w1TXpUw== 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=SczpqaghsQ24i9qW4T/+7guNut3vKv0OD/9PTH4CLZc=; b=f48jXWw7gcNH/1Mv66TWOTI2UapCY2UfHlO/bj0eQ8peLly0sCZPekkaqM8ykybF0IZALp4/cu6bsSkmW5QitaABc85LO6SJUkKLQGhIHLFcW0wSxbBhtRwEgA5b9Ig9NREkRvBKEiDVYy4yVUsxQ8scY41xLV2DL0M/qqr1dW4= Received: from SJ0PR03CA0197.namprd03.prod.outlook.com (2603:10b6:a03:2ef::22) by LV1PR19MB8898.namprd19.prod.outlook.com (2603:10b6:408:2b3::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.21; Mon, 20 Jan 2025 01:29:14 +0000 Received: from SJ1PEPF000023D2.namprd02.prod.outlook.com (2603:10b6:a03:2ef:cafe::f6) by SJ0PR03CA0197.outlook.office365.com (2603:10b6:a03:2ef::22) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8356.21 via Frontend Transport; Mon, 20 Jan 2025 01:29: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 SJ1PEPF000023D2.mail.protection.outlook.com (10.167.244.9) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8377.8 via Frontend Transport; Mon, 20 Jan 2025 01:29:13 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 8F1EE4D; Mon, 20 Jan 2025 01:29:12 +0000 (UTC) From: Bernd Schubert Date: Mon, 20 Jan 2025 02:29:04 +0100 Subject: [PATCH v10 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: <20250120-fuse-uring-for-6-10-rfc4-v10-11-ca7c5d1007c0@ddn.com> References: <20250120-fuse-uring-for-6-10-rfc4-v10-0-ca7c5d1007c0@ddn.com> In-Reply-To: <20250120-fuse-uring-for-6-10-rfc4-v10-0-ca7c5d1007c0@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, Luis Henriques , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1737336541; l=11548; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=lGgU/6mKYjWx+26uCYFdN2LgH+8yA8kYYPtM6i5hKbY=; b=meItYGegdaNgNJgiYtW4BQ9GhtPZmUHpBUYkEXtwVTdjH5jtAYLAuib8cMS4DoD9rrm8XYkb/ hdp9cXTG+SUA14s4x2m3xrc2gwUU/xl+ym8/skiSPMz+csSUjLHxtSV X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF000023D2:EE_|LV1PR19MB8898:EE_ X-MS-Office365-Filtering-Correlation-Id: 9bd4c404-424f-4b89-0097-08dd38f1d8ea X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|1800799024|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?q?ojBC1Z0PcQ/6nFoEIhKKFAGUeP5xVJ8?= =?utf-8?q?Zwn9hECwF9KnpVx54bxfI3m4tJHwCEAR7ef0nH2bKG/0nBkDMTOKl9GyoWPiSRp0k?= =?utf-8?q?DPqmohsA60oMVp8hCLVdhY8JJpINc42o4HL3v9ZLjDLDt4W2A9gdoTrHkrLBvKs06?= =?utf-8?q?9CKFEIDfzRrlzR4uzKKkLylffBZSP5r8qBMiPN+2bT3Kt6uBbhpOcRxWfpIcoaBCL?= =?utf-8?q?lSIaKELJgZvHi5OCvDwNge19FaErqgrZkU80cvDQEmNM1ncujy+qrDEjfy7DejI0a?= =?utf-8?q?92soV85ZECJ3wuSmL/QsNtTcDM19AtzAdxKQ9F0gHdIlpAulKgebH07YqssEDVuw+?= =?utf-8?q?XPKgnYHwOtMpGD0Dl7JdqD0aJdPgfJR+hF0F60QaDcZWzDuyiSrQVjFVTNUxZZBJu?= =?utf-8?q?SYQZrTTDHG22IPYLEvpczvdpzoAmvTaXXtbkWrYodqjiG5aOYKw/6U86RI5JyCJ7K?= =?utf-8?q?wYtFzSFAaVPFsSwE3BGLOdWotazVlO5qUQlFJa4iWpjqEohwwnWCFTJwG8mCudj8J?= =?utf-8?q?9J8bs0qCeyXyOjtil44EXBonf2ucaQ3oaOVh5Iey39MSAV/DetTtA5yMUNJQvsZ1v?= =?utf-8?q?cQuc+Nydwn+X6tm+ALrVCPJPyjDZreWIzh0Kh7T9kNd65nOZ4WCNbDJzAmnmvwR3q?= =?utf-8?q?SPO/jWQAM3OuVJmHm5/BgEx0wHVHh3dgfzeR+RDsglb7cyqp/jBtRVI13HzJiqeip?= =?utf-8?q?SUULviTuFadFms2Uq1xL5FAMiwgLKikmeAHGLnxRtds8qgegt0/bgkd6Qb14DIhIi?= =?utf-8?q?r2B6LO2UccCMWTHh47HagKrlvp2EynFYWOQ7FyedDIr4Az7gs+tyEugYU2mvPbQFh?= =?utf-8?q?yDChceLSddKH3xCu3QtjDmfYMnlTpHHJJEaCXTCRset4W7wEqWHYmUa02xOsDydLo?= =?utf-8?q?PZu+/f02pkjTtFmx9Qowi0HmPQUJG2/ixurAkP5eUOd8eNlLNt7ugNFq86SZyz1fC?= =?utf-8?q?kceg5WzdSOM/tapGCXpuo/2n2BR+DOFHC4gvPnzktZmMVQd/AhSCDgvHmL9e4qS95?= =?utf-8?q?YN6SeB67YpO9Sf6KhAClI1/pU8XZaUZhkgzrPK8/nBgmnzdU+khJFOgnRKMqo7nOR?= =?utf-8?q?4u7Qq3gtf6fFMmHmhFYwLBYP3lhRGpwwWNuaNFfSevcEzPUc0q9Etbhpnu2NiGsrq?= =?utf-8?q?yTHGP3Zfjj2Za1uU5G6JADTgTv09YjYqK9iRxHizBvKQ2rSZQ2SubA2GKumkuoANk?= =?utf-8?q?JHNj36w+Ys0N4spjRG//YCb/bdt+8byuNb2faqPhRk3F0js2sfTfwnT5lqGWnMzNk?= =?utf-8?q?I/FltbXVIyLVuivU8BFs62EfWAPkH24CIh1mEDxrTuih6RReMq6+mS9vkwJ7VeRXP?= =?utf-8?q?tO6Z8VTh7DcYvidZxMKujvCpFli/euZePpFmPGmMnXlKWdG8gdswhjr/YGcqTqaGb?= =?utf-8?q?RMzZDUSVa+ubTn6RSIiTsMcA5iYsBoIjGiKlsAp2OBT06CICx+hSOg=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(7416014)(1800799024)(82310400026)(36860700013);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 3WoUgZ0cEjpO7qZwKZiZF6d2K16A19vdVW7ZxSj9BvJUa4BLt0uuWOlEsU4uX2fZr5MtvEne5ryvKl3uTdlBRIneW5WPf2JOSZt+nETtprT6NUmQy86d+gAhtz05Rr6glakRcFJaghHLuERrcPNqs3+oiaTJGhnGUDXw1G2SYvhlERrdlnrQNMll4Qp9kMZm9tQHZm8e5lQ/mHLdmyxfXOGmoVERsBYBQLnUWJaoqETTFw+3RfQolaRMKhi3ckzljZZDrgqGra01TtzzuLhzVdYoBnmMK2rBpFtJXB47frHK8bP29T1IEheEXE16YrukTQHOAqqGHz18m4MKmgEjbavIBQ+6ESL11LpqFxM6Inq/jhGI/bmGIjsH2mmni0PlHkLsNJ2WpLwy4YEIe7173p8WvfqLz6YuDUyA0cggkgK7sb/F8eq/I/a3iT53hPmKbMxxWsyyy3dAE93GPslIt/BFUh9nRSmJuIPPBz+xsoNKKpBwHDkQOWDub9zLdN9Y2WQ347hNcx0SWoJcvY/Tnt6LYr17KJPhzmcpVU+kAcVm2N0OB8d6uStrv5SBPYRHy8/jE269lFuusFQo+6Lg80T0RKG2fyCP0EahAYNt1Q5vrBmnt/j4ljJlWnHB1/A8kESzZami/iYELhxVH1X+CQ== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2025 01:29:13.3028 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9bd4c404-424f-4b89-0097-08dd38f1d8ea 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: SJ1PEPF000023D2.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV1PR19MB8898 X-BESS-ID: 1737336556-106115-13454-11011-1 X-BESS-VER: 2019.1_20250117.1903 X-BESS-Apparent-Source-IP: 104.47.66.49 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoaGhiaGQGYGUNTCKMXYwNLC1D Qx0cLUMs0iOdXSJM3CIsXMwCjJyCA1Vak2FgAeVx6wQgAAAA== X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.261928 [from cloudscan14-7.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound 0.50 BSF_RULE7568M META: Custom Rule 7568M X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND, BSF_RULE7568M 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 Reviewed-by: Pavel Begunkov # io_uring --- 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 74aa5ccaff30998cf58e805f7c1b7ebf70d5cd6d..86433be36ac4d4c5d6ab7c3da8565acdc3d1e4bb 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -36,6 +36,37 @@ static void fuse_uring_req_end(struct fuse_ring_ent *ent, int error) 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; @@ -95,10 +126,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; @@ -155,6 +189,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-commit-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 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 */ @@ -532,6 +726,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 @@ -663,6 +860,7 @@ fuse_uring_create_ring_ent(struct io_uring_cmd *cmd, ent->headers = iov[0].iov_base; ent->payload = iov[1].iov_base; + atomic_inc(&ring->queue_refs); return ent; } diff --git a/fs/fuse/dev_uring_i.h b/fs/fuse/dev_uring_i.h index 44bf237f0d5abcadbb768ba3940c3fec813b079d..a4316e118cbd80f18f40959f4a368d2a7f052505 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, @@ -80,6 +83,8 @@ struct fuse_ring_queue { struct list_head fuse_req_queue; struct fuse_pqueue fpq; + + bool stopped; }; /** @@ -97,12 +102,51 @@ struct fuse_ring { size_t max_payload_sz; struct fuse_ring_queue **queues; + + /* + * Log ring entry states 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; @@ -120,6 +164,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 Mon Jan 20 01:29:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13944651 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 2B8D833E7; Mon, 20 Jan 2025 01:29:23 +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=1737336603; cv=fail; b=d782KA259NyAuBQXrsIziP9sJG6w4QwlGhUQLOESo95+UcUBGIGXsV1SXvCd13+lL1lni4wMQEVOTcNYDZghMdXFKz+qphK1p1NmoLl226LKM3j4Z1oKFAMck2vGRO6qsPFAI2SuVeXUp5Me7o8SPCo9ulNUv24cJTb4WxayG/o= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737336603; c=relaxed/simple; bh=1c8nwG+AvizMXYL6lMtMaTcWJG4uUtDdhcv5gi9lF1E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=a5yZEFZWTKfiEGAlYec6SJFrIb+WBbmdMlRroidDwQQA4BzKrun+4B83XOly0xppQ1EXrRfy0RNdrFm8t3RydYMLKcP//ugW+HrZEiMdbXdc243yvEQUT2vy/XdCZX58iiv1lm3O06NiqhEMOPrBfnMV+zs25sacLQm/PUQg2X4= 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=lXLjqOa6; 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="lXLjqOa6" Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2173.outbound.protection.outlook.com [104.47.58.173]) by mx-outbound8-131.us-east-2a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 20 Jan 2025 01:29:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=IfrsMI0DvJ01VgrHrR8mpDmMItfDtQ8+TXViAeuMHXeIbDdu1oDHB3YpBejhTyuA9QECBQNCcd9SpeSCKt1BRzvmyuh0yUgb5Vg4J7rWljYBP5riRLWIDDoZDZYZhIn0n1b5vlB54DzwcvLkZJuk6ZVw3GC3DX1QLUKRcgmLb+IygpJgSvwOM2+961lX51bV3rL34JUdyholDREIeBfHlJw1xjSQPbuoNm17ziZtq5p0RCwwG/KKloGoX5TAPd5PKbsDOUA7a65F/R3o2Z/LTqQxnh7ie34o88uKDrI6UrYDIcmMkvNM5cyixHzjYm21OQodUzVFPc2jBzu8LYwQ+w== 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=nAT4F5WnNqPbWeM38xsXXr+k7zixmUyA9Ody6XNGvsbr96zugGs1osfc0CyoOJU3Z5wZ4ZB1J0gOaHuMPoofgL9dpQjNo2/k6jNfFBEvju8xGqbme3h/v2iNh3Rjyqd7AlVdXMut4CylP8uX1WuFKk4aAO07AENq0WbUKJNRLVFYbZ4QM0bqySjIw1Ws2blblLNA+2CFIT+a2lhpV8KZMidu7tFN51iKgpDWBNvFg/FngroMMDGqUujcuQRI/9zXheCHA4sIM7XxwGVnqKOH94MLqsjtRmpLLCBWh4BFXAs93lSKBgpdrQwHhKy2gcVgnnnund4NYdK0vExa+nBwBQ== 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=lXLjqOa6TZ8qNcCQ5M5JYWYyGIjyuCz1+hjfoHfxcxqrTBZX3MJAC1Erra8MeQEbMjbWgzK9Z+5+F6uucGQCVm0DRFYBMUIVALkZFAbx3jf9HJ0YHM8/HZeHJnChiRNaVjJnh/EpZlgym05ddQIMXlNj4d/84OCdV6+ykZ8+mgI= Received: from BN0PR10CA0016.namprd10.prod.outlook.com (2603:10b6:408:143::23) by PH8PR19MB6788.namprd19.prod.outlook.com (2603:10b6:510:1bc::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.20; Mon, 20 Jan 2025 01:29:14 +0000 Received: from BL6PEPF0001AB73.namprd02.prod.outlook.com (2603:10b6:408:143:cafe::dd) by BN0PR10CA0016.outlook.office365.com (2603:10b6:408:143::23) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8356.21 via Frontend Transport; Mon, 20 Jan 2025 01:29: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 BL6PEPF0001AB73.mail.protection.outlook.com (10.167.242.166) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8377.8 via Frontend Transport; Mon, 20 Jan 2025 01:29:14 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 8FC0134; Mon, 20 Jan 2025 01:29:13 +0000 (UTC) From: Bernd Schubert Date: Mon, 20 Jan 2025 02:29:05 +0100 Subject: [PATCH v10 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: <20250120-fuse-uring-for-6-10-rfc4-v10-12-ca7c5d1007c0@ddn.com> References: <20250120-fuse-uring-for-6-10-rfc4-v10-0-ca7c5d1007c0@ddn.com> In-Reply-To: <20250120-fuse-uring-for-6-10-rfc4-v10-0-ca7c5d1007c0@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, Luis Henriques , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1737336541; l=1912; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=1c8nwG+AvizMXYL6lMtMaTcWJG4uUtDdhcv5gi9lF1E=; b=eV8hMKVCtQcZZPFw1YuocAHHIHOgx9yIE9SUNYYxbxOflm/Rnhvm3C8Ocg1NpuCzQhOkDpx0o NMMcVkJGiESCZ4anlt1cRQhoQcApAp/ZeuK0IFsPBjuk/FFXi7GJ30q X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB73:EE_|PH8PR19MB6788:EE_ X-MS-Office365-Filtering-Correlation-Id: 27ed0c1e-c8e9-4481-c910-08dd38f1d9a7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|7416014|1800799024|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?2mQxy+qDpOptoh5AysZ8g0bW9EdpPh4?= =?utf-8?q?u7Ei2n+bpiGd6tzgxvpUenrF+rA+dF0epk+FykfeC8YA1xqA/duF4duAEi+NC9NZf?= =?utf-8?q?OjKjnH5AJLo3VbrgO1s6X2tmg1ytraOdHHNuuj+tjX+STZt750xvlpff62eqfnQZ9?= =?utf-8?q?jjaGLqu4Um6oe814DijTVGo3uv5+pMXzvVCqliqwp0ZZcVghXUC2Z0UN7PK1oKcva?= =?utf-8?q?WKoXl7GglVvNu/JZ1WA0HrysnQjPQ1UF9axbhfcYTuWYK1Dhc2jcGK6ssS31TwJ9u?= =?utf-8?q?E6kpjWCsdOf2S7ftHy3GFHOw4tsdEgp/42WuEYFittshJqHDzVftBdRTnyuoN2TzP?= =?utf-8?q?GWqrtA/xsnTc4uMWypeYK+qTd5cQtkBTUZlj8zK3zcIEf49y5tOCttx8+mk/NymQr?= =?utf-8?q?Et233cl3T2eIVmvOqbndwbDgJhO/xkLvTl8UBHTqjR5O4GGsliXpGPNzV/xfn1L+9?= =?utf-8?q?Fgso4JQJKwu0xke31lOE7cz+McQcYbGsPSf9O3BWFdR75RIIX7L9U9hF4/WQv3w+H?= =?utf-8?q?VeZbvoiSTaDbHct8ZEzn5jdTi/5MAIPVZMKe3SIjMeWIaaDNqLM+iFyPCPbR+/EnL?= =?utf-8?q?j1/WxY5KpyBfmYg9CaOtA1Wb8zqxYCqUg/pfX+g5ljQHvcXTKQ4B0nUVe3H1HLmDO?= =?utf-8?q?b6S8wS38BhoOdDE3T+MaW0n6bx2w1MnvR0EmPbqIAZ6KkdOIGk0HKQd169m1ngh5e?= =?utf-8?q?iVkruVKKGFXfrQ9tZSXhkQQlDfMcsbrpqvFMfWKzQxP0Uzmr2dUjrGloi1rI/3Nlc?= =?utf-8?q?f7V1taIV6Ebri+XF8czqlTiRIkdZoyKX/0KXlU+k8+im2HgaelbN84fXnl0UdeDxM?= =?utf-8?q?NO5fanh4ACRv5klbZlJan2xJK/GKaURmrO9oZc4aEhnGw6kBfU+BTT4oHEp+sxgot?= =?utf-8?q?dI9EMdZHp/BlTDtSDMruNerTA76OeJkef/6PaTIakrcq9nwatb8V1XnAgKranuCIS?= =?utf-8?q?ECWnpUoaR9T92fau/VuucfwvRZm+fCh3LwAVXk5txSGC63lZ8gJ0gj+LvjKJ2Dznt?= =?utf-8?q?+Y/U/7So9fTbgQMjsmzChjjSSZsv6ZNNo3t6jL81Gsg9uXTv5zc/z22jSWvZFuKtL?= =?utf-8?q?m8SdX9tRRbnjN/kNRonlVhwIHyHckN6LRO6R+VKATp+pPMhP0diyJvwNEL6EdLGMe?= =?utf-8?q?CE2ZmXwN2A325l7wS8GaVhXnqE/Gvc5GEo+3wI/ytfJUvsyPbtV7ihL78x0zqjC+Z?= =?utf-8?q?ilZQl3XxUp3qkPzaEw3BbhtSEiIcY9snTfLGlV/n52OS1rWIiT2EFIsm/QOvkdhAO?= =?utf-8?q?VW8qGyLerJ/dq+JIkiD/0mpPbql60caR2sA8gvgvNtXcSdOidVBGhB8sMdn8BTmqa?= =?utf-8?q?0yNpoy37aowV5cJ3qsgK1mSnB7ogsowW/3zXj9yM842dQsTjDUYqGLlgS8mZeEDJc?= =?utf-8?q?ox5z4eRJX4P/V4bO4grFlwQ9tcTr8yeuGyk2J/NwYO10dBIlMUWbP0=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)(1800799024)(376014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: nozewRCkwqkXvoqc2NYxN2shXShJ9UHzbY/yEFNN77upBv9dJYPbfk3iFgocRUguyieKPq1f/n+s8QPZpaeOIgOpWyQ9lSst7x4fctEdyvJsJIPwre07idxRAyg28hmhpBoEvI/6espKLSlOnyd95WJImXX77r1BOujf5IHSmbqoXEWTkpT8iInzL9pO1FbzEhrRD7p0b4jqHLFdZ1UiVaJsSjgvKhQE3NXjTfeBgAdxM7lddtB4PG9bvYlUFw5CRuLvqSxXRAnordLsrIn5hkF0COWaPCxHTvNHx4xJ8bQNuE8FjKVUeJ695jj5peLpiVDssxp3Z576iRnVsLO3OWdXl4PpSv+eC0aGUeMzlNYLezMsdV6xKHplaNleE5zRO1OeeQCwHlMZJgG2lkI19Uyz95+GzM8q49P8oLSSUaSxP8/sZr/hu6TZtXZG0vwk+3LyNRYBzUI9qWrl876q1ggIdU5XstoHCphdJnrHL2FVg7TqrLicUv6yJX/Tw4krp1opJOWBQ3ep9BhoSfCuxHzO+sBd3IR2x4qWYdhB2gKQTWPWDAHfn8AJ0MgdDjKc3BNtWbcGiQl1rWXjBqt/U9l0aF+3wdoEOC26gdXoQc5tmFH7H+jcOo4Ijhf071suiyTon5EkjZujLfFUn8eNhA== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2025 01:29:14.4841 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 27ed0c1e-c8e9-4481-c910-08dd38f1d9a7 X-MS-Exchange-CrossTenant-Id: 753b6e26-6fd3-43e6-8248-3f1735d59bb4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=753b6e26-6fd3-43e6-8248-3f1735d59bb4;Ip=[50.222.100.11];Helo=[uww-mrp-01.datadirectnet.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF0001AB73.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR19MB6788 X-BESS-ID: 1737336558-102179-13330-11601-1 X-BESS-VER: 2019.1_20250117.1903 X-BESS-Apparent-Source-IP: 104.47.58.173 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.261928 [from cloudscan18-185.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 Mon Jan 20 01:29: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: 13944646 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 99AF121106; Mon, 20 Jan 2025 01:29:24 +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=1737336575; cv=fail; b=O18+0PQYn6At/7cceA4kODJojsTiZC1AEOstw4cgeBGQt1SgxWmicRDVKSU+3ATXftiru+Wl8b+yx10CsNORe1lftQQBz6xYlOueWlaF1lzAaUoYhyy0awshpsuAp4D3No3CZ+HuzmDQVIs3KT0iDgUpfiu1DPVOcYvQBoqQoyM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737336575; c=relaxed/simple; bh=A7fY8phy6fOm8qv58F87DVyXUfT/Xm20UDYB3ujETI0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=M/3EmS8gI206AjKgnzAXwD6E/GyrBbKbZHqImNHZ4PoYof7d8XUSWTpl5GKhj+sc2EffgiY/SCZiRIoIQ07/3Vi7ElR4Eph33oTUjYKolS0Q0k47EbC8IRnxyZ9qNnpn7P9v/EvBxCXkY1CgqEKG0KvwrpiGWtES3FVNCyByssY= 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=KBogC/lk; 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="KBogC/lk" Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11lp2175.outbound.protection.outlook.com [104.47.56.175]) by mx-outbound23-227.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 20 Jan 2025 01:29:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=t4fveLYB2DfWynRxKcVPPhOLoFmqsTD3z3jWJnUVL1dGaQTQMVnSHiN8BCFHGBe6I3gzI/rImgyFGdQMsXmbl7Y0YY1j5ss9mz5jFZwIACHHNDcIShZZsKv9FFDUvZS08MRUe4GYc3jVDdb9B93NIj+cGjM7NwBf8uBos85RyEKr3LCHNXLCKkH5Yt7ewuhy8mHJYjaD7hu0tf8t5FR73rfhxK2AGtyrd3qb76ZRUAl9XDFN1RVoJN+RoMWS1FkPjckB89AGgAZLoWtssUWon3IXjIV63xNcwuSQlTQemuUOqlbC+Bi2h4nHTPs0UwXTNuKJDWXspLG82i/dLFkHIQ== 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=ikNBXQ/zdsE496uE/mPWLzONaoucBhOaWu14uv41fn0=; b=fosjm5cgvMZTDUMnc/hA81mL8g3SdDRebYjPiMyq9FyoBL7w64obebnUot9HbE0jx/biGfkwEtw6BZDkOTVTNZJzyTcKKr7FgCk9rYur3Hed2Jo3f2h7q++gJJRzg8h4uR1rjvw7scT30cB+V3dUijLUpKp4xxxZGnN2PHhvArjmsm15VR8b4waSrJdDubEfBfvvlezBm5dxteclOps9Lm1KnFVol/aclQeiNjzWsM8gT/5fKPQg/rxDEkt61OmFycWbFT4TjLBF6Nnl9h02DPSApsKUZvLrbblPsJjeSnvPm5oa0SsoyDmHokiZ7ddoEkWIGqAp0knyKIDZ1MoOSA== 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=ikNBXQ/zdsE496uE/mPWLzONaoucBhOaWu14uv41fn0=; b=KBogC/lk74cvBiD20gW1BFTdNI9PnfMsi+SQ9ro6PDaNQk7AhPbUhFifyNi5egAZo1o24e1z08p5FaaICVQmobBv+UefFX11TA1kfbR2zCSqToeGH/alLy+YuWjgAjYiRqkty/JyDV2gS/s2Uk/3YtJASHe8x5KJV7QosMT7Ogw= Received: from SJ0PR03CA0200.namprd03.prod.outlook.com (2603:10b6:a03:2ef::25) by MN2PR19MB4013.namprd19.prod.outlook.com (2603:10b6:208:1e1::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.21; Mon, 20 Jan 2025 01:29:15 +0000 Received: from SJ1PEPF000023D2.namprd02.prod.outlook.com (2603:10b6:a03:2ef:cafe::f2) by SJ0PR03CA0200.outlook.office365.com (2603:10b6:a03:2ef::25) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8356.21 via Frontend Transport; Mon, 20 Jan 2025 01:29: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 SJ1PEPF000023D2.mail.protection.outlook.com (10.167.244.9) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8377.8 via Frontend Transport; Mon, 20 Jan 2025 01:29:15 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 8A9494E; Mon, 20 Jan 2025 01:29:14 +0000 (UTC) From: Bernd Schubert Date: Mon, 20 Jan 2025 02:29:06 +0100 Subject: [PATCH v10 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: <20250120-fuse-uring-for-6-10-rfc4-v10-13-ca7c5d1007c0@ddn.com> References: <20250120-fuse-uring-for-6-10-rfc4-v10-0-ca7c5d1007c0@ddn.com> In-Reply-To: <20250120-fuse-uring-for-6-10-rfc4-v10-0-ca7c5d1007c0@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, Luis Henriques , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1737336541; l=7047; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=A7fY8phy6fOm8qv58F87DVyXUfT/Xm20UDYB3ujETI0=; b=LBFWKBcCzltNoBD/PhFbi8XuA35PvqA8glwxcUoliAvhCDU9PzwVgTqWJZliJ3Bj3NRU+2Ok+ CIjhaSEDZZtBVY3kPX+kz14EODFocrv6TO7Q9PkbNIGOQt8obtRU7je X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF000023D2:EE_|MN2PR19MB4013:EE_ X-MS-Office365-Filtering-Correlation-Id: 6ee1c67e-97bb-43a6-1baa-08dd38f1da08 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|7416014|376014|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?q?7pW8d1uRLFHX4iKa8iQ8qRNNjqXpsvc?= =?utf-8?q?Y8YHe9KZYtXOY1n7PVsJqOwfrzrE1+O0j/7PzexuGZRNIlxZOdfaD23/PgUV7ogC6?= =?utf-8?q?WoJettJr1ozZrHtIrrig3f5gXZRVnLN9gvISgtnvjLlGD6NMomlBNldNQJ5iJBqGa?= =?utf-8?q?KCpXoPS//YhKGw61GMXJUWvEz4/iX9nuUp2Et2pWnqOdDeqJg1meY6RoUVJxbyH5X?= =?utf-8?q?h+ykFOzGb9aozGc8r0VuzADezPJ1ecDyKY4G5wW/SJ1zm9MelRFswBrZYRRM7F3BJ?= =?utf-8?q?1VPuhmiIuVcoAix4JybA8HDviZb75h9fkN+7wOX2+9CrAvGaYtoKKd2BxvQssHIE8?= =?utf-8?q?UqTi1v+LVp4p+YJNAfmRzxHnXhVCbNrauAqBjOqTp8OrWCubUPQJN4KV3L9/rdVg6?= =?utf-8?q?bODs4beMXYkl/6Ff29fshohrFAWO5z8lj7OvA9UtkVZ59tRF80U1il0Ord315Zkjd?= =?utf-8?q?4I9KI05pHMJYptCY8eZmwdkfPfAHkT6Lnpb9KIf83K4wNatWW+6AB5F3tBeIdhTPg?= =?utf-8?q?xIn0F+7RUmLN++8+leTUqOHUY8hlPnntpMFfmLW1Ndl9V0AufuqEAShibv1po+StR?= =?utf-8?q?y6omK1/bDge3XpI0ZdTve8ieW2CTb47zZFc/IVu3nN6UW9XcYRQS7Rtlh6ACluGGL?= =?utf-8?q?kIpRHd2h5teXVudF+4QUoFP2WPmmuBSzcCPndGCPFS/RSCAReQ6nMfyKVxhsqtn9K?= =?utf-8?q?/3GMppeymZgYXHtl3cYMN7kuaipIWsx7/jGmN63dqPHQgskHc9nEZOCI8eNJRtfBv?= =?utf-8?q?76iSmPIje+oygH+EKszMxP+Q7CRkVt3o3aq1ev80bHo9f6mHUdxJTcGkr3LzGihE8?= =?utf-8?q?i3UUs3kkiPS3S43H3iyrjpeyMXxmB6jogRkmU2RJfRgwWzD/CFsr7pSatkyNhMa0W?= =?utf-8?q?ShqX21e9UQASt6SwTzcJ8leOUb1lZXT7q2t9Js7srWZbDB6FdawF1RRY5XlLcYMSz?= =?utf-8?q?4cByYV8FHGgm+GfVPwXPC8kQ6wk6quY/vzUcggPjIcnQtRVej22VjWnA+pvQfrdI8?= =?utf-8?q?sLFx3SCz1uMfx4S3vxqkkdAGMil7SyEB5BuT9O4yOPrgccPBAs8Ni/YwoBIN/NUPQ?= =?utf-8?q?sSNtb47tzdJ6T00485FaEABuVS4X840QK7fag8t2xKp3+OUBrS9k48UBjMqqTfq8L?= =?utf-8?q?fPNNmWo30lh7k+XRZDzRDrcGjS7W9dDs8eb6ErH/+nxmRt8WNPXG7Y8uhEMNMtADp?= =?utf-8?q?9sbQDaWDkonoSrohLHlmTcJt7TCUaqaabnp2zOxqM384UeGzKRZqPL+lTH8uEmNyl?= =?utf-8?q?dPUEeqCerFN3/F8sh+VVBvNvzdlZ3pYz4dmSH2EF/NJRdDWztiaMKoGWntXu6CSpP?= =?utf-8?q?nkY3AVNbttZgTh6e7WGvhsAoYq7tWDPZFPVjEGXJdISQSJ8iADo0X3Vll1VTG0YL1?= =?utf-8?q?dKtMvC2HAzYjzopxyRhKX82nWZMI2O1l6JYv6YiwamDcy76vE5M6xo=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(1800799024)(7416014)(376014)(36860700013);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: +RSzZzCEturujyv04BYXSbWkLP42Jj31XK1hfp3O5HzJtqnzq70g7Cq3WNCpfdc2G3GeVUrYAF9lnZfo7GWeoRCPwDbAlrF3A7i8BnBk+zogoLTDUIr8t8dgXk7lebQn+F/PSUEBiZf9TXkFynhqmDdP7RVn+s6JxGsyJ+uF77BT3pSDKEDiWjimuJZAgku65VxSack2HdAN0NUNOmqhK7/wpjqgHckvkeXoeFlX4+NF4eJZHvwQu083gQ0rLhijEHR+RP0RyOmwhlpSLUvvxJfLgvERFHyEzHwKykhbftA1DWg24lwLUnaoC0cTVvtSbI0aKtSFy5LiRKd4CANNisUd31FMRTMoawz6+XrBoj77kd0AePsD8iaexMltp2XtUPjTZvBnA/CCoJclDhq64xqDQ6Inpy3XkMQ/hnce1hUKbvrkXIV7I/+c6lgVQgmt+ftaJRS8QrrZKgQl6Rl9NL9HVtyBZZYVf/9r/YBCVZIZntMWtJDndcWtnlQM2OENhxK5HaEbwOqnlH8eEAcXk705a84g6JlDKYmON+c+oQzL1SQTp+wOVAY8kZLw1i5ETG5jvU4BObWXte784dR9EqzlaCMux/nAbIZ++aN2E4fPso7SXduDufy63ap588XzymZeQzqjoX7I5L8pCYvNcg== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2025 01:29:15.1622 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6ee1c67e-97bb-43a6-1baa-08dd38f1da08 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: SJ1PEPF000023D2.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR19MB4013 X-BESS-ID: 1737336558-106115-13447-11016-1 X-BESS-VER: 2019.1_20250117.1903 X-BESS-Apparent-Source-IP: 104.47.56.175 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVmbmFhZAVgZQMNnSNC3N2MA82S TFzMIgMTE5LcnIxNzAzMDQyMDIyDhZqTYWAJRC865BAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.261928 [from cloudscan9-34.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 This prepares queueing and sending foreground requests through io-uring. Signed-off-by: Bernd Schubert Reviewed-by: Pavel Begunkov # io_uring --- fs/fuse/dev_uring.c | 180 ++++++++++++++++++++++++++++++++++++++++++++++++++ fs/fuse/dev_uring_i.h | 8 +++ 2 files changed, 188 insertions(+) diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index 86433be36ac4d4c5d6ab7c3da8565acdc3d1e4bb..c222d402a7e0eaf4e1898bb3115b10cff1e34165 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -24,6 +24,29 @@ bool fuse_uring_enabled(void) return enable_uring; } +struct fuse_uring_pdu { + struct fuse_ring_ent *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->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->ent; +} + static void fuse_uring_req_end(struct fuse_ring_ent *ent, int error) { struct fuse_req *req = ent->fuse_req; @@ -774,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 */ @@ -782,11 +830,23 @@ static void fuse_uring_do_register(struct fuse_ring_ent *ent, unsigned int issue_flags) { struct fuse_ring_queue *queue = ent->queue; + struct fuse_ring *ring = queue->ring; + struct fuse_conn *fc = ring->fc; + struct fuse_iqueue *fiq = &fc->iq; spin_lock(&queue->lock); ent->cmd = cmd; fuse_uring_ent_avail(ent, queue); spin_unlock(&queue->lock); + + if (!ring->ready) { + bool ready = is_ring_ready(ring, queue->qid); + + if (ready) { + WRITE_ONCE(fiq->ops, &fuse_io_uring_ops); + WRITE_ONCE(ring->ready, true); + } + } } /* @@ -970,3 +1030,123 @@ int __maybe_unused fuse_uring_cmd(struct io_uring_cmd *cmd, return -EIOCBQUEUED; } + +static void fuse_uring_send(struct fuse_ring_ent *ent, struct io_uring_cmd *cmd, + ssize_t ret, unsigned int issue_flags) +{ + struct fuse_ring_queue *queue = ent->queue; + + spin_lock(&queue->lock); + ent->state = FRRS_USERSPACE; + list_move(&ent->list, &queue->ent_in_userspace); + ent->cmd = NULL; + spin_unlock(&queue->lock); + + io_uring_cmd_done(cmd, ret, 0, issue_flags); +} + +/* + * 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_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 (!(issue_flags & IO_URING_F_TASK_DEAD)) { + err = fuse_uring_prepare_send(ent); + if (err) { + fuse_uring_next_fuse_req(ent, queue, issue_flags); + return; + } + } else { + err = -ECANCELED; + } + + fuse_uring_send(ent, cmd, err, 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 queues (%zu)\n", qid, + ring->nr_queues)) + qid = 0; + + queue = ring->queues[qid]; + WARN_ONCE(!queue, "Missing queue for qid %d\n", qid); + + return queue; +} + +static void fuse_uring_dispatch_ent(struct fuse_ring_ent *ent) +{ + struct io_uring_cmd *cmd = ent->cmd; + + uring_cmd_set_ring_ent(cmd, ent); + io_uring_cmd_complete_in_task(cmd, fuse_uring_send_in_task); +} + +/* 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) + fuse_uring_dispatch_ent(ent); + + 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 a4316e118cbd80f18f40959f4a368d2a7f052505..0517a6eafc9173475d34445c42a88606ceda2e0f 100644 --- a/fs/fuse/dev_uring_i.h +++ b/fs/fuse/dev_uring_i.h @@ -117,6 +117,8 @@ struct fuse_ring { unsigned long teardown_time; atomic_t queue_refs; + + bool ready; }; bool fuse_uring_enabled(void); @@ -124,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) { @@ -147,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 Mon Jan 20 01:29: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: 13944643 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 CE1681CD2C; Mon, 20 Jan 2025 01:29:23 +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=1737336573; cv=fail; b=YDeYP478Exh/PXQRlCgX2hlGBt7f99n4SnYMYo6BJsXzbYLTdhy0KbJDJAFEksgU2jeUPwfJhVXnwaBnmpkMrxlm0rNGteAP3wII/uuuw5h3OtNd6QFxzzjZgOPFi+ZmIPOZUuLaiiasq7jWoRoMdG+Ynu5rmCKE38lLDvt3F2Q= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737336573; c=relaxed/simple; bh=Zo2EkSOv1NPauKXDRdImC3x8ypCIpeDQNYOqOik5DNY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oJ0dxGwrWjRF/Wt+ukykjF1xB/N89dn3h0wBphxoFa9AJkfdYlQdEE1dn+DzH6s3kYIXK7D2+VDxcVhcVr0lkroENTlf1HwgbGekngBQNrdJCpOsJJSBlIz3ElBCPB5qK5trfvecFM2GSpw/kr1jmfxXX4Mw7FIIb0jd/OgyrlY= 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=YrVjDkND; 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="YrVjDkND" Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2045.outbound.protection.outlook.com [104.47.51.45]) by mx-outbound-ea22-15.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 20 Jan 2025 01:29:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=jCGv1GbOcXAao9ZFqR4j7+9T1NpH7KeOO/coRBWpR85515NVM6BAzT65H6ZlIcSuRmysTsXZov6M8+00kYUkrWzyZ9wjEOakoaa+nTMPyZuq1gjow1vYhKoZysZ9U1RmxWW6ri7FYrEbXH4YyyW3shwg2binsjI961OJZIN51OxCpNSd04MI6PAmjuDIJV6tKGLYta9c8sMJhZav0bEv/HDXfdjeYPfmssSK3w5be7wzf1xUxXdecSp0sbY/FxEQuwA+oIb2pj3dJZv0wAHuO7QI7wm+EdR1042KlYwj8TkM+YnTLVA4sXN4yysEiIlfjsUVxXtQbYYRPYqTs7ei+w== 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=cCJnM09yTlejVTQpR4aEFFfgq5YghJtpIlDKjqpcaDo=; b=i/M2B0u9mK7129j2U1TUYLoKbJC5O+Awx0Gpr8WyxTccKnr1xA6TCT8pdZYOPHXb1zMQTqbFTdyzwfZgn+LjhHCRwqgtgRc+3r6pFWSrFCzzbGLcOAsp+RwsnCVJzGWR8Dm+cU7C4sc6cfKRdFiPk4dQ4A/1EuxqVhfKmJUPcNfim4vXsaFM9Cg/0PwKhsuIy7qmkj34ZFZDrw70b4V1Oh0k4tsZS/R8OJEXbcrSkf/1iqLfRuqZfHNeDiL9rWkrUWgwzg2zrZqPokUnw8mumGxxrPMTBouI5swKLziAfxooXJDGOpdwnp8lEBLPr1UrJg/zOuVn3TmwEeUoXQUiUA== 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=cCJnM09yTlejVTQpR4aEFFfgq5YghJtpIlDKjqpcaDo=; b=YrVjDkNDAbUQ98b1RGm5FbtmKBOKs1zhsJe3qmPHk18JT16GmlYMgLc6iGij+cmAnvY2U+qflQ2mtRl9OFvJ2uwa3TV+3N2QCRDNziiOW80dPxFjfQt5H7z9VSU4kKUX2t6VaM3H7Cy8K0vs/sbiPbohekQsMtRSxWAiobOJAXk= Received: from BL1P222CA0005.NAMP222.PROD.OUTLOOK.COM (2603:10b6:208:2c7::10) by BL3PR19MB5258.namprd19.prod.outlook.com (2603:10b6:208:339::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.21; Mon, 20 Jan 2025 01:29:16 +0000 Received: from BL6PEPF0001AB78.namprd02.prod.outlook.com (2603:10b6:208:2c7:cafe::70) by BL1P222CA0005.outlook.office365.com (2603:10b6:208:2c7::10) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8356.21 via Frontend Transport; Mon, 20 Jan 2025 01:29: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 BL6PEPF0001AB78.mail.protection.outlook.com (10.167.242.171) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8356.11 via Frontend Transport; Mon, 20 Jan 2025 01:29:16 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 83CD24D; Mon, 20 Jan 2025 01:29:15 +0000 (UTC) From: Bernd Schubert Date: Mon, 20 Jan 2025 02:29:07 +0100 Subject: [PATCH v10 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: <20250120-fuse-uring-for-6-10-rfc4-v10-14-ca7c5d1007c0@ddn.com> References: <20250120-fuse-uring-for-6-10-rfc4-v10-0-ca7c5d1007c0@ddn.com> In-Reply-To: <20250120-fuse-uring-for-6-10-rfc4-v10-0-ca7c5d1007c0@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, Luis Henriques , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1737336541; l=7347; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=Zo2EkSOv1NPauKXDRdImC3x8ypCIpeDQNYOqOik5DNY=; b=rz1GXOUfbcB1h0vQlvWKGN12LAN2NWfNUDCipofhEmP+y1WR6ufYtHQHvE+ycwnJ4VeYryejl PHk9ybqcrwND+Sy4trp8dk7NK/f41PBfdGIFwcR/0T8JsMXo4MpPE5L X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB78:EE_|BL3PR19MB5258:EE_ X-MS-Office365-Filtering-Correlation-Id: a89654fc-75d8-40dc-c682-08dd38f1dacc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|376014|82310400026|7416014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?/ACk4fivJZjx9h3r3aIke1W8Nq2AHsW?= =?utf-8?q?UJdyMwOvLtT+UpkpAfa7XqxM7s32+MC8pw/zECbXWjXjpPXLil5fmcQtnx8nFQMR9?= =?utf-8?q?Vv+zFmrBelbdp0Z4t/HIc5ddPYuZhsXcNWotymOzK/1WoGcvSVqh32R6khZlHtOWQ?= =?utf-8?q?i9fvgHdSVNEsNZLnl0ia8w1dj6tfwEy7+tP1u6D731ozoog0X4VeNuqgDUBj6psZE?= =?utf-8?q?vSWfm/k89gr5GOtDPQFURkJlNoW5TmhA73LxffvPDisN9c/1ejzcEVnBBmqaN6AYS?= =?utf-8?q?Q/CGHCKLOHBfTnPRFYS6UjGetN4tk9en15AA9LglexD4o8NzBRgYiqPPnXqbAIA22?= =?utf-8?q?h++GoUAnYLIb1XH65WXicCIz1HelKyX+6RAtqpirLE6B3K8whLr68a8HDgM0uCZN3?= =?utf-8?q?RaTXuUSK5kGf/7z+hBQ5egdxuO66rLylQHSMWVLn9Ez/aNWZc57t6V//PwRqleU9v?= =?utf-8?q?hhqPpx6owISgjj8BEBoomtb80NEFy75NrvduqKmGjQrE9p3YZEkbRgN/eST+opTqQ?= =?utf-8?q?6QDTJjJFU7mFaZKzc6oRwbE/pxaz6rFO07rxrrEZFJj/GP8qwCJjD8e+yXrD9/eyH?= =?utf-8?q?BYlvomoD/0gXyODeWc8anJHtsEpdBIGfsfaoqcyokberkyZsHJ9fPNsgCOApXSjI2?= =?utf-8?q?UbkfVkug7vl1V3DbTwcKm7SH7uXnwMCdBWSRoW0ylALeNp+G6NM83V7Xjyd7x1OX5?= =?utf-8?q?mFJtE4nLE1mSg1/wegtsHkyBTKeaxMcV9DlcGFMthSIp79ClRfTFj3dV2ra3SOnn/?= =?utf-8?q?bzxd+s8MZOdq1XdUKWRY7iBjVu/Pnd5WA47N3PoqzHFOh5164umilAUMOxT9cOx4O?= =?utf-8?q?isJIgRurmjv2ZxmyemFenNnRb4l2z45ZT9B2kW9kj9sH3fAs5TvNFkEd31B1wR+Vg?= =?utf-8?q?iUJPdeusPVmuLPlF20sJcXfv7PWfc1RCas/Xcg/MqWWabZ4CflbT+V4Or9KSRSKAq?= =?utf-8?q?/+cXF1XPZBag0vx5+aRAfZMIyGIGC/MKX8OFrJowHd9q6YyvzLS0Lb9f1FpgvvcTZ?= =?utf-8?q?BMgzmE9J48xhV34p8S6hebNPYCI1D13G7c3eIf7SL/sC7mJh+pQOmmP/Fk6/56aPZ?= =?utf-8?q?x5FnOSx/hfv3yDfva3fMmCg0kjcWo0xmzC79b24M1gwVnyAFkceNzL1r9+g/kSZ82?= =?utf-8?q?jQFXT291RTkSuogK5v5kfnstGm8V0qLZGQDwlsUNXcXCXc/5dgsz6HQYM9mHNZkzq?= =?utf-8?q?pir2w4FeGvis2IOHrgU1Z4g8F2/coPYUsyoiTJ/ZpmeYadG+zAAPoBcSLxT8ImHQ5?= =?utf-8?q?kD56M5omRVRyRauEdKNCTh6GosIqLruBIn3mBPfTCRsD7DDxOOFKRdwMj6S1JUYln?= =?utf-8?q?5LNX85IyWcTL5PbEPa4MrIXB/1yT7lJfAxsMonJojeS/jXYbcTW05S2DkwjQP6DL+?= =?utf-8?q?ZM0GfH6Os1ijIGhTExX7SybLw8dTxH7DC/wHThks5GueTMGkXfWK/g=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(36860700013)(376014)(82310400026)(7416014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: f0aXlSPC/9ZtW9gOt6BJ25NaSsJ31s4hYq2aH8ZvRTmBnTB1LQvdv+G2QfDiKTLiRbjISKALPv1NLdDfbJXfMTnS3+8/KN7h9ZtZEz87F/q0ZbJUXozZ2yMa0L26XRLtFW/0lpU3FWrrS9bMwzxNrt7L5uLjz9hQH9yeyqZXsGzCK5F93MadDP15Gy8M501yZFcM5b7ZS/qRg9Ip2t3Y0Z82XvE7o2Ryp5fzkbRlgA1cd/q2h5AIbaK6K6NVlWj2GuXxWliWqmvEDD8p6A2JfvfjmWv5ZuL9cLa028ozkh3fhcsHeYyZ2uNUPfI3bh9u3NFlB1pG/cLvQrjUigrVMdNRqtoG67T1LcBfoTTq3+1VCibnCZMlUXeT+ggAL47+j//B2PJrSXfujFbMMhHzLJmfHBMIhUWtye+fFrnMG3dSccHKmde+74zy25a5qeWaf6krGfRiRMju6jgrBe9okeEia8b+K6+dLG1/RA4pCHFRmdV+FOWCrG9Xh9UZXt+bN/apFjlrbC1nfgfSThMuwZQmriFRIRIwo7xU/9yXiQ2u7VxqeS4ZMfSNfF9I51G4YfPCVQSdGnGNj7z4Sm00iCidjTdxzBJvdMgbuFTUWflmnVu/1PvvEsWJu+3Jgrbfpi7kJ9a7WNu99h/RzDQ6Vw== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2025 01:29:16.4199 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a89654fc-75d8-40dc-c682-08dd38f1dacc 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: BL6PEPF0001AB78.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR19MB5258 X-BESS-ID: 1737336558-105647-17571-264330-1 X-BESS-VER: 2019.3_20250117.1903 X-BESS-Apparent-Source-IP: 104.47.51.45 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVuaGhoZAVgZQ0NzI0jg5JcXSMD XV1MwiNdXY3NDUODkx2Sg5xczM0jJVqTYWAAlDtC9BAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.261928 [from cloudscan10-85.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 Reviewed-by: Pavel Begunkov # io_uring --- fs/fuse/dev.c | 26 +++++++++++++- fs/fuse/dev_uring.c | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++ fs/fuse/dev_uring_i.h | 12 +++++++ 3 files changed, 135 insertions(+), 1 deletion(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index ecf2f805f456222fda02598397beba41fc356460..1b593b23f7b8c319ec38c7e726dabf516965500e 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,12 @@ static bool fuse_request_queue_background(struct fuse_req *req) atomic_inc(&fc->num_waiting); } __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)) { fc->num_background++; diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index c222d402a7e0eaf4e1898bb3115b10cff1e34165..859e53893eeb5544d57dd961da0e99e7b3d5d9a9 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -47,9 +47,51 @@ static struct fuse_ring_ent *uring_cmd_to_ring_ent(struct io_uring_cmd *cmd) return pdu->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 *ent, int error) { + struct fuse_ring_queue *queue = ent->queue; struct fuse_req *req = 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 (error) req->out.h.error = error; @@ -79,6 +121,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]); @@ -86,6 +129,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); } } @@ -191,6 +241,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); @@ -1139,6 +1190,53 @@ 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) { + fuse_uring_add_req_to_ring_ent(ent, req); + spin_unlock(&queue->lock); + + fuse_uring_dispatch_ent(ent); + } else { + 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 0517a6eafc9173475d34445c42a88606ceda2e0f..0182be61778b26a94bda2607289a7b668df6362f 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 Mon Jan 20 01:29: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: 13944650 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 BDC5E29408; Mon, 20 Jan 2025 01:29:27 +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=1737336580; cv=fail; b=fzs8ma0pF+5E0B4xqOMUyfEfYVUG31bhWJZJL4iJPWrYivylXQEFeRlSdHsgDCs3QhSYrPm+MJVFrYOh2bhX3dKF+0OM2tgJGddtLPh0mgMvISLSSSLoiM+R38VKMz839hdf25kyu5poceG96OhN1eFmX6fTX9tzYW0lO87DpeI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737336580; c=relaxed/simple; bh=kvxZ2XTh1mcC5XvtjF/RhKXqggBAhZ3d9JSPoUzZN20=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hfteQ17gldo238TTsI99+Z1NAJv7ZBBwYdznVsLOqp30MUPN1nF39Cj1V8M1Y7ULsaMhCwCKOXANpxUJfkf7w+AcJR7yShVhcP4fw2RlkL3Iq2DxZ+RqB8XzlJvkDOBXKMiRaAfVJyMG1GS0oprCbZaiZ97+K3kjmdQBwUoLzgc= 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=rDVe6lPB; 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="rDVe6lPB" Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2040.outbound.protection.outlook.com [104.47.58.40]) by mx-outbound8-131.us-east-2a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 20 Jan 2025 01:29:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kfpH0zIxJQPZgS0lgtMGymV7Fuh3+AUonE1LNX88SFvTzARuFGUs75N3Ja4Iscn9EQwWAGGyjnxO7+4VTi4pECs4sXNEOK5sooE1xjUuJWrEv/hxpojO7u+hfLsmHKUREzmYs2+PV50GWxKNvyaGmFO4Ibqei8hGfRPAmea8SDdJCWw5HAiYUjX6WfrialhZGaCZDYq0SoR+fwLcwmLLvARAAgNuOKMtAWeO3LTLNME1adLCiTM59duj/SsyOCQvQXT8qdaPYadbhZhaoItFzpAtXj5nsjBLm7ErLZgHc3c0fRfm0OXvwegg3YLQ1kD0+td6MWUlcBzH6bCHxYsIJw== 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=aDI3GQZ2NuVrZvSSq/m9Dnu0ngsqHn3awlPtUrzI6dY=; b=c8Gds4L++m6MTbd8VnBc2w16WBjNUiRyx5U3xDmMjXSJ+tu26RJ/ODj12vTnOF/gnL6eLDlg6srEqZSvWIsinFguZ2oa75Hej7FIYwD2XQ0nM+RomNeJ8TjR9huyeN16utXDmFCgWKtnrDllhaT/LYWQxVhUrMY9MtQ6jPWbFNi14EqoPK+R/Vmu0fSZeNdcc8J1ZWKRioRekv0QSVEJIJQem7KG1EISD8FkxV/qWwq1aoScVojnMirajM/vg9NcdD4fYwso1JWn4GBABqI2wxTGZ3zUxQpyh6WaNdVb07SjnLF7rNUBKYcSoCrN84KxTJD6cjK5LdiTFk02rwc/Mw== 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=aDI3GQZ2NuVrZvSSq/m9Dnu0ngsqHn3awlPtUrzI6dY=; b=rDVe6lPBACMGQXbxfqwHMFO9a5vZ66dEZoS+SbrVwwb8gwbClBVIkGJLSH9IycUvYRiTBZeo0qgz7uSysKul47l2sUNpxrHsVjT6rGEcKqNCesTdOs4lSJvZVNhfhGtrgo33wcY8FpQ9fBJs9YNitswIC3ud6EEHNAm8RtccEJ8= Received: from MN2PR18CA0003.namprd18.prod.outlook.com (2603:10b6:208:23c::8) by PH8PR19MB6811.namprd19.prod.outlook.com (2603:10b6:510:1be::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.21; Mon, 20 Jan 2025 01:29:18 +0000 Received: from BL6PEPF0001AB75.namprd02.prod.outlook.com (2603:10b6:208:23c:cafe::c9) by MN2PR18CA0003.outlook.office365.com (2603:10b6:208:23c::8) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8356.21 via Frontend Transport; Mon, 20 Jan 2025 01:29:17 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by BL6PEPF0001AB75.mail.protection.outlook.com (10.167.242.168) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8377.8 via Frontend Transport; Mon, 20 Jan 2025 01:29:17 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 827B54E; Mon, 20 Jan 2025 01:29:16 +0000 (UTC) From: Bernd Schubert Date: Mon, 20 Jan 2025 02:29:08 +0100 Subject: [PATCH v10 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: <20250120-fuse-uring-for-6-10-rfc4-v10-15-ca7c5d1007c0@ddn.com> References: <20250120-fuse-uring-for-6-10-rfc4-v10-0-ca7c5d1007c0@ddn.com> In-Reply-To: <20250120-fuse-uring-for-6-10-rfc4-v10-0-ca7c5d1007c0@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, Luis Henriques , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1737336541; l=6263; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=kvxZ2XTh1mcC5XvtjF/RhKXqggBAhZ3d9JSPoUzZN20=; b=wdFEcwQZyh1xyuXEqktX+nD1NncJnNIiNQGbyxdkfa94bVtfnLs1g89/4C1DcW4BNQYfgbU92 36ksfxxvheKA/5f5f0jdyAGkFHyUBl8wVtEhDsk5+mUM4P9MtZ0fmvf X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB75:EE_|PH8PR19MB6811:EE_ X-MS-Office365-Filtering-Correlation-Id: 03d300f7-062f-4ef6-539d-08dd38f1db6b 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?BKXu2kbnyRg81n0fkcmdZOQufG9cODf?= =?utf-8?q?gCYDfAvErbLU5vi4kj7CmsUHsyro+PHnjXPKE8gQO8TQ26DMIQc8Cai/SbgrYimcO?= =?utf-8?q?A2mtTu0xfrtjJkHpouw1tX2K/99vHLfcj9ypG+UV22x6Q+zwNlowCmY7seEKBoc4D?= =?utf-8?q?Mhh6QenDNQZdOk5S0VPttFklmMeAlnTAZVK2cSCbtiujQqSRJZAXTvXGq/zDGxb7g?= =?utf-8?q?KjiepSm3DPDCTT5tpWE5aPlt57UnGTNjyGm+zYkx5gmPUccqV5KZyu2vJzchpifDK?= =?utf-8?q?hbF7enFYZX1/5Q2s6Q8hpvBaUopaFjsdL7TgH72av7Knm9NlGdYthCmMSX6nTtXHA?= =?utf-8?q?/CKTQTzUmr6K3ngZ8PPrFB4Xb6KCsf2yK6zNTQ37klPLW+BCQflVJb2cWCMS6mRim?= =?utf-8?q?FtpyY6UNNDpAL4YNLavqifmyKYe8onQV3N+9spOIMwZNNDIrnNUCR71UdIJGymzOi?= =?utf-8?q?4xfG6E4cMeu2IH4lue5E+CXOQsaGZ6h0z0Ez5bQwYLUP6sWrgUJkiZ6NeWcidUQus?= =?utf-8?q?2mSv7Ps8ylkhH3v1mNjWfuDZnw4BoFbkbT1F4CdZggdNlTVD6IfcjiyWEKnXskdRz?= =?utf-8?q?9fCsemRWjLRMFq8qvjvI3pnCzAmx/hT8+gA4+z592euhEaDn0VuLT/BqM8t77IFcs?= =?utf-8?q?EgFfH+FY1JwppBNXD1piCECXhmnJLnvHuteylu3+5hZkcP0vsvqy80kKvdZz7hwhg?= =?utf-8?q?V2DhVyUI16J3uCEwm2nZHGuG4N1E5qJBscr6c3YbEv4Dp2DgIFJB5PMafOwyhg7sF?= =?utf-8?q?xgtcn63eAHyZyTG6F4JlixfK/NM57Qi0l1Ryum99p4jACQZjoSLKjU3up4mtCT9tb?= =?utf-8?q?uIhhUz3GNYBBIppofKdEPqkkh4l7mkHyNnTWDn9jkt2gSdXwkplhzhaGP5mZtxtCI?= =?utf-8?q?po9wKYtmPSydY+2/pDO1ngJIgKANHX2jhdFXbb9FkH92CvKKD4/tQQP4Q8Wl9PLrS?= =?utf-8?q?g6dwWnmC/3RdGvF01y1Vr6o9YGTxZimllj/45VtyG9J9XyLPj6c95BlWpe7rN30VN?= =?utf-8?q?2M4Me3NX0/jNuwOIDn3n/GDCYWjTPK4o8PudjIyWwyXd5dzyr7jOCXikM/GT3+wog?= =?utf-8?q?pqDb15YKeeKuWgW7XDSxnVBYfUGu2K01RG95n6R7e/3dUgHZlaV9VtOKnR8veDFOW?= =?utf-8?q?aeo9SsVe3ddNv5L2EyWiBijsNwpZrqLN1sHE8UqmVdCWsX+wOf4alzgCr56sqYFGL?= =?utf-8?q?RvRGfr5i0NDh40zpreVdGFOWA9grUKerKfxlqxlHruINv7kLskdtasy81QdTfEbwQ?= =?utf-8?q?224ip2Krg+UevVySP8AybbodjO8+uQXdydrHmGlOYTxwt7GmR2cJeX3YD0z0bMO8C?= =?utf-8?q?o3LKZ9KRc2FSf00VhSyqfqAFzutR7Wr2UK6f/xhDjJPvAizBQXC/WjGUp6PPu3P6Y?= =?utf-8?q?DkGC2KQtin+sV7aMgfIivtFdRmgX+K4GXRRfYd4YXxqLzPyy3YUXR8=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: VgS2nQSzBc9jYVRDiehtQy9LRZQXNgwc3YWX8QJ04mjQsNSiR4yYs8VGNrG4FiKFTPVpEJrhQsQS6hi5OiTO5fcUZH/opOg5bIMsRyVoosDPygB//2eLXH1KqFITHFCvgXGqiANc1tEU4Oq9sVLLLyQCt2Uvep7vSjaEjiZpLukDLiLRCgufpYLKuz1uK9MiMas3auOP1cjwClchWfh6WNllPjYjDAMpAldj49rZ8T3V1rzoJuzEoqNLqVb88rAqjTwFw2ul0M0meS2Ns2ujBjHk12UKANzurcg/VOTPKP9+2uwzNTgNrB7mBpc/I/iObgL6xIKEq2N161C0/zdFMz22yZ2ZzuEr15PrOmfjnOs/J45efQutVOJz/L6H4pM/53SWhqOkFfmKamQ1T1Qvs/7fUZWTpyPcnZS7Zy+tC32D0NSDAH1Hjzv/BYruCsgWUoLcslO/HtCWgsdJtzZXFk4IS+h985DyuMUP5zve1w45X8PWuMHrcX6NHJT4u2/C7TyaKSvTyp7LCfyKTN0yknWBUFP8OzXWxM8fBUQKQ+vzCO6uSD1BWhHfrCZraFWyNAxVNc6QnrzyYDWl+kngzP+zYzsXjR5xwIjkscnZ9H6VpB0S/XStyhsGMhhRZUea1Rx+Gi7GDvbHJhBQZxazIQ== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2025 01:29:17.4121 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 03d300f7-062f-4ef6-539d-08dd38f1db6b 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: BL6PEPF0001AB75.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR19MB6811 X-BESS-ID: 1737336561-102179-13333-11612-1 X-BESS-VER: 2019.1_20250117.1903 X-BESS-Apparent-Source-IP: 104.47.58.40 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVmYG5sZAVgZQ0DTJIMnEMDnJwi LJONk01TDJ1MjMwNgsJdHULDkpychIqTYWABgG18RBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.261928 [from cloudscan15-221.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 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 Reviewed-by: Pavel Begunkov # io_uring --- fs/fuse/dev_uring.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++-- fs/fuse/dev_uring_i.h | 9 +++++++ 2 files changed, 77 insertions(+), 2 deletions(-) diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index 859e53893eeb5544d57dd961da0e99e7b3d5d9a9..fcce03174ee18153d597e9cd1a2659b1c237e3eb 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -150,6 +150,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; @@ -159,6 +160,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; @@ -242,6 +249,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); @@ -280,6 +288,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; @@ -288,8 +297,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, @@ -309,6 +326,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); @@ -423,6 +441,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(cmd, issue_flags, ent); fuse_uring_commit(ent, issue_flags); /* @@ -885,6 +944,8 @@ static void fuse_uring_do_register(struct fuse_ring_ent *ent, struct fuse_conn *fc = ring->fc; struct fuse_iqueue *fiq = &fc->iq; + fuse_uring_prepare_cancel(cmd, issue_flags, ent); + spin_lock(&queue->lock); ent->cmd = cmd; fuse_uring_ent_avail(ent, queue); @@ -1035,6 +1096,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; diff --git a/fs/fuse/dev_uring_i.h b/fs/fuse/dev_uring_i.h index 0182be61778b26a94bda2607289a7b668df6362f..2102b3d0c1aed1105e9c1200c91e1cb497b9a597 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 Mon Jan 20 01:29: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: 13944649 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 E163D28E3F; Mon, 20 Jan 2025 01:29:26 +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=1737336579; cv=fail; b=HazHjUvhguzOiBiB1QZkwEI9GPyPuez9q5dTw3nz+dpMjwjz81eUG2X9AgJWlB3qH2q0lF0zwAyawrTP3lFmnkw6i94sYVO7ClA4Soq61WqwiIofD0PH2yKgjbgA4qhfYvT7C6ke+9jth6TWVFAzFqJvlcZ3apWZdzCkvmYmiHY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737336579; c=relaxed/simple; bh=PtkHbQtgTwdO+BfyISwQHmB+lYymfSW2vYL89BCuf6Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fag6wh229TPgMxbXoeRqB/0zzI5o/b92S7YP5BjSqJdvj1U9WKhVxiRsQawlyyRzUEpksMHNc5COrGB4e/vXnzcU06XfGSGLjOrhMqFypv0CV7bToBckGGuBRFbL7oC94V7L1qariGb8BM6moTCtLijAMHumuUlRQGHHVDzcvkU= 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=BRF5cQRg; 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="BRF5cQRg" Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2043.outbound.protection.outlook.com [104.47.56.43]) by mx-outbound8-131.us-east-2a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 20 Jan 2025 01:29:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lwuD8udJ1bp5GfV0rmrSJTOpAT4dI2TYDIaEwqaFsoUKSkNulIOdQHMoYlqCYZFvDX46P8+HdFlW95jU3GKEfT4higZ5ZcSw7MXoaRr2RLS3lUFl7rdzQ2gXTkNUu4FnWdGtOjEbdqrOCKTFmpPpnUj6/k7NSobkHLFqNA2nVy8sd96Gfhs80ata3p9QnvXPzfniTRiR2kebnvQfeQD0999EOdk4UKoPgU1Powyh3jxVQQLmLTRLWHYZ7/9SdghOLb374joGaRjcoZoBILTW4YS6Tw8QTSGlcqx64ptDB6Aja6k+cLzo78H6b2O8pWrPmywYck5en1MSuvb0o1Vvig== 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=G804zKEHS0lOfYhRhWhJaw9vJglZVJlLF+b8lscdVQY=; b=OowtGWpRtEqLi8o7+AKMIPPWiwcw/h97qCcxGd1UUKBo+4cC68XtTMLopkpk2OS4DIPNb+Xt3iXZ2Oo3/q9GohJv0N1uei4dX9DFiiYYroGnGKohRuPqz7pxLQ7gF9Vn6jsTP0F1UHy+fw/EiuRncC9GLjukD243yUVJ+AISs/gjJeh/PGNQn+v9dXL2C9TIAErRiKE0peH3L2OIP9tjx/IKvkG7UAvMkKL3VNFWnjEzV5k5/urhVCZjEmqyIIoY80/IRzDQao+AO4ePGqkmDHbCFkLyeiY/szrbo9ShT6wcb7Rx6ZIdctCPZlB2bb6DOhJDXIIRXar1hLPnRw/6FQ== 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=G804zKEHS0lOfYhRhWhJaw9vJglZVJlLF+b8lscdVQY=; b=BRF5cQRgHbjroUYex+1/tcfFqvG/1ADPpt7oSRmHlnnQFNfvU945f7lCtoxXCDCFWnQU4hNdz/bZoq5msFDVZDJYAmn28vY2GNhjaQrwogU/hIsOQIt8m8t0uiBqPKLWC3ayj7CkkoeqOJp7rx+dxIr4HgsyE1CEU2SKwv/Ee8A= Received: from SJ0PR03CA0218.namprd03.prod.outlook.com (2603:10b6:a03:39f::13) by SN7PR19MB4749.namprd19.prod.outlook.com (2603:10b6:806:106::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.21; Mon, 20 Jan 2025 01:29:19 +0000 Received: from CO1PEPF000066ED.namprd05.prod.outlook.com (2603:10b6:a03:39f:cafe::b4) by SJ0PR03CA0218.outlook.office365.com (2603:10b6:a03:39f::13) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8356.21 via Frontend Transport; Mon, 20 Jan 2025 01:29: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 CO1PEPF000066ED.mail.protection.outlook.com (10.167.249.10) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8377.8 via Frontend Transport; Mon, 20 Jan 2025 01:29:18 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 7B2C634; Mon, 20 Jan 2025 01:29:17 +0000 (UTC) From: Bernd Schubert Date: Mon, 20 Jan 2025 02:29:09 +0100 Subject: [PATCH v10 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: <20250120-fuse-uring-for-6-10-rfc4-v10-16-ca7c5d1007c0@ddn.com> References: <20250120-fuse-uring-for-6-10-rfc4-v10-0-ca7c5d1007c0@ddn.com> In-Reply-To: <20250120-fuse-uring-for-6-10-rfc4-v10-0-ca7c5d1007c0@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, Luis Henriques , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1737336541; l=2934; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=gfucKS4wCiZXcsbZYV4HxvxB7feQM2tuYjq92kan4BU=; b=A9ILRCoq5jQ8uDeb5rLZPV30U9Xe8njTfUKtHXfjJyjawpn031b+BwdHuop5dZNe9BJuIh3l6 TxCmOnTAAtOAhDwtFddzSURBwVk+iIzicWlJE1BIHIeXHaKGf8Iw8a8 X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000066ED:EE_|SN7PR19MB4749:EE_ X-MS-Office365-Filtering-Correlation-Id: 66ee525f-1cbd-40a8-e9f5-08dd38f1dbca X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|376014|36860700013|82310400026|7053199007; X-Microsoft-Antispam-Message-Info: =?utf-8?q?Y5LONAJ3pCTZm7MOLuRB0eLoE/XnabN?= =?utf-8?q?nzdX9lLYb8e5eq0p6RCRsmuCRcVpuP7TdVPI8K2SuS0x1aqlSmpLwAuZQVV/TMdiU?= =?utf-8?q?XxD7daGW+GCkglelhiGD+gEJh/fXZbBCLMcHUwMjdrthuSAdTHh7hQ44LQpxx+Tc+?= =?utf-8?q?ah+flOsSRE1cL0YSD5uppps3hPSdUnv0si4HbnUdgLQdoElxBemZg5oct8E0mhx4v?= =?utf-8?q?kSYJDlmNpHke5GyJ5VBiRpf1M1KrgXxOKxTRfXfa6DnvE8BkE77PhI3gmk3XTld/4?= =?utf-8?q?Qklgo0XzvXJTaUnDtRFW63ZncgX1plY6V/AGvULDStlaAdkqKrlirtLIpJnaFT91h?= =?utf-8?q?TWzT/L3zI4CpFPiHK4iIIPzXI3voOz5druMqOUiynbvzs9Ax98qii8EHy/ztK65yE?= =?utf-8?q?sUi40q5y+viOepXcANHjasGP68cfCluDBpu6n5giKLnMvy0c6kvR0KYtujmeGkk/4?= =?utf-8?q?uxwqqHsVvfO1Vv8KzNyD/rTRqDo6OU5M/sOMbSV3Sl38IDP2gj8wr1vovXsiOvWHB?= =?utf-8?q?ZZuPMx6qdyoE1GFrJ+S1CXv9mLnK7dMOytbWly4gicKPCx05wl1gFEaJzhwymXzBH?= =?utf-8?q?aK1rlPrEbXkdhWFECZumVwdfdt0jCW//G0ww/rIcu8GJN/vN1dmnolZOswxm17y+L?= =?utf-8?q?cO+eB/By44L7Y+gpeSXd2KeldphUoosrwwE9u4u1Ab3TV7PzRX7KAPeor+ozglGyw?= =?utf-8?q?abSWq1BfMBg56CXUspZ0PZW6buSwaALDWO7793OlP4ZMQ6l147BB889ohDEVWHi99?= =?utf-8?q?di4KT6mfA7KRh9rn60KH3GPctSAlJXC7Y39+WVKoHLMO1DVPf//Eb3+JispBgTmuL?= =?utf-8?q?30tfq4hFFLcDnuTho8jL60kICcaft8ehaUFhRXxf3KAWqw9MbwFXCGinpkT4T1bRy?= =?utf-8?q?zUmSQtEjufI8Stch8QJ7P6Qy7Ol7QCqeehtWJhilRlSwQaTnmsWRcFeaWdvxB6dXt?= =?utf-8?q?yZ/u2OXEbrIC5uUgPJ6sM2GcoFJ9LgqGnemeVzr/+L9d1FEfJ5hJpBY14ZOSIPTC9?= =?utf-8?q?m+1STimAwFUZznhZTBMj97DhT2dfckDUNqbirMziSp8ySbErjyLs+eUhWlhY5jgjo?= =?utf-8?q?NEaVkHt3T920r4KEyqGL8qqng9rd+CHTtACRih4agmnmQq32XqQTZL9kQIdGD+qDf?= =?utf-8?q?z69sZOHftXp3tBlEizuAikBBC4tVij54fJXs27D4+Zju4/zV09uDXbpyEx8aHgrWD?= =?utf-8?q?a+D2ti6PQSiDnQGlpG9whclws+DVMY1PCTqssYISnapmx13lfaNboVavnKtxKh1A9?= =?utf-8?q?sRQDGtZ4yU7lWLUzgryd7ogk34NlNlH2iBRukR/cewhw5U1iL8EH5VBLCcaUqCk9P?= =?utf-8?q?b5Um01+ai4dhpkuV/ei7drbrxoVYXTjG8LC533uPklj9DvC7Ip8p1yBBGoY/XgLUF?= =?utf-8?q?Hcx4ovWmCNeFw0LMt7obreVlhjECuMpuOE23sC6OXG1fdsAQlHFCBo=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)(7053199007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Mcc0/rEaAhGu/HiFvTZKhQUaW1gCwIdqlN4rd2GFHJQeasNr6LpfkHaNIZQ8g2cHBpZjPBhRNG3yv20kLaP5PiQUQyTGt0XdaxMse3CnqWPI/1DpG/ZmkWBSqEFG57PVpZRaY/e5mbQAW2OaY1r2Fe+tF1/Tx0zYoS4PKdIGqEOv7/WbFYxZMXZcAT2BgksRiteOtlpdDY+zG0qkv7RjxEmKfQ6PW8KI9lMWCPLcmt4/3v9HMENz1IssJ/XhgKQ0vTaesplTIrPyUYMluHBpOhCBqB0/dDAQVLYWGXVQmV02PjAUyCq2TZsE9mErgsAkZZNUYVfK+1r9sp6lMWhtFIXa8iZ3LjWWJ2PS7dDDCSxQ4o8qRsntGeH4JKeWHtzWL3Hi4PxHUKnn2M0qSEyIpEgwJk3HTsfg+4kSqqr59jk7/4pvJsT7HVQ3ZCIL8vFtPXbNz1J26XdUdGGv80uTm+C6Q5/64Lc8/bmYkiQ4uTCOaOnrysOR/PgPr/RvkKZNJ8k3LuLlt/+A24/gcOEhWLC1fsKD36CyQJD2Mzn1Joeb1Stbh0Cgr3dOC7/kRw872FcvHxfqBNoHHFj/rnu3MLf+2r17wor3ZU1CgrZkOjwDf3Jf+y6q5duWQ9syZUWrRl4b5D0JZKfgz3rFThreiA== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2025 01:29:18.1323 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 66ee525f-1cbd-40a8-e9f5-08dd38f1dbca 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: CO1PEPF000066ED.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR19MB4749 X-BESS-ID: 1737336561-102179-13331-11611-1 X-BESS-VER: 2019.1_20250117.1903 X-BESS-Apparent-Source-IP: 104.47.56.43 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVkYWlgZAVgZQ0NgyyTgxxczUID Up1dDC0izZKNHC0tw4xSTJxMI0xdhYqTYWAMsn8YZBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.261928 [from cloudscan12-61.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 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 | 3 +++ fs/fuse/fuse_i.h | 3 +++ fs/fuse/inode.c | 2 ++ 4 files changed, 10 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 fcce03174ee18153d597e9cd1a2659b1c237e3eb..1249c7fd4d63692413d103e72eaa5e502188d3bc 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -957,6 +957,7 @@ static void fuse_uring_do_register(struct fuse_ring_ent *ent, if (ready) { WRITE_ONCE(fiq->ops, &fuse_io_uring_ops); WRITE_ONCE(ring->ready, true); + wake_up_all(&fc->blocked_waitq); } } } @@ -1130,6 +1131,8 @@ int __maybe_unused fuse_uring_cmd(struct io_uring_cmd *cmd, if (err) { pr_info_once("FUSE_IO_URING_CMD_REGISTER failed err=%d\n", err); + fc->io_uring = 0; + wake_up_all(&fc->blocked_waitq); return err; } break; 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 Mon Jan 20 01:29:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13944648 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 C135B28373; Mon, 20 Jan 2025 01:29:26 +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=1737336577; cv=fail; b=kszvhQcjdEOzOT1HhPfTJyy8d7mYaFKE2dCffyf71D0WG3focoNCQbOKEDeEjGBJzKjhhNDhovudLpj2cPWDtkTStFA8MDOjfpQqS5LumI9wJWG/pDbt1drerrZ9W0+eSjSIk/rMI0XRdyGmmF/m2N+Za6LPMAVPp9Wj6PInhp0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737336577; c=relaxed/simple; bh=3i8xm5Y1fqUWaEUFdAiYLVi+P0PPRqb1MIt8B8j7Nfo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZqOd+i6VOgdawwgeJ9vG8djYoKar6P1Gy8oB/kTNkpfPZw4hXQPTAqYLE3RjySwuhW0peJuDqfBhgo4vEptG39FmJWcsEAdbiE+IsooqmejmE4utCGRL0OHsazGQ8Wgf4/ZWYuze8ByHsgDYjx5Bb15bgHb/9DouR5Q47vjOruk= 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=bei9kF7T; 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="bei9kF7T" Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2049.outbound.protection.outlook.com [104.47.58.49]) by mx-outbound23-227.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 20 Jan 2025 01:29:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Hl1L/nJ8yd4hVntdmikrzXwqig9CcbAuLMahxocr7IIElG1DEhPuB30T9SHuUK1W9J7eY4VaYoopMGSbXvmZfleWpYvNAfdSBFoCLx9xEo7j4xbesLot8SeKLNkX6WspGNBSPpdgk3JXrn6d+52r7noX0wFes65GODzQmuKrYPlkuek11CxbUFQbV++Y/SWR0dd3SGOOJZfuWFKnPh7Wcx1bq2JgsCjK+ebnCkLD4izPSo9q/fTdl78VdbYFkiMokdP9zmIumzjBBexIX79Hp5CXlxv2vFCRkmiEdyL9zi/2rNklCglw20+zDlA+uI9MI3li/INWZVoWbS0D4rB28g== 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=PFYAXuUB0Ed7tRwQ8bNK4SgdfVSspLgCn1I1pYG92o4=; b=QGFnh0RNTQYk+kG4QNC65jVYqSqDxckBAYRBKG57KYr0AolMUZQq88KjN39Z3vPq+yorXWjDTmsNN/ocWb2kavPaL9lrT/OsI9XZrx0pUvmZPOak0uWPTS6rqMiPCERo0gx2LjXp147HBuqLWCSqZ0HEcoMjv27OwyPbwEr0VbvOZJ+tXDNRTsF4MyUCxPF9rgJ0Zkw4EQihLtZ1mds1xLcR3QtPbi8EPPiaBTMI4QUZzx9CRPksLdt8smK6G9t5/nCDfc4EZ4OnbS85Z2QUmT4oYyBTk69QGr1QmTMZsGqS0GAWGhFFtZ+671f2DXLpr5hltLvtIN1OSU5i3C852Q== 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=PFYAXuUB0Ed7tRwQ8bNK4SgdfVSspLgCn1I1pYG92o4=; b=bei9kF7T2mqY/a7qPYYPIrq9a4ypdsNtFqrWf6ERKfAAphbwO7gNK/+JS46URyM0A9p3qNb3QW1lTUmUe+HAdqa8z+YMGLcq/zLkfnAqNnU9XBrDnc/oa5F/tBbkZzsKFK+VQl85CnkukcNexkycMjrXwwxizZ3Nd9rQ7cjaDiA= Received: from SJ0P220CA0030.NAMP220.PROD.OUTLOOK.COM (2603:10b6:a03:41b::6) by SA1PR19MB7016.namprd19.prod.outlook.com (2603:10b6:806:2bb::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.21; Mon, 20 Jan 2025 01:29:19 +0000 Received: from SJ1PEPF000023D1.namprd02.prod.outlook.com (2603:10b6:a03:41b:cafe::4a) by SJ0P220CA0030.outlook.office365.com (2603:10b6:a03:41b::6) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8356.21 via Frontend Transport; Mon, 20 Jan 2025 01:29: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 SJ1PEPF000023D1.mail.protection.outlook.com (10.167.244.7) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8377.8 via Frontend Transport; Mon, 20 Jan 2025 01:29:19 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 744194D; Mon, 20 Jan 2025 01:29:18 +0000 (UTC) From: Bernd Schubert Date: Mon, 20 Jan 2025 02:29:10 +0100 Subject: [PATCH v10 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: <20250120-fuse-uring-for-6-10-rfc4-v10-17-ca7c5d1007c0@ddn.com> References: <20250120-fuse-uring-for-6-10-rfc4-v10-0-ca7c5d1007c0@ddn.com> In-Reply-To: <20250120-fuse-uring-for-6-10-rfc4-v10-0-ca7c5d1007c0@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, Luis Henriques , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1737336541; l=1431; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=3i8xm5Y1fqUWaEUFdAiYLVi+P0PPRqb1MIt8B8j7Nfo=; b=gHAv4MjTHqnhDovphFybSS2DIk+wpRCpWGUTqJvWdg+Z0k5N6U7st1qrAD4CUd6/IF1Iml3UB bH8TOJvq0HIBOiIFGBkL5NQ1YR3JPSqdcogjtCwcx6/f4/DPMySADvV X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF000023D1:EE_|SA1PR19MB7016:EE_ X-MS-Office365-Filtering-Correlation-Id: 106a37e5-22dd-4179-cde7-08dd38f1dc5c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?qR48b2dltNR1uHYCOxsCJsFKsAlelyL?= =?utf-8?q?ga2imfvncKPZR9eQfxSBTiFdr178dBRouTJL50rv7apHM+5NPiohun4w2pxsnPerF?= =?utf-8?q?mWnvzoqODhvcDeE9kIaOLc2qrYUNsX0x6w+zBPJdio9zb+1+h34CLZ6xJ1hRpkykk?= =?utf-8?q?DAhkG2BWdwMb1/e8DQd8F6McVoTbYtphUxQmr5OlDbbv3A0D+lMoGlVKZCQU4XEdy?= =?utf-8?q?orkkYEHsGOYpS/P2cr3Nc68X1UvWhqORI1Mr5Ch6GDs0PmnhXryxiCKgZYVTprD3J?= =?utf-8?q?mhuN5PAtlzK7DFgS30h7zB53nLiqsIuoi6+1U4ft7s3NQ5bwTxktlqTn+dDXysKMI?= =?utf-8?q?JtCobTZo6rVwvEXXDAHk7I0Dz2Ff0MKZrHuUVarrZUJy2GqEFSO/zG4yW2QKrQO4P?= =?utf-8?q?9ubf2AdkFH0JJf1agR/oueNAlZ95GaWl0yYSztHWhvAl6mBA6yjfqPycfqDX3F705?= =?utf-8?q?VHDG5uoQC64jl3nKZSrdv5RoKq3mDgdhhZb7bRr30332baqMGGqdZXGtcnP5pbgaJ?= =?utf-8?q?h3EAgWNozV5S0LBn0G6Pu1HPFve4jLHe1lpYuo42SILe0C3J36JY9o7rd+U+TcNMf?= =?utf-8?q?t2WTZcWTPziI3wsUiwd7M5NMUqk0wb4ZehVkx6B9gwLn8souUnElUvgZubONaBNws?= =?utf-8?q?zfIK3ClHRKRk9tpydLX69SCma8qt5xND40LrZncwQsGPxS3xCqDfLIWGq4Wl8brnS?= =?utf-8?q?hXEEO7UyE7FWNksjy3rSJZhIxLlLXpiMHIJ6TU3PWgXgqstv7xJd1yBJi27VPcfkU?= =?utf-8?q?AhiyanjUaOBsCJt/6IfC8xZS2/TibxPV50L4cUDWo5/xJ7wGs4v34Kp2xB3VO4VIt?= =?utf-8?q?n8dtvUDW0azoQYDya1U+8hREn+/HWZy8itUnwqglQ9gsTckQbRERmQwe4eCos+BGq?= =?utf-8?q?tQs1Sa2699y2URNiORfmi0I5Gr5eZgc9K+xnlm+fdHNjOPBjHRZbFqtzI6MD+jetE?= =?utf-8?q?m20FHenffAdMXzncf6UVTyb+10/BZaXdV0MPQQoUfIMcocSPSWi6PMy63AmsVdMFf?= =?utf-8?q?oR8cwaSoJmx4vMm6i7CiItqvlYIu7A+lMv3VsqasDVNSTbK1dwX8Wah6b5SAtdkvD?= =?utf-8?q?MvO7STrg4GQjNwtviMEOinLS99q7qNc68W9DdsI7oNxH+L7FCVN8VztDLz9UPcTfE?= =?utf-8?q?IlV6rRGzEaD0LcEg3H/TKyco8bMNQrKPwCTfOe9nICV/S2tj5v8HDKESmqYplxGgo?= =?utf-8?q?3uZWr4aXw629CqbPvLIK56Pqu08pLb5e87Tn/MSY7PeomFiz5biqleOBNsFtPuNG/?= =?utf-8?q?IcUuisVex1z6PiN7dMdEu2qeeBLaba5TV4CcBI16/Cgezdn2014IHbr17AKImi7sn?= =?utf-8?q?0JnRmbnSpGK9yniNIlUuC4eGmAUkieJr1NVjrVJdwWRu9Sh/i+J1GaQX/H856Bvnr?= =?utf-8?q?ZZmCWiiCAwxLTtg0GzbBrm+6qxDFfv/VQuwAio6bWbCkR/os5T1S74=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(7416014)(1800799024)(36860700013)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 0kPftMEWdgXbKgOSZjrrWe0RY7PaevnWONivFXYcCIFEe8QLHH8wMExPq0AdDZqBtEdvLETqvwdAz+UMC2P6YrglhUVffqTwSkboqxoRQ2yEcj/axIqJUxW/FX9Sq/vIZ9HqzvIbUeoUCAt9c1q1Sqn1W0ZO72+KOEAhpXwOQnr/oyR3BBUdUEaReM41UWtUo4ptcQ2mUAGEcXdRF57JHZHmXm0ropdgp4NMZvnJIzhrk60/Kn4YJicIjaJcSm66PqNVbqhg/dVv3qqDl3e2clCWGAXbl2x10cE3rutscT2F3Av7Jm44ubQRebEAnSzPJAu5oKRHFAfvYLBJLkDk6E/ZtHUlkDb4MvGeV2k+pBFScVcHicc8DRVby5LVPBDlvmNuzhJEXYO5pHgBs8HJG0erQs132MTYmrT0Db9cBSzJKFNETyKxfj//vkN7smQlNofLyvp4yvto/EpbZnITVn9PL85jQ5cLQukN1WI2y4Nm3pxQLq+TzVqKcOcqLZmHHPYNdeKYtxJeXVEv1tvA4JuAMUBijdoo6IUD9hNPNY+aUJ73q8QtJduLcCFAfvNCDF0JPWD0FNAcXwBLPYp3qvOv3WmCcLeREZQ++GmAHeN7jRTJuSe3PPBsIxDkmosE4uqtMDcdnrqvItDqY7+zWw== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2025 01:29:19.0728 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 106a37e5-22dd-4179-cde7-08dd38f1dc5c 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: SJ1PEPF000023D1.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR19MB7016 X-BESS-ID: 1737336561-106115-13451-11026-1 X-BESS-VER: 2019.1_20250117.1903 X-BESS-Apparent-Source-IP: 104.47.58.49 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVobGloZAVgZQ0MjM1NzQxMIgxS TR0NTC2NwozSLRMMXcNMksMTXZ3NxYqTYWAO6m12JBAAAA X-BESS-Outbound-Spam-Score: 0.20 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.261928 [from cloudscan13-194.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound 0.20 BSF_SC7_SA298e META: Custom Rule SA298e X-BESS-Outbound-Spam-Status: SCORE=0.20 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND, BSF_SC7_SA298e X-BESS-BRTS-Status: 1 All required parts are handled now, fuse-io-uring can be enabled. Signed-off-by: Bernd Schubert Reviewed-by: Pavel Begunkov # io_uring --- 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 1249c7fd4d63692413d103e72eaa5e502188d3bc..5f10f3880d5a4869d8a040567025c60e75d962c6 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -1084,8 +1084,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;