From patchwork Mon Dec 9 14:56:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13899912 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 0804E1B4251; Mon, 9 Dec 2024 14:57:00 +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=1733756225; cv=fail; b=rKoE2Y4CPxcHo93ytWRZmngjZsR4LBE+oh7f0qqmnQhd5WRHOo7qA0A0TE3EHbieB/d6ZOcPjz9BqOI0jmCRpFySlxqEWQdXGibwk7tT+yJYQfTt1gt/WbvYnVGh3HMgadChB/DtvUW0NoGSwnFKExlOGiiwafsr40Mm/g+hvIk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733756225; c=relaxed/simple; bh=M3GcQWwOaa8BbwZh7SUIGaTx+lkvQ0F1YCuEjX2dKV0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=C4X+RFX1rYcs1IpRvu7DX6WjQeBNuhlYI78E51ktarGIstAco9YKYCto5sXuv7rTVNBWXRQIsVkdFUeftSTC5r+cYSldjFBPwqbzdADmg4GMKArjVTCoFWXMauYS3zx0ecn5SmhYgZVECwsrO/Bg54gzkWJR8Au1NJ3N1D0p4is= 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=MeVyT3xF; 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="MeVyT3xF" Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2044.outbound.protection.outlook.com [104.47.70.44]) by mx-outbound19-133.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 09 Dec 2024 14:56:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=OOd033/4MsM30aGmYdBu1PtVYZBACEdDXg1QPNe4koHmLAwp10CSvOT1MUsWe9alZZgdecIu3tCKmEUW39oO1/TBR0ytGHJyH8UiFnEx6b1iAjXrKG79bjEIqqBC61ILAcHxcZibH5UGxxXY9lDN09sfalFRARQWjKc3dziwA3ZFbZTFVN+4PuWkEW4rGt4U5PgyOgEqSUVSrLPJ9xgaNS6EpgDESkZt210Vo0tLHNbZ7gIDaD+i6iqfWXZJ6vw86uWQRuWeepo2rzGwZHsWuSB4DtjePauesYw+MSCAjcrdwK/a0HaUsctPqyyv55nuAZSVvQpVA1od2xeGxF1vCw== 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=oDI+TgQKF2z9Gv4sC8bbQN3kZ0XF487zLTLucEDXWNxdM2ydHqYZ8BQLMDPj9ph7nsX6x/xllFFZDbAf/oOFn9yZyXxMVbdCfQ75WyzmaeMH8fu9p3tffVT+1O39XPeldvzj4OMH+nGV6yXuSGAxsyY91pjCJsE6/1xm/gquQoyNpxcbU+T16TVeGKvz97DNihU5h/ta+TfmNNmi1o2vm4f86DGV556Kvk8/tCo9MEj41hwY2GFaBwCBxChDStT1edqZgz+scIsnOB7si14JAjVdFkPHKLMERe7x4CHuCnCZz9K2gZiCg0UTei0Ueo40SFoz/emFusUpEABSodHxcA== 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=MeVyT3xFso6RNgb2fRszVtzGFY6NoJi0g7JAWnS5b7Jiw48+4nxdia66mTpCHbscjKDoUFpwZwwvkloY6lG/mAj6gzZHuEh2Nt+4byKTSILWn5+f6zPWc1rgemSVBzQAW1YnGMvgb2Wkgz+XZQzRClHer4fV/xZJR9lo23aqT/c= Received: from MW4PR04CA0210.namprd04.prod.outlook.com (2603:10b6:303:86::35) by BLAPR19MB4292.namprd19.prod.outlook.com (2603:10b6:208:254::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.12; Mon, 9 Dec 2024 14:56:42 +0000 Received: from MWH0EPF000989EA.namprd02.prod.outlook.com (2603:10b6:303:86:cafe::45) by MW4PR04CA0210.outlook.office365.com (2603:10b6:303:86::35) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.15 via Frontend Transport; Mon, 9 Dec 2024 14:56:41 +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 MWH0EPF000989EA.mail.protection.outlook.com (10.167.241.137) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.7 via Frontend Transport; Mon, 9 Dec 2024 14:56:41 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id B954455; Mon, 9 Dec 2024 14:56:40 +0000 (UTC) From: Bernd Schubert Date: Mon, 09 Dec 2024 15:56:23 +0100 Subject: [PATCH v8 01/16] fuse: rename to fuse_dev_end_requests and make non-static Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241209-fuse-uring-for-6-10-rfc4-v8-1-d9f9f2642be3@ddn.com> References: <20241209-fuse-uring-for-6-10-rfc4-v8-0-d9f9f2642be3@ddn.com> In-Reply-To: <20241209-fuse-uring-for-6-10-rfc4-v8-0-d9f9f2642be3@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733756199; l=2781; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=M3GcQWwOaa8BbwZh7SUIGaTx+lkvQ0F1YCuEjX2dKV0=; b=uXt/u269srlQTUf3vf3DEX68VGyc873fLpAYiFAYU0oERCz6HLt08hDfN32UFc0C86bFj7Bon BkhYB51G6ihBnQ4//TFezUVC4tdJtmU+3rYU8fV2DmEPUEdH3JoLMSL X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000989EA:EE_|BLAPR19MB4292:EE_ X-MS-Office365-Filtering-Correlation-Id: 25f3a080-a420-483a-725a-08dd1861b0f2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|7416014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?mdYVLmZT7aoCRjpxuuamLOqwA3UaSWj?= =?utf-8?q?XR2t9NYYGaGnru+fx2/pKe/qpA+tB3XIi2+rITclMCOGC2IYSZVzRdxB9B63FFkxr?= =?utf-8?q?r+H9H1ekbcAqQAACApck0xrdKHC3/G8+BXljUKLlohcgxrAg/Jl0w2vbewFwpDf0m?= =?utf-8?q?9CnpNEZmhuZEFc403NGkeALBX6PKjKmEGdcaOmiw/hJSmapqDzCYejdPa8+kaum7c?= =?utf-8?q?dUkSZWlV1TTjC9tD4L4lSiCuCti972IoDPxgoh/edLoFRdOshdtDcrKg6QsC3c+30?= =?utf-8?q?bL17NohCEZZSLemVLqB5DdH7DYJiENgsuv6cShNIcidVRORkxzOM7Az9vleS0ChzN?= =?utf-8?q?f8Dw/+/ILpBCDTFmzVxiOZaQBY4P+bM+xnToAzcUXT7/KuzpivehK4w/X+57NEKyE?= =?utf-8?q?wu66qUTMO34cyoPIXTNP+xV3v/XlDN/fqUbo6ZNJbmtvDREVglTnH/1HGebyh1xEK?= =?utf-8?q?EMSD0n9MZm5LflM9e6fFbVgzYC7TVecV+qvVOwpUfqiM31chx64pbrr29uN/2pfMA?= =?utf-8?q?ACJCgu+Qpw4tmkb4W4/CtxkQTCEKasY5CffsJhPoqhGLtYtc/yn1ibKuJcUSmgwFF?= =?utf-8?q?sX71fNudG2IcfBWl3+T6FpqEQ1BY4UqzpcHynn0i1grspIrJ45Q34r+yevazYVK5c?= =?utf-8?q?h994SJdz+aVykSPv2Gpqg+d+VucMqLY1BBUBX0LtbGDTCvGmVQof13PQ0fB5vcnG9?= =?utf-8?q?BppP6TMTWiEAmkcx3iNE3nRBLVbe5lHoWov96N26Oaw+0U6IyMPklfYbMfia9IUWT?= =?utf-8?q?CIhXkmXazlaJjZ+nLxi9eI08YjlSmwqyF0QcWRtGc6i7dQVV6CVPWpJ2i1y/kgWq1?= =?utf-8?q?ywI6ro4a4nTNmMDHW55t5sK1xeLYVb5/mKzJp8wiZwIh6xfDqfoKtNeJ1af/NniW7?= =?utf-8?q?TE2F6t+bNVy/Kn282asGztzNC2Ck0c+W8ol1ORsctCQ6WVTjHh/b5hGc0W9X//Nj1?= =?utf-8?q?AsMGw6NITNAfO88b46PTyamzbA5bBSnlQsx49E58xHvx8J5Fgr6RyE/9zHkOfmDxq?= =?utf-8?q?Q0zou79HJDzvSuVSf+7j/eqDKMB+uOzqZAoQMv8NnV2+TFOdflXew3z20tJ1w30na?= =?utf-8?q?KqzbfElWzjRd7R3zUGybbEDgf6zLe/aU9SaV4TvbFE5w8PJ1HVeh8fQ4oRJIPX4W5?= =?utf-8?q?wSfQXXrmBcowNDC+flERiNABpv/vOKD72F8a89CfaGshM8ZNgeZO6sdwLzUPnZ+Ct?= =?utf-8?q?k7J65DQDPYKcQJqOriE/CvcBMFNt0YGBqw4lOMwVaj2RA74O05Xpgjin2LEfM25cl?= =?utf-8?q?7TkkCiHjo1DMkQlZVurIzrQOCGW41ijfB8J6rt/LpSqS1HcZblKSOToTvB5vgkZfB?= =?utf-8?q?7s9UAQPGYsBlySoIuMxfIchrwvcLSBXNsJ5iOYQV9+i3wiC51uJhEU8lBsvDEndw5?= =?utf-8?q?7BEQxj7OwzR?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(1800799024)(7416014)(36860700013)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: sWl2Mx/iDZR+cW4tEUOdLQvZRPrUKX2k+hKfX4XFfjiFHz6xhXETvtevk5pg+VwcVlpiFlYq1F5AelMSUKwGyLPN1Q60qOv974/obmOdnTpAI/XKoaBsmRUwatLaSqbnigo0aCZERsl+75Q545yvYUaXinterNoMhi81XbnIMP0mhBlbfmt+uXnz21ZVrKew5hz7WEyHzqkEImtBkzMes8omXu+MB5uRs5fU9ek0UCEuu9ehlNEtCt5iG+c/oeocYHIzPsD9vG6z3NqxNAWaWo2WLRHsm0y/AEgJBD6Kl4TX17TyBj0wJ3RNNF+qbiuP98sE8fVYGUEaBuT8/aBXVVUPr0pK8iZMt3+bQuWfFWRcqTA333z5TAwyp2rV4bcFTH6Nkllc9jCPwtPo3Wz+ZDx4sSJSxLTuwlUaMbGiJzagP5E2kACSvFz4t5lAj3xCUOCVaMPKV7D9lZ3fG6OCh73wsEDsU8d/7O361f2xWzlyBryD4wLy4CcNXIo43gE/UmFsg8dpbHY6Yg1Dzde8ann6tzRNr/qQvNgzLGPCCtIr53fXiyfRMHOlAxEwsN82ipqYg0aGO4dxwsgZUU6Vq5QCtYy+I8AGOPhxKpAwC0CM/YdPeU3Dsq8XSpNCLYOZw+l8Cs/XrqnBx4A7oHM0bw== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2024 14:56:41.5114 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 25f3a080-a420-483a-725a-08dd1861b0f2 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: MWH0EPF000989EA.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR19MB4292 X-BESS-ID: 1733756204-104997-13364-6650-1 X-BESS-VER: 2019.1_20241126.2220 X-BESS-Apparent-Source-IP: 104.47.70.44 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.260997 [from cloudscan16-51.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 Dec 9 14:56:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13900011 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 16DF914A60F; Mon, 9 Dec 2024 16:30:05 +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=1733761810; cv=fail; b=mwydej+AcMKItub81dUXta4FQAprasvxRQACDPu4Zk60fnR/VxI0paNs2ImGz33Kfwg8QsJiM2Krm7AQJKCwh+7IECPDT9XdWvMK2+2O7TW81ZBMo2mRt0JQ27YSifEeeOb7IHYucKLejtebcIBOUDWXUSMq5rWZjla/MDSmT6c= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733761810; c=relaxed/simple; bh=wxYO2fuIGkvqmeC9PNGhH5rOX2Wls8HlW08RzezL2Zw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YY6omuL2B+XxsFG6zpRSndhtYD63+7RM1yWIZ4OU+JCYi5r9rtCpoloX2zPOVZ4z57QaT7kHx/ilkf5ZzpX1sAYJkpfO/m6FSri1/4I/icZuf3Std1tzoX+mcbJ64llCLqyWRTaSJ+VXO697vWZjYONXrTWeLuDdyUoPTDebWuA= 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=1+uMXEtu; 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="1+uMXEtu" Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2171.outbound.protection.outlook.com [104.47.55.171]) by mx-outbound44-160.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 09 Dec 2024 16:29:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=t+mfuPLhiJXyzfTKPegl5biTc8ilnvu5evVqdwltY5SpWw1GOPqq9TdDoIJQ67TMx3Ir0fXdUShbRIPxGEPkQUkSs5K5ROI2gK9CErRaih1a0LJ/ipumu3RRvITPg/4pPWwrYrh3laDbUGxdCv1MVqIVmXPS6U120J4jYHCQcsNWW5kjbaELxd2+xwZNwROLzkKfeltXY3Pjwvh4gjWzoNFHweowrs5VLd4Na7Kt79ucZAzHDiJ4SEdcyLB2AEOWwNXUlH1oDYh6cm6Cr3gG67/esuWcHijXi31YFoCfT9TNzmDaUa7RxtdoyqlpIuC2c55gyG+JPhCLDUPwD5fJSA== 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=AAS5I29pmtmLd0KhqXHg6SBq2ULu8j0VWPzblKRlhdESHMVoa/hAEQwQ/px6VLrJHFr+NW700UVsHasdXg9IheKzi9pH+SH+/+HLK/Tan4NSXcleytJkwk6zPs2G0oU/54iM6gePVL5Ob4YZw5ub5gGtv6itHm0fOfIKzUvXKI3lJQ9MV1JUCR/uMuMlQ+lzjXV+jRXsd1YTT7AuCNcYujDMRs8pu9jPYOu/i1T7QhWWyqwKNjU7NMwd1kMIea1zd4TsAccz7KlXd47D9TXtQfJFZxsXf9Ka/W7GM9pBliNUFvlWPYHc5XvAv/Ud7M/BV3q4cM+spCF5zhZ/sNefsQ== 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=1+uMXEtuZVVdcogFl200bBWsqjVGbDUwVYCFIEAsBv/RNGY9JKGt+kEqb6Ai3YYwjyWv3cKdWp3/UqOtmQDdIC9RT9y1jikCbu3EDc504QIIrm7HS7951fpyP8eUZf/G1BQsscuelm/mLOEmtjnTBFXeK/fNOF0Y3wVGl6XLXcg= Received: from SA1P222CA0122.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:3c5::17) by CY5PR19MB6315.namprd19.prod.outlook.com (2603:10b6:930:21::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.11; Mon, 9 Dec 2024 14:56:42 +0000 Received: from SA2PEPF00003F68.namprd04.prod.outlook.com (2603:10b6:806:3c5:cafe::b8) by SA1P222CA0122.outlook.office365.com (2603:10b6:806:3c5::17) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.14 via Frontend Transport; Mon, 9 Dec 2024 14:56:42 +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 SA2PEPF00003F68.mail.protection.outlook.com (10.167.248.43) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.7 via Frontend Transport; Mon, 9 Dec 2024 14:56:42 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id B3A614A; Mon, 9 Dec 2024 14:56:41 +0000 (UTC) From: Bernd Schubert Date: Mon, 09 Dec 2024 15:56:24 +0100 Subject: [PATCH v8 02/16] fuse: Move fuse_get_dev to header file Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241209-fuse-uring-for-6-10-rfc4-v8-2-d9f9f2642be3@ddn.com> References: <20241209-fuse-uring-for-6-10-rfc4-v8-0-d9f9f2642be3@ddn.com> In-Reply-To: <20241209-fuse-uring-for-6-10-rfc4-v8-0-d9f9f2642be3@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733756199; l=1631; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=wxYO2fuIGkvqmeC9PNGhH5rOX2Wls8HlW08RzezL2Zw=; b=9uW6gXbFsrlSgqIdVdK482oscWmymG61cmXoOKElukWYJvuRPLegJItWjP0yTIyn/Q1kvIGOi saavk6itiChDSVlyJInU+XRF3IFyxMI+XLrdgHT2egnclCReyKhct6j X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00003F68:EE_|CY5PR19MB6315:EE_ X-MS-Office365-Filtering-Correlation-Id: 71ee50db-0222-41ff-9eb8-08dd1861b178 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|7416014|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?utf-8?q?r7km0PBlCBUST13vBU99nqqk9W6Np9y?= =?utf-8?q?xC/xZMCTKp0S61E3NzSUYtSR+IWrN0IV2Jx5RYYGPP4pdhvM0W0qcnKKZnBAKJX+q?= =?utf-8?q?DCWirvK+5e7u/jmvPRYJLtp8u1QnPqUKg05xciGiLXFW0puHb1ZBsRRFG9SiiX0F4?= =?utf-8?q?WVbdYZt5QfmylRH73riwtL5PEq9GW6bFCa5JBbGJjzqF1FUOEC4lyxExAZPRlYxvU?= =?utf-8?q?vikPSSvKw2NtLMQURRquLOV9W3sc8Jf+YLTgUsuHKBt/4H5LPEUD0nXmZgcaGe4fU?= =?utf-8?q?fqWzRb5dxOJjFyag2AXAje6h7W+iwKxModiLjIXjqPsnOPclnOUishMIHdmjYH5lO?= =?utf-8?q?8yg720kCOpFzko5JAd/bNw33oMBl4+E/tNz14I3VEiJ5Axeq6ZmF2eeiLf/shtTSN?= =?utf-8?q?L3iCOhE3Ba9eWd2q9XE3MPV1P4x8jQyvcPBPmjxUuchA3dfzZOjfJrQ+mKfGwYDa6?= =?utf-8?q?vXFuo4ko4E9vDUXlMqhyRZVXyeDRkBsbCKs/qFMkQbPdGbM1IJxNGqunS70QBY4lo?= =?utf-8?q?xX2apw0ScvDRsiQW3widEJGySkMYZjdg+kOhFNin+F8YKr9p8YhpeFpiWSGI1n2+2?= =?utf-8?q?pA+bUZSMpLW69wNiMr+wWRldKcdFB1lwzd3xa7gIdwoKJYcOt1wyqioagBO5O8cm/?= =?utf-8?q?sAmedl0kWkMpjaKbS3CUci+/tUU7zfGNN8krF2fFT4TdlKp1L1BlaFEaWAxrC0ItZ?= =?utf-8?q?GxqgnA2L+B6dG327KhwguisIGIvVyG1CvdVCd0ffsVPRN9cx2U0TXPRbiprL2tQmJ?= =?utf-8?q?l1xKRkAysWfgUrpBfo++/xPluhySgSRxpiyUtyw8Jw850kJ9f9DHsLbJ4yr79nYZh?= =?utf-8?q?E0p95oNfBkYntECkgZqxiKKRRoUOpbdyI4PIY/XkH6l3zqNm+RSKN4j5W+GJfdK6+?= =?utf-8?q?FT6wJkWIRB3YfcPLk2dLqLLQhtAHsmvtmTywoEE7BV3Exa9AAolNcmgXY8Sx8rlzL?= =?utf-8?q?7ZPfMDCb6KtOIVYhTLkKPdbd4Ji+U5w3rwl/snRjr40xCQOg413gKs9Xma4Pfd/xJ?= =?utf-8?q?AOkUIc4dvhDf/fBxFZRc4fn5BPYx6fh4tZPXNjT/DvQv445Y1Ealu7hDPXxdmzloU?= =?utf-8?q?AJ8lkJd1yNAo7LW17bOF7dnYjZR+ZVQrOqEEqW6OJC044tgmIsbb1SE2yQaPDZIOQ?= =?utf-8?q?DH5XEP2R0gqP1mUWVmDxcl7zSNZsBR+pncv5CEewIdJ1YrKDueCe2XNnaX6F0zTrj?= =?utf-8?q?OhGVqZ3Z666h4a3ujediPNvKj9rtoxHOgxOyGLpwpFf/m6QpxXZ7v/hV4f3Oy1hPf?= =?utf-8?q?r5hxY1GJPlJ35VxotZqqqiDAzSrRYf8H9ymsNUVCc4PcodSqWUg9em0biQvjTVX+c?= =?utf-8?q?hAkPnVYbExintVrgk8bt4t52+pWmakuAi6NjPeMoKQLUTJhmQndMb8C02W3RmmGGO?= =?utf-8?q?x18DQh5I6iX?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(82310400026)(7416014)(376014)(1800799024);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: H0AqP/MXvArzOI104W/dzLpHBycurJkrykePxBDQ/gKXwbkT2ORc9Ey/7m0/zPlcVxL+v8EMBHpDzY56keT8LgpjTGSKlM8yUrtWpnpw3Bxoz+l63nwi4BmeNvL/tQqTWXhE+ztv9kKjTwUU39p4yTSSKKwiEV6YN4aPDpSPPDzSNFMqHR/Xg70rJ0/SOGdn7kBfkqFPuh2MT/Gj+rkA85/FmWl+U1fa4RUHmOxiQgkklHXpXaqDbwLkBC49M7NDThPl/EGwsbpVJDL9EtZRo2hDoiPOHTeVIz27Ls64o3yFv/u3C0WVCIiGZHuKsbKRLgfje5fEPKUt2+52DANOgHmAweHa3NYRq+JnusH62VK5Zkq2DN50QmahiMpEPnFPuy8KRkWCVp2gJJmqPHC3cT9DNiAWIGd4cRXyuc3cwoZi9N3e51GpT01kn4NzuF3ts2y80L2502YS7vU/ZhLCGpuO1Zfdr/OrLoZsP9YDB/gBw6oJJbOzLRr+9XhNi6kvXa/Ud1WadglUYy5zz/damu6zCcUqkGKVrpna9LQUKXtc20OiFy9IXast+Espww5hZMKhbX0kcmrgOXmydRN35oJi/vV1pct+WdWoJkCU0rTa7pZYc8xzrueakWn+340w8ZtGGRKHY7SzZVUylYkx8A== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2024 14:56:42.3907 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 71ee50db-0222-41ff-9eb8-08dd1861b178 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: SA2PEPF00003F68.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR19MB6315 X-OriginatorOrg: ddn.com X-BESS-ID: 1733761799-111424-13386-7866-1 X-BESS-VER: 2019.1_20241126.2220 X-BESS-Apparent-Source-IP: 104.47.55.171 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.260998 [from cloudscan8-210.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 Another preparation patch, as this function will be needed by fuse/dev.c and fuse/dev_uring.c. Signed-off-by: Bernd Schubert Reviewed-by: Josef Bacik Reviewed-by: Joanne Koong --- fs/fuse/dev.c | 9 --------- fs/fuse/fuse_dev_i.h | 9 +++++++++ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 757f2c797d68aa217c0e120f6f16e4a24808ecae..3db3282bdac4613788ec8d6d29bfc56241086609 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -35,15 +35,6 @@ MODULE_ALIAS("devname:fuse"); static struct kmem_cache *fuse_req_cachep; -static struct fuse_dev *fuse_get_dev(struct file *file) -{ - /* - * Lockless access is OK, because file->private data is set - * once during mount and is valid until the file is released. - */ - return READ_ONCE(file->private_data); -} - static void fuse_request_init(struct fuse_mount *fm, struct fuse_req *req) { INIT_LIST_HEAD(&req->list); diff --git a/fs/fuse/fuse_dev_i.h b/fs/fuse/fuse_dev_i.h index 4fcff2223fa60fbfb844a3f8e1252a523c4c01af..e7ea1b21c18204335c52406de5291f0c47d654f5 100644 --- a/fs/fuse/fuse_dev_i.h +++ b/fs/fuse/fuse_dev_i.h @@ -8,6 +8,15 @@ #include +static inline struct fuse_dev *fuse_get_dev(struct file *file) +{ + /* + * Lockless access is OK, because file->private data is set + * once during mount and is valid until the file is released. + */ + return READ_ONCE(file->private_data); +} + void fuse_dev_end_requests(struct list_head *head); #endif From patchwork Mon Dec 9 14:56:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13899909 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 A04E51BEF9B; Mon, 9 Dec 2024 14:56:57 +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=1733756221; cv=fail; b=PFzkJxx1hUTs0qd6tCCVrfDQZrMdBfZ5ua7nh5gwv0gcWMW8NomN8oQ0cXDpgMx+4Ft4urLAPdn7i2DyACtfTuYlMUVnW9TptR2rcmGKYOhTW2XrvcBny1ZAQb0ueiQ8hAjioAYR58WpKzJmbAi7UA/PsfA+waL+P0amr97Lq/U= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733756221; c=relaxed/simple; bh=bH7AXbAgM9O8WxYv19f8qiXoKWtYqGZmQxByq03RmGI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FP/jyKAsdrHzOXIm9BNEgS/Xe01X52/JMSHe9SvA/rQnLBChfHK09W9VCBKFo3yV29N/ueuLeBij2dza5jQtVOxGU5evjrBEAUCV9ekGHVJaUVYK/3gY9nkZrTKoaGq9AMBNO1WbhaZ4AdS2CEY7nBEeyGtNPRrd0rgpZOZY7g8= 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=Ph5F3w4Y; 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="Ph5F3w4Y" Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2049.outbound.protection.outlook.com [104.47.56.49]) by mx-outbound8-209.us-east-2a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 09 Dec 2024 14:56:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CWPMvzCdLvmYNgVeZRTapfLkkOPT6joj4sd4Jx1FnZ5JafoMUy+qaHaylqJ7N9yR+IDySPQoffc93Yz05c+QSbw10gMhqpEugyyUVMOPwTdz+tIvrKq+wGUkiH7KLOXBwiQKvfS9QG6NPr7R2S3+elx6w5SJgMN5AiW0ga+Tej0Aphm0q2txP26DY6x8rk1eLur1weMx9NC7QOWx9dgTudAJDAXuOk+6oLsaQciHm7fe1xZhtFbfzBlible1XUEXK5P8U2j1peAJD2PXT1s2Pb2GQjNkDudNXjseEg9TeIjv1hBhSrKl8euaK2aozjGcBrVl4ENpXZ4vWBSQ3bxCRQ== 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=O9kwO2xl5Q6ASmQchr2Eamt53GyBEkjFkjMCaC/hCopQqw/8E2Ng/GkVpxQQFepro8uaGoUJ6Q1h06Xzy6uW15+e1kOI3RvRPS6uvYPiTI+vR3gIiRJO28DUd31rUvYK2hGVmouNQpeYO4bOXffZZgBC0HK8GN2OKsNvOX9aRkOExnapYJRsz5aah0AZ1fr6d7W67G6JtmqTwfDoRHiaqZrLGyCsaebwh4Xbw8EIE8Q1gHisW4jo35r73u+9y+x/UedZgAYgCA77Mpge8e85A3PP/loM2ryjnCoIMjrEn9I9Cbltk5OixhgxsF2MXoZ4CEvi41j1k2u7X5nQniIGMw== 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=Ph5F3w4YIXJhyZtLs+TKe7nofORc6jxCfPNmWXrAzNFCMmvgbqD2KwMwT5YJdkExAZBtFoLeMu7p3EJdhQ3+Ts/xl5xS/KRV/j30NsQmlyM4K3Yc6mU1fG/SW/A6WkA+Q0YwSywdqP2rMETt+uiJQHs8TVlJQWhk2s0ObMRediM= Received: from PH0PR07CA0025.namprd07.prod.outlook.com (2603:10b6:510:5::30) by IA1PR19MB7711.namprd19.prod.outlook.com (2603:10b6:208:3d9::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.18; Mon, 9 Dec 2024 14:56:44 +0000 Received: from MWH0EPF000A6730.namprd04.prod.outlook.com (2603:10b6:510:5:cafe::f6) by PH0PR07CA0025.outlook.office365.com (2603:10b6:510:5::30) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.13 via Frontend Transport; Mon, 9 Dec 2024 14:56:43 +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 MWH0EPF000A6730.mail.protection.outlook.com (10.167.249.22) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.7 via Frontend Transport; Mon, 9 Dec 2024 14:56:43 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id AD10855; Mon, 9 Dec 2024 14:56:42 +0000 (UTC) From: Bernd Schubert Date: Mon, 09 Dec 2024 15:56:25 +0100 Subject: [PATCH v8 03/16] fuse: Move request bits Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241209-fuse-uring-for-6-10-rfc4-v8-3-d9f9f2642be3@ddn.com> References: <20241209-fuse-uring-for-6-10-rfc4-v8-0-d9f9f2642be3@ddn.com> In-Reply-To: <20241209-fuse-uring-for-6-10-rfc4-v8-0-d9f9f2642be3@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733756199; l=1370; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=bH7AXbAgM9O8WxYv19f8qiXoKWtYqGZmQxByq03RmGI=; b=F7xuOfHmwR+qLdrcRBAoUZweAVgpFW1TMCRn7IoI0fg9iftMrlThMQWU/7YmNQc4Go9B8SpGO gmk+pXGyVLdCZRZUP7Twj5K9BP02WMKiiVP6muZr+0slV7Z5YPKzFyU X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000A6730:EE_|IA1PR19MB7711:EE_ X-MS-Office365-Filtering-Correlation-Id: 562dd1df-65c0-4709-5817-08dd1861b21b 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?j/h3R/Y1QL0h4eGaJjdofDqu+PoCCwO?= =?utf-8?q?gJ3GuBOE8zBXalpinBBHaWT1fULEbRaiszRru0xKe53ysLKyhmOjG9eHTkM34HJO5?= =?utf-8?q?RNbyN4k3ELlkwsjFG+7q7yJyLdJq0qfZR/ZWCuwp7qZLm5N0W7CPRt1Zase+6zUub?= =?utf-8?q?tTywRZckjuFomn1X1mpecAJMgWijNtEtajfsjy37GCDOd/O2SAYCCPi5gOCOjUW25?= =?utf-8?q?OcWkQafeYNf351YlfM29F88LAh6WFWPn99myvpv6gCB4Zx7x9BvbQ5DXmkbRCNECj?= =?utf-8?q?ox3qAUFIURTNRpS0c55k3K8Zq1BQPb1SX+ixtwctWaDPTNa20JNG8wumvZYvsi1qd?= =?utf-8?q?N639hI28N4ayd+wZ+oCSXhZI7d3DFJIHDZvWKbcVWm/mJ7Ktl8q1bN6gjIdrQ/xtK?= =?utf-8?q?uG+ndOKYY3dSW5XhaoqzViU+2S4sKTCqBXetbKDQs157TVOrWrXT+tnPaoWCp3ZLq?= =?utf-8?q?8FrnTAs7rRY7layEA7zBn4pOt0OduwQ5WXawhqwR1STkWTxCFbw0OuRvowi8Vey8q?= =?utf-8?q?6LONmGERut40aeAsyC6VRdgjuiY3ugOBU01ZixUJcDK6m6hZ/apnztqpKi7GIKWSP?= =?utf-8?q?QOoWFVHn5lTRLgy/g1FNk4NPH+pFx+ZX2An5+074BChdONuAVy5VbQMbbX8Adw+aJ?= =?utf-8?q?fqOdaf/F7l0zNK8Lx5WitHILJUd86ukDk90M+lKA9aSQ/v65zIXnFLCEtPbMkUnmS?= =?utf-8?q?GDEs+CUEEV77dtWzewJOOGkrjLNzO71n+wop8ndXexGnKicD9ln4lCeE4CUGKn4NT?= =?utf-8?q?dRb28EJGWGlHbZ1jNAwT7HnsrwtrXhPmdou4g88I/c27hVj4v2xQP3S8D1hju5xPq?= =?utf-8?q?uqKwd74LSaP0V5pj/KzPK+Sg9DeMNGtbdG/6PvtNy4uUp9o+8Q2ITDH//NoxwHSdy?= =?utf-8?q?3dHPJ1Rj6B7AC7DLSx8qjowKr8/se13kxxCqltPmQYGx0YnP5gOjNTbGVJ5Ut8gSH?= =?utf-8?q?aA5J1XwfaSTVz+ZeBvrDAi06RCxbHT9Iw7YVFk+4JHIvW7c/SovFnckwuO7v/dlYJ?= =?utf-8?q?K7zvRYwV5TLmMfrBpwDM01qWLaY3gxhZKqwXKFmx4PU5I8p/YivVyH/ZAxA8ynkO/?= =?utf-8?q?yq3cr+t8t6lALTYwt/d1UKC+WceDOdmEMCigBjcWGb0d2+kcRCCCY3MKGnm661miQ?= =?utf-8?q?PSthRS0niDd9Z4rzLn/zSz9GMUlh89VIKKztiMpt4/lUoGpeIjx4H8DDwhHayPZvI?= =?utf-8?q?qqOByDehtonf8e9U2/YIdl5+nNqLEuFqF/R95m9ZxJ+apFmgfrJkrpvU8qkpswD6w?= =?utf-8?q?67axBu1ZTf5ju6M51IIY3S/gf6tnUf4w9kA3+1Z/M9JV6x1TYRL0UhCOt17nAeeRA?= =?utf-8?q?imSQdS0WPEcpG68X6X9G8WAu/fdkPPP8dkCRd21uzexDpn3pNuqsn8ziXkpcXfL1t?= =?utf-8?q?RaP6RpfeYRp?= 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: qzLNEFVjFF8gFCiuqACK0eJEk9iMpPzo+BFfDDdybtDyBXcTFXXg26/UjnGvGMflRbkS+4MB9kM+BNG/L+gk1ShMxPHkl+2gf/uAYL9Rx1QTfGhMbVdZRCLACFbiH9yFdy6Ch1kMaidCzJTJHo1SCi1cP2I+uy0IpxV6RiUxfb1q2pbXz+QieIKG1xEFL3Kjx5J1jKgA2wCl+eljhk30MEjJy4PBrAKE870U9tx5S/uEFRezyJkJDsgnl0LUURS0tRyXZ1Q1Dj/33ZGhkb5+oAu5zsplJvmQifcUhJbHZPDZAeM663U3qtU7zpoFzfqO3GKrOx56hL82+iBi3ZcoOWng5mMIxYq/hSaYwZt7UJmYM0yVXzAd5H7lVRI6zs7x0OjUswuim24oXoFeK0KU8KshTZinKy+iLviilwTiItQ8JYhoRiEn1YvqvJ3fSbH0GG+bv3kv7jvnyPGY0QVvsl3dzSo0Oadaww81bU5JhDZi8uylpxHdh1tuYKknDIYHhQkXjIuk1jWgbo8Ji/oVpFtdbrDn+5HGwgPRlb4wD6hmGunFj5DRXvRpqQxppDIRp/vHNLzqfMH19SBriMWZts4BmsJQM1uTGgVmg1ZWmuLov/yKqCvIDMqV60zlPtfaOC7+EHtNDTV5wtXCAcd5VQ== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2024 14:56:43.4571 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 562dd1df-65c0-4709-5817-08dd1861b21b 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: MWH0EPF000A6730.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR19MB7711 X-BESS-ID: 1733756206-102257-13468-1819-1 X-BESS-VER: 2019.1_20241126.2220 X-BESS-Apparent-Source-IP: 104.47.56.49 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.260997 [from cloudscan22-239.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 These are needed by fuse-over-io-uring. Signed-off-by: Bernd Schubert Reviewed-by: Josef Bacik Reviewed-by: Joanne Koong --- fs/fuse/dev.c | 4 ---- fs/fuse/fuse_dev_i.h | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 3db3282bdac4613788ec8d6d29bfc56241086609..4f8825de9e05b9ffd291ac5bff747a10a70df0b4 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -29,10 +29,6 @@ MODULE_ALIAS_MISCDEV(FUSE_MINOR); MODULE_ALIAS("devname:fuse"); -/* Ordinary requests have even IDs, while interrupts IDs are odd */ -#define FUSE_INT_REQ_BIT (1ULL << 0) -#define FUSE_REQ_ID_STEP (1ULL << 1) - static struct kmem_cache *fuse_req_cachep; static void fuse_request_init(struct fuse_mount *fm, struct fuse_req *req) diff --git a/fs/fuse/fuse_dev_i.h b/fs/fuse/fuse_dev_i.h index e7ea1b21c18204335c52406de5291f0c47d654f5..08a7e88e002773fcd18c25a229c7aa6450831401 100644 --- a/fs/fuse/fuse_dev_i.h +++ b/fs/fuse/fuse_dev_i.h @@ -8,6 +8,10 @@ #include +/* Ordinary requests have even IDs, while interrupts IDs are odd */ +#define FUSE_INT_REQ_BIT (1ULL << 0) +#define FUSE_REQ_ID_STEP (1ULL << 1) + static inline struct fuse_dev *fuse_get_dev(struct file *file) { /* From patchwork Mon Dec 9 14:56:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13899916 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 8EF701F0E47; Mon, 9 Dec 2024 14:57:02 +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=1733756226; cv=fail; b=Q4h06SnkbWJFSji+dXcU684v6y3sxfg50pxx7zln7rO4vicbtu6D9YFEDHvWBX1YqpGBs50WAtUjAjLWZhOW8uQzyVnyYG2OQGIchN1+WpkcGPQrRdXBZQfsvsme0fOyitkQQWu2rSfy60CmEn1FMF5x3Wh2bmpzs8UuNJOCVU4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733756226; c=relaxed/simple; bh=bpz9jYdZQEOQdBfiKXiZwRgnp9oHesOsIHgalszfXPs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FRI/TUTpAmZ8CBkci/pAJ/Y98RVDwDKftx2D8wfxJ2jKKPxU/8M2TGaiaIc0YbRgYET7zx0V3AF6B2jguJocDrIg7Qr1dkdrwYe3Qjz3qA7FW+O2YE5pW3fCkUCE40y+ChL8D71YirlN6F/2IRwHFkCBtQoWOBmwJhrzq3RKhJM= 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=jHLAs7r9; 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="jHLAs7r9" Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2176.outbound.protection.outlook.com [104.47.55.176]) by mx-outbound43-237.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 09 Dec 2024 14:56:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vBNcUefdp+/cTqR3xpbnPfHP3emyQEuM8qB2wwv0Ev85laBQhzPzFFJuubvlS93rYj40S62vTTLHZ5gc1fw+g2UCBwVKQqUx4yfpGRq3fjt4jgA2DEHk/a+yALSUCCxsAgY12rakunG3t4U/dz29KhWCGne3nrKRwiQ/HJSJ2W63Hc06cD8LQojlpTOefnxtuTQPYFDQ5AoAQKyZZzPveCC69unkXWkX4wWFlqvTy5jHlAPHbcq9h8zi3PGgT8gHwH4+NWNa6RxFjRONs2yitc7AAHFWasDqQCELJe6ukJQaRi4LeNz/ZmIn5uUSBu4Cfc4utpr9z/ijqA5CWdhJtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OzB207LVFcHhSySR/O8OdAO8erEuw9C7AZx6YrWeNEk=; b=Vux7IOZDID0qEs4nTXfL2aYSENpqyA8+e1BBkcyoQc4AlyJXgdkyRWwEbu9Q0DzmKg5eOd8ZY1p+3HTydI8LwPMD9Q9b2VLIXLy+aOH8QsDM+4xmyWRM5S9+zYHdQoyUR4z/8nZb0QwZI1QgwnrsqjuhT1X57hlRUJQ9QKGYfTelDOWlSVJhI+bTRYP11RtDZC0EU1wnkmS39YmtW5PM0yDqBeFs8y+0zlvEf8pM/ycv0I8fXK6+kudF/UUViF2p/FFfvfW39MQLdjqP1CTqV4f8qlzBb3F2Kv+CgR8zE+clBWiaRCUrjyHGwTUvJhJMaFe7KwsIq8N5wYbMavd6lA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=bsbernd.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OzB207LVFcHhSySR/O8OdAO8erEuw9C7AZx6YrWeNEk=; b=jHLAs7r9ZMLlH5szqAnOlZLp0DOBxFVgvgB4rXpWE15k9EaZ/NG1TGtN4J5umZhGvO1zfYNx+codxPAKJnch80QLvKDaZjlrQbWhoiRxphgUrYRR7cWEq4im7hhHwUPHqWbSxoCOthNynLWGsWsniLbHYH6hdHg6p0mE2pwtPrs= Received: from PH8PR15CA0011.namprd15.prod.outlook.com (2603:10b6:510:2d2::28) by MW5PR19MB5508.namprd19.prod.outlook.com (2603:10b6:303:193::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.20; Mon, 9 Dec 2024 14:56:47 +0000 Received: from MWH0EPF000A6731.namprd04.prod.outlook.com (2603:10b6:510:2d2:cafe::fa) by PH8PR15CA0011.outlook.office365.com (2603:10b6:510:2d2::28) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.14 via Frontend Transport; Mon, 9 Dec 2024 14:56:44 +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 MWH0EPF000A6731.mail.protection.outlook.com (10.167.249.23) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.7 via Frontend Transport; Mon, 9 Dec 2024 14:56:44 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id A6F5A4A; Mon, 9 Dec 2024 14:56:43 +0000 (UTC) From: Bernd Schubert Date: Mon, 09 Dec 2024 15:56:26 +0100 Subject: [PATCH v8 04/16] fuse: Add fuse-io-uring design documentation Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241209-fuse-uring-for-6-10-rfc4-v8-4-d9f9f2642be3@ddn.com> References: <20241209-fuse-uring-for-6-10-rfc4-v8-0-d9f9f2642be3@ddn.com> In-Reply-To: <20241209-fuse-uring-for-6-10-rfc4-v8-0-d9f9f2642be3@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733756199; l=4852; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=bpz9jYdZQEOQdBfiKXiZwRgnp9oHesOsIHgalszfXPs=; b=5TAyoxfz8+V6xh8X6UmTT3fdCOSin+QVp+quAVmkD3RukDpCl37ghjbH94qbOJw1M/ngDkQFH BoNHCghsWqJCMBCrEhSyRDZsI4hk8GaTla5WUnSE/YkL+X4e3gAReUu X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000A6731:EE_|MW5PR19MB5508:EE_ X-MS-Office365-Filtering-Correlation-Id: 27f52959-5030-4e88-d36b-08dd1861b2af X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|376014|7416014|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?jU4Yvs9P6voC36rZ+K/DYclnyhh7PRw?= =?utf-8?q?tsZJxIfSvXNx9U53htEqdZSwMkIkf/V8BkVlwuyLSnw3HVlAwZRBDmnmKdO5d3+fh?= =?utf-8?q?jo9DYYYyRr3t8qbCwXQYpZ5wqf05FIgC8fuiORlUeoQzPrcYYk+6n8oNC+ZsAh9W9?= =?utf-8?q?a9hzp/3NVb8BmPtl9263exNrdZiQlmjhMJ4GnMnKwHai6wlU13OtV4MkzEMugVeDX?= =?utf-8?q?khZY8w0kWICPK0QMMSUugvAaxkgWvV8PiWK7qJxELQ7Txik4zCJWbkbYWvmA3QClR?= =?utf-8?q?RRwwJGtdRPan3yArN68dNuFYnULa9AGa/fEuZM96Fm0D8xXgzyhc85scvtPGu0hB/?= =?utf-8?q?C4iiEGtgLxOKqS71ariCtTi6I3G0WnkY1SOXVCnXWmXl9gcC7EoSthkT8F35Skvp8?= =?utf-8?q?iGHeK2t4eAHDF9pcVB+45nQc/htfnUQ34mzbIieFASKphTWtzyL8PzcUTKNkUO32Q?= =?utf-8?q?V6Zqj/z/yyBzo6xLIcZWsQ9XZ+bYhr1JNhAy2NUt6xLEbP6kj95j4/u840HgzQdVp?= =?utf-8?q?9lbBh30oOi46EvqORHiQ7kIcgpNVJtlSwgTiUjlkUpyPOElopyW1c8Grvfdv7Ts8e?= =?utf-8?q?/h3+/GHF+ewcIZe4FmHSI9CR+KHycwoefoAmTH727ZaTCaDbi44df3Nz8YnT+4nuk?= =?utf-8?q?AcJst5M+JlcAYasQ0tOP1fgqIXQTINZBlOX4hQx8aQic8kLunewQkxtawQqmJkeg1?= =?utf-8?q?eMpZLd8pSfrmGNklE+/LgclnPfre4EL6xycsLZ4YRxNpiQHbR0skyNV4cteDcbgzN?= =?utf-8?q?6kCLTyOw8hJqw5Ur3wS2+zo1bLHW2L8EAMHBb0Wg1bC1LISa54zyrbalVouD0wTMk?= =?utf-8?q?X6lJy1yucKavm9GPzvzrSji6Gzt7Kz5T9M95VL6MivByqR+bczy/EaMeWMPqDBlYr?= =?utf-8?q?ToI1cFedRpAtR99YWbexQ3I6Cbr52WX8KXaAlBp9AndwAKVEGgoig/pu2LJIzZWjY?= =?utf-8?q?E15ZkRCUO+mX/KQ25zAXlpHyL9puCZNG4Yd1OplStenD5r3ljA3Qx/SOdlxl+43Xp?= =?utf-8?q?sJOWIa4eyKTdVDtmceKolmOmWBMUwLgU8IKu/YUcK6HuJ4BYozUeNS5/Q/1akmy03?= =?utf-8?q?IgG7z0isFTOyQJxmD/SD9HrVwQVoqNJ/caUGntcdM2zETc7xXqmEOuvU4tdcehdx9?= =?utf-8?q?d0JsGUscdD339VxkedZzs6pK9eZiOp0QcdEAacNVp97ey2h7TEOXrQDf+9xY2C+E5?= =?utf-8?q?x/Ygv3rIO/4a78/SvulFZvjZdBVWDzIG6zhfplQmtrs41dbBNe3FAq76fEDIF5QbQ?= =?utf-8?q?NRN2h1c3M94UkNJtL/zF6uNgseCBl22pzcx9HJR5y6nIlm321u/220PaX170PfGAU?= =?utf-8?q?YM5D4zXTpekyMn5FRUg+Qx3h7ZZ7leNUp67ptDKXX5V40hml/z4j/VEyxp2/Kd5mI?= =?utf-8?q?O+vyrGEGecA?= 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)(7416014)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: CSiKTqIIK27vzc2PtmdJaLavnDy3jUD2vbeUhT9uARb6IO9dg0ZWx7WxGQw75Vrj2E5eax/DLeHs/BpfmpGcxb1Ee3ltkjDua9Ttfn0ErUASky9su9A2Y5jBCQOJg+NuIRRXkOPAIyYhPBLNROrxU7/b7S5Au7l5BglZPejZR69tGljgpr9HWFB2NvCg2Dn+zHqIRsCpM0oOhVYidnTQcmArOCBjTzk61qXsj1JkXTultSB5+SzN6xws7ik76GZl3LBG2IFfxZX/3bAF5nOcKB8TeNS7hqr4tkTsaiiRrjThixv+NFCCzjw0H2peX2Fzpqx0EQhzf7G15CcONHtxvyg4omlBl4396lgcwIJsFraXHanv9hqZVCFdWlP+1UDC4ReX6EZ3mHiPaUIFXKFp1pcrW1XVhYj6sgggi13N0uEWLyO4aa8VuiAfWYNAl9HEztQW1Q1SZ1cFdT6ZqD/FlQDiv58fCepqGaTqL+rw0ORLQ2M193fEeul9FZO/BvrggWq48vsU34OenezBFIjUo2BK/I5O32BW/9AKHIV89HzQdkBs0H3Jeffx2kIuCDwz27mc7soRSQgtZCwbwxO4wIC46MBrFQGjj7+mZhXbfI2w4x27ZsM7J5HBg3D1MAstRSUdlcFObi7vcqYDaDyj3g== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2024 14:56:44.4146 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 27f52959-5030-4e88-d36b-08dd1861b2af 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: MWH0EPF000A6731.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW5PR19MB5508 X-BESS-ID: 1733756211-111245-13395-4910-1 X-BESS-VER: 2019.1_20241126.2220 X-BESS-Apparent-Source-IP: 104.47.55.176 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVibmxhZAVgZQ0CDJIs0oOS05Kc 0kydAszTzRyCgx0dAiLTHZzNgkydhYqTYWAHzkAYFBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260997 [from cloudscan19-154.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 Signed-off-by: Bernd Schubert --- Documentation/filesystems/fuse-io-uring.rst | 101 ++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) diff --git a/Documentation/filesystems/fuse-io-uring.rst b/Documentation/filesystems/fuse-io-uring.rst new file mode 100644 index 0000000000000000000000000000000000000000..6299b65072a8468f08cc4f6978c386546bb9559a --- /dev/null +++ b/Documentation/filesystems/fuse-io-uring.rst @@ -0,0 +1,101 @@ +.. SPDX-License-Identifier: GPL-2.0 + +======================================= +FUSE-over-io-uring design documentation +======================================= + +This documentation covers basic details how the fuse +kernel/userspace communication through io-uring is configured +and works. For generic details about FUSE see fuse.rst. + +This document also covers the current interface, which is +still in development and might change. + +Limitations +=========== +As of now not all requests types are supported through io-uring, userspace +is required to also handle requests through /dev/fuse after io-uring setup +is complete. Specifically notifications (initiated from the daemon side) + and interrupts. + +Fuse io-uring configuration +=========================== + +Fuse kernel requests are queued through the classical /dev/fuse +read/write interface - until io-uring setup is complete. + +In order to set up fuse-over-io-uring fuse-server (user-space) +needs to submit SQEs (opcode = IORING_OP_URING_CMD) to the /dev/fuse +connection file descriptor. Initial submit is with the sub command +FUSE_URING_REQ_REGISTER, which will just register entries to be +available in the kernel. + +Once at least one entry per queue is submitted, kernel starts +to enqueue to ring queues. +Note, every CPU core has its own fuse-io-uring queue. +Userspace handles the CQE/fuse-request and submits the result as +subcommand FUSE_URING_REQ_COMMIT_AND_FETCH - kernel completes +the requests and also marks the entry available again. If there are +pending requests waiting the request will be immediately submitted +to the daemon again. + +Initial SQE +----------- + + | | FUSE filesystem daemon + | | + | | >io_uring_submit() + | | IORING_OP_URING_CMD / + | | FUSE_URING_REQ_FETCH + | | [wait cqe] + | | >io_uring_wait_cqe() or + | | >io_uring_submit_and_wait() + | | + | >fuse_uring_cmd() | + | >fuse_uring_fetch() | + | >fuse_uring_ent_release() | + + +Sending requests with CQEs +-------------------------- + + | | FUSE filesystem daemon + | | [waiting for CQEs] + | "rm /mnt/fuse/file" | + | | + | >sys_unlink() | + | >fuse_unlink() | + | [allocate request] | + | >__fuse_request_send() | + | ... | + | >fuse_uring_queue_fuse_req | + | [queue request on fg or | + | bg queue] | + | >fuse_uring_assign_ring_entry() | + | >fuse_uring_send_to_ring() | + | >fuse_uring_copy_to_ring() | + | >io_uring_cmd_done() | + | >request_wait_answer() | + | [sleep on req->waitq] | + | | [receives and handles CQE] + | | [submit result and fetch next] + | | >io_uring_submit() + | | IORING_OP_URING_CMD/ + | | FUSE_URING_REQ_COMMIT_AND_FETCH + | >fuse_uring_cmd() | + | >fuse_uring_commit_and_release() | + | >fuse_uring_copy_from_ring() | + | [ copy the result to the fuse req] | + | >fuse_uring_req_end_and_get_next() | + | >fuse_request_end() | + | [wake up req->waitq] | + | >fuse_uring_ent_release_and_fetch()| + | [wait or handle next req] | + | | + | | + | [req->waitq woken up] | + | X-Patchwork-Id: 13899918 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 BA3591E9B3D; Mon, 9 Dec 2024 14:57:04 +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=1733756228; cv=fail; b=MMRjCecB5bC39jAHCWVw6W1/VIJAH8zB9hOUY8V0vtreuYSnOq0H/4SOkyCWhBGXMP9rTynivSjIF5A5CrQHz7XmB4wrSW9g7l9K1A6RHm089JS1/CnG867nfGzaUgQjUOIL0aCwLhD9N6nlocDExJ4qTTlKVJWbEJKgA8zlgfA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733756228; 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=MX2TPr/ue7/lOa0Chxa9/daQj2x0WqRwt6LTbZ9XuYGvHBMjzhD0s54JVnn9zlEkQMUvMNUwm0cQhMjKfnoHFAu+5vII9/x8ah1hLRwTPCC8smNrEfE/wJSSnLvIzFYPHvHxyyy1E6btXA7T/4anGMywYMd9Kn5DPnIZ2hGVjxs= 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=HAnDkeqe; 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="HAnDkeqe" Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2049.outbound.protection.outlook.com [104.47.58.49]) by mx-outbound20-215.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 09 Dec 2024 14:56:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=VreWllskI9zQcMoTtUgYj3u3cGiQC/Ue1wzWhOzB+80MeSFFDYi3pMFdW+A4K551pqeG9lez5+YPfLVzl+pj0dscBJKH30PBEUAp2xwH9I426/EFFsUOhOphn6N9tNCQcPkRdHJ+XaznJA0XK6YqFt8H9PhGvthpXQFF+U8KolVKm2DeXeeIflUhwr7pwxSKmiGgQB7yFHqnYN4s3JtUq0APOwIyvk1BRBadtqbs5O1oOlMXt26YSmKFmApo2aIJ8wfb2Ltd9tLQh1Ntq+lm1V3yGrM9+a3ez9Cc+6NsbSyHqijqy/EkX9L7eh99YhZotUUl9+bjoDKiALlU66dhtw== 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=iZggkk+P/sS70iUXpk3uXg6xHWZEaWeFYx+UECZzRxemhvYj//q8R2wSZEMvMjuf/HZi02hFo2/HC33WVPcAGN401lHtiU3KYb1t1B+IuJNrMTcmUnmMuDQqE7SSdqrutb7OMa9PmpycH1N9sOZ5y8DuH9d/y1YmTMfGHaPa7QR4GVHlLQXhFx0TZhI/T2ptv2BaRoQFZLqHflbvXBdHDmycHTIsXeulsNZIRp5KjedCYnhZJ+bwnOxzBawOdtYQicTweWKIT955Uhn17CpAoe36xPECOPNchtBO7BKtlbXF2CBezPINEA3WMVw9mM3tnM2+kxJKyEuvKBjGSRrk9w== 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=HAnDkeqe+WMxv4eDWAnzmTwg85Y2fFl7KSuKjzaqW1U/S6xkTcduUBFGscl+uKSV2dEgHfTQtA9sPtvToEuiH9y+1ycnoqVNRM8snEhDuIA7WpEaj85qlKvJUEEE3x1SokBL5gbSVxIOFrjwIf2C0yJe1Q8Mkj89K9APWE22o6Q= Received: from PH7PR02CA0026.namprd02.prod.outlook.com (2603:10b6:510:33d::35) by MN0PR19MB6240.namprd19.prod.outlook.com (2603:10b6:208:3c4::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.24; Mon, 9 Dec 2024 14:56:46 +0000 Received: from MWH0EPF000A6734.namprd04.prod.outlook.com (2603:10b6:510:33d:cafe::b2) by PH7PR02CA0026.outlook.office365.com (2603:10b6:510:33d::35) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.13 via Frontend Transport; Mon, 9 Dec 2024 14:56:45 +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 MWH0EPF000A6734.mail.protection.outlook.com (10.167.249.26) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.7 via Frontend Transport; Mon, 9 Dec 2024 14:56:45 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id A061B18B; Mon, 9 Dec 2024 14:56:44 +0000 (UTC) From: Bernd Schubert Date: Mon, 09 Dec 2024 15:56:27 +0100 Subject: [PATCH v8 05/16] fuse: make args->in_args[0] to be always the header Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241209-fuse-uring-for-6-10-rfc4-v8-5-d9f9f2642be3@ddn.com> References: <20241209-fuse-uring-for-6-10-rfc4-v8-0-d9f9f2642be3@ddn.com> In-Reply-To: <20241209-fuse-uring-for-6-10-rfc4-v8-0-d9f9f2642be3@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733756199; l=6974; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=MxfJjh+KWyLM/pBEqZ+TVduRkvAsbRDO2XTjnbrCNS8=; b=7fWLyN6l2MTxNDNYXoY9+Qt1ao76sGHBRJgxOzipQ4Tjrqu1aF1Sai+NiTE8igWSzMa0ic5pl qgx4Cz2xA2TBdIrA4PDhhHODkjdCzaODt1j0696lbJehi9QyeVGu1sn X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000A6734:EE_|MN0PR19MB6240:EE_ X-MS-Office365-Filtering-Correlation-Id: d18e5cef-1589-4a06-a786-08dd1861b341 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?r5L8kcFDPLVGof6EdQeSZC+2Nms2v1x?= =?utf-8?q?f/oDlMJhvg7S9orAeZNw6U5//VNJbGJmraCpTrzT5WEzTE1nQTSXuBMWFC0lnppsd?= =?utf-8?q?9uNLhxhBMbRFKbBN14KqsYzqckxBd57CFHjaq9erer0h5gP/djUP9Q0dgURrPYWjJ?= =?utf-8?q?FQObBwKC/RLlW9T3Jj5cqswxQFK+nWu1fDRfIlmpOxCbm7/yZPgjGydyaIKxZy11U?= =?utf-8?q?UHBhxHw50rCCTm2lWidbj2YlMIVF+vNrAUO15d07pQHo4WdQZH37udEaHGDQx7Jiy?= =?utf-8?q?lyEqQNcu/6OHMLsDl+rG+0XkCVaoVCPv8Bl4xUgegG+OmpPJkGBMGcERceZz4/Z6l?= =?utf-8?q?16BENaBTsc93oBI81vp7ALAPb5QkAvAMwwAP6U0oUUiJPsaMXrlEZ4TarZGwD/V+a?= =?utf-8?q?6yp9qafjwqmgHjBURk9kHIbYSRhn4/mtQZA2bytricPdwqniWL6ddCd7bugWrNyRm?= =?utf-8?q?xY6rVpR+BIoClknbmxB5F554FdIyGeV53/xoSn1eQajR9rbzVqdn+3G0jEbAAtS0W?= =?utf-8?q?IfvRaTK9kLwMOW74THT/+w30k98iGd4223i17Xd7Ru1gyGjdEfC/Hn/sUplxFRPs8?= =?utf-8?q?2J8pWsqnFdzUIjhHKfYrezjx1vAhjA70YOmICvgpxPCrOBNTSupQKWuLgHsQpfIYJ?= =?utf-8?q?3tZauuQgOkiJzfR1yoXrQTGj9VrnPkQnI9UD3aauVpXoiIDo+W+OXujN1EDD1sRRd?= =?utf-8?q?zJViEoS8jwJQyycKZuBYCvQhmd8GwNUd877kXiSybdED6IUyM3Umihe9glPi9Bu+F?= =?utf-8?q?AT3OUJUdQDJopJQmxhOV+HIRmf2lck3HPRIxFLMFsceadMcsnntJO2FFd9SSKEsDV?= =?utf-8?q?yAtxetEq5ixUxm+tHpeXVsBZxJUVXAav1AK9JAE8QcCIiELXAUL7O4tukkvZ8xOBo?= =?utf-8?q?4bZSqIVQq2jYWC8j2riNvyFNp4+Fe03n/vWS6/p0w+h5r6Zm3rlxCZPW0LE8KJwD5?= =?utf-8?q?n9NxXXhgq8odUqWz6gmGMEkYk/W5lkhOkReXORB5+mcGuSlAU/yTTbcUX5ObB2jrG?= =?utf-8?q?n6wmiW/WE8ObjPkRtHLlVggvozqScWGT/pXLdu0HL2Q9WOClEf26hV3jgaDN74F0a?= =?utf-8?q?Evl8KmaASkP7IOCO3/XIHG0Y5PvVkU+DanLgdWZAz9WQEc6r/TRr2SW2oiy6o4xlc?= =?utf-8?q?zwGPhWM+8QMpM0tIpnWU5oQfp6ENwvGIDH0MwW3ZZuZQdmLn9eYZ0V5jUbt4vvGYQ?= =?utf-8?q?khPsGFEUHD7buNXo9+Fd4jM3PpuLu9R6cH9uMR0faTNwDbSncBgOSlWmr3ALPQxJB?= =?utf-8?q?k182qjhsaSRoVNUpB4+JSDX2pFvOCZXCZzXysQpkpruyP/UCjPqZdxJ4c18ouJolZ?= =?utf-8?q?Iza05yCi7aQVC/WjwqCXHpg6Cm3wZwYl3XEUvxw5+H8jvgPAhyNXwY67tgaoNpSGf?= =?utf-8?q?67AHGREGH/E?= 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)(36860700013)(376014)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: oHWc5z7yEkWIj9eCYOPsdlKJlSKRT5Sv8do5abmaFA+9I2cwAR3+V5YUUQ0LqKae59K0f2wgvFK7tb9CgLZqEvbIUoTihg2l67L5xbakYTBskCV2gf5BBvynzUwzXIekaZSV6Z1r4Y8dp0D9hpN+tEdmVGi8iHxBCOEGdVPRqsQOgFABn3wHyn28M4WxgdwHNSNPMpof4UPnuHPZcNavyGfNpnp+smMfra5DGp4ntwn2hvZyguWE9A36fl2QGZzFvR/nOwLwGe016bRiAf8PTJDjVKsUf/iS165fokqOcMSe0ELwtVjhhkSPofLpBLh/IL1DQcXJWespqEtZTYLjfhyfFxTGfjTFY0sWxjzVxNOvavUs0rls0zKuNNkHKA5iCmVHHDPHwDeAzrUN+G/CHBIpG1IBwQG2uXRmC0VdKexJsAWdEDrTXMFt/ZzjuuxCM/WGxCMf0saCalwqoQYtxf7J8qtQ4vfTjBp1O22g+9SVNlsjZMyZFezieBgGbprwvzpk9AXWp589St4dWwlPxWSbZsEmG4Ylu2tA2pSO+567G+i0P5Uao3cX42W/ppZ93qz1AO8SdYjgNBIDl+SeUnpb2vf/AAY9C8yNlhRjhqnsaNU7AJ73m/57Me2kwN/tOS1ctzJ1MaeroFOn6YHSrQ== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2024 14:56:45.3859 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d18e5cef-1589-4a06-a786-08dd1861b341 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: MWH0EPF000A6734.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR19MB6240 X-BESS-ID: 1733756213-105335-13467-4253-1 X-BESS-VER: 2019.1_20241126.2220 X-BESS-Apparent-Source-IP: 104.47.58.49 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.260997 [from cloudscan12-98.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 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 Dec 9 14:56:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13899921 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 E704E1F2C24; Mon, 9 Dec 2024 14:57:05 +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=1733756230; cv=fail; b=U95o9rHATMx6NZaqVYrxDTKD9jPukteiqMFh1gZUHxTs/DBMh8Wvf9Ek8sBQrvyMb/1JpDPMx9qe4UQvKSkl+fBK0q3Ljgs+GRbCj/HIJes9di6X2gpk0YlrKT8cU96JttmH/aWwPCYm3XAkmJtoaOT8jsE2/TmOhtR4k7OKv6s= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733756230; c=relaxed/simple; bh=cKZJS0TQimjXXv+dr7LLkRkboc05UBW4qYNp2Q3qbv4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OMtovRUNV6KbBiu/k4xRiRa9x5FT5FSchjEGVDO8UB5hh11kagQlzEBhW3E3gB7B4J2JBCpPXTacYoli/wDUWfbhYHpka4Fym+h8FhBp6beuwJOr5GxT+8TExqlIb8ouBOTgq4KRiJKcLkNQrIg7eE5acAcuR6MnEtK3mDy3X4o= 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=Evlf3tEw; 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="Evlf3tEw" Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2043.outbound.protection.outlook.com [104.47.51.43]) by mx-outbound19-183.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 09 Dec 2024 14:56:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=eDzfddfV1l9r3ZC/ZSkrhTFHzUnHQNf8aCW89y1gx3QO6Kswip+vhgCNutqtjVR6HfmZn0QQP8hp+WdF4r0uu+oSOZ+VnG9IDMEP/0MUX6/NXtW5eAxqdM8kCstaGMtIKPRUZtLoIZ1MSILdR6qPrl8W4q2NkJftgCLHe0+rDSAGyNXI27eMc2AR5WY/xf+F73cpxQhaYz37wh7AbYg1Xl70Gb6RlDX0WFOvYZ4HXjWOcL/gcH0Z84r6xEeLh6HNtF6xjvB7OMLHsPepyM5BvKaC9iU0AuCmbUXn8qIvM5FzBYVJUJZEiF/U6I7YsBW+mqkJ8D2A0e67C3yiWGL3EQ== 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=Bx/AltGE5Pl/F4L17QtrNcKDJvytw6ekIKoMMr31Jc8=; b=o7Ba9NoqELPV0t7FaThf7xFkuYhyztpB16NljNaPimH/nyItuA/kMn4llEpvkXGz87qHvJgpaSD3S4cX3mwsaP5Ohntj3j4tmTZvaiThZJFB4lEykIvUu6Dhy/liT9ElUkyxNA4GXrAXpt4uqimv5uyFByz1ghr0y+Y8/8egKflS48GP3tPtBpgm2OUXFcNjT3XZzDf+ajQHFWuxwGbzAfeKwnner2KjZVoSSBsThgTRhNE0WcoaS5L/oyPaBtmbPYHeP4oF9Jl/X6xc5hR/ghxNIqQCJhoWv94sxTGHvt6Zic8vEA011SwR0mpJ90tkHcayTxLboXie2xrg8PbIrw== 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=Bx/AltGE5Pl/F4L17QtrNcKDJvytw6ekIKoMMr31Jc8=; b=Evlf3tEwVyELZQH/MUvuxE3lD7DV1+EOHtxQFJPpCpDeJbt6RDkYmczTbUp9IyVy1mvdHqaYf5ApAInIllxYNcIo6UrkuXEHL1ewqpGlKi1Cgn9Ir4s7aU5yw6EFiPyZWPE1YP2vo4zBjyIcuh0FCGWgg1hKxFtvec2Ejr9q1Mw= Received: from SA1P222CA0107.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:3c5::28) by DS0PR19MB7902.namprd19.prod.outlook.com (2603:10b6:8:15c::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.12; Mon, 9 Dec 2024 14:56:46 +0000 Received: from SA2PEPF00003F68.namprd04.prod.outlook.com (2603:10b6:806:3c5:cafe::1e) by SA1P222CA0107.outlook.office365.com (2603:10b6:806:3c5::28) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.14 via Frontend Transport; Mon, 9 Dec 2024 14:56:46 +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 SA2PEPF00003F68.mail.protection.outlook.com (10.167.248.43) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.7 via Frontend Transport; Mon, 9 Dec 2024 14:56:46 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 99FF955; Mon, 9 Dec 2024 14:56:45 +0000 (UTC) From: Bernd Schubert Date: Mon, 09 Dec 2024 15:56:28 +0100 Subject: [PATCH v8 06/16] 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: <20241209-fuse-uring-for-6-10-rfc4-v8-6-d9f9f2642be3@ddn.com> References: <20241209-fuse-uring-for-6-10-rfc4-v8-0-d9f9f2642be3@ddn.com> In-Reply-To: <20241209-fuse-uring-for-6-10-rfc4-v8-0-d9f9f2642be3@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733756199; l=17444; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=cKZJS0TQimjXXv+dr7LLkRkboc05UBW4qYNp2Q3qbv4=; b=C9ekvteGlKPISWkJv30hXMfW0KP42fEv6F1mkr0MPTsbLB5u03DgUzGR2WZ/ce6SECjIhqSoU iaTJo/4N7gdDZy/uWMFhEXujgHOci5HjwK1VwlcYtYjDFhRP5bMLqNZ X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00003F68:EE_|DS0PR19MB7902:EE_ X-MS-Office365-Filtering-Correlation-Id: e3dc2cf7-4f74-4ba2-47c0-08dd1861b3ca X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|36860700013|1800799024|7416014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?Bon5E272GKtCoazSpsfZN6yamUg60M1?= =?utf-8?q?9mfQ6JM7ofXI6l/HD9p1ne67xFff7+FhSJblZ0gU/6+QmUN3blNsk7gq9hmE344Yj?= =?utf-8?q?vbSZr1xhXfwMqMD+SPBGya2kDdTEiHhNZPGD7Mbw4xqW/M/StjjNz1qFAAseBrHUW?= =?utf-8?q?PrRgbW/+u/aEwcfFu2pvRFip2EdtBuFZi59arzwNJpGPG4yqPf8cS3rzOMBmTddeA?= =?utf-8?q?OrQVOZsi2PFeuNj/cipX7zdJa0MXYQ8ZZIPNgXDOaFgmAiQO77seYN9axvVCAc/zl?= =?utf-8?q?4NjoQR/W81rXTOhxMS6tAB8iUepzU/puR/ZUNH9VhT+CqNtvxUJ4YsPsQjlttVf3o?= =?utf-8?q?2N+jxFtZyZaYnMmWgBY+491kt1nKCSCDjJQ0p+p8bW5UNbrKPi2DVfBBqn411RVMi?= =?utf-8?q?Z+UcoG1GCJ+rs3KRw1O8rKnOk15AUDFaYfmHEjfM6QyTxTe/nuwbR9XxxeTWe1rXC?= =?utf-8?q?gyk33+DkcE7eGzlir4lCFD/xO+vPHiN38UHf0tS4aZ55Nmd4xQBndz4ctGkUxvZhG?= =?utf-8?q?fxBDd0+KmanzIzer/N9bevUsvesfquEn5gKWVpPI3l2pIJ/8IjCwoGXLaNjZf/E8j?= =?utf-8?q?uf0jOYRqU+BdQyGsXuU8uX59qUi4/XsHg5kd4y6fo8gFjk9cywuOHDAB30vte91jJ?= =?utf-8?q?7mFWo0P0iM9exvvF8231GgEWxIdrC1YdccK3WDgR+CJB89fY0p4fgLcKf2gAQvEKG?= =?utf-8?q?DYU/dlRV3p7bE0g78m/NWoNOB0BKOa/cNIEWHE/I8NgdAIjh4QYaY713w2pMFGSlE?= =?utf-8?q?/PuhoEEamVyG2lIwYH3oYoTHUSh/7+M3NknJHFNBnrKBym3cBdD6O1wOpquZiRJUO?= =?utf-8?q?okoMqOHrnDvR7a+6ZU05IuYP8b3RYGqZPb0j3Ur+65d1KDre0YJ7PXUPZnYgNBNzy?= =?utf-8?q?u9iOtoXc0ElKyuLALE0xL7kQ9uIxJ6U0LYn2JmmOkdHVb8UaM3E/zNfEj+kP1VCqN?= =?utf-8?q?pj8eQyhx+MEk+kYMsjMF3Q+mvTUp2OysfaPLHRQPAxwP0hDqADnoyorpvhJp4B4Yz?= =?utf-8?q?la21DUQEDc+HOy/SmJbQxrTOjFg0xkNcMTpkFPwTADYlg72rxwE5v5Xw1E9wn1Ylk?= =?utf-8?q?JVZc95ksuKtE+h79qRH9Vm3MpbBxyJyyzfWHREf+qg3BQr1MyOvgDXm4bqy26oSSr?= =?utf-8?q?Wbyip/AerbXdjNgBaOq43iN7p7LdMC+qlyoHtobRGR5O4ukIPxFH8pMsaB8a/RB6M?= =?utf-8?q?H+2yJ4U/EhVgSKAAc4S/sWNZXxnoVcryUYtnNF25z9u1OQ9Osbv8TsW1bLqmGu+qY?= =?utf-8?q?Zb2yNJjE547/MPvF/syVRTOC9ZUfniiefwNiGgH9ManrudENcORI5OZVLlqwQ0U6j?= =?utf-8?q?APDl5MxSPYuAkeNnsvxcpGhGUe7WFp2iwxEVCs4ragGsjq9cvpxHN1AcNiE8f9lGS?= =?utf-8?q?u/6SKMaWzWt?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(376014)(36860700013)(1800799024)(7416014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 1hqSOlUDDo1L/fdF7IfpXO/x5FEHLdtInynCfv9DQJYc1RW2FCBjaVlLHW67P66MQDt3rkeTysK7Q7tEysfnFCpTVq6qY2DS1tomoSD/ERtz/EYRsrPxKa0p1Zllo8DzMPBeglQhpF4NMNxDVBGbh3Y7zkwjMeOn1aM2pP0y3bJn0gLUXMHsmi1sBiBM1rt7b4zpV2eg0FiG2V8RtroRbHTSgFDnxd9I8eJB2ZzQkwylx3OecO926T/sZOfJXwBBNQ5zcbJIehWCx7Vh8C3GgUz43LkoVi/RUPrd+SKY1QrjvgsXuw5B54XfanBqxyYc2gIZbVep2lA+APv89ZTdocbSD8tRwKRDMX6W3LqJcnKJeg603NCGxtWnVwkYGqonCV9ZBIRHHYGEk2rpbcE2/K6ZbY4RKMVDe1oNgaLr971eO5I2Dt8zDFOcDk1GKr7w9wpo+fWG1oqmP5TaGzVVh6DRMqGxy4PDKI9qrJlwqS0ZJCDEecA7uIYKbm4VOxq+XcF+aXstDreatiMgIlZc+6mYqYKQfEr9LFPWMXmMyRvaJqiiTMqEmtF/TpZoZM2SsKS+EdXp72TtWLKSIVYc77zKaXimK24itEtWXIjF+pBDEq7mHX1MhNX9K1N6Ts6TFVBBVdYLm4hxZWFySG0gCw== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2024 14:56:46.2657 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e3dc2cf7-4f74-4ba2-47c0-08dd1861b3ca 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: SA2PEPF00003F68.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR19MB7902 X-BESS-ID: 1733756210-105047-13355-6305-1 X-BESS-VER: 2019.1_20241126.2220 X-BESS-Apparent-Source-IP: 104.47.51.43 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoZm5mbGQGYGUNTA1DA1MTE52c LSzNTANDXRNMU4LTHF0NDMwjzR1CLNQqk2FgAwajnaQgAAAA== X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260997 [from cloudscan13-27.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 This adds basic support for ring SQEs (with opcode=IORING_OP_URING_CMD). For now only FUSE_IO_URING_CMD_REGISTER is handled to register queue entries. Signed-off-by: Bernd Schubert --- fs/fuse/Kconfig | 12 ++ fs/fuse/Makefile | 1 + fs/fuse/dev_uring.c | 339 ++++++++++++++++++++++++++++++++++++++++++++++ fs/fuse/dev_uring_i.h | 118 ++++++++++++++++ fs/fuse/fuse_i.h | 5 + fs/fuse/inode.c | 10 ++ include/uapi/linux/fuse.h | 76 ++++++++++- 7 files changed, 560 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..f0c5807c94a55f9c9e2aa95ad078724971ddd125 --- /dev/null +++ b/fs/fuse/dev_uring.c @@ -0,0 +1,339 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * FUSE: Filesystem in Userspace + * Copyright (c) 2023-2024 DataDirect Networks. + */ + +#include "fuse_i.h" +#include "dev_uring_i.h" +#include "fuse_dev_i.h" + +#include +#include + +#ifdef CONFIG_FUSE_IO_URING +static bool __read_mostly enable_uring; +module_param(enable_uring, bool, 0644); +MODULE_PARM_DESC(enable_uring, + "Enable userspace communication through io-uring"); +#endif + +#define FUSE_URING_IOV_SEGS 2 /* header and payload */ + + +bool fuse_uring_enabled(void) +{ + return enable_uring; +} + +static int fuse_ring_ent_unset_userspace(struct fuse_ring_ent *ent) +{ + struct fuse_ring_queue *queue = ent->queue; + + lockdep_assert_held(&queue->lock); + + if (WARN_ON_ONCE(ent->state != FRRS_USERSPACE)) + return -EIO; + + ent->state = FRRS_COMMIT; + list_move(&ent->list, &queue->ent_commit_queue); + + return 0; +} + +void fuse_uring_destruct(struct fuse_conn *fc) +{ + struct fuse_ring *ring = fc->ring; + int qid; + + if (!ring) + return; + + for (qid = 0; qid < ring->nr_queues; qid++) { + struct fuse_ring_queue *queue = ring->queues[qid]; + + if (!queue) + continue; + + WARN_ON(!list_empty(&queue->ent_avail_queue)); + WARN_ON(!list_empty(&queue->ent_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 = NULL; + 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_t(size_t, FUSE_MIN_READ_BUFFER, fc->max_write); + max_payload_size = + max_t(size_t, 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 ERR_PTR(-ENOMEM); + 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(ring->queues[qid], queue); + spin_unlock(&fc->lock); + + return queue; +} + +/* + * Make a ring entry available for fuse_req assignment + */ +static void fuse_uring_ent_avail(struct fuse_ring_ent *ring_ent, + struct fuse_ring_queue *queue) +{ + list_move(&ring_ent->list, &queue->ent_avail_queue); + ring_ent->state = FRRS_WAIT; +} + +/* + * fuse_uring_req_fetch command handling + */ +static void _fuse_uring_register(struct fuse_ring_ent *ring_ent, + struct io_uring_cmd *cmd, + unsigned int issue_flags) +{ + struct fuse_ring_queue *queue = ring_ent->queue; + + spin_lock(&queue->lock); + fuse_uring_ent_avail(ring_ent, queue); + spin_unlock(&queue->lock); +} + +/* + * sqe->addr is a ptr to an iovec array, iov[0] has the headers, iov[1] + * the payload + */ +static int fuse_uring_get_iovec_from_sqe(const struct io_uring_sqe *sqe, + struct iovec iov[FUSE_URING_IOV_SEGS]) +{ + struct iovec __user *uiov = u64_to_user_ptr(READ_ONCE(sqe->addr)); + struct iov_iter iter; + ssize_t ret; + + if (sqe->len != FUSE_URING_IOV_SEGS) + return -EINVAL; + + /* + * Direction for buffer access will actually be READ and WRITE, + * using write for the import should include READ access as well. + */ + ret = import_iovec(WRITE, uiov, FUSE_URING_IOV_SEGS, + FUSE_URING_IOV_SEGS, &iov, &iter); + if (ret < 0) + return ret; + + return 0; +} + +/* Register header and payload buffer with the kernel and fetch a request */ +static int fuse_uring_register(struct io_uring_cmd *cmd, + unsigned int issue_flags, struct fuse_conn *fc) +{ + const struct fuse_uring_cmd_req *cmd_req = io_uring_sqe_cmd(cmd->sqe); + struct fuse_ring *ring = fc->ring; + struct fuse_ring_queue *queue; + struct fuse_ring_ent *ring_ent; + int err; + struct iovec iov[FUSE_URING_IOV_SEGS]; + size_t payload_size; + unsigned int qid = READ_ONCE(cmd_req->qid); + + err = fuse_uring_get_iovec_from_sqe(cmd->sqe, iov); + if (err) { + pr_info_ratelimited("Failed to get iovec from sqe, err=%d\n", + err); + return err; + } + + err = -ENOMEM; + if (!ring) { + ring = fuse_uring_create(fc); + if (!ring) + return err; + } + + if (qid >= ring->nr_queues) { + pr_info_ratelimited("fuse: Invalid ring qid %u\n", qid); + return -EINVAL; + } + + err = -ENOMEM; + queue = ring->queues[qid]; + if (!queue) { + queue = fuse_uring_create_queue(ring, qid); + if (!queue) + return err; + } + + /* + * The created queue above does not need to be destructed in + * case of entry errors below, will be done at ring destruction time. + */ + + ring_ent = kzalloc(sizeof(*ring_ent), GFP_KERNEL_ACCOUNT); + if (!ring_ent) + return err; + + INIT_LIST_HEAD(&ring_ent->list); + + ring_ent->queue = queue; + ring_ent->cmd = cmd; + + err = -EINVAL; + if (iov[0].iov_len < sizeof(struct fuse_uring_req_header)) { + pr_info_ratelimited("Invalid header len %zu\n", iov[0].iov_len); + goto err; + } + + ring_ent->headers = iov[0].iov_base; + ring_ent->payload = iov[1].iov_base; + payload_size = iov[1].iov_len; + + if (payload_size < ring->max_payload_sz) { + pr_info_ratelimited("Invalid req payload len %zu\n", + payload_size); + goto err; + } + + spin_lock(&queue->lock); + + /* + * FUSE_IO_URING_CMD_REGISTER is an initialization exception, needs + * state override + */ + ring_ent->state = FRRS_USERSPACE; + err = fuse_ring_ent_unset_userspace(ring_ent); + spin_unlock(&queue->lock); + if (WARN_ON_ONCE(err)) + goto err; + + _fuse_uring_register(ring_ent, cmd, issue_flags); + + return 0; +err: + list_del_init(&ring_ent->list); + kfree(ring_ent); + return err; +} + +/* + * Entry function from io_uring to handle the given passthrough command + * (op cocde IORING_OP_URING_CMD) + */ +int __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..73e9e3063bb038e8341d85cd2a440421275e6aa8 --- /dev/null +++ b/fs/fuse/dev_uring_i.h @@ -0,0 +1,118 @@ +/* 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_WAIT, + + /* 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; + + struct io_uring_cmd *cmd; + + struct list_head list; + + /* + * state the request is currently in + * (enum fuse_ring_req_state) + */ + unsigned int state; + + struct fuse_req *fuse_req; + + /* commit id to identify the server reply */ + uint64_t commit_id; +}; + +struct fuse_ring_queue { + /* + * back pointer to the main fuse uring structure that holds this + * queue + */ + struct fuse_ring *ring; + + /* queue id, typically also corresponds to the cpu core */ + unsigned int qid; + + /* + * queue lock, taken when any value in the queue changes _and_ also + * a ring entry state changes. + */ + spinlock_t lock; + + /* available ring entries (struct fuse_ring_ent) */ + struct list_head ent_avail_queue; + + /* + * entries in the process of being committed or in the process + * to be send to userspace + */ + struct list_head ent_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..388cb4b93f48575d5e57c27b02f59a80e2fbe93c 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 + +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 use 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 / struct fuse_out */ + char in_out[FUSE_URING_IN_OUT_HEADER_SZ]; + + /* per op code structs */ + char op_in[FUSE_URING_OP_IN_OUT_SZ]; + + /* struct fuse_ring_in_out */ + char ring_ent_in_out[sizeof(struct fuse_uring_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 Dec 9 14:56:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13899915 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 8C7371F0E46; Mon, 9 Dec 2024 14:57:02 +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=1733756226; cv=fail; b=EGn0yoNyh+pOq+45u4SB5Gh0/PQCBZqYLPY8gTfCLdAHC6tNbOfsB3ZSz+AKqFuQu4s3jfV+XUpp1js7D3jUrP4k1+nWsBCfhS3VAwn0tCkZY8WcWx9mz+rLBe3aKnRq8ZbJdzovgKALr6Xq2/pHah6eqpiMD3DaOyj4zO+Rh5w= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733756226; c=relaxed/simple; bh=pXmaGi493Z+xJwImaaI6EqAMWloNhxVZrnpvS83JwYQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=n8TMShpkI7C+srDQ5qThlTwYvrp3e9oXoookh33tu6cyB2GyJ/ZaT0Jsh8I63JJ9zxbHnPkNFJCN8eajsldHZexXzidxfgrKwmprw+Qta6Hb42bgLgaHx9NXI2SQvmr4KoeJ0KHMjchHPVbmBvzuyXI6lLCw0iUTfmA2Gjm2O8c= 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=FAGXxxWN; 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="FAGXxxWN" Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04lp2040.outbound.protection.outlook.com [104.47.74.40]) by mx-outbound22-162.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 09 Dec 2024 14:56:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ROuAz+D8op03/z3mOhrhRxsGeXXcONiDz90EY2Qcamg7Ow+h1BvYJGsgj+041j994RHJcbTYi4mVbRNzhIAEvrCxBlOus9tg6FWNFQab56DIzsZ8ACvVc6xpYIfh+GQcN14AGTjxf2pVsa8VIkKA6nXBE6Yt+19PikoXufnzHDAFuKnd2YuSCiQYF+pJvC5pfhg15jQ+aZ8vA2RH4FItVpGCoA+a/GcwDidsYfZEq1VPxQausxnLEH2aqtvYKwSt9tbqb3idhLF7H1S83Caqv+2FeH4C5rz4E0LSUnrM84ry2Y5hjt6z7X2Ngk3OMZtaHgcM2aQM90g0ywXYdsiFYQ== 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=UCKxJbX20aB+p+oZM8AKuQV84gHXK3+Z63HtwgJhJ7M=; b=MHeFNpRzcLS7KSkF0tJ36AAYK2WEQxJcYwdc6EXwlVdH18eCI0GevCJ1cSumRZc4gXnXrZ27iIeqIhr+n4YCM0w4H8Ij52s0u206XaRIRA6SM0c4xGdTSETJirKGwivvyzuXTaG82B7uL6Kz/oMMPhb3udvyyaABk9zOndWKEGwp6fZusOAPQB6FypP4Pgx9Zecwu8bre1KDjttTid2bYx4WASl6OhguvvTU/Fx9FTTbn5+x9MLSvgtZIFY+iV1oMW7dqknW1cWH2N1vb7jyS2BFnf0Q/4z3lTGzHnmWUCPYPtfWfEqymMSUvEGnQ7EhKrDqhADrP8MEoI5RNmGS1g== 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=UCKxJbX20aB+p+oZM8AKuQV84gHXK3+Z63HtwgJhJ7M=; b=FAGXxxWNkin0xmLqhd+W8eDgIoVLUuAJ1kF461pXSA2bjByw0cN2R+aPicetBMejJpSdKet9sm47foo8+CVQgFllVtOC/nDz9FJKBsLnSRfontN7J5o8pCOdbLyr7hKgk9yfzcH842arrr745Y2LnoSoZE17hiCGJZWBrqk1JLY= Received: from PH0PR07CA0030.namprd07.prod.outlook.com (2603:10b6:510:5::35) by SA3PR19MB7542.namprd19.prod.outlook.com (2603:10b6:806:320::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.11; Mon, 9 Dec 2024 14:56:47 +0000 Received: from MWH0EPF000A6730.namprd04.prod.outlook.com (2603:10b6:510:5:cafe::3a) by PH0PR07CA0030.outlook.office365.com (2603:10b6:510:5::35) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.14 via Frontend Transport; Mon, 9 Dec 2024 14:56:47 +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 MWH0EPF000A6730.mail.protection.outlook.com (10.167.249.22) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.7 via Frontend Transport; Mon, 9 Dec 2024 14:56:47 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 939DC18B; Mon, 9 Dec 2024 14:56:46 +0000 (UTC) From: Bernd Schubert Date: Mon, 09 Dec 2024 15:56:29 +0100 Subject: [PATCH v8 07/16] fuse: Make fuse_copy non static Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241209-fuse-uring-for-6-10-rfc4-v8-7-d9f9f2642be3@ddn.com> References: <20241209-fuse-uring-for-6-10-rfc4-v8-0-d9f9f2642be3@ddn.com> In-Reply-To: <20241209-fuse-uring-for-6-10-rfc4-v8-0-d9f9f2642be3@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733756199; l=3665; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=pXmaGi493Z+xJwImaaI6EqAMWloNhxVZrnpvS83JwYQ=; b=4q2QZNg2ovgZn6fZYHRlTjVsN9fR2XT8EWPnjH4hPKuu+nSeRfXgDa5qBU8eETLUNOQx5cNuM f1UueApjhCBCVK1WtjVyPavwCaVg9NAjot2FnxEckv8TTR6G1VduPvr X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000A6730:EE_|SA3PR19MB7542:EE_ X-MS-Office365-Filtering-Correlation-Id: 79df540a-d8b2-49bc-c755-08dd1861b471 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|7416014|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?q?ZRuLA7xAfsLEIJ47cRiOzJ524uwUARK?= =?utf-8?q?aBreVTJRqdKvDBW4qzw6I3A3FFdqRBH8ohtdGP1bF7ed7vxpWCyluWTdJTK2LP2GV?= =?utf-8?q?Pf1tiNKgcfxaTd+sarYsWpMtTTvdsADUbWlYAK5KGv5iBudATmf1mY4AdpzBR+fLc?= =?utf-8?q?T6+oUoUmFhYl+ZTuC5TtBwg0QkrtIS+sjzHzaGC3zNNUigleJp3IZQkbqo/UmXknk?= =?utf-8?q?5fzUOnm89NuWc7LQk9wXs9DldnpKZ8M3K+xJOI+ckpdtYL7ZCx78ACRnKpjnEIJU4?= =?utf-8?q?QFVqlNVIBYzoNG4XU+aHuV+TjdBnzchdh71HbIQUXU6wwZ0ekD3oShVyXoIvURvk4?= =?utf-8?q?phKiSPsUSqmPqA3VrCjsp9mdMSRrFbQwubwHMw6eK/bMWiZgvB1DTF4DSAO9l9zrK?= =?utf-8?q?W/vALzp2yFJFZETxuriPmgck4wv28YKdyK+QfznMMpzzAGx0JytTYr0PhjxQF0VIY?= =?utf-8?q?rT22ZKNZcpRfrVD9KsWapc/MsRfCRFTGpsbYFCoNXqFqssV+MdWxdtgHD/YlzAxGD?= =?utf-8?q?PwTJN81ClTP2Y48mBqLbDz3i2RApRYCQO68oWbeDNQD6aSlvKf42pDnTf1upUDA6E?= =?utf-8?q?y4f4hS0yOu5GCmavhnbN0o3ET9HrZfpEPyFv/M/F9Avsn9V61LirulX4pTdh0OqnZ?= =?utf-8?q?4kCZPQoL4J52dV61RJJTFmj3X5F924os4S5DvAiZt2MjOCq+2u/+Y8irebUQ0Ru2l?= =?utf-8?q?vBrwk0voU+Sd0HvgwDX/kBxwPpFx68Am1BKqoJvP4Prk2u233cjP5SIMeFuP3RYp/?= =?utf-8?q?k+inA67nl+zJjU4cotB4otoWSB7NAiMTnrMX5qohbPGP9pi3J26jOVTq8FtCmCJD0?= =?utf-8?q?wZKh7zEfF29+TbQBvKRf41GEOLXftsKr4icgLXQdkjGN631ENrUOvz5KPFM64Mufi?= =?utf-8?q?/XGS7/WOLeirkf5wif5N1CGeWwFSqeI2MuQmnRHsOv0tz+8zIXh5fWund5TvTXXA/?= =?utf-8?q?ote9ico6Wm+wyiISqIDH62f06S4/0TvTizDKrM3PaxMRltFjhxn0UG5K3xASuh6n7?= =?utf-8?q?PbmJXo9yzTRTG7qPUw8bqB198Ac7gluSSgEXL6aZFCoO1ED/8jsoAz6Px0K/1zgBl?= =?utf-8?q?VsSIpMDm2edT5j9pJ/vgE267hzpMC9duLHwvM+puTsI/nuam0kUvkn7VCSztFVuFs?= =?utf-8?q?bw5o/bz1BlsNF3tCgop8KE3cDKF1IJ4UrNJFi62ZVmPJkA9RxAUh+CHeFRG4Bj/kc?= =?utf-8?q?nhMDqblxc8g13cgvES7P+LLd9xrMvt5ohSBafnNBzY21SDVcv+u7GipXVDvgoUf9I?= =?utf-8?q?i85mo+Ii2kbpkMeMqE6rwVNLhkcieazSO+IYiWavmuNlNUK+YhYSC5Uar/j3Z/WLg?= =?utf-8?q?Y0Xwji2hlsgQIT0PnR+Mq9kFTEkNr1x/FN3nETaVFDoZhG1MyTNbmbRhXrFnqRfPA?= =?utf-8?q?kiMdZRqUfO4?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(1800799024)(7416014)(82310400026)(36860700013);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 24RAVpduUnXtmYOyTKjve3jSX06Ql8m49wELVBJdHSQzLczI8z1NbD8rbhCCINR9rx6W4IscXNBGCuWdnFbbm75ajBwnljYb81yT419ixCFzp2OJre4v1VdIATlyhV1Q/r0VX+N6sV1sSPgonr7Eeys0zhKKdiUhJt5V4eBzmBIIENEJyR+3OPEtOtmOfaHidhpp8w0DJfVcXa5Mehv2ZamLVxbZIK4dTwLxNLBFX/mU9ECgKEGjxsh+n7byUKWE6awdClb1CNrT1jYqG4IaabgAXcN2kI7QkuW3Sf3sJzzweKz4MfwK4q/ABvf70njh85F3ixam0jiywEIi8FPw9e+dWLf9jIcIxGqziXukOS7A3o2qHWz9p65/3eQdKVssWzpMxlkI7PsHUXG1D8Kkl0bcM+ah1bYeKDrR7HX1tv5qi7NCQrwBp7p2v9XNG6nzMzK2FRpyAbut1HFF1ImVf86F59k+ZeJof/8RReUPkYEDQwoeCHYcySmgDT2lUnni/hSrGdPR/x6MrEzHYo8j/Re/eafUHS4pIjdBQt6ptLHke1XsV5UGIMxzONcOYbY+sOXcUMFVNI5yvupmcUEuZy8d7n+xhE/TADd8/WwYh/uxbNimnDa7L4G/iVu2uwpoisREReSV8zduYpfuZPFg5w== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2024 14:56:47.3790 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 79df540a-d8b2-49bc-c755-08dd1861b471 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: MWH0EPF000A6730.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR19MB7542 X-BESS-ID: 1733756211-105794-13371-6924-1 X-BESS-VER: 2019.1_20241126.2220 X-BESS-Apparent-Source-IP: 104.47.74.40 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVsamJpZAVgZQ0NLUwsQwxTAtKd XE3NjEJDHZwMwyMSkxKcnQwtLCwDhVqTYWALR8J2JBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260997 [from cloudscan8-129.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 Dec 9 14:56:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13899911 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 1B88B1BEF9D; Mon, 9 Dec 2024 14:56:57 +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=1733756222; cv=fail; b=agsjdntJRcNTleemNu0BPZykILYrwMKrawKWVyrCWxUn7SNtRpEDC1n4UZyg2uvZ+t0FTm0ZzaT5GtHmcSazhnEAUR3kBZHZ0nmyDyJ+rV9sLx+gxtYvWdtpwet6qir4D3FAwKH9t7Q244dFZyHCAYOxSbbVOiCSXGKSrYGe9ik= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733756222; c=relaxed/simple; bh=RdW8CNS5KhJWzICWUZhnzVTBQaF0htre3+ISX55U/Tc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oMVmyyIalUDsAzy22iEw3jPcC/i+SpFNty686fdD6ZZ/kj05oDtaLQvhD/zEo3PITW7shlpdAkjRKLThmlyYYh1mI4kISVb9N2IbBhbzTuiZuoTM3jCI8W7ora8D0gsIS84PVsNFtmAGFfeSO6elch2yjygSb9U8e8WAObzQ7sg= 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=Pp/yWJeJ; 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="Pp/yWJeJ" Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2040.outbound.protection.outlook.com [104.47.51.40]) by mx-outbound14-107.us-east-2a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 09 Dec 2024 14:56:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hBq5RhFrbRiFLTskIvqQ0QKxSKxWfAOeYe+ABZzrVa/GgZbG+XcoumZRZAcMJPN+3zz5smIMPra7enoKcc/iIcu7V1z2AMyuBN+eLrp0NOwuAYjzxnhQMK+QIvhPtFib09WZ42ox4vtgm6VvlHoBt2zy5d7+V8JL0l5wZXp+SvpV6/4BdvIOv8dkEdAEDAX5dwf0nA9OXTYJq62tD9o9xChAc2YhdgNsVGVkedXKYvpdFqp57E1LXiagS1PsgGCGtW/sAFBvio5JfPGVsjmHGOAl9XTEbArU2oPhLYnFO/7aALdrLFESEEy6RuoVCx2wVfwkK3CnMRkzgTZcx5Aicw== 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=UjuaugDaR1JCbtHQLuBm9QFC1+Jpx/W+88lLdtt89Mw=; b=vbJHB2o78Rjz6ChTs0qwN5VkP0tzIVvHUlQn08eSgFxbVTcdbkaMIenUChA+ThMAtQkIdqxirxlgGyNUP+6Dr5Qz952vXC/tcHMon4ptyEZH5SRvXg4Y90SMKoxrby/QBXADK+sWaVaMY5RGMzpTCZoR4YFiH6T9IcCAcD366HhmSMjODRQ5u0gOH2m6HEMhErRoBC74TuiDkhPUDPEUpToq3G6xpY6k8LGivxk9wMD5GNP/NEtOUJUi2EGMbuzetmDdBsZdXiODjfzyHBowRxIzFn3hcLwTmNj65TsG5zuTf1mQXLkOgjfO4hAsSCGP4rIGhwCndnBwNpbjihra9Q== 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=UjuaugDaR1JCbtHQLuBm9QFC1+Jpx/W+88lLdtt89Mw=; b=Pp/yWJeJaRjPjGJ/BRlGiXYq4dSxVgwJiVA/8glhPADOXSahqH/l63qXG9bw7GX2DpEOl6uPs67PBUK73ZAEb29gURZTPLS3/GlXGkaRzvbsKcNKNlCM8m8LYrtI2r+PIyxQBvpJ2A5hDEYcNw5hp9y9HaBGOxC6l56Mtuhtxgw= Received: from SN6PR08CA0028.namprd08.prod.outlook.com (2603:10b6:805:66::41) by LV8PR19MB8422.namprd19.prod.outlook.com (2603:10b6:408:20b::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.17; Mon, 9 Dec 2024 14:56:48 +0000 Received: from SA2PEPF00003F62.namprd04.prod.outlook.com (2603:10b6:805:66:cafe::f1) by SN6PR08CA0028.outlook.office365.com (2603:10b6:805:66::41) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.10 via Frontend Transport; Mon, 9 Dec 2024 14:56:48 +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 SA2PEPF00003F62.mail.protection.outlook.com (10.167.248.37) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.7 via Frontend Transport; Mon, 9 Dec 2024 14:56:48 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 8ECB955; Mon, 9 Dec 2024 14:56:47 +0000 (UTC) From: Bernd Schubert Date: Mon, 09 Dec 2024 15:56:30 +0100 Subject: [PATCH v8 08/16] fuse: Add fuse-io-uring handling into fuse_copy Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241209-fuse-uring-for-6-10-rfc4-v8-8-d9f9f2642be3@ddn.com> References: <20241209-fuse-uring-for-6-10-rfc4-v8-0-d9f9f2642be3@ddn.com> In-Reply-To: <20241209-fuse-uring-for-6-10-rfc4-v8-0-d9f9f2642be3@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733756199; l=1731; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=RdW8CNS5KhJWzICWUZhnzVTBQaF0htre3+ISX55U/Tc=; b=tOOJRivkiSuFANMwGn/JjpTB21PJ2mhn5+IlP1rzXoxiYILg2hcBkL4EGv9ghlWhGOebXKYeF 8QQ0NeVo0v+BrIwIFr7GtlpJWBGI8Jyo8EW148nq0BYbvB8YVMsswqq X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00003F62:EE_|LV8PR19MB8422:EE_ X-MS-Office365-Filtering-Correlation-Id: 2f437dc0-768d-487f-7611-08dd1861b500 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|376014|7416014|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?EpNsMLWIFfMvbWK/qHUOSZh2H5muYwT?= =?utf-8?q?DVUEIMm8WZCAw02/NhzID31Fxk7BiVQMNv9Vo5oY81ep43WwFF5R6rfU5CBvkEgzC?= =?utf-8?q?ezD6d2NTmZtw0ItuiJDRtonyNKkQiMYuEQzqwn9dqVoXCy6ttsbyZ505G3j7tYfMO?= =?utf-8?q?UI+PppPxQr3BuP3yDF0vurEo1wkm8J2xibXgKsABbuXdhYIqx0yvwl1OXaZ4Y4iKn?= =?utf-8?q?F131IVenVdjGtqaDAfq9d0RirbzFMTJ9IUMgzn4fJDQQ1ecgkJNgKNbHrphf8tdqZ?= =?utf-8?q?tYQnMjuS2THrBW8oevHRzZbgQQnu33HpwUGYsTx+tIpjZ9Ph5JAM/e2qCSlpm4Ckc?= =?utf-8?q?Nut3DFRZe+bBSdSrG2P4zLHj+ZvOdAX2X+bMDELfl8o8CWmprK6tCoosrkc1jhkVK?= =?utf-8?q?cIM9KoD2L1qiXhB/oczLm65n90GEokKIffGnv9PEtvXN5tna5S+VYPe2oRSAeMwty?= =?utf-8?q?WYpqxWMBUW5j1faCfyVMzXuNUnWukXE3vtE3ilynpIy+pfvvtzgS241cOT3n6HGBn?= =?utf-8?q?/SZIAlE3jEcczAZrK0gW3oI1Q3HjK7+8YUBcQ2e6z9D91da5913FIno8+RdY6HfYH?= =?utf-8?q?G8ya96iGAQi8pAbcIP3DkP8XMb9WmO1oxnd+5hF6KcA5EIsiznHTsli/TRQ3Vv0V+?= =?utf-8?q?hGhEwbjjLJezdLRtaXpdFWJSdDFCbie7nmuzb6LbD+S+DOOXGPnzH80NdXh0uD8hY?= =?utf-8?q?kn5PhaJw6GNty4HRaOrYFS6EKPFhB3cyRMp+LGNrHXbdEsWAfTm7ACzP5BfDmKWxM?= =?utf-8?q?duyloYEMSJ5ndFyNlfpgEU8z/9zynQYjjNRBmOsFO198OFfIPFH7kutKTtCq+MFaP?= =?utf-8?q?a7W+gHUAY5V7Tt0qSTdhtvz7CXcejp018MZJMojpeRzZjDgQC/IbA84x39YdhwozF?= =?utf-8?q?12rHJs/FH7k3SAYOrDM8n/HMUTwpMbUboArz5bUhBQDdf/IJeDWjc1j0ETHCTJK9b?= =?utf-8?q?UYEhPFrcwOgjpiT/kZfhGORqiriVPtoe4wMGaL6GZRVcnEf59ttG9F9wY0dcvnjbp?= =?utf-8?q?VEQv/9XbtitDtP+vAhp615LGBc3WcHQ8T0ZxX/KI56xhz7E4GOYD6+7VjDAwIoQaI?= =?utf-8?q?IeL0UWyshIqsdK+CczSlP9QPGfkksRNbJZq3P4sgjhBfOnjXLddVEjV8j0rH9UySl?= =?utf-8?q?wIP2SZmDS9Guq5PEh0aFv38bwbzsDAcNUDrmowx4KES1f941bQP5ElSupjcFm/9jP?= =?utf-8?q?nS9LLFe6kXi45Ebqfus7iWHVAZQDW9GQ4d+LBOP3VqUDhkkmkMTNboCxQPsPC/jX2?= =?utf-8?q?eiaWHrnVbrZUhCjgNZLU8eB76Jhr/ezUM6XUBDhNvE+mxbkXwOIUAix8zKxE7nUKZ?= =?utf-8?q?K/p/6nd81YofvhUTfMiEJeuhot32f6ny0G4BtEez2/eF5xud1kDqiaS31V1o3zT3A?= =?utf-8?q?nbKCyyUu6lo?= 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)(7416014)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: nvYWpXvb3BavEBB+gwUH7ZbmMMGd/7k1N32NvZMg2Kz5Gy0k3QInEiUyq1gcB2noYAZ+l4l30COe9tRg2bYw/K9au3+E4v6osQp3hIHG95vHrg8ESCmxXM87qOo9JekLjuiR3FDfZ3WZpUQyiLFhlQP2GDzh9fnnEX3S9G3l/AnYx73vhi+JaV3I7px7k5HRElacToljKH3QMFxe5/g6ggD0b0qdJnU5TsbUHx6NxP4BzTIpUDIzuz25z/wj0ziM4xFEuHAJ+NhUTLwKNf2Gocf9Uh+ft20A9PV3ARL6I1ll/LDsQPGyfg4+GPL4URw1poK/whySkeNDXW+9iGIAvBxZbNYB5UBk66M5WiKqDw6RXeHRWxT6q4Hm7zOrDaLaC8YDmapxJw46kd1mwWWkHPeFoKtDH/gRSfI+nroUeGnHNhaqfvVb0qDDAkFKZ1niFj4iQieq4atDC3BF9q9efbw3TrkR6fKOcUNRAnvClNT3f23u/h24TehMdok0Hp1Cs2skau+Kp175mzpDtCD9rY+HOMoZAXzqqZLrHA5pj9qh7jt+r6XmHHkRI9AUsp4vKlSNx+KhBPfZ6ijPzAN1YI2yZbqCOp2uAHH9/ZdrV6//H1pRmLgnn3+I89LBWUkciPLMu2l/Gq4jJzVIaoN0TQ== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2024 14:56:48.2204 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2f437dc0-768d-487f-7611-08dd1861b500 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: SA2PEPF00003F62.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR19MB8422 X-BESS-ID: 1733756212-103691-13593-2143-1 X-BESS-VER: 2019.1_20241126.2220 X-BESS-Apparent-Source-IP: 104.47.51.40 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoZm5iZAVgZQMMk00dTQMNHE0j DN0MzIxMjMItXM3NQ0NSXZ2DLZ0jJJqTYWAL2ZUExBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260997 [from cloudscan22-230.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 Add special fuse-io-uring into the fuse argument copy handler. Signed-off-by: Bernd Schubert --- fs/fuse/dev.c | 12 +++++++++++- fs/fuse/fuse_dev_i.h | 5 +++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 6ee7e28a84c80a3e7c8dc933986c0388371ff6cd..2ba153054f7ba61a870c847cb87d81168220661f 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.offset += 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..0708730b656b97071de9a5331ef4d51a112c602c 100644 --- a/fs/fuse/fuse_dev_i.h +++ b/fs/fuse/fuse_dev_i.h @@ -27,6 +27,11 @@ struct fuse_copy_state { unsigned int len; unsigned int offset; unsigned int move_pages:1; + unsigned int is_uring:1; + struct { + /* overall offset with the user buffer */ + unsigned int offset; + } ring; }; static inline struct fuse_dev *fuse_get_dev(struct file *file) From patchwork Mon Dec 9 14:56:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13899910 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 9F12C1BEF8C; Mon, 9 Dec 2024 14:56:57 +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=1733756221; cv=fail; b=HxE78tjdvZhw09maPOQ0G3F5I7mbHhhGLXI+WUivlTiZKvbjW1i6hqKuJQHMe7LkzrVWB3GKaZrbdXfjCB2oVbgC02sXBm/QV+k5MvbN7t99M3lLOT5p5kk3RRw4JluewtE6po7j4Q3dg1NaIvO47I1z2iSGd5V748lEg7EzKps= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733756221; c=relaxed/simple; bh=DZCxR+9y+0VlsjDjUKCRoKY0s9jGT+XUZ1X4k7iI99Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SDzfSLssJpY5TDa1dZWS0u6J/F+PCApY2PQWQ7Ym13DVKc96aYBIKnR+OV8sn4szmyt1tg4+nKdh6v6Xscc9rvwie4mFLik/UoHwhu2j3jzX/gDWz/MdtGmzRdrXz6Wt7R4tOoYjOHFOI9Ijf0tMdgTC4+OBCBAkRnsWNl0MTUM= 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=E4ut91P5; 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="E4ut91P5" Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2174.outbound.protection.outlook.com [104.47.59.174]) by mx-outbound41-18.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 09 Dec 2024 14:56:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=td3QNpU4gtIk1esFayKa4RjmHap281TUqgdiZne/84rq0I+CT+EDsUC6rp9BM+NsMsYWEeq+UDzAk+dwVchlijCQ934CT2J+MaWvT5ACT81rXxB+a59d/lri0SD1MmudkEtnUwmacFJw/hnK53sNAWlsTJabvjuNtq9H8HstwNDAurENwz50RJcAMM2Kvi1g7e6mQSL+2OJc5fYB38PyUnChH3kbLIsFCIm4j0AfdT4gQGeIfIies6iDG0tdWSg6JfegJeiqH9eGGo78762kyqAfqdBYec5/99ZEmOf8Eb5mPctGEkwW7o2Qc/PYxtRlYBOZqSZIja12FXfSDwQu5g== 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=MJ17exbkEPno46IkvCvwmhAlMktHh0hGC08hsLQfEoI=; b=dK0p7HgplovmJO7kIKYLw6UkHUiuHvitOT+suvbLoMeFMS1fHsdqgH6MgZ62RD5CHwJIXjcEZOXCB6o+qdWSzARIGj18/TY7le1g5jYfy66xJW8gLWs1bildizCtgptpqohc3F4t2bZ0WonGqRMyzTFD8eO9I+L2tOt4fehJIo5C61/2Sq+StPC+hqSyZAtIWVD0WWOOiC6tShZKtNv9MxGpqyqe/E7AD+UiloOs/ToSv8tzN8X1PEj5IKu9/QibzT8gklAUB+4PiBm+JThc55UHnOMxrchCpnAx4WgZ6fmi3fuo0qXGbvYooDruRkd7lYNbw7CYViidyVOj7usVGg== 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=MJ17exbkEPno46IkvCvwmhAlMktHh0hGC08hsLQfEoI=; b=E4ut91P58z0uriPcAz3W+aXSJldANrDvWpW2S/iGH3uiAemGUyNL/Cz4xJzLbe3oXxfQF+L/hmtLYxeJQpJ9bxU+vHmALhIiSxhpIeSPl8mt7ooZY5K6RrJCnCrs2mDnttU9zvitz+ldUGvhFakDWxV6gToFGrcjqrZxIF2rHs4= Received: from MN2PR03CA0017.namprd03.prod.outlook.com (2603:10b6:208:23a::22) by PH0PR19MB7550.namprd19.prod.outlook.com (2603:10b6:510:28d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.18; Mon, 9 Dec 2024 14:56:50 +0000 Received: from BL02EPF00021F6D.namprd02.prod.outlook.com (2603:10b6:208:23a:cafe::75) by MN2PR03CA0017.outlook.office365.com (2603:10b6:208:23a::22) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.15 via Frontend Transport; Mon, 9 Dec 2024 14:56:49 +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 BL02EPF00021F6D.mail.protection.outlook.com (10.167.249.9) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.7 via Frontend Transport; Mon, 9 Dec 2024 14:56:49 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 8E62A192; Mon, 9 Dec 2024 14:56:48 +0000 (UTC) From: Bernd Schubert Date: Mon, 09 Dec 2024 15:56:31 +0100 Subject: [PATCH v8 09/16] 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: <20241209-fuse-uring-for-6-10-rfc4-v8-9-d9f9f2642be3@ddn.com> References: <20241209-fuse-uring-for-6-10-rfc4-v8-0-d9f9f2642be3@ddn.com> In-Reply-To: <20241209-fuse-uring-for-6-10-rfc4-v8-0-d9f9f2642be3@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733756199; l=3396; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=DZCxR+9y+0VlsjDjUKCRoKY0s9jGT+XUZ1X4k7iI99Y=; b=9jlgygMESdQ2+cnVjpGtsikH/ESH+1L8sHHc4w+jFjxT+y+JQU82vnFRxFVicY1hX+8SJvLOi ghIyDel/l5FBgqsMMgQ31uBNS5Z6+H6RyI5Hegs7lDPdzR3GQWdiENa X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F6D:EE_|PH0PR19MB7550:EE_ X-MS-Office365-Filtering-Correlation-Id: 12a520ce-e113-4720-62a4-08dd1861b5c3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|82310400026|7416014|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?Yv/3vja4TlqqSMbxgsnM+7VzZL4YFC4?= =?utf-8?q?lQcPvK2LpJ3VActAoUFdUUeWL+tNMnxAH6d4wwpduoGs/Lg+OvmCe3xs+WMKsEWnp?= =?utf-8?q?3T144v3Z26UHwUwH/U+xS6SQnNnMm1o750Y9vBrSiDonby0blJok1hTOxHyMhsEea?= =?utf-8?q?r/G977gFvXwgk+D5F0lL+zHyJ0AwqvTbBnf4UkgWo5q5kqP0U7GBE84VKE2XGdXZY?= =?utf-8?q?h4r1nmZlimk5ZclQ3zbN9e1xW39/cxcF0lCwbN9qDrlO5Whp2x9pn3dWjVT/lS+Tt?= =?utf-8?q?eB4/Ftrqntix129QaKWr4OBLEIIff0vwjvhoBejBejr2qslKy4l7TFJa4ISa8Bebk?= =?utf-8?q?4zA25Cr6//0RXz6Cev1x/3ylAd24D3EjbsY54jJNZAqHcCncnwae0pqZHIbp8s8LH?= =?utf-8?q?rxrz+FCo/X6AxQ4Aq70c51EuPpI++YKN6Ibb697J7OnbMmU6NQ586sGw/WdDWWXTd?= =?utf-8?q?DhVVbwHajIX1txVE46H1PfAU8rJRwOGHoTZSYIbukko03W9RZ2enz+Uvfj5n8mwXU?= =?utf-8?q?Pd9t4z+S4SAwslV8ZMRAmWp3KwqJEttBSwwHf1MILhqnJrz8X5sna9QtH+Zi4bQld?= =?utf-8?q?Eap79YUedZSukvKdvRj5ojF5cD16ULT3VMGeQP7Dx+pxyxEA3zfc30b89OqBTFO1w?= =?utf-8?q?zMuXi9PpKIy8ku5J+vYY//neEpELlOMf0JnDbmaQXpmyiew7s5fKztR4yZ/xe51li?= =?utf-8?q?37GrKFCudAGyeXVXTX4cG2qHQw2KwCEmsux++HckEvWYINCUpMvthYjHaqMksCLnf?= =?utf-8?q?RSWV98T0zI7f8EC5P0VTK0ATDVzrYkPu7MeJ0d/YjKvEUe1LV4Kmluq99J5rHKJob?= =?utf-8?q?zgkdkPjIMQG8mIhHMZOS7xSSIhxof0lX5DOI6Yy1I2CXB+1HsBapsZtpWTlC7GO0g?= =?utf-8?q?FPg7bh9+RbKmfCYO1tHJfq1dOuFjFKZ4Nc/UfXCWUIaa9Q5kNLB49G2kfFlbHRn9K?= =?utf-8?q?zkIOLDh4JSYo98pXJhH+HCGc8p9gtsRI+q7lpiSFLI3QTrpt74XYmtXuVNI4mvM+K?= =?utf-8?q?vMF2xyAk+PSTIdddKUvb57TqAKO7kWZ8Gr6pZOYt2La5g9boiAScyBkTQmF1VybkF?= =?utf-8?q?Bb/PEILzeWB6V+W9c72z+x6FtimDzhFXKJ/WOqwl7xj8VXOK7+0OVG72SGLCUlL9T?= =?utf-8?q?UDA6i5ZdM2qPa3uAvTu0/zBUqdePSAurAfMzu66t79waTYuTG5k1NWRnmXM/BCsX4?= =?utf-8?q?B4o4+L6C3Vzs81W744qdWaqfqznNY1c8tI3FAVc+UjCgoIKF9cCH0RdbIyPxX9/1R?= =?utf-8?q?FouY0u0kdIYtuJxE931TiGmKLz5nEczc8XBk9lt4ZS3jsA0SHEKgoKfN3iHIcSvEs?= =?utf-8?q?KUlHBbeJkoSKUkGJl6HQiEWaye/J3x0rz69ouTH+KwE4MFwxS5gDSdiZHa/8uJIBz?= =?utf-8?q?/GPn6gUsrFs?= 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)(82310400026)(7416014)(376014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: ajh7AVGJSxHTkMvL4bnxGURajsJ23CMpwcdPe6pun+WLoavw6LlH0NAAfK9pgZftkbpEjwZGHrRij4C8EnjzYKyb4TyJfCt+gkmSq2198ikHUt7ddPAEp+LXdipO50xVCRqfHYJF62g38hYdYVE2J5WbG9rihDW7BwmLvieK479fjoNwW3o+khoOTjIsYHKO4RPU8eUE/V7GEA99dOooxUMZfcKa2hhdV5zyPWslwgOxFj62/0D1dmkzQ9+s/AAD4+lSESmGORv6hluji2vw5amtJqk3FD7M1hVZQm11iv+BE41MTf1067MV534eEUxeFxzv/GOurWiVY9oJ7M8xdacU4OSwkIdkNAWSzwrsFTq6mv2eGulPmFee2Zwp/SK9rlDE2hMar542/ZPha4vO8xLgASbKaYxlC2isV9zsCy0pfn2LrA0FJ6oNz/je7aR6PTfqFmqgoDrVDJeNyk1mR/q+V/7RhS+bUIkcO4Zhx+sjBcYhW4fhCcZ3lcTVmHyLbYxyLAtvYjAvFQKcZ4kONDhjUb8iGNQfnaMGaH5r3sG+lc870mhDqhHiEyvAg62veYzjAAmKof23Gq/6OAHmCVWHREKu+Dh7eLs9XUFaIfiEv6uposOv+Xpk7glEPdYMGvGYVWAqH9/y/ogSvLUwbw== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2024 14:56:49.4040 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 12a520ce-e113-4720-62a4-08dd1861b5c3 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: BL02EPF00021F6D.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR19MB7550 X-BESS-ID: 1733756212-110514-13456-2496-1 X-BESS-VER: 2019.1_20241126.2220 X-BESS-Apparent-Source-IP: 104.47.59.174 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVsZGlkZAVgZQMDkp0STN3MjQOM 3CKM0k2TTNMs3QzDjF0DglNS0tOSVZqTYWAJhHGBdBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260997 [from cloudscan8-150.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 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 2ba153054f7ba61a870c847cb87d81168220661f..a45d92431769d4aadaf5c5792086abc5dda3c048 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 0708730b656b97071de9a5331ef4d51a112c602c..d7bf72dabd84c3896d1447380649e2f4d20b0643 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; @@ -43,6 +46,9 @@ static inline struct fuse_dev *fuse_get_dev(struct file *file) return READ_ONCE(file->private_data); } +unsigned int fuse_req_hash(u64 unique); +struct fuse_req *fuse_request_find(struct fuse_pqueue *fpq, u64 unique); + void fuse_dev_end_requests(struct list_head *head); void fuse_copy_init(struct fuse_copy_state *cs, int write, diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index 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 Dec 9 14:56:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13899913 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 46B331B4254; Mon, 9 Dec 2024 14:57:01 +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=1733756226; cv=fail; b=KIqvSTVCZARBOj1JSsjD2/L+JlUf5IW/74CyqsAcc984QJvx3bUi5i+0yxaZeBPb/wqsqw9qQkXYLSigQIRZmvzjFjtK7ShJ4q6oR19V+0/a359CTl6F/fOw3s10CwpUPUwZDRaMln/olbg/XEbED/gkknYYIyyH3JlJDJbh4Gg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733756226; c=relaxed/simple; bh=/M1wyxByHVvwTSlRk/PuikX9dE2QyBQM/XxMq9BZi5c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=u8osp4BH0Qr9odHRISxHS3/OtlMU4GeqEpV2q+H5CKnyChh5soH2gz0gSnlV4iKQzojCmOmmLultIn8uwq3FpsTOJSDDVcRnIxKN4195puHACY8ZmIwrNCHS45/g2luCtPZW5AMHeT5nu9ekfOmOdwkAj3fYAAcSDd/B/aB9EV4= 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=a9VggEDK; 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="a9VggEDK" Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2177.outbound.protection.outlook.com [104.47.57.177]) by mx-outbound13-209.us-east-2a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 09 Dec 2024 14:56:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=icpAKY+e4OUJxW6nrj61tZkdJyttWog7kQft2oq0y6WaIeiaJtWWExO7Xp+Qn+bNgtFFkKc3eqtxVra30eo2DGiwvxTZCLRvrgpSYg+uOlglEGHtuv35pvePX4gwbKHgd/CqcbpViJEGO+bjQyVkj3u1s+fWpXhUseXrbNOMiWC2RkYK++saaZEUB1M6q9rg7zq/RBY5RTNrg4AGar3tk2vYBD+fqd/ktSNAvy9MvI4JcjApf8m2aPeWNh4Mftf1YzWYmqGFmNnVZ1BRv4dpGlDSHkBt4i18tQkMEdKPn7q/GCL4rzFw15eSdmaNXHmvjeyIcKb3dNtrz5Dec7Yd5Q== 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=mW6dQn6sD2KFs/h3P37EcShT0ZSlBbUomfJOIKk81NQ=; b=y7DjbOHrfPmTsB+OqOcc4EjOF6EpqA4y7THt7d1/OJ0xMjWQE2CEw4gP7EZGuOZ1I6VyllFWmMDCADiJXX2SqXEBeDjo0tgmEywhv7O32FCFU96W8eferVIvmFXVoI3uLQBOiqe2CsX00aT0w5ZFzYhg9+SEufT5ciKSx172N8RyruUi2oCRQqiXJaPRREW+DrxfJWrOnAg3E04ANjm7uovRYKZwxiLr2S2aO3J9vxVVq01AappOxJGd5BoCsX9kg0YhBa6yHLHryVKuOdL5zNBfyeijDG228TtX9kxpWf3D7MtiMV80kNAHJ59bZXbgm/iOpwhNopxmkK+acvdERg== 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=mW6dQn6sD2KFs/h3P37EcShT0ZSlBbUomfJOIKk81NQ=; b=a9VggEDKdsFkZIqtEvuyA12D+RciOcRRHC9hv+HdNF08z5bwKUXv8gUKy4xfgd2h3OKWvb1DWRO6khJXIozGRUO7DJAY09kykA4CtD1UMo3/aUFUbrElc8j4dLFUvfj5Ysll5pSX+KgbFezK21OzVfZfL7qr9UReLJkIsHgxTmg= Received: from PH7PR17CA0061.namprd17.prod.outlook.com (2603:10b6:510:325::11) by CH3PR19MB8190.namprd19.prod.outlook.com (2603:10b6:610:19e::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.12; Mon, 9 Dec 2024 14:56:51 +0000 Received: from MWH0EPF000A6735.namprd04.prod.outlook.com (2603:10b6:510:325:cafe::97) by PH7PR17CA0061.outlook.office365.com (2603:10b6:510:325::11) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.12 via Frontend Transport; Mon, 9 Dec 2024 14:56:50 +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 MWH0EPF000A6735.mail.protection.outlook.com (10.167.249.27) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.7 via Frontend Transport; Mon, 9 Dec 2024 14:56:50 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 886CF55; Mon, 9 Dec 2024 14:56:49 +0000 (UTC) From: Bernd Schubert Date: Mon, 09 Dec 2024 15:56:32 +0100 Subject: [PATCH v8 10/16] 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: <20241209-fuse-uring-for-6-10-rfc4-v8-10-d9f9f2642be3@ddn.com> References: <20241209-fuse-uring-for-6-10-rfc4-v8-0-d9f9f2642be3@ddn.com> In-Reply-To: <20241209-fuse-uring-for-6-10-rfc4-v8-0-d9f9f2642be3@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733756199; l=15167; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=/M1wyxByHVvwTSlRk/PuikX9dE2QyBQM/XxMq9BZi5c=; b=sALJJITKPa29S3rT7Do6lY+HicpxVkWEi2rU5p+bfARVu23HPzZuar8YA8Uq4PpWqeE6MN+Ux 7sbVBNKYwG1CGN5WFIk7dOGRSIhXP3K6XpaN16Dr2V3ip6oBXP3lWRx X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000A6735:EE_|CH3PR19MB8190:EE_ X-MS-Office365-Filtering-Correlation-Id: 16f4a471-af45-49bc-d93d-08dd1861b627 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?Yrp8P/E7xwxgwrz1z8lTHMVsm6+aThg?= =?utf-8?q?LkN2zrgI/XV7/fFEtMtzdJf8XjZYSLeaC0c6UdyByOUErK3qEY9i0xB3lYCyaFxBT?= =?utf-8?q?Hn5lPUQgGpzEdc4OtXymYdegcc3by+DN8PYHY+XZM10uCWXJ3pcRGYX65ic9LrGHh?= =?utf-8?q?4HSITSdrqn2k1RG+8KRxbU5x19OASzxNiBfV81eiNtwkVrQzTCdZUSrvkSw1kUBat?= =?utf-8?q?DtP2k7lxPVx0yx+tp5X69u6xoGmzXHBPc4/eSAVWwVpgXOmvUUNVi1LLqWxvSCZVX?= =?utf-8?q?72aJZHeqkrwWiPbpNC9tiZYuPCTSyEDFc5HsnQmCmBt9jMCOqhORJYLbIpEhR32hz?= =?utf-8?q?nhCYusd1zC2ckMROq5P8Wf1DNtqogZwszt4doTFaxn084v8hI8yiyr6CSXmjWBO6u?= =?utf-8?q?giXRSaiTAIXDhqSa9Hd1uI0o82a4F/fuCDu9XKMQiLr+88g2jz4G+bLr0kbc5TrUr?= =?utf-8?q?0cK/NxJ5MoMwqfDSKfvjJveKhQUP9MZMhQGCMoJCfhRk065PeCkVzr8P3f2kRBq0l?= =?utf-8?q?l1JVQuYlvbchijM4XwA3FlP70pfaZK6L/extrqAOud7vLUzS+N1OPYT6LfUTqyDWc?= =?utf-8?q?Z/wtOrRj5KrMeMhCPQKy1njYremLO04FJ4X70XkhJ5udqncwjdvr8d7gIq6wZ/o7L?= =?utf-8?q?G8x/C6jEoVFtUj+/Sh2yEV1nvxM2e+yndysdArTxEADi7CXSbZyrogq2Ty39OSZ1g?= =?utf-8?q?SkdaFPvcOVDf5spdsmROdkRcE03SdBtVlmBYrtVEyo0QE9FCerkZlQ2Rs6fwE53Os?= =?utf-8?q?KlcsjXlUJr40RxxXNGnG0QFkQp5rWRa6olTrJnjlykejZcXRXeuvKCzC9laWO0CN2?= =?utf-8?q?wdl9XUwtAyepkDllIOXQ4JA9TF2eW1IE5gS9IDjSaN3EYrWOvVrmDWfQwgWIVdY0C?= =?utf-8?q?vtL4AoEv7Ve5ssZVh0fbBZo9NsNilAdjcfaj7N5WEBDojHwmdh5tNKGpRs6A46TVl?= =?utf-8?q?xw0KzM1hRrsgKNcDXwGZeUZ2jGUOvH0dJfJX63R/jc0RRviQtLhzlcDVeZjIXBWeP?= =?utf-8?q?pOSP13ErPuSGEyERPPwoiUD7NX4Zf/z6PeIJ+U1Djngi48ES+82HpGdNI5ro7mu1A?= =?utf-8?q?S5oMUyuj5u9Bgvd6v4SaKwtUsSOasIeg8sswy3ECJrCPOjzhh3SQDx+Hr8PtY35AP?= =?utf-8?q?m4N84/0vt9vr/6R7+as4GCwk2U8oSoZP0Uiy5yYR4oyjx3L45Sny/SCjuLce6xclR?= =?utf-8?q?CTsf2QW1KOCpwkIe4QPM4CI7Qm0YkDxfDzZPqcXjy0DizDkEHclI7cz539tWpGbET?= =?utf-8?q?fJMyQG/Zv7+HQo+6ubAo8ldkFNsKyl/Io08weIayDNKmKb/sfcHJ5U+ixbxuSJlZJ?= =?utf-8?q?D9YN70H6hkqkfoQB65JpB3tBLj516sZu97kYWp0EnAaaxCMbrWhCTpkR9KxhLOnDC?= =?utf-8?q?c5WZGb1Zgqm?= 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: r1b28nDkEshu7dqc7rgBnX3WIeBrke3xmIsYqnI5dPXJAITQZ5sjHokeEZwwkupKtRo5cc/4NIhsObUKVO4I+94PLbG/gh8YiwLd/31qDwLKy6KLvtTP6Z9lUJSeHDrEjU5orp2kiIrRyQ9HiFSZkCnn9y5gzPMq0p1o6kMK1lQ2DBud3VgJtNvIYLyjdcvs+UKgAxkna5gukEd5wZrFZU4iRP2/3xUiNxmNY5KIV9TX8D+L/l77v1fcTNUbuXMfm3KLbOAK692vCSN5u6MvDleCM/BGTNpcCHTX1bHVGsploq9mwNrI4u3Ngz3xgO/ywiabLE9M3PzDg7Guv7wVwnPRULwatSnJTBf9zovgO5EksB+Y94Psx5du2FxGTD+wfXG6vAVCin7VoWdufhxHdwCeQnKlDWPoJlxUXsQWJoQV262DrXJ67tOckBdultKHgvkLAA/gU+FRnT+8Na3CoJEdqFc9BE0JHkDbWbzk1nxVFNhmEIkrwBOC+Sg69PwDalAOBD0L+Grughf6IhPCMms+bunAGAn6EmvR3zQXibDYy46uSCZgNnCtKr3yj40/EJ139wGJnel4lEzTSzvbqL6aYzJWmPtLmshUTX5UG0g/MkmoRrbAStMLJpADFBGmopnbJNxS9RW+8F3FlgFE0w== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2024 14:56:50.2500 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 16f4a471-af45-49bc-d93d-08dd1861b627 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: MWH0EPF000A6735.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR19MB8190 X-BESS-ID: 1733756215-103537-13400-6407-1 X-BESS-VER: 2019.1_20241126.2220 X-BESS-Apparent-Source-IP: 104.47.57.177 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoYmZoYmQGYGUDTVzNjIKDXFIi Up1cjSzNTCIsko0dTMxCQlLS3V1MAiUak2FgAExr0UQgAAAA== X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260997 [from cloudscan9-140.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 --- fs/fuse/dev_uring.c | 431 ++++++++++++++++++++++++++++++++++++++++++++++++++ fs/fuse/dev_uring_i.h | 12 ++ fs/fuse/fuse_i.h | 4 + 3 files changed, 447 insertions(+) diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index f0c5807c94a55f9c9e2aa95ad078724971ddd125..b43e48dea4eba2d361119735c549f6a6cd461372 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -26,6 +26,19 @@ bool fuse_uring_enabled(void) return enable_uring; } +static void fuse_uring_req_end(struct fuse_ring_ent *ring_ent, bool set_err, + int error) +{ + struct fuse_req *req = ring_ent->fuse_req; + + if (set_err) + req->out.h.error = error; + + clear_bit(FR_SENT, &req->flags); + fuse_request_end(ring_ent->fuse_req); + ring_ent->fuse_req = NULL; +} + static int fuse_ring_ent_unset_userspace(struct fuse_ring_ent *ent) { struct fuse_ring_queue *queue = ent->queue; @@ -56,8 +69,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; } @@ -117,16 +133,30 @@ static struct fuse_ring_queue *fuse_uring_create_queue(struct fuse_ring *ring, { struct fuse_conn *fc = ring->fc; struct fuse_ring_queue *queue; + struct list_head *pq; queue = kzalloc(sizeof(*queue), GFP_KERNEL_ACCOUNT); if (!queue) return ERR_PTR(-ENOMEM); + pq = kcalloc(FUSE_PQ_HASH_SIZE, sizeof(struct list_head), GFP_KERNEL); + if (!pq) { + kfree(queue); + return ERR_PTR(-ENOMEM); + } + + kfree(queue->fpq.processing); 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]) { @@ -141,6 +171,210 @@ static struct fuse_ring_queue *fuse_uring_create_queue(struct fuse_ring *ring, return queue; } +/* + * Checks for errors and stores it into the request + */ +static int fuse_uring_out_header_has_err(struct fuse_out_header *oh, + struct fuse_req *req, + struct fuse_conn *fc) +{ + int err; + + err = -EINVAL; + if (oh->unique == 0) { + /* Not supportd through io-uring yet */ + pr_warn_once("notify through fuse-io-uring not supported\n"); + goto seterr; + } + + err = -EINVAL; + if (oh->error <= -ERESTARTSYS || oh->error > 0) + goto seterr; + + if (oh->error) { + err = oh->error; + goto err; + } + + err = -ENOENT; + if ((oh->unique & ~FUSE_INT_REQ_BIT) != req->in.h.unique) { + pr_warn_ratelimited("unique mismatch, expected: %llu got %llu\n", + req->in.h.unique, + oh->unique & ~FUSE_INT_REQ_BIT); + goto seterr; + } + + /* + * Is it an interrupt reply ID? + * XXX: Not supported through fuse-io-uring yet, it should not even + * find the request - should not happen. + */ + WARN_ON_ONCE(oh->unique & FUSE_INT_REQ_BIT); + + return 0; + +seterr: + oh->error = err; +err: + return err; +} + +static int fuse_uring_copy_from_ring(struct fuse_ring *ring, + struct fuse_req *req, + struct fuse_ring_ent *ent) +{ + struct fuse_copy_state cs; + struct fuse_args *args = req->args; + struct iov_iter iter; + int err, res; + struct fuse_uring_ent_in_out ring_in_out; + + res = copy_from_user(&ring_in_out, &ent->headers->ring_ent_in_out, + sizeof(ring_in_out)); + if (res) + return -EFAULT; + + err = import_ubuf(ITER_SOURCE, ent->payload, ring->max_payload_sz, + &iter); + if (err) + return err; + + fuse_copy_init(&cs, 0, &iter); + cs.is_uring = 1; + cs.req = req; + + return fuse_copy_out_args(&cs, args, ring_in_out.payload_sz); +} + + /* + * Copy data from the req to the ring buffer + */ +static int fuse_uring_copy_to_ring(struct fuse_ring *ring, struct fuse_req *req, + struct fuse_ring_ent *ent) +{ + struct fuse_copy_state cs; + struct fuse_args *args = req->args; + struct fuse_in_arg *in_args = args->in_args; + int num_args = args->in_numargs; + int err, res; + struct iov_iter iter; + struct fuse_uring_ent_in_out ent_in_out = { + .flags = 0, + .commit_id = ent->commit_id, + }; + + err = import_ubuf(ITER_DEST, ent->payload, ring->max_payload_sz, &iter); + if (err) { + pr_info_ratelimited("fuse: Import of user buffer failed\n"); + return err; + } + + fuse_copy_init(&cs, 1, &iter); + cs.is_uring = 1; + cs.req = req; + + if (num_args > 0) { + /* + * Expectation is that the first argument is the per op header. + * Some op code have that as zero. + */ + if (args->in_args[0].size > 0) { + res = copy_to_user(&ent->headers->op_in, in_args->value, + in_args->size); + err = res > 0 ? -EFAULT : res; + if (err) { + pr_info_ratelimited( + "Copying the header failed.\n"); + return err; + } + } + in_args++; + num_args--; + } + + /* copy the payload */ + err = fuse_copy_args(&cs, num_args, args->in_pages, + (struct fuse_arg *)in_args, 0); + if (err) { + pr_info_ratelimited("%s fuse_copy_args failed\n", __func__); + return err; + } + + ent_in_out.payload_sz = cs.ring.offset; + res = copy_to_user(&ent->headers->ring_ent_in_out, &ent_in_out, + sizeof(ent_in_out)); + err = res > 0 ? -EFAULT : res; + if (err) + return err; + + return 0; +} + +static int +fuse_uring_prepare_send(struct fuse_ring_ent *ring_ent) +{ + struct fuse_ring_queue *queue = ring_ent->queue; + struct fuse_ring *ring = queue->ring; + struct fuse_req *req = ring_ent->fuse_req; + int err, res; + + err = -EIO; + if (WARN_ON(ring_ent->state != FRRS_FUSE_REQ)) { + pr_err("qid=%d ring-req=%p invalid state %d on send\n", + queue->qid, ring_ent, ring_ent->state); + err = -EIO; + goto err; + } + + /* copy the request */ + err = fuse_uring_copy_to_ring(ring, req, ring_ent); + if (unlikely(err)) { + pr_info_ratelimited("Copy to ring failed: %d\n", err); + goto err; + } + + /* copy fuse_in_header */ + res = copy_to_user(&ring_ent->headers->in_out, &req->in.h, + sizeof(req->in.h)); + err = res > 0 ? -EFAULT : res; + if (err) + goto err; + + set_bit(FR_SENT, &req->flags); + return 0; + +err: + fuse_uring_req_end(ring_ent, true, err); + return err; +} + +/* + * Write data to the ring buffer and send the request to userspace, + * userspace will read it + * This is comparable with classical read(/dev/fuse) + */ +static int fuse_uring_send_next_to_ring(struct fuse_ring_ent *ring_ent, + unsigned int issue_flags) +{ + int err = 0; + struct fuse_ring_queue *queue = ring_ent->queue; + + err = fuse_uring_prepare_send(ring_ent); + if (err) + goto err; + + spin_lock(&queue->lock); + ring_ent->state = FRRS_USERSPACE; + list_move(&ring_ent->list, &queue->ent_in_userspace); + spin_unlock(&queue->lock); + + io_uring_cmd_done(ring_ent->cmd, 0, 0, issue_flags); + return 0; + +err: + return err; +} + /* * Make a ring entry available for fuse_req assignment */ @@ -151,6 +385,195 @@ static void fuse_uring_ent_avail(struct fuse_ring_ent *ring_ent, ring_ent->state = FRRS_WAIT; } +/* Used to find the request on SQE commit */ +static void fuse_uring_add_to_pq(struct fuse_ring_ent *ring_ent, + struct fuse_req *req) +{ + struct fuse_ring_queue *queue = ring_ent->queue; + struct fuse_pqueue *fpq = &queue->fpq; + unsigned int hash; + + /* commit_id is the unique id of the request */ + ring_ent->commit_id = req->in.h.unique; + + req->ring_entry = ring_ent; + hash = fuse_req_hash(ring_ent->commit_id); + list_move_tail(&req->list, &fpq->processing[hash]); +} + +/* + * Assign a fuse queue entry to the given entry + */ +static void fuse_uring_add_req_to_ring_ent(struct fuse_ring_ent *ring_ent, + struct fuse_req *req) +{ + struct fuse_ring_queue *queue = ring_ent->queue; + + lockdep_assert_held(&queue->lock); + + if (WARN_ON_ONCE(ring_ent->state != FRRS_WAIT && + ring_ent->state != FRRS_COMMIT)) { + pr_warn("%s qid=%d state=%d\n", __func__, ring_ent->queue->qid, + ring_ent->state); + } + list_del_init(&req->list); + clear_bit(FR_PENDING, &req->flags); + ring_ent->fuse_req = req; + ring_ent->state = FRRS_FUSE_REQ; + list_move(&ring_ent->list, &queue->ent_w_req_queue); + fuse_uring_add_to_pq(ring_ent, req); +} + +/* + * Release the ring entry and fetch the next fuse request if available + * + * @return true if a new request has been fetched + */ +static bool fuse_uring_ent_assign_req(struct fuse_ring_ent *ring_ent) + __must_hold(&queue->lock) +{ + struct fuse_req *req; + struct fuse_ring_queue *queue = ring_ent->queue; + struct list_head *req_queue = &queue->fuse_req_queue; + + lockdep_assert_held(&queue->lock); + + /* get and assign the next entry while it is still holding the lock */ + req = list_first_entry_or_null(req_queue, struct fuse_req, list); + if (req) { + fuse_uring_add_req_to_ring_ent(ring_ent, req); + return true; + } + + return false; +} + +/* + * Read data from the ring buffer, which user space has written to + * This is comparible with handling of classical write(/dev/fuse). + * Also make the ring request available again for new fuse requests. + */ +static void fuse_uring_commit(struct fuse_ring_ent *ring_ent, + unsigned int issue_flags) +{ + struct fuse_ring *ring = ring_ent->queue->ring; + struct fuse_conn *fc = ring->fc; + struct fuse_req *req = ring_ent->fuse_req; + ssize_t err = 0; + bool set_err = false; + + err = copy_from_user(&req->out.h, &ring_ent->headers->in_out, + sizeof(req->out.h)); + if (err) { + req->out.h.error = err; + goto out; + } + + err = fuse_uring_out_header_has_err(&req->out.h, req, fc); + if (err) { + /* req->out.h.error already set */ + goto out; + } + + err = fuse_uring_copy_from_ring(ring, req, ring_ent); + if (err) + set_err = true; + +out: + fuse_uring_req_end(ring_ent, set_err, err); +} + +/* + * Get the next fuse req and send it + */ +static void fuse_uring_next_fuse_req(struct fuse_ring_ent *ring_ent, + struct fuse_ring_queue *queue, + unsigned int issue_flags) +{ + int err; + bool has_next; + +retry: + spin_lock(&queue->lock); + fuse_uring_ent_avail(ring_ent, queue); + has_next = fuse_uring_ent_assign_req(ring_ent); + spin_unlock(&queue->lock); + + if (has_next) { + err = fuse_uring_send_next_to_ring(ring_ent, issue_flags); + if (err) + goto retry; + } +} + +/* FUSE_URING_CMD_COMMIT_AND_FETCH handler */ +static int fuse_uring_commit_fetch(struct io_uring_cmd *cmd, int issue_flags, + struct fuse_conn *fc) +{ + const struct fuse_uring_cmd_req *cmd_req = io_uring_sqe_cmd(cmd->sqe); + struct fuse_ring_ent *ring_ent; + int err; + struct fuse_ring *ring = fc->ring; + struct fuse_ring_queue *queue; + uint64_t commit_id = READ_ONCE(cmd_req->commit_id); + unsigned int qid = READ_ONCE(cmd_req->qid); + struct fuse_pqueue *fpq; + struct fuse_req *req; + + err = -ENOTCONN; + if (!ring) + return err; + + if (qid >= ring->nr_queues) + return -EINVAL; + + queue = ring->queues[qid]; + if (!queue) + return err; + fpq = &queue->fpq; + + spin_lock(&queue->lock); + /* Find a request based on the unique ID of the fuse request + * This should get revised, as it needs a hash calculation and list + * search. And full struct fuse_pqueue is needed (memory overhead). + * As well as the link from req to ring_ent. + */ + req = fuse_request_find(fpq, commit_id); + err = -ENOENT; + if (!req) { + pr_info("qid=%d commit_id %llu not found\n", queue->qid, + commit_id); + spin_unlock(&queue->lock); + return err; + } + list_del_init(&req->list); + ring_ent = req->ring_entry; + req->ring_entry = NULL; + + err = fuse_ring_ent_unset_userspace(ring_ent); + if (err != 0) { + pr_info_ratelimited("qid=%d commit_id %llu state %d", + queue->qid, commit_id, ring_ent->state); + spin_unlock(&queue->lock); + return err; + } + + ring_ent->cmd = cmd; + spin_unlock(&queue->lock); + + /* without the queue lock, as other locks are taken */ + fuse_uring_commit(ring_ent, issue_flags); + + /* + * Fetching the next request is absolutely required as queued + * fuse requests would otherwise not get processed - committing + * and fetching is done in one step vs legacy fuse, which has separated + * read (fetch request) and write (commit result). + */ + fuse_uring_next_fuse_req(ring_ent, queue, issue_flags); + return 0; +} + /* * fuse_uring_req_fetch command handling */ @@ -331,6 +754,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 73e9e3063bb038e8341d85cd2a440421275e6aa8..6149d43dc9438a0dec400a9cebb8c8b7755d66b0 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_WAIT, + /* 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, }; @@ -72,7 +75,16 @@ struct fuse_ring_queue { * entries in the process of being committed or in the process * to be send 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 Dec 9 14:56:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13899914 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 7FBAC12FB1B; Mon, 9 Dec 2024 14:57:01 +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=1733756225; cv=fail; b=jgsjoXwyzk5IufYBC6boy3ymI1VqkYUfUltNkBKn9ykPEhjXdK6I4x/hJs9xyR8VfUtLROqW+5xlZ9CA2rSHiMVR6DQ5fXy2bIXnXbsPlCFdR7nsqT02YS7bef7ll4y3Vj9nwqcszS8uo7l98Pk1yVVDxoxAdu7BTMX1vJP0COw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733756225; c=relaxed/simple; bh=eKI0U+AuJtwB+fno4Bz3mNklFoJFvo+ps52gGtzqSAA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=k5F03pQIXnUYjMPI1Hm0x0rjJkZFZ+a1bYwhUOb2FeS2hEtQmQgnECRyjcJxHPOER3OBSblsq/D35Fjj3u7+pgNh3rxoIT1mJyMogvCvxKFmi8pv2IIbA+Gy/dDNBNQXSJY+NmUqPTkbLk+aeHKuOLBO1xai9ZW0EyP+MmIP2ao= 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=dRVL/6sJ; 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="dRVL/6sJ" Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2169.outbound.protection.outlook.com [104.47.58.169]) by mx-outbound13-209.us-east-2a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 09 Dec 2024 14:56:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=V9zNsp79SiPfEw9puPv4FSodM3kpUae4zuWNVdf1cPSk8rKRCkXfd7faDpYQhuSFT23vYnOl28/C3sr8Ymf1jvyw/UJHAcPTXtA4Y/fWYJ5nzhPoArSYHZrTGnBpGx20TQEEBYk7KoFPADnIMU/gfGkQ6XELXN2x6TvZD+A6B6Y/HR1EtqW1qkh8E+IVxl7v5kmIdqm/oidRYJJcsecjaKS+wUovXjz2XCwksPqr87fqnxUygyGBI5tK2DgqFIkK4GNbs0EtLc7O29xTYtChTyWdbBIds2OqJD7kiISJmw+5D2TvFkiL7TjUbe3f5SDLJHpN6tSOqqvHuPFJ2uLsgQ== 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=xnkDbC7ZyYtC3bq9n1BrP7lWmOlzW6ZEWMvLboo70Q8=; b=YPfaWeE97AKbXukpKnCDMblORo9g7mVXgot3YjVVgVDe5vEWk52/q5OgEmKDhSQG9T3cE5NUSmp+Ljp7HR70LZjmb2Fld77ctmGOhq7i+sA/q4xMxSbTTVz6Ce2E/bDUb8FD6koV+EFBo9buItpu3GGTVAZ8OvT9pOYeQAuZT7Tye5XHZIN/1s9UZbker0rm59N5lJmQYYURXTDX8aLCt4/2LwuGqruZopPfnIOvaKkXCj3CFP0vzHZ162VADBslr4ZA1Z1ptEJSuGL8MIfvEsmb4xkzM7bvUkwRrjbGauYxIQrladozNsC/rxJyqDfw5O1hjRxStmcWG5lTktNoNg== 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=xnkDbC7ZyYtC3bq9n1BrP7lWmOlzW6ZEWMvLboo70Q8=; b=dRVL/6sJQT0zgl46OadR7rdn9xCR/m9LdfCqeHBM8at4FgRSxNuElL3rDhhphsedvUGaAv9Gki5hdx+6oaT5IXluzx1YYjOHWaLTnpPr8OiqA16PVWvbycF9r818KozFjYZ8y03aYQ+UmBhcVwHr/jfL79PSImL9Gu7jT5YUlSc= Received: from DS7PR05CA0088.namprd05.prod.outlook.com (2603:10b6:8:56::14) by CH3PR19MB7212.namprd19.prod.outlook.com (2603:10b6:610:144::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.18; Mon, 9 Dec 2024 14:56:52 +0000 Received: from DS3PEPF000099DB.namprd04.prod.outlook.com (2603:10b6:8:56:cafe::90) by DS7PR05CA0088.outlook.office365.com (2603:10b6:8:56::14) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8251.11 via Frontend Transport; Mon, 9 Dec 2024 14:56:52 +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 DS3PEPF000099DB.mail.protection.outlook.com (10.167.17.197) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.7 via Frontend Transport; Mon, 9 Dec 2024 14:56:52 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 82B9C4A; Mon, 9 Dec 2024 14:56:50 +0000 (UTC) From: Bernd Schubert Date: Mon, 09 Dec 2024 15:56:33 +0100 Subject: [PATCH v8 11/16] 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: <20241209-fuse-uring-for-6-10-rfc4-v8-11-d9f9f2642be3@ddn.com> References: <20241209-fuse-uring-for-6-10-rfc4-v8-0-d9f9f2642be3@ddn.com> In-Reply-To: <20241209-fuse-uring-for-6-10-rfc4-v8-0-d9f9f2642be3@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733756199; l=11744; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=eKI0U+AuJtwB+fno4Bz3mNklFoJFvo+ps52gGtzqSAA=; b=3bbSnMHDf9AHCJZ3iIHiJvKFK/wBN5wwfLr8tB9FiZ9QasG9oChOkbV4YceggfTBaIlDRhC1Z cGoS+eKj16VAMNCL9YdcNImfvswEK/XKHkhQ7vYO5HQ8RgKQWEhnGtI X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099DB:EE_|CH3PR19MB7212:EE_ X-MS-Office365-Filtering-Correlation-Id: 8a3ff317-432c-4b60-2f32-08dd1861b74f 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?I+CifftrmaZU13zPwGvd94RnRsrKW9u?= =?utf-8?q?dComo37eVNWd0ynh6SOs0EQ6VZFUa/8hBE+jqDnjomVlcVquIqZDyN0V79UhuFlFQ?= =?utf-8?q?J02i2Icz665zArZMpktlzN8P38sXVinJ801bmLY7aOLMwD+uZGg+mQFYplMJpKK8x?= =?utf-8?q?hqlQQfk8OplMF+JqZXX6afUy/s0vSUOMRn3TyzcEO/QlyCcXOk540u5tDzyvbz4Zq?= =?utf-8?q?llVvqAVyxCovR1d5XOXiOa7hGJGjd4PKyFX5Bqvi7L4y2N3ZbCoTiXEw7ew+GPpNy?= =?utf-8?q?9t2UI/HQe3FsNjtJAZ0yypqWulyMxdKlxpHMEOHTN1taguesZ8IWA08Vr5hnFCrjD?= =?utf-8?q?C/JYgLizJ3hW6o/lBJ+4OQKTMczI9pqM7rBAFTtmvVe0FrB/vnJ6s6gI5rA1m/cd7?= =?utf-8?q?TUjXXk3DkeZBHJoglaiYiGXvb9Ck7RV3nI8EW2Bdy1qciv49/t6zDzVUy8BzYdNPb?= =?utf-8?q?SEZkuB8ZA4Yb9eqk+FvWTelg7gzJAKis9Ph3JIHHEm7ptNKyF8HCPF8dCXBqbOhIK?= =?utf-8?q?qPP/ECj26rAuMoREmuer3I0lu0W07lcYYghl2V18Be+Zv80VNGpeIbpd6TnaGfcoJ?= =?utf-8?q?OVKpStYDfsBrJxtlB0MWFXoNu3yOzHFDb0F4bH85mz58sXJ5yA8gsmp2X6OCBcNgi?= =?utf-8?q?V5Bo9sL7lGOF0EL2iGDKmTDRTf2L/qHCBMTMOy6y42V0mqjqM1qkD5E5+p2EjGrOy?= =?utf-8?q?to9OIiSQ2FFOFxCzfM+1qJX1tFlW8k0xh4WWZlicg06cH4iaIipWg1GeOpAdKV1Ee?= =?utf-8?q?9rv3rZn2juIrGM+meN2fSbDLZ79egC04RWralEjVpg4EJdCAUCOV0rz7qmhA7p8P+?= =?utf-8?q?PW54zUpYn6GlWwWRgjPOgtrxPR6bMumD5S3fF3x43YJn9P5aZSN8pZhgnPkwPnetM?= =?utf-8?q?eng+xgBkWSOBGDRkH0sQjL4mehj2BNbmqtgVICaNpZqkodYS2VyIxhY1Nh24zcWBU?= =?utf-8?q?1qPu/aQZ3ne10kGQDwHDQj9Oi3tNaQ2aDuK3Eexbuol6e1d95fcGSXxj3ZTwQ8DGJ?= =?utf-8?q?gWHJ9siL+CslArekG0MUMp+AY13kNMgWNX60Vh75aeZrBiYB5jXnqxlvu6ZVL6aNn?= =?utf-8?q?kH/GabUAyBHzYKygFBvC6WW6WmoWnpGvT84PLykng5EI9lrRaWGd5CfF40Kpo4wpV?= =?utf-8?q?jqsuyGEcnSs7i5+cyISF/ZelQoan2WIJXpXPSQZw/guIFwCO1NGb4hFDBIXlDi46D?= =?utf-8?q?UQ+qnyLflteoDBvv4unLXwlJLf4AyylnCzwhVd+ij/ogyPtuM8GpYkF7WfJk5Dw8M?= =?utf-8?q?De2/8YecMUw+apomFGVha2XPcaxenNmdRdIscCxNrMO7i/pBHpSO9lI2GR90JVS8Y?= =?utf-8?q?ztA6aVi+f7gYIkPKxzVXlCulwBDyTLopCFgUF5LC0BSzB4XAgubvPONREjQ0r/qMD?= =?utf-8?q?Lp5ZyxkQZ3K?= 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: iDU2O+Pce2W852nWPdhx/E25hf/BcIKUtMwc4u/wo7PgKW/vRKfuxmm25kO6IR+7lZNIh4N89CN076lTI2cw7nT/7TfgcAwJG9VIPQsPS6FBStO4Nr75YKtiP2MX38lAETeQMZkEFaQPgbaWuyya7dMWP23lxte7ISpLBUxZSQJ5IkoT8CFX8goLfeBS+bWCWKtR44703+Q3NB9VVtaavtOlTZN5SKHppoITaD5hoplv0D8kbfwCHYmTw1lpUF49S+7wCveBg/6s5ib/C5xXgDNyuS2pVoxdaPH9iT7z5s9qXvJtSFjmrX1F/1PeSc/7wghJD727Gdx2gdrYgc3mveTKMdD8Ez1momZNgV23E2/o1/FFqsPOLLPDRNllGhT8AnG6lKBhmsYGRp1QJDLKwQt/QsZ5EWVllpFd0ccJhZG32Ox2MxE6cLmVCANKqO1r1Eoirh2cgE7EuOPCssK8LQY5F+rcXD76p1h0Ie6gH2xR8qIuJEhXNYl3QGO125GWVbKCSTF64meCDEULjeIe7qpJFssv46ysm9oi3MflwAfcB1lmMhUffVtgwI5SiJ14tAr4DP1RFemLXKuWOInR/uFiRTJJl9Wgg+GBrZxhw8F961+IlPG4DH0omHLYXcf/hDs6xVynhSPoS76hzkp4RQ== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2024 14:56:52.2011 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8a3ff317-432c-4b60-2f32-08dd1861b74f 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: DS3PEPF000099DB.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR19MB7212 X-BESS-ID: 1733756216-103537-13392-6407-1 X-BESS-VER: 2019.1_20241126.2220 X-BESS-Apparent-Source-IP: 104.47.58.169 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoaGxsYGQGYGUDTVKMnYwjzZMN E8LcXEwsjYxCzZ2DTF0sDI0tDIzMjUVKk2FgClph0QQgAAAA== X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260997 [from cloudscan12-245.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 On teardown struct file_operations::uring_cmd requests need to be completed by calling io_uring_cmd_done(). Not completing all ring entries would result in busy io-uring tasks giving warning messages in intervals and unreleased struct file. Additionally the fuse connection and with that the ring can only get released when all io-uring commands are completed. Completion is done with ring entries that are a) in waiting state for new fuse requests - io_uring_cmd_done is needed b) already in userspace - io_uring_cmd_done through teardown is not needed, the request can just get released. If fuse server is still active and commits such a ring entry, fuse_uring_cmd() already checks if the connection is active and then complete the io-uring itself with -ENOTCONN. I.e. special handling is not needed. This scheme is basically represented by the ring entry state FRRS_WAIT and FRRS_USERSPACE. Entries in state: - FRRS_INIT: No action needed, do not contribute to ring->queue_refs yet - All other states: Are currently processed by other tasks, async teardown is needed and it has to wait for the two states above. It could be also solved without an async teardown task, but would require additional if conditions in hot code paths. Also in my personal opinion the code looks cleaner with async teardown. Signed-off-by: Bernd Schubert --- fs/fuse/dev.c | 9 +++ fs/fuse/dev_uring.c | 206 ++++++++++++++++++++++++++++++++++++++++++++++++++ fs/fuse/dev_uring_i.h | 51 +++++++++++++ 3 files changed, 266 insertions(+) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index a45d92431769d4aadaf5c5792086abc5dda3c048..8da0e6437250b8136643e47bf960dd809ce06f78 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 b43e48dea4eba2d361119735c549f6a6cd461372..60bcddec773d1cf3bbefc674fdbdfb7823b7fbc1 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -54,6 +54,37 @@ static int fuse_ring_ent_unset_userspace(struct fuse_ring_ent *ent) return 0; } +/* Abort all list queued request on the given ring queue */ +static void fuse_uring_abort_end_queue_requests(struct fuse_ring_queue *queue) +{ + struct fuse_req *req; + LIST_HEAD(req_list); + + spin_lock(&queue->lock); + list_for_each_entry(req, &queue->fuse_req_queue, list) + clear_bit(FR_PENDING, &req->flags); + list_splice_init(&queue->fuse_req_queue, &req_list); + spin_unlock(&queue->lock); + + /* must not hold queue lock to avoid order issues with fi->lock */ + fuse_dev_end_requests(&req_list); +} + +void fuse_uring_abort_end_requests(struct fuse_ring *ring) +{ + int qid; + 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; @@ -114,10 +145,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; @@ -171,6 +205,174 @@ 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, + bool need_cmd_done) +{ + /* + * fuse_request_end() might take other locks like fi->lock and + * can lead to lock ordering issues + */ + lockdep_assert_not_held(&ent->queue->lock); + + if (need_cmd_done) + io_uring_cmd_done(ent->cmd, -ENOTCONN, 0, + IO_URING_F_UNLOCKED); + + if (ent->fuse_req) + fuse_uring_stop_fuse_req_end(ent); + + list_del_init(&ent->list); + kfree(ent); +} + +static void fuse_uring_stop_list_entries(struct list_head *head, + struct fuse_ring_queue *queue, + enum fuse_ring_req_state exp_state) +{ + struct fuse_ring *ring = queue->ring; + struct fuse_ring_ent *ent, *next; + ssize_t queue_refs = SSIZE_MAX; + LIST_HEAD(to_teardown); + + spin_lock(&queue->lock); + list_for_each_entry_safe(ent, next, head, list) { + if (ent->state != exp_state) { + pr_warn("entry teardown qid=%d state=%d expected=%d", + queue->qid, ent->state, exp_state); + continue; + } + + list_move(&ent->list, &to_teardown); + } + spin_unlock(&queue->lock); + + /* no queue lock to avoid lock order issues */ + list_for_each_entry_safe(ent, next, &to_teardown, list) { + bool need_cmd_done = ent->state != FRRS_USERSPACE; + + fuse_uring_entry_teardown(ent, need_cmd_done); + queue_refs = atomic_dec_return(&ring->queue_refs); + + 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_WAIT); +} + +/* + * Log state debug info + */ +static void fuse_uring_log_ent_state(struct fuse_ring *ring) +{ + int qid; + struct fuse_ring_ent *ent; + + for (qid = 0; qid < ring->nr_queues; qid++) { + struct fuse_ring_queue *queue = ring->queues[qid]; + + if (!queue) + continue; + + spin_lock(&queue->lock); + /* + * Log entries from the intermediate queue, the other queues + * should be empty + */ + list_for_each_entry(ent, &queue->ent_w_req_queue, list) { + pr_info(" ent-req-queue ring=%p qid=%d ent=%p state=%d\n", + ring, qid, ent, ent->state); + } + list_for_each_entry(ent, &queue->ent_commit_queue, list) { + pr_info(" ent-req-queue ring=%p qid=%d ent=%p state=%d\n", + ring, qid, ent, ent->state); + } + spin_unlock(&queue->lock); + } + ring->stop_debug_log = 1; +} + +static void fuse_uring_async_stop_queues(struct work_struct *work) +{ + int qid; + struct fuse_ring *ring = + container_of(work, struct fuse_ring, async_teardown_work.work); + + /* XXX code dup */ + for (qid = 0; qid < ring->nr_queues; qid++) { + struct fuse_ring_queue *queue = READ_ONCE(ring->queues[qid]); + + if (!queue) + continue; + + fuse_uring_teardown_entries(queue); + } + + /* + * Some ring entries are might be in the middle of IO operations, + * i.e. in process to get handled by file_operations::uring_cmd + * or on the way to userspace - we could handle that with conditions in + * run time code, but easier/cleaner to have an async tear down handler + * If there are still queue references left + */ + if (atomic_read(&ring->queue_refs) > 0) { + if (time_after(jiffies, + ring->teardown_time + FUSE_URING_TEARDOWN_TIMEOUT)) + fuse_uring_log_ent_state(ring); + + schedule_delayed_work(&ring->async_teardown_work, + FUSE_URING_TEARDOWN_INTERVAL); + } else { + wake_up_all(&ring->stop_waitq); + } +} + +/* + * Stop the ring queues + */ +void fuse_uring_stop_queues(struct fuse_ring *ring) +{ + int qid; + + for (qid = 0; qid < ring->nr_queues; qid++) { + struct fuse_ring_queue *queue = READ_ONCE(ring->queues[qid]); + + if (!queue) + continue; + + fuse_uring_teardown_entries(queue); + } + + if (atomic_read(&ring->queue_refs) > 0) { + ring->teardown_time = jiffies; + INIT_DELAYED_WORK(&ring->async_teardown_work, + fuse_uring_async_stop_queues); + schedule_delayed_work(&ring->async_teardown_work, + FUSE_URING_TEARDOWN_INTERVAL); + } else { + wake_up_all(&ring->stop_waitq); + } +} + /* * Checks for errors and stores it into the request */ @@ -532,6 +734,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 @@ -696,6 +901,7 @@ static int fuse_uring_register(struct io_uring_cmd *cmd, if (WARN_ON_ONCE(err)) goto err; + atomic_inc(&ring->queue_refs); _fuse_uring_register(ring_ent, cmd, issue_flags); return 0; diff --git a/fs/fuse/dev_uring_i.h b/fs/fuse/dev_uring_i.h index 6149d43dc9438a0dec400a9cebb8c8b7755d66b0..392894d7b6fb15472d72945150517a9f0a029253 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, @@ -85,6 +88,8 @@ struct fuse_ring_queue { struct list_head fuse_req_queue; struct fuse_pqueue fpq; + + bool stopped; }; /** @@ -102,12 +107,51 @@ struct fuse_ring { size_t max_payload_sz; struct fuse_ring_queue **queues; + /* + * Log ring entry states onces on stop when entries cannot be + * released + */ + unsigned int stop_debug_log : 1; + + wait_queue_head_t stop_waitq; + + /* async tear down */ + struct delayed_work async_teardown_work; + + /* log */ + unsigned long teardown_time; + + atomic_t queue_refs; }; bool fuse_uring_enabled(void); void fuse_uring_destruct(struct fuse_conn *fc); +void fuse_uring_stop_queues(struct fuse_ring *ring); +void fuse_uring_abort_end_requests(struct fuse_ring *ring); int fuse_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags); +static inline void fuse_uring_abort(struct fuse_conn *fc) +{ + struct fuse_ring *ring = fc->ring; + + if (ring == NULL) + return; + + if (atomic_read(&ring->queue_refs) > 0) { + fuse_uring_abort_end_requests(ring); + fuse_uring_stop_queues(ring); + } +} + +static inline void fuse_uring_wait_stopped_queues(struct fuse_conn *fc) +{ + struct fuse_ring *ring = fc->ring; + + if (ring) + wait_event(ring->stop_waitq, + atomic_read(&ring->queue_refs) == 0); +} + #else /* CONFIG_FUSE_IO_URING */ struct fuse_ring; @@ -125,6 +169,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 Dec 9 14:56:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13899923 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 D46FE222D6C; Mon, 9 Dec 2024 14:57:09 +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=1733756233; cv=fail; b=NVvHNSZIpzV0FGPFWZ51zrbfJii8fSOnGBf5GuoVQTyefk18EaYqXKaEC6YCBEPKNUkBD4GI9Ezc9SFrYQymMUqjKI4Lfr8/gG3IuBALqM8g4ZjWDGPLnUgYDSz9qwyQogCkhjT+ElXvJGUN33yoL/c+g0d3FBb81t6WW1b0ZBE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733756233; c=relaxed/simple; bh=CZr3S7iiYqHqnIv3eTleEfD+5LU4X0VMvfqqhWyF0kI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UI89LPMB4Wnmg25cYE7Dw1QRX1oA8u1tQZ2Eg1haRq4GC+5YktnDcfT3/qz0UW0mFAMYaW07LJ48abysWbuVYTCUan+vs8ljB+Pm3VmMn4GkFSogL/l5omHgBTeFlHcJHxrg9WVxBzpRhMTaqoRwetovFOD1D2fN323Q/BDM4JM= 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=aXNW/ew7; 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="aXNW/ew7" Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2168.outbound.protection.outlook.com [104.47.55.168]) by mx-outbound19-223.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 09 Dec 2024 14:57:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QCIN4Mj+k/4s+P+upM2iTMqWgWalXOGM3h+5ozsTD+hrauxChRFGXf1Nhe25XEu5C8a0jc49VMw/1GI1rtwgRL9JlV+KrCK/VPFL4ofZSLyyQxqkUztSBotLCdq+szxLuzWgRkeYCM8pjJfXSt9mLkaAv4lI+cxRDdeuS8vmut1+HOiz9JoGGNpnVAI8zy3+zFfUlKR9UMF5cYWe5MGfND16OLNo1EwBj8c/epQaePSn2E7AQtT+MY9XRUoBD8Z08KaDpq9T9hfN7ooNvLqjXf5nYyW2/EFUR21eoua9k4z1SoDcyi++6HvZT7+upFJdMiqiiZbyTVu1T2PX5WeEEA== 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=J7Iq7p4MbRs+sH4wgNVtfpwoxwBVqkpF837dtxkSE+4=; b=njwdknqXiRvE3R7/qh40gtxoEOFR53YG1P0R1cVmkRKP7kxeKWOC0pk7SamnWqFR+jJCgHU0lh5JWPf02+YEAMUMwVHo90Zj7LYNcao6LaY8Ixs0zSjtXvGLYoJNF0zD6WTkB6O13eTTNebBD6Fuw/lLkxf59uL6gzKOD5cgXLCSqssUNzFkEMBaj2LK+FddQ7pSytM9XMRsU+itDCHr8jfLMoNKs/3E5f/GiE5RDa6bWy2GhQooQnkbMEt/QZsF4ZI44wQZKosddFU8A0nUGbnAdFROVaFFLCgJmYO0jkI5E3IOxKRh1ZYmM75p4j7cvddnBZCBRj3XC6H0PKk6YA== 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=J7Iq7p4MbRs+sH4wgNVtfpwoxwBVqkpF837dtxkSE+4=; b=aXNW/ew749hpdE0XoNNc4DilT897qVDVcLtWxhFlnUDeP7IBJ7fRz7f4+q8RMjldij5OZeYuu0ltuam/MuT+DK51novGqUJQpZVnIpVUuDMwzLdhy0ttlhBOvxv6i+N4Y6Ho+MEJhYUaqtL1Ct1zZqd9M1vT8CCYutiucfGAZCw= Received: from CH0PR13CA0043.namprd13.prod.outlook.com (2603:10b6:610:b2::18) by DS0PR19MB7719.namprd19.prod.outlook.com (2603:10b6:8:fc::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.12; Mon, 9 Dec 2024 14:56:52 +0000 Received: from DS3PEPF000099DC.namprd04.prod.outlook.com (2603:10b6:610:b2:cafe::f5) by CH0PR13CA0043.outlook.office365.com (2603:10b6:610:b2::18) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8251.11 via Frontend Transport; Mon, 9 Dec 2024 14:56:52 +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 DS3PEPF000099DC.mail.protection.outlook.com (10.167.17.198) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.7 via Frontend Transport; Mon, 9 Dec 2024 14:56:52 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 7C26155; Mon, 9 Dec 2024 14:56:51 +0000 (UTC) From: Bernd Schubert Date: Mon, 09 Dec 2024 15:56:34 +0100 Subject: [PATCH v8 12/16] 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: <20241209-fuse-uring-for-6-10-rfc4-v8-12-d9f9f2642be3@ddn.com> References: <20241209-fuse-uring-for-6-10-rfc4-v8-0-d9f9f2642be3@ddn.com> In-Reply-To: <20241209-fuse-uring-for-6-10-rfc4-v8-0-d9f9f2642be3@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733756199; l=1912; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=CZr3S7iiYqHqnIv3eTleEfD+5LU4X0VMvfqqhWyF0kI=; b=5SvKvr+oNHrrErmPGprJTijJglJmlo2AWPzoQKirNNLA2de7tNW2u1+4GY/Z4QQY93XDiLR4o fcaaZ/KfUa8CK62MZGMnjzabgG5yVbgs6n2NNT3ptPMNtRKc7439aY/ X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099DC:EE_|DS0PR19MB7719:EE_ X-MS-Office365-Filtering-Correlation-Id: 8d03c427-78a8-4a8e-73d4-08dd1861b75d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700013|7416014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?utf-8?q?fnwOQE1emzborc7h/0SVzYaQuJfvKe3?= =?utf-8?q?qQ+30l1FTmTIgtZEJ/jXfYI1tz9NncxV1DAfuKimfQRxUcg8Kiz+nwmfZAcGeC0Iz?= =?utf-8?q?0p0Vc72fCJrHLTW+8p8t45h+avN/Y4Hp5JF/tVE24piaF3evX30Why2sKAiHkViXd?= =?utf-8?q?yHnliwTmWA8QDwSb9cyL0Iq7T5XLO1PbX7Fr+rbSry/3DWv1HT3PpStEaZbx5+3q3?= =?utf-8?q?RyejZ0JrAjCWGIt8kIj2mEYl8b783kY0P6ytYoWamRJXqE4mes98C7A6P70D1vD0T?= =?utf-8?q?POSgMF07nK6tqZnyLyUuFTQHZm4SIbKvxXtVtuLzTZPS3skFb6NXNzXaQ1TGDoyRI?= =?utf-8?q?yB/a3fM3MGjD55FHyykBFDys01PF2vflqpGg3CSRZiKkoNJbcy4/sOq2ibwQ9sajM?= =?utf-8?q?i/IqeY3Nsc5dhruXHtkzRYczrWJC8mopcE9AfntSqNpvP77szNP26Z0ySDM30LACV?= =?utf-8?q?OIYpRZBLwljZTpGse9sI2ddOGvqKaucYMKmLL8aL4PBPw794+hhGZ0zWiI8KrHIP5?= =?utf-8?q?9vq2tqIBbyhC/ekH64DH7ZRwPk2WN/fBnmZYtiSW3Q2IztYbC35jJNEMzJm/FaiTi?= =?utf-8?q?VoKyp+bCEEMaC6tBykzDWKm42r+ioo5PVgBToHunDjxeQ9/Al+MLWkWC/BxmIcZB4?= =?utf-8?q?O7EEH2+eqNaQOJcudTVuCrKDC8csjcA4W6LhkKYEFEm5kWGB2e4WUPSmVDWmX8jgn?= =?utf-8?q?zAFiIbzQ27Cw4HXmnP10i+HcsK1UN+FRKfOIitySB6jUpGs2iJGVX0BxnsFMNTJfW?= =?utf-8?q?zALV2tcs1DA3GQStlZK8+ObsXyxnvCaW9U/As/cakT8JVdfv8kJUUJ0vhbhLIXD6R?= =?utf-8?q?X05199g7q66dpWr+CLxOE6cH8/1Wc2isiaFspqgtD/SaWykm1fs9rtECsk8aJXKQk?= =?utf-8?q?gZllCnyraLnHPpytqE93CPqN4RjrZqX2X1SA4qBlcLAPtWrvrzvoFnFhIS1vdxkei?= =?utf-8?q?KCjM9UFgcKcCYNLbeWZ3kcKhmUUUTZJrNMa0jrHPyIqxryz+fmbdK2ixUUUyARexd?= =?utf-8?q?Zzi8r6dWHmdfiwrnrnQVZwqsqQYHcDfnGskDxz2tWyPAIYQLIB4NoDgCohoxDmilK?= =?utf-8?q?nX3m2HDAzbmTuPq+PjTa/O7Y8ZPt+B0CHEQDIdf50sFdImFm1cJ2s/nmTDCWM9lTk?= =?utf-8?q?tyhy+STHZtxuS0IM4yLQZhnO4F6iZ4Xl0+9oTeUXuKHYdwwO4o/9fYdCjPq3Aiz8K?= =?utf-8?q?7mbufQLWGoSID6TXe5x3DqNXWVNOkD8J1Pw+ouc/Nx/iyE3ZuKNYvlBVRaklxpwwz?= =?utf-8?q?JzJGeS9qEFCew/ZiHyLc8/9B+2yqi0pZnHP8XrWLeGeNI47n513mysSrTBjjkK86S?= =?utf-8?q?miyLv9Pa+e1yQJOPkkk9X71aHMwB1MuVAcmtnqZPp6rI0hEH3NPFHs4N8klCmGQqB?= =?utf-8?q?vWqx89TNi0E?= 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)(36860700013)(7416014)(82310400026)(1800799024);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: exUCp/fQWHHvHKA9/dhof20C5s2KJvoJu88Uoygl7cSnGgTWLoySUwQ25KVv9570Ir/ORuBshXWYnEEkTEP7MyJX3A2v9XclUQRa746OdEDThzUVLXyHIo3RzdHZoZgjanjz9XmvRhSsPcktCiIuBoHqls+EmM0MOIPPgTIsg5CLC27FMivA2aE7U8mOui1K+DNX0R47qTouipuGmzvm6Gp6T5OCBmWeO7CqHvTbqjwZ3dC8xv1Q13crqQB0Rori5iENuAjL80rJYzSzzW3Q7ACgNTXwyrLG29k56NOm4t/DQnL8OLkFpAspwZa62ejMCD3pcMCJT6IrACJlGMESi5gHv08310zXVhtuf2mKXwPcW/G03cdb+bXSzKzba8dL4dLTDhoGDz2L01Sw+6BYDMWv5iAzvjw4ye0HgjkbwmI4xVUmTGGpOBAOlCuPbX1kkMNSd+hbg4o2GU9xtpJ4xo1j25ZXybmb9HHNdq8GZEH9IYopRNXQtqf4iSDfqRCmLKLdqaUtDviVGxHvAsYQ1qnczLbk+lQO6MMRTS0PkLzsFnao+3JScNGVtYnWKg8uIqIbfSWXzIALNrZ17BR9pAtDz+RfDtpTZeFbqKEGY10tJh+6KmP3ZCXZHxWnn2/I8DfCdT3q0NTX0c053C9e/w== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2024 14:56:52.2165 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8d03c427-78a8-4a8e-73d4-08dd1861b75d 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: DS3PEPF000099DC.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR19MB7719 X-BESS-ID: 1733756223-105087-13364-17990-1 X-BESS-VER: 2019.1_20241126.2220 X-BESS-Apparent-Source-IP: 104.47.55.168 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoYWpmZAVgZQ0NTA0tg4ycAiKd k8Mc0izdwiNSUx2TLNyCg11cIoOdVUqTYWAE3yzCVBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260997 [from cloudscan15-202.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 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 8da0e6437250b8136643e47bf960dd809ce06f78..71f2baf1481b95b7fe10250e348cfba427199720 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 d7bf72dabd84c3896d1447380649e2f4d20b0643..1d1c1e9848fba8dae46651e28809f73e165e74fe 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; @@ -58,6 +60,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 Dec 9 14:56:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13899917 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 BD3AF1F0E4C; Mon, 9 Dec 2024 14:57:02 +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=1733756226; cv=fail; b=l59x8HkFSfJQLJLT7HW5+YfI9JDBE1NUH1ipihX5JRijEyE21pOeklKKvXl6aIm72KPR1d3bbbsKwDpwXA7hmSdcs18sIVB3+UIPXaWQ+pQ90GZC5ZNO66jKybTD4w3Ai7x6idSukshvGp9ofG/djZRAxwYj0dsRlb+uTrg2oog= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733756226; c=relaxed/simple; bh=rL+rJumJZVQv3keV6fOiXKdgnPwMmzm2pZxEFS7KX9A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=m8R0xRFnI5FmW6vmxvNbSMvRIfOFW4B2JYonKSFkOD5cjLFn1aeq8lmZKkWRyh2+kVuwtmRzHWVKPdt4y9tiCmXMGyV7/8088UX1OQ7UiQ1dmcFhjuNqxtQheYJUnKtQudK9G5uUj/5Eu09J5lNFf97ydJrNCUeE9t4Jd5Ao15o= 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=FPnP6l7H; 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="FPnP6l7H" Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2040.outbound.protection.outlook.com [104.47.66.40]) by mx-outbound45-178.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 09 Dec 2024 14:56:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=gsfFw2fk+JiowSrYneG6Wvw+GDmAABlmVMbiew4oXe4sp21XBCayKULWzVQ/yegSoISiiVqX2eDLFk48fjZrjSM8WcB5KycdnHm4xm0s51PdjDmBMx8Vye9lghVRLFM8RVyS9N0CrZuzBmepWE8Fd0kY+azypWMdLQQFzHE6B9/F6EWlkW83d+ldU7oXQC6JfYcolxVJaKzEmd4zwFQmxCEZ/KwT8cbF99O4SOt8NcH0M14cu8u5JFaLJcbKS8aPbSo2touwRgZ3BmRMSvyJvdJoms5Qj6VeYfTv1L5MCl/FGMVxaA3EwYlBdOhrT/04M/OUGrtePk7xxYio+sL8wA== 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=QyPiP7KMk4/OOskRuTiWdKJCJbVy8Vzg024X8lSSfpY=; b=uuFdDmvId6jkchVGlF28fwzl7l00T9cifqU3z1C1SZ6GsQLv0qRxW6j9vV9MpDZahXZiPLLLim6lA6EnGeqXVgCo7Ldnr2tIxpq+CgN63uBPg1FYXiD2rixwe6j4PkzIh7macPPPIQCDVy95WhxckBYxeifFXSMyRNsw+fMVChWWWt+oRHoUDd/SduX0b48/zqNmIqa4Fy2QBXem4FQxfO+LUdVsd/5ldueWDHkhWti/wexWlfYv5mgltjdeaJ5bsyq5WLCcDfltiRdYflgti0MB8a1PvCwGATrKJGsKy2A5Xj4CEIl/wrWzMVoegr8fRE5JssuuGkaXFw9e4Jv0aw== 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=QyPiP7KMk4/OOskRuTiWdKJCJbVy8Vzg024X8lSSfpY=; b=FPnP6l7HxbaXqcNenkjKRKQmWRPh8Ovfqb4KejQNq3Bew3mdWvapLaaJHXFnGvr+i5UHn3iG8z9nYsOHnAQ4BCHuQrAceRjHGQfR+rZOJQc4e4vQMH5+hrKLRHM6273Tib040o3gJgGcTEpFd1Ih5tOPn+QQ3mWrc4FjffpSLtQ= Received: from CH2PR18CA0041.namprd18.prod.outlook.com (2603:10b6:610:55::21) by MW4PR19MB6675.namprd19.prod.outlook.com (2603:10b6:303:20f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.11; Mon, 9 Dec 2024 14:56:53 +0000 Received: from CH2PEPF00000140.namprd02.prod.outlook.com (2603:10b6:610:55:cafe::71) by CH2PR18CA0041.outlook.office365.com (2603:10b6:610:55::21) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.12 via Frontend Transport; Mon, 9 Dec 2024 14:56:53 +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 CH2PEPF00000140.mail.protection.outlook.com (10.167.244.72) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.7 via Frontend Transport; Mon, 9 Dec 2024 14:56:53 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 771C818B; Mon, 9 Dec 2024 14:56:52 +0000 (UTC) From: Bernd Schubert Date: Mon, 09 Dec 2024 15:56:35 +0100 Subject: [PATCH v8 13/16] 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: <20241209-fuse-uring-for-6-10-rfc4-v8-13-d9f9f2642be3@ddn.com> References: <20241209-fuse-uring-for-6-10-rfc4-v8-0-d9f9f2642be3@ddn.com> In-Reply-To: <20241209-fuse-uring-for-6-10-rfc4-v8-0-d9f9f2642be3@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733756199; l=6858; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=rL+rJumJZVQv3keV6fOiXKdgnPwMmzm2pZxEFS7KX9A=; b=mP/GYTNuuHw8TS++cPZjFUVTscmj1ArWqFsFEXwW6lQdviPSxARp0vc+XU+Rkpj1t06sFG5d6 y5HpSDlw/quA1lm78tJXcWV5zrpB4Vsi93dpJcC7UqE2yg3AE9qMRAU X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PEPF00000140:EE_|MW4PR19MB6675:EE_ X-MS-Office365-Filtering-Correlation-Id: 0c00660b-9ad8-4cf5-6a00-08dd1861b7e6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|376014|7416014|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?+shEzd0uGDr5uQjIQ1OMc5OyC2ek7oR?= =?utf-8?q?BXxvSg1LMHchPsFoPAu5o7WU88+l+Lz+CHxfLLtExHxZ3aozx/9OTEEZ9Ys75rF9p?= =?utf-8?q?0pfkXn/k4CvnfELUOr/GmqH5y0hw9ht7xBKr/QpavBm552emxRy2eKZqFyBRTv/Fq?= =?utf-8?q?wCdHeIKO6a0poe5KNhLCMm/jW2RpoIgNRch4rK2e65ayVuop9gqXBwYN8lrSiGMY2?= =?utf-8?q?0Uq6U3SL+AurQM9iVv276ssQODCX8Htyzay6Jq/hFHnc5kvKHhXfDo0n0TpBVrufP?= =?utf-8?q?SBXOw912/BgOTwS0il7L8dqS71pnOLrGHn/p+w35A/swpWZcg4yNfijr6nJsG3Ves?= =?utf-8?q?s7tRSRhuJ66OBzO3DWtTPlFBoHxW3GTUeVuVGO09kubM5geE7cqHDtfCAqgVhjfDB?= =?utf-8?q?x7BQw1o1L7F4giscExQpTKFgkfpO+RwHLj+Ts72DTbBH6Jc58cLl3uL3n7RGgsSDE?= =?utf-8?q?WVKbojYWumYRykVn0LB0PYvmUqe9Aa3qZDMKBITDikKYVObF2g6upn0SSwcJtLrSh?= =?utf-8?q?H3r5Rym18TSYlij6eDxgBkSiQa3faHb47ZQ7JduUs2+AaaRnW9/gOULvLLUNk1//I?= =?utf-8?q?IG4aRpjxzba3o7OSn5Alx35WJJzbQWGew9zByFX0dVbtZhj3lEvDDODeM97YqUzXu?= =?utf-8?q?0yAK8/tWZZv7tzNrHt8Khk/5pNyxAOHT26JpRKB3tyoOGvgt0Qzualwj6gVHodG25?= =?utf-8?q?HZrNtzUp1CHCjD7KXaG4fcvN8JHQgWnX6LzICWglqeoH6DKHM0ydyAoN3TWb8nBGL?= =?utf-8?q?S+SKkZ5VorECYdMzzzzUFtdxqBUiuusolg/5Zrg++ubYKxG+7V2vsH3pKvx1XO4kz?= =?utf-8?q?kSAhvV1De9jCsSYpbZoQN2HPZ68DaptQpiBomLox+hjZwic4qLmzmVc5kuAV8jktX?= =?utf-8?q?a27811m3Ajdr+bBcY2YffT0/T76ftkVVUK/rG648N9kNHnRP112VG++XcHYkFFuiv?= =?utf-8?q?MvBNjHzkr7q2q9g5hTIroNKKpjf7k4eEelesqBOF3EZ7TBDaSLNid/vxaReSE7HS2?= =?utf-8?q?ANGyMF5zfV1vutM2PVCzLEBRzBQsZw9VYYdwrjmgKVeJ+rolIVq0/ejI3qhF3RRkm?= =?utf-8?q?65myMr/aGD8Lt7D53rk7U+csOz6QtOvR6QqwUQqZ90SM6uAGetYymiuIh7YDZrWgk?= =?utf-8?q?tPWwAxIi2r5HQlM16n48/EX7DKAkGa83hf2VBt6irFL4AQsQ9DECTFzYYCWBz+o/s?= =?utf-8?q?I5QrAzECheSx83H8XZtRoGkaCTd6i2e5z1uo+V66+n6XRJYl+Quv6ugnv3B3KVJyZ?= =?utf-8?q?rB5ZSGWs8j1QiSpsra8CwTVD0zjCIDgA3OucLK2F8yMCQ6jMdY4kkmOO5tvVzbn1c?= =?utf-8?q?yPNXIMbBwq7Bifa0gqqkogLtbdWmh+8g//nkbEara5SbtUpEpHMfDJHK8pST3FWME?= =?utf-8?q?7AL5ibRN3eD?= 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)(7416014)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: eCKg/K58MmjnZBGwYZHlPkFUjySLZweQaSuiJLHx3+VsShGCBj/tY7sCaEVP5Q8t4+NNAJEl6oGOUpAT/ER6THhrYs1TKirqXOCBmPBKVPoHaVUPa3nqJLOJVqpgLJpgjMtd0sr+ADknBq1HGG9vlQiUcuScDTTIDi3qpmCEj0EbKQuC6PzTa1jXF/prSdE37F8wz6kG//ebho34xwbLEBmUKOaQVoZRP/viMsvChrfBtNdLgnwrGqWM6CHG0VJKYVkHrbIkkQ0PdhxAg8CKl24DVJnltslD/UiYpmr+w/AtHn+F0WAFrIQV+OTFvKeu2ay98jQXXBr2g/e9AzXpxjm7Bd7q8E2eVlqU6lJFW7IFysiv9rdf4w8UUr3GexGwORAe+KP0JwduhgvvF8cXXo2A7cEdFCfoyzgWS276nqf/TJnJcx7mAuFvhDnbl7hIXLuM5T8YRYxXbMMvK54Xeax00Bt32lApYTdvo67FJCjx9Ld6GD20opaXi1ggmj0YQXwTIqJCQ+uLA2bJfGm5ZoYNawRfIy6IQ0NcM7SC7UKLBY8qiyecA0qihDHrrY/alvM5G+ikyiQrIte8Izd19z+Z5IzZdFqN11hmeD8qJl1CyhpVjYegyUbXOKrLTDa1bM+KexzvjFCIEbKTsb4fBQ== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2024 14:56:53.1766 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0c00660b-9ad8-4cf5-6a00-08dd1861b7e6 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: CH2PEPF00000140.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR19MB6675 X-BESS-ID: 1733756217-111698-13393-4879-1 X-BESS-VER: 2019.1_20241126.2220 X-BESS-Apparent-Source-IP: 104.47.66.40 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVmZmBmZAVgZQMNkw2cIoxcDSNN nQyDjFzNLMNDHVLCkx1cLEGIjTjJVqYwHFTwIRQQAAAA== X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260997 [from cloudscan18-0.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 This prepares queueing and sending foreground requests through io-uring. Signed-off-by: Bernd Schubert --- fs/fuse/dev_uring.c | 175 ++++++++++++++++++++++++++++++++++++++++++++++++++ fs/fuse/dev_uring_i.h | 8 +++ 2 files changed, 183 insertions(+) diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index 60bcddec773d1cf3bbefc674fdbdfb7823b7fbc1..5767fb7a501ac7253aa8a598a1aba87b65da0898 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -26,6 +26,29 @@ bool fuse_uring_enabled(void) return enable_uring; } +struct fuse_uring_cmd_pdu { + struct fuse_ring_ent *ring_ent; +}; + +const struct fuse_iqueue_ops fuse_io_uring_ops; + +static void fuse_uring_cmd_set_ring_ent(struct io_uring_cmd *cmd, + struct fuse_ring_ent *ring_ent) +{ + struct fuse_uring_cmd_pdu *pdu = + io_uring_cmd_to_pdu(cmd, struct fuse_uring_cmd_pdu); + + pdu->ring_ent = ring_ent; +} + +static struct fuse_ring_ent *fuse_uring_cmd_to_ring_ent(struct io_uring_cmd *cmd) +{ + struct fuse_uring_cmd_pdu *pdu = + io_uring_cmd_to_pdu(cmd, struct fuse_uring_cmd_pdu); + + return pdu->ring_ent; +} + static void fuse_uring_req_end(struct fuse_ring_ent *ring_ent, bool set_err, int error) { @@ -779,6 +802,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 */ @@ -787,10 +835,22 @@ static void _fuse_uring_register(struct fuse_ring_ent *ring_ent, unsigned int issue_flags) { struct fuse_ring_queue *queue = ring_ent->queue; + struct fuse_ring *ring = queue->ring; + struct fuse_conn *fc = ring->fc; + struct fuse_iqueue *fiq = &fc->iq; spin_lock(&queue->lock); fuse_uring_ent_avail(ring_ent, queue); spin_unlock(&queue->lock); + + if (!ring->ready) { + bool ready = is_ring_ready(ring, queue->qid); + + if (ready) { + WRITE_ONCE(ring->ready, true); + fiq->ops = &fuse_io_uring_ops; + } + } } /* @@ -974,3 +1034,118 @@ int __maybe_unused fuse_uring_cmd(struct io_uring_cmd *cmd, return -EIOCBQUEUED; } + +/* + * This prepares and sends the ring request in fuse-uring task context. + * User buffers are not mapped yet - the application does not have permission + * to write to it - this has to be executed in ring task context. + */ +static void +fuse_uring_send_req_in_task(struct io_uring_cmd *cmd, + unsigned int issue_flags) +{ + struct fuse_ring_ent *ring_ent = fuse_uring_cmd_to_ring_ent(cmd); + struct fuse_ring_queue *queue = ring_ent->queue; + int err; + + if (unlikely(issue_flags & IO_URING_F_TASK_DEAD)) { + err = -ECANCELED; + goto terminating; + } + + err = fuse_uring_prepare_send(ring_ent); + if (err) + goto err; + +terminating: + spin_lock(&queue->lock); + ring_ent->state = FRRS_USERSPACE; + list_move(&ring_ent->list, &queue->ent_in_userspace); + spin_unlock(&queue->lock); + io_uring_cmd_done(cmd, err, 0, issue_flags); + return; +err: + fuse_uring_next_fuse_req(ring_ent, queue, issue_flags); +} + +static struct fuse_ring_queue *fuse_uring_task_to_queue(struct fuse_ring *ring) +{ + unsigned int qid; + struct fuse_ring_queue *queue; + + qid = task_cpu(current); + + if (WARN_ONCE(qid >= ring->nr_queues, + "Core number (%u) exceeds nr ueues (%zu)\n", qid, + ring->nr_queues)) + qid = 0; + + queue = ring->queues[qid]; + if (WARN_ONCE(!queue, "Missing queue for qid %d\n", qid)) + return NULL; + + return queue; +} + +/* queue a fuse request and send it if a ring entry is available */ +void fuse_uring_queue_fuse_req(struct fuse_iqueue *fiq, struct fuse_req *req) +{ + struct fuse_conn *fc = req->fm->fc; + struct fuse_ring *ring = fc->ring; + struct fuse_ring_queue *queue; + struct fuse_ring_ent *ring_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; + + ring_ent = list_first_entry_or_null(&queue->ent_avail_queue, + struct fuse_ring_ent, list); + if (ring_ent) + fuse_uring_add_req_to_ring_ent(ring_ent, req); + else + list_add_tail(&req->list, &queue->fuse_req_queue); + spin_unlock(&queue->lock); + + if (ring_ent) { + struct io_uring_cmd *cmd = ring_ent->cmd; + + err = -EIO; + if (WARN_ON_ONCE(ring_ent->state != FRRS_FUSE_REQ)) + goto err; + + fuse_uring_cmd_set_ring_ent(cmd, ring_ent); + io_uring_cmd_complete_in_task(cmd, fuse_uring_send_req_in_task); + } + + return; + +err_unlock: + spin_unlock(&queue->lock); +err: + req->out.h.error = err; + clear_bit(FR_PENDING, &req->flags); + fuse_request_end(req); +} + +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 392894d7b6fb15472d72945150517a9f0a029253..bea4fd1532083b98dc04ba65c9a6cae2d7e36714 100644 --- a/fs/fuse/dev_uring_i.h +++ b/fs/fuse/dev_uring_i.h @@ -122,6 +122,8 @@ struct fuse_ring { unsigned long teardown_time; atomic_t queue_refs; + + bool ready; }; bool fuse_uring_enabled(void); @@ -129,6 +131,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) { @@ -152,6 +155,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 Dec 9 14:56:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13899919 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 063611F0E54; Mon, 9 Dec 2024 14:57:04 +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=1733756229; cv=fail; b=mnVGm99CKVHIjJNOmBDuebXjQwdPfzAGGVNcBm6zaqiWZuSsLFtxek29wZmKmDs3aetn2yXec/IFmqe+0OaNjnUlG8YSNl3pq787qNzzXuAP1svYxiKS3yylrEAXaujT2yROigzFxJ1ZEEQeaL3XRjrp6/YUhLyspPtBszsNYqA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733756229; c=relaxed/simple; bh=IBtFZfkLCG2fc0bSnwFdChR2irmJWWPIqSSm4VNXsiA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=a/z3QfXXZSQDseRoZs/yHrj/Ddz7GhGy1y8uvsaGf0oKKSfcGU1MyK3nvt7J24OwyXU8XS/BR4mZc/8fwqiJCNsf7lJ5mtRa3OLIKTVpx/pz5Qy5bckQCrgW337ypIr3L9qiOPscNKKeHs9BaE1duRrZ4bDLCduPsaBTPYPBk3E= 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=Nnn8VMR9; 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="Nnn8VMR9" Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2168.outbound.protection.outlook.com [104.47.55.168]) by mx-outbound12-196.us-east-2a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 09 Dec 2024 14:56:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FoNA4ixchfjpVRUQNMhiRR33yhWGfXicokCywNnXVcDf0Yn9AxtxzGIuydNBKWOcRCLcW+MZGtdQ9KGG7C+Wx2tejtpRiw8x65c7NKXO3RW2XT3GXq0D5zGE9BGzDkW2mIm9BM2Kv/vk6ZM7+iZSlXirlbitr91iVwzkpUOGrWETkYXcQ8rNB64yR+W1vL8aL6B/oCIbmih6G4af5j8NhSRTl3fXSImAmAjAX9vVvAPwEKr2IeGs0SdbRGyRnaGozmCKDhTejPk9iQQX43OEKqAZb3lN0bieFLMcCKeLm/EP0OUCFUfAdJ5bgZbNrOjx0m1LlQgo3u/yt0fyk+ZF0A== 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=A3Rhwr+YML1ti0F6RX7ueIl02XEWTedI9bT1g3RxC6o=; b=VnVIUxtvJEnFmuUYzW32vOSNs5gUZ0Qqp6mGq6Q1qEuNG4Y4YolA5NkGA6CA9URMi54AXlauOiohA743mMUt7Na0cOFb5Gkb9Ha4PemIHpr8bj7l1etAqHF6765fvucVp4XPt2GntwTad1BbwK93DviHG0W1sEq5qQZLsXN2BThta127yPlvoXMwrNGRTctnWJKAAFi6KgfdXnB45eXgs/vMeCHftlphEjHBKyVUD41tJ24xeUOKMPNxOZFiVlq/kImQwZQnm+3OE69b6NNZLk7voNFwPtoxovs4nypqgzRo809jE2C/xJpR8yfx59Lb3HrcTadTSEIK+F4+YNnusQ== 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=A3Rhwr+YML1ti0F6RX7ueIl02XEWTedI9bT1g3RxC6o=; b=Nnn8VMR9FasHM1wmGX0creOK1AYAj/o/xxV5MF7jVhAY5oBl+zryYSdwh/RgLQD7ygO6jsS1wbHP+p4Sc9IVu3aE/fvHdnfiXKOOI7+69WwQw497KUBDQuCFhUNElpzR+Hxz8TjEticH9r2Frhi5m8dplohFp9UxWgKIaNfPfv8= Received: from CH2PR14CA0005.namprd14.prod.outlook.com (2603:10b6:610:60::15) by PH0PR19MB5364.namprd19.prod.outlook.com (2603:10b6:510:f6::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.18; Mon, 9 Dec 2024 14:56:55 +0000 Received: from CH2PEPF0000013B.namprd02.prod.outlook.com (2603:10b6:610:60:cafe::25) by CH2PR14CA0005.outlook.office365.com (2603:10b6:610:60::15) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.14 via Frontend Transport; Mon, 9 Dec 2024 14:56:54 +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 CH2PEPF0000013B.mail.protection.outlook.com (10.167.244.68) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.7 via Frontend Transport; Mon, 9 Dec 2024 14:56:54 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 71B314A; Mon, 9 Dec 2024 14:56:53 +0000 (UTC) From: Bernd Schubert Date: Mon, 09 Dec 2024 15:56:36 +0100 Subject: [PATCH v8 14/16] 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: <20241209-fuse-uring-for-6-10-rfc4-v8-14-d9f9f2642be3@ddn.com> References: <20241209-fuse-uring-for-6-10-rfc4-v8-0-d9f9f2642be3@ddn.com> In-Reply-To: <20241209-fuse-uring-for-6-10-rfc4-v8-0-d9f9f2642be3@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733756199; l=7102; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=IBtFZfkLCG2fc0bSnwFdChR2irmJWWPIqSSm4VNXsiA=; b=w1OCg2JJEuR3HbNXo1jpQ0ZtXDqb0ws180QPYsBW9KvhZm7s9osxim8qJgBpSlr9e38Ku48cv r5+nAYyK2z9A7SvA7KC2BIjyVehIjHXsC7olKOJ0+FGpYvYlGSreLLH X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PEPF0000013B:EE_|PH0PR19MB5364:EE_ X-MS-Office365-Filtering-Correlation-Id: 943612b4-d742-4e8a-fc2e-08dd1861b883 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|82310400026|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?q?bCq8KF8SHdD2hW1YYgFfYSG+J2Rts+H?= =?utf-8?q?Y6cb8ivBoelZ6K7npao+NGcO5w80DbizpBiRTAkf6JxLQKGK8ALW4ITfyVm42tBFE?= =?utf-8?q?vXZQ49vMewe6GykzXEl5g1VS9RlORviO6VfwpAgDc1UoSjej0PcBsCmk6sIh7tI+p?= =?utf-8?q?g60EsIBkqWEni+Go1Et4samP6NFf3T5NCCKAaGrSC/z2Ad59elWbqcpiPxM4xN7Ls?= =?utf-8?q?otNbaZbGR2ZbJhVdUmMzxHVMnPC6rZBdv37zvYwo5TS1B0vuhhLC0myUsh0vICXw2?= =?utf-8?q?SRM8Q81QEO1MN0grQsDZit/buILkqaVQRSKj7NTS0ZhPH4/B33kgsebFCqd5Y6fM9?= =?utf-8?q?wFvNNqX0RWKLGPZzNgChWeDRdVOeSUyAb/nLH/CpOLvXxUXKz3grtu155TEyvfxJ9?= =?utf-8?q?20jb2WBKQH0mU6vMJgQjSyZ6J7I8G90Kodzf3HvD9iKaLK+0svbapYzsGo4pJvhB/?= =?utf-8?q?qDDNSwM0jU1Vjb0XQkZlJv8MD5PGekNSh8G9+CmJB79bBikXSdFLMDqx5LGutaxiy?= =?utf-8?q?Kay45xsi/JjU+u1cO4vdGuhWdoOwnSFqcicET+YL6qJyHFfqtHEbyYvTguw3CIQv+?= =?utf-8?q?1LV+UWUiNEBpy5WzUaHEeVNzGRGSkEWwcMQyi5uNG394lVFEtM1bvZJPvMs2pvDfS?= =?utf-8?q?FUibFGz0u6dCiQlME2dDTlEeB5i9LBuIUHbkAydBefHOzvXAfbJbzlXFZkYPj3Erq?= =?utf-8?q?sdC0mWy25nV+ecq5Ouc6MzVIdd7CSgIISQyFXFMygMdnRoZ+46b4uCajXwd2FUiXg?= =?utf-8?q?UuFu0/nUbfYtm1jIYqi14stWThd4JjmZ9fVCJ6rc6YNg/e4JI+1O2jdol+7qT5UXG?= =?utf-8?q?3eTBer8WIVKeaNIc3Dh3DY5CeZmgW6+DTBHPXHhA/3d/+M4NlckXKMjZryTQNxdS3?= =?utf-8?q?7cBahK5TQwJ5IXmJEvwuaMFG5qG37Xus1GTmDEGrRow+avREMhtjAmJwgUUwUR8F9?= =?utf-8?q?G+IJAT7NCugWSp8JUghl0wEqXm9cwlwrDff8KJDJ6c6DCtIcCv3pD7Z6XGscCsG8I?= =?utf-8?q?eEo6SeNBRA3gjuDXGqkhFN947PvZBfa4VhQEgGlOPBbnhr/tTO3qJ4EcmWooCbsGo?= =?utf-8?q?dY/s+/WmTzRWMFfRz4+J3dCW2XTNZIG5OaaeX/2gUOeh3DdYXc0r2zsX5iRyYRs34?= =?utf-8?q?R7OQUpptJOFYEhh3naCPY9INm3OERcyq1fzwN8+/ANS4QrRp5w65hY0Ofy/hAlgqC?= =?utf-8?q?W3ocz18zd8xr0hfHxuATaZl0pfbz++wqB29oQC8jf2RF1vM1cAlYYA9MZryNdCQFl?= =?utf-8?q?mQCmng9afvuVygkO1xTMJpJ/nXgQVLoWWAqMfXW+48A1acZauO6uZN4MVUXQOx4d/?= =?utf-8?q?rXc7Kn4H0wd1rMHCuDsjJwViD993d22wynQuJ8d+vnCgQ8JFtCRaU8d5xcqbkatnN?= =?utf-8?q?u5AEwqUo5I1?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(7416014)(376014)(82310400026)(1800799024)(36860700013);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Z6RqpChtq/L8dAY22m78o+mOzqFdW/5F8jtPW2Ddrg8yZ+Jy+a77DvsMPNZPp0+Hrphf6ZiIuehH/s720u8XIOa78aJGJ8urZxWkGXrsa7dE3u2O0jtXxFKYIdutJgzxTUSIL620OSgdXKWavzCNwODCUEV1gN53SF5KXOzJ/3ijWX4JB3j37r1uiB2GSYgj6JQ3OIaX49vAgKAOYc78CLa5FVl0yjgEEGbdAcpucHmK38iMOekJIDPvbkKLbmBmang7ou7mTIljIl6hhltjjDZT8VTLkTKZ/ErDk30lSpL1xkaM7eqSeY0GLSVJQhhNLLDinxiyog3xHrVr/dqOR3CZvZQqhgtJZWfFoawt8ATLFUXmyiFAgNmlsF8Q+hMG482WqS0RWoM2Ul+QA2+9w4y91jJr9GsDw+LgW/tJBp61Tgp6axYN6F9tXYJSuRS1+DrAvClr9wzmK2ToXB44b2qZ8i8hs3avnmrTpvF4kATcWQ6rJsqsWv5HJmnHRoe7FL40zGmqk9Ex1yCFsOjL+33fdcAT5wLYyo8neUEf4VCuDJoGGqqAueBao16/j4bkDn2SYADQFwY82o4hqWQNF2jB9X28iXjOHubB0rtovktMdxLR5pIYB/gJEJk4vSvxIufawCSuCo08Yb+2pHUBhA== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2024 14:56:54.1936 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 943612b4-d742-4e8a-fc2e-08dd1861b883 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: CH2PEPF0000013B.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR19MB5364 X-BESS-ID: 1733756219-103268-13464-5361-1 X-BESS-VER: 2019.1_20241126.2220 X-BESS-Apparent-Source-IP: 104.47.55.168 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVmYW5hZAVgZQMMUs0cIsKdXQON HUJMnAyMQk1dTMNMXU2NzSOM3cMs1cqTYWABE09VJBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260997 [from cloudscan13-203.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 This prepares queueing and sending background requests through io-uring. Signed-off-by: Bernd Schubert --- fs/fuse/dev.c | 26 +++++++++++++- fs/fuse/dev_uring.c | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++ fs/fuse/dev_uring_i.h | 6 ++++ 3 files changed, 130 insertions(+), 1 deletion(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 71f2baf1481b95b7fe10250e348cfba427199720..8f8aaf74ee8dfbe8837f48811138d4ff99b44bba 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 5767fb7a501ac7253aa8a598a1aba87b65da0898..8bdfb6fcfa51976cd121bee7f2e8dec1ff9aa916 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -49,10 +49,52 @@ static struct fuse_ring_ent *fuse_uring_cmd_to_ring_ent(struct io_uring_cmd *cmd return pdu->ring_ent; } +static void fuse_uring_flush_bg(struct fuse_ring_queue *queue) +{ + struct fuse_ring *ring = queue->ring; + struct fuse_conn *fc = ring->fc; + + lockdep_assert_held(&queue->lock); + lockdep_assert_held(&fc->bg_lock); + + /* + * Allow one bg request per queue, ignoring global fc limits. + * This prevents a single queue from consuming all resources and + * eliminates the need for remote queue wake-ups when global + * limits are met but this queue has no more waiting requests. + */ + while ((fc->active_background < fc->max_background || + !queue->active_background) && + (!list_empty(&queue->fuse_req_bg_queue))) { + struct fuse_req *req; + + req = list_first_entry(&queue->fuse_req_bg_queue, + struct fuse_req, list); + fc->active_background++; + queue->active_background++; + + list_move_tail(&req->list, &queue->fuse_req_queue); + } +} + static void fuse_uring_req_end(struct fuse_ring_ent *ring_ent, bool set_err, int error) { + struct fuse_ring_queue *queue = ring_ent->queue; struct fuse_req *req = ring_ent->fuse_req; + struct fuse_ring *ring = queue->ring; + struct fuse_conn *fc = ring->fc; + + lockdep_assert_not_held(&queue->lock); + spin_lock(&queue->lock); + if (test_bit(FR_BACKGROUND, &req->flags)) { + queue->active_background--; + spin_lock(&fc->bg_lock); + fuse_uring_flush_bg(queue); + spin_unlock(&fc->bg_lock); + } + + spin_unlock(&queue->lock); if (set_err) req->out.h.error = error; @@ -97,6 +139,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]); @@ -104,6 +147,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); } } @@ -211,6 +261,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); @@ -1138,6 +1189,54 @@ void fuse_uring_queue_fuse_req(struct fuse_iqueue *fiq, struct fuse_req *req) fuse_request_end(req); } +bool fuse_uring_queue_bq_req(struct fuse_req *req) +{ + struct fuse_conn *fc = req->fm->fc; + struct fuse_ring *ring = fc->ring; + struct fuse_ring_queue *queue; + struct fuse_ring_ent *ring_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); + + ring_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 (ring_ent && req) { + struct io_uring_cmd *cmd = ring_ent->cmd; + + fuse_uring_add_req_to_ring_ent(ring_ent, req); + + fuse_uring_cmd_set_ring_ent(cmd, ring_ent); + io_uring_cmd_complete_in_task(cmd, fuse_uring_send_req_in_task); + } + spin_unlock(&queue->lock); + + return true; +} + 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 bea4fd1532083b98dc04ba65c9a6cae2d7e36714..8c5e3ac630f245192c380d132b665d95b8f446a4 100644 --- a/fs/fuse/dev_uring_i.h +++ b/fs/fuse/dev_uring_i.h @@ -87,8 +87,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; }; @@ -132,6 +137,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) { From patchwork Mon Dec 9 14:56:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13900012 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 A72BA1534EC; Mon, 9 Dec 2024 16:30:14 +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=1733761820; cv=fail; b=tE0qStImdMOO+pMdG1zazw/mmOHM2ahuz7biiJ5Hxe/OXErm/aAOJRPtWwH6JpLqK7qhDnS3HO+ylU4cptCvWnzu5XCwoOegbNwCKK+mKG8Y9+W8e+Q27LDmDBX9w6ruabgGDvWrc7w9FQN1jQPNtaanBi+c1jHZZMXvm5PV0Xo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733761820; c=relaxed/simple; bh=dvX5MNc2XuYprMqXPx3CWRrFkQa5S+Flf+icX9eFsOw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=riVNONxh5NVVpucmnxWQdOELUOst7Vvn5rnBI1INnk2uGjNLJV8uv15+64Wgcubt5SnlvRWqHV6QeQMetkWrw2wjGGYGniw2UUTxUZ6h8Jb+3oFKXPF2aJS+6iah0sByZ99WD2rmfcmX2yibxTdrFvE9DmTrmChnKHffrAnyzp8= 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=RZz92bn2; 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="RZz92bn2" Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2048.outbound.protection.outlook.com [104.47.70.48]) by mx-outbound18-195.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 09 Dec 2024 16:30:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=RHFO7VJYB2VbDr7wYNb/4yHE3qPrMzkRDdHN99omaxqV6VR4izzi/Tjd+VY6J63DRC1pRbB0rgirKT6m3lm6Na+LGd2Hf/0yMaNw9gm6kIAzXVUW8Dl+DiGsqq8rZv61knn6VxHE5zqSglAJ0RuSPiGdQpOQmQBMC7y9aIVR454KV2Oo0rFcDAzW2Pi25BhzMs0reApIIDwYOFAPQnS2WbJW+Q5+TwMuVldT3ZTczEwMoIxLe5JL485Y0zxl1SDwAle06RcSQV4EcrUqlR/PEun+K5UXx4w5UjITPQ10hI4CzcIVwEaXy4L1NJ5ZqCC/KKvpm5t8G9qTM/0asY8bGg== 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=A62xMnV752j5Wo6JRvqqVO9QrbSHTe33Xvng/kBU9j0=; b=vRDZp6wZm1JKeXBn+zh+10rDNUlY+FFFqof7EnSUX5bI5sUJBJ8vcp9o00osPwR4P12AHeIdMFykQi7OX65Q445VQ3wSwvXbozO6iL3+fSOFzWC0WMBJSrWIEtRHhl41ePDBrTL9n75iYQnsRyjb8o/VvLJH3mZ8FeFYzHxC4rc6mgq2+OxzqaF6e+VlGZwUPtVCC50WKgEYwxeUQ16lpcSpr+nii90wG7XTG/BDRLOSVu0emKXiu50iRgoNOqa3i1pLrjMD8fFcr1XN/NIXjc8Qo7akZ45gfbuMpfaYYUr7v95M+116IrN34XWntp9aDrBDWg6kb0ho5f7HYiI79w== 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=A62xMnV752j5Wo6JRvqqVO9QrbSHTe33Xvng/kBU9j0=; b=RZz92bn2GXWvo+T6JKqe6xkd5Gy1+UXQP+ppsBLRJnL4R59mxCyYKMb4JlFmx/5d5mXE2fHnuZqK18Ih3RKeJvhrwhrfXFJeJnsUN2BPL6pYi3//sMfc9pEgavPl2wXwEFdfP+4SpjLQH0HG+VgfQoKTdH9Nbj22NQffn6G0CTw= Received: from SA9PR13CA0063.namprd13.prod.outlook.com (2603:10b6:806:23::8) by BLAPR19MB4228.namprd19.prod.outlook.com (2603:10b6:208:278::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.18; Mon, 9 Dec 2024 14:56:56 +0000 Received: from SA2PEPF0000150B.namprd04.prod.outlook.com (2603:10b6:806:23:cafe::68) by SA9PR13CA0063.outlook.office365.com (2603:10b6:806:23::8) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.12 via Frontend Transport; Mon, 9 Dec 2024 14:56:56 +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 SA2PEPF0000150B.mail.protection.outlook.com (10.167.242.43) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.7 via Frontend Transport; Mon, 9 Dec 2024 14:56:56 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 6B65418B; Mon, 9 Dec 2024 14:56:54 +0000 (UTC) From: Bernd Schubert Date: Mon, 09 Dec 2024 15:56:37 +0100 Subject: [PATCH v8 15/16] fuse: {io-uring} Prevent mount point hang on fuse-server termination Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241209-fuse-uring-for-6-10-rfc4-v8-15-d9f9f2642be3@ddn.com> References: <20241209-fuse-uring-for-6-10-rfc4-v8-0-d9f9f2642be3@ddn.com> In-Reply-To: <20241209-fuse-uring-for-6-10-rfc4-v8-0-d9f9f2642be3@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733756199; l=7432; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=dvX5MNc2XuYprMqXPx3CWRrFkQa5S+Flf+icX9eFsOw=; b=zzaRkfvmRBskxsD1zt+/kNS4vlRR2ISIhWeGE4b3X7FiwzBf9FDDPblR/ecEthOUPg7AEH/oX XYD/1p1QPVgDJzFitFupHdXgrZvpxdtiriXtLdkbhbzHlQBqNXmYbPo X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF0000150B:EE_|BLAPR19MB4228:EE_ X-MS-Office365-Filtering-Correlation-Id: e10e36d2-3f48-4cad-eb46-08dd1861b9ab X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|1800799024|376014|7416014|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?GO+KTJIrZ7Hf7qoz3ShhONqGbIB91BZ?= =?utf-8?q?6Lb924RTIv/e2QW8dvFgSnncFqu6x8XUNpP/kMAIgvBF5mkatEwrC/6MmlS4q/9v4?= =?utf-8?q?idLl30T+Xbgb1SmgUA/6Mqaq1ONgdvVIIimUehjn295pPcJV2XKcqU7E9NhYzLM7F?= =?utf-8?q?4ipbvl6kiJH47hKFNYUsS/uPIx43DPT25qQ8pVuzAM8BO6vLkfOuFjA8i6jsSeTMe?= =?utf-8?q?gxS8qSsXv8P5Z6j37YYEXyP83BPIi8UlJ5udDZydlNa7P1kphUIwk4StuSQZgsrmx?= =?utf-8?q?8nnzhnsV+Obs3Kkbvq+FU7NIoc8wUFDvyn2AXn9PTfxIukNOwxjxZprF0fmHaugon?= =?utf-8?q?fttjBMFLhXyiGx8550O9sWB2iGe+GjyNHxzJ3sZCUj6gVA4L9vbvvQauDxAzqEqAN?= =?utf-8?q?7Wda1xAMzcOJfJ+xiRmZ0l0iZJyJrtvu/NbB+ygmaTZlPZP6KUXcmJcUiLTprx0Q+?= =?utf-8?q?AIe7u3oEWPPZ61laAUOq97tDfU4erOR0ELNqbGJa+P7sWQMJgYYTGY7i2kJ5bXJEc?= =?utf-8?q?AFnxwvJn1eehdkH652AZ1Q4Sv1SlqL9g0MePtoSt+UWxzzCzk74zPPAgzNSgNz4M5?= =?utf-8?q?tSRUH5kMI2vcq+NbzlksxzqD0hbijYRaC4IEGF43IV3Oixzk9UCg7K7ShOLf6FG9O?= =?utf-8?q?14fABvJw8SfGA9PRLNph5McQBP6eP2FejqhuCp5EjdcEHsKS22Idw5agjbHvZ21mu?= =?utf-8?q?XX9/3kcOfRHIfvPwCJSVnEtCiZs9iOeKgCU/hbBMN9gAqaEWvDY2lCPRndofhAqkJ?= =?utf-8?q?VM7n4SRvBks/YF8RwPQ57gPRpXSwzUxFRpUXlMuW5ifAEBDlW0Q9PTmMQ1KlC9shY?= =?utf-8?q?SbrfmLAixRB9ODQWIbIxJ7a658lKlqrimFU8XINVh3xCEsV2DSaaIKSgnp+hMeopZ?= =?utf-8?q?/8r78Uxn5xNJLnUaRU6dpJekitOtNfqDqEvxoJ5MjctEZtWxmtBtpNa6eXcvYu0iM?= =?utf-8?q?O2PKfiYNPS42DgF5exP7WFDVpD6LC5+4+ZrrJ5NrVHFi/LNCIjerAiqBtQjwmxF30?= =?utf-8?q?Tx1MUIhst5OXy8WCku0uwtbUvEeuG+kUjBOEJfVvrEO30mOSeSq0UwAax37LeokuG?= =?utf-8?q?C0EgFKztRjODtNDcu0vCa244FjfkfxkoQyzUuAEIqw1BKc73K2wJaKd32JlHPS5+D?= =?utf-8?q?nmCTRASx7Z2Xwv0mXo1h7hFulz0CliHYrGJqUsoS7AHkOxbQw+Am9sQ73s0Vt4z2S?= =?utf-8?q?Ua5jtAkfY1DlRvApA9T22Xerc2xSbelmWTuu9QgcvCS9osjCizlOARH1L35Ua6lLf?= =?utf-8?q?2OqcbGTjuLWxG2YohVeq9lCJF5ulGl/MPaqzbd8xJqMq/M1wTNNVJTifQfQ0Kg2Nc?= =?utf-8?q?U2qOTrb1UmtdWthy+g52o4a3Ri/kVI2csUvGuKsMpEjFYCajyZF5MOXXRdFQo7xOJ?= =?utf-8?q?Vo9f1Yjl7Ye?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(1800799024)(376014)(7416014)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 4Fwd16utALMORYePbfWPySLEGFrchEcQL1HJB0WxvE5zvtrrzintyYoAj1o63Vcpk8KrZXiDJZIkfbAjrDt+uGjQw1HW0Y2iAmNU2qwc8MZWQMwyCxFQPG0LWAnMHK0qBEhM1j6QksjiEnTnohgqaeu48r4lQR06nia62K2oYigGYa1U4eYn3OfU+U7sXoxlTtdnHjMh7RTVZ7ZuGlBRgJmD+YzhFv9/Hver4kHVplZGxzFJ47GtSUMAWYLoeA1HpaZiYHJe6ciNc4uRQFxCwGGGGKKGuMjC731QInn+nqqQVph3dPEfgK4NHWS59bhcAVaZ/tX3mkY1cbcjtbS0Z+5mdpIXlm8drqPJ5E3v4BLlbKYW93ViNCEPFMQHyBEz8MnF68WOqzykfiUREWTg7zoXKTG7HSW7xo46Mp0ZFPUlJcOw4H0nBQpMdaqh0S0qJOos5yXvRxUEExL9YIRkbiE0qjYqcoCfj/n9QM3BXKTS8ZkZsdBwNqwjoAXZHWTdhSn/PIKWGTjRfBnBhoHsoxxF9lRmkhvLjqbtUE5HjsYci88O1e0AWJfYp3mSbMDBIc6EJp5hAie1gSWfYZKhjd7zLDEx8IqnF0Fy6MKHw7ugIGwDKZXxSaG7HbYD+hqxC8j8iBVpI0YT18wtKkma1A== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2024 14:56:56.1330 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e10e36d2-3f48-4cad-eb46-08dd1861b9ab 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: SA2PEPF0000150B.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR19MB4228 X-OriginatorOrg: ddn.com X-BESS-ID: 1733761804-104803-13418-14614-1 X-BESS-VER: 2019.1_20241126.2220 X-BESS-Apparent-Source-IP: 104.47.70.48 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVuZGBkZAVgZQ0Dg1JdnM2MLcPN HMNM0w0TQ5NcXM2Mg0LdkiJSnFIC1VqTYWAGw4wEBBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260998 [from cloudscan9-122.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 When the fuse-server terminates while the fuse-client or kernel still has queued URING_CMDs, these commands retain references to the struct file used by the fuse connection. This prevents fuse_dev_release() from being invoked, resulting in a hung mount point. This patch addresses the issue by making queued URING_CMDs cancelable, allowing fuse_dev_release() to proceed as expected and preventing the mount point from hanging. Signed-off-by: Bernd Schubert --- fs/fuse/dev_uring.c | 87 ++++++++++++++++++++++++++++++++++++++++++--------- fs/fuse/dev_uring_i.h | 12 +++++++ 2 files changed, 85 insertions(+), 14 deletions(-) diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index 8bdfb6fcfa51976cd121bee7f2e8dec1ff9aa916..be7eaf7cc569ff77f8ebdff323634b84ea0a3f63 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -168,6 +168,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; @@ -177,6 +178,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; @@ -262,6 +269,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); @@ -294,24 +302,27 @@ static void fuse_uring_stop_fuse_req_end(struct fuse_ring_ent *ent) /* * Release a request/entry on connection tear down */ -static void fuse_uring_entry_teardown(struct fuse_ring_ent *ent, - bool need_cmd_done) +static void fuse_uring_entry_teardown(struct fuse_ring_ent *ent) { - /* - * fuse_request_end() might take other locks like fi->lock and - * can lead to lock ordering issues - */ - lockdep_assert_not_held(&ent->queue->lock); + struct fuse_ring_queue *queue = ent->queue; - if (need_cmd_done) + if (ent->need_cmd_done) io_uring_cmd_done(ent->cmd, -ENOTCONN, 0, IO_URING_F_UNLOCKED); if (ent->fuse_req) fuse_uring_stop_fuse_req_end(ent); - list_del_init(&ent->list); - kfree(ent); + /* + * 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, @@ -331,15 +342,15 @@ static void fuse_uring_stop_list_entries(struct list_head *head, continue; } + ent->need_cmd_done = ent->state != FRRS_USERSPACE; + ent->state = FRRS_TEARDOWN; list_move(&ent->list, &to_teardown); } spin_unlock(&queue->lock); /* no queue lock to avoid lock order issues */ list_for_each_entry_safe(ent, next, &to_teardown, list) { - bool need_cmd_done = ent->state != FRRS_USERSPACE; - - fuse_uring_entry_teardown(ent, need_cmd_done); + fuse_uring_entry_teardown(ent); queue_refs = atomic_dec_return(&ring->queue_refs); WARN_ON_ONCE(queue_refs < 0); @@ -447,6 +458,49 @@ 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 int fuse_uring_cancel(struct io_uring_cmd *cmd, unsigned int issue_flags) +{ + struct fuse_ring_ent *ent = fuse_uring_cmd_to_ring_ent(cmd); + struct fuse_ring_queue *queue; + bool need_cmd_done = false; + int ret = 0; + + /* + * 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_WAIT) { + ent->state = FRRS_USERSPACE; + list_move(&ent->list, &queue->ent_in_userspace); + need_cmd_done = true; + } + spin_unlock(&queue->lock); + + if (need_cmd_done) { + io_uring_cmd_done(cmd, -ENOTCONN, 0, issue_flags); + } else { + /* io-uring handles resending */ + ret = -EAGAIN; + } + + return ret; +} + +static void fuse_uring_prepare_cancel(struct io_uring_cmd *cmd, int issue_flags, + struct fuse_ring_ent *ring_ent) +{ + fuse_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 */ @@ -841,6 +895,7 @@ static int fuse_uring_commit_fetch(struct io_uring_cmd *cmd, int issue_flags, spin_unlock(&queue->lock); /* without the queue lock, as other locks are taken */ + fuse_uring_prepare_cancel(ring_ent->cmd, issue_flags, ring_ent); fuse_uring_commit(ring_ent, issue_flags); /* @@ -890,6 +945,8 @@ static void _fuse_uring_register(struct fuse_ring_ent *ring_ent, struct fuse_conn *fc = ring->fc; struct fuse_iqueue *fiq = &fc->iq; + fuse_uring_prepare_cancel(ring_ent->cmd, issue_flags, ring_ent); + spin_lock(&queue->lock); fuse_uring_ent_avail(ring_ent, queue); spin_unlock(&queue->lock); @@ -1039,6 +1096,9 @@ int __maybe_unused fuse_uring_cmd(struct io_uring_cmd *cmd, return -EOPNOTSUPP; } + if ((unlikely(issue_flags & IO_URING_F_CANCEL))) + return fuse_uring_cancel(cmd, issue_flags); + /* This extra SQE size holds struct fuse_uring_cmd_req */ if (!(issue_flags & IO_URING_F_SQE128)) return -EINVAL; @@ -1170,7 +1230,6 @@ void fuse_uring_queue_fuse_req(struct fuse_iqueue *fiq, struct fuse_req *req) if (ring_ent) { struct io_uring_cmd *cmd = ring_ent->cmd; - err = -EIO; if (WARN_ON_ONCE(ring_ent->state != FRRS_FUSE_REQ)) goto err; diff --git a/fs/fuse/dev_uring_i.h b/fs/fuse/dev_uring_i.h index 8c5e3ac630f245192c380d132b665d95b8f446a4..4e670022ada2827657feec8e5165e56dbfb86037 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 */ @@ -49,6 +55,9 @@ struct fuse_ring_ent { */ unsigned int state; + /* The entry needs io_uring_cmd_done for teardown */ + unsigned int need_cmd_done:1; + struct fuse_req *fuse_req; /* commit id to identify the server reply */ @@ -84,6 +93,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 Dec 9 14:56:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13899920 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 71C7D1F0E57; Mon, 9 Dec 2024 14:57:05 +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=1733756230; cv=fail; b=PcXGqM8VQ8kkqVFE46zlbD+1j8zdszyb85pEpg/wcVS6vywO6R6GuSwjlAzUJOqsPAJtMJ7C5k3RFKR74A05YvjrIDhiwP/v1VKiZoj97/v3c2IiD6CmqQFCSv6nA8bylOzaJ+lI5dOHKkydqGC9RRqEsmf71K5F5+lBlUEcGQs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733756230; c=relaxed/simple; bh=rY2K7hsReI4pxpACbowihLqcyGYPxjsrm3vYExzWdPY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UvXfADlHfwnHv2Ms7L0lbFF1my/iZpb1XbxbmTAWTeMvZE+IC8oq/NXXH66H8MCVZQvBJXdemN5EacgIg3YGB6VdmNqBSf8YAmilKZSXamER0jkGZPgH0wjkEfRYXYNw1LzFqP3cNs5tES1i65kU6IVBxPH7izS8bctNGq8yLbg= 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=vtvVJORL; 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="vtvVJORL" Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2170.outbound.protection.outlook.com [104.47.57.170]) by mx-outbound21-115.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 09 Dec 2024 14:57:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SgWIvT90Z0E8TY5yKw12DRx+HvToT34fqjW16UiHC36OsaJcKCs/cd4JTb18sN7kS6TTsn6NOw+oWYlePZv5XyeaOMPSjz5CKbCzhedqgipPsncVqRGxinFsbouzhyyq+v8JRUV822pEJ/uvY0LBMbt9fpa6C/2rRpFYJ9filpPSFDjZMYG+JeF38kcx7SaclyFXg9aVVPJIKATeyODSCuzX0m8/8zYyEHPsqbYCPbEPrM+Lr7VG3p5VtMa3rC75rac3iMMTjmQVJar39dpjZgBbD8mo0uyG506DiKV/W+5fV+7bWQ0jbFnVm80S3mW9B1hHahWyYmtRvYBrl++a3w== 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=HiqP9HlaxSiwtbtB7vX3vdAB0f3mcgYAOh3ghlZs1qU=; b=Vm1gCfsvG7x36/wVNHXL6uHmJRuFPijBgYz+a7nx2W8z826g7J2c1/hkFrA0HIHov7zhF2vO6Lw4cWOPiLZ3D+m/vOV15TxKR0ZxlZlCKS6z8BQFP8j6EeR4w3KJXb0ifRHD7MJCqw177o0PELF4oPdjJHT+8BvCqHLiAatQa+ykXEh84Ij/43thO55H+xsCIKWkij4zL4pkGeW4s5IX3ifY9vogCyVVVRTD7C3o/L4ry49J1bpBJ4uarpuEnPjCnJ+oyo2N3B6YL0IdNz4pH6dzgC0ofkgHWHZS1qL8p8rmrbu6yRNxmvySSHK0DPkY0PtiEJBsrde4V7YWNVSksg== 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=HiqP9HlaxSiwtbtB7vX3vdAB0f3mcgYAOh3ghlZs1qU=; b=vtvVJORL0PC0SGeQ7O4JKMRORg6+HVeDaDzhFDbFHQgQRHFjqYUHBoDZo97hTsyp5zYgFRW4G+uElv1BZAwZGljsrCnJRItndEaJuBmwD75c4+bvLCgMm9JFHYfnV4BwucH2QYt/zcvvU1HWAYuk0F7/c2wKmHt1t5X1z0mNnY4= Received: from CH0PR13CA0002.namprd13.prod.outlook.com (2603:10b6:610:b1::7) by CH2PR19MB3862.namprd19.prod.outlook.com (2603:10b6:610:91::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.18; Mon, 9 Dec 2024 14:56:56 +0000 Received: from CH2PEPF00000142.namprd02.prod.outlook.com (2603:10b6:610:b1:cafe::54) by CH0PR13CA0002.outlook.office365.com (2603:10b6:610:b1::7) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8251.11 via Frontend Transport; Mon, 9 Dec 2024 14:56:56 +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 CH2PEPF00000142.mail.protection.outlook.com (10.167.244.75) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.7 via Frontend Transport; Mon, 9 Dec 2024 14:56:56 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 654304A; Mon, 9 Dec 2024 14:56:55 +0000 (UTC) From: Bernd Schubert Date: Mon, 09 Dec 2024 15:56:38 +0100 Subject: [PATCH v8 16/16] fuse: enable fuse-over-io-uring Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241209-fuse-uring-for-6-10-rfc4-v8-16-d9f9f2642be3@ddn.com> References: <20241209-fuse-uring-for-6-10-rfc4-v8-0-d9f9f2642be3@ddn.com> In-Reply-To: <20241209-fuse-uring-for-6-10-rfc4-v8-0-d9f9f2642be3@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733756199; l=1367; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=rY2K7hsReI4pxpACbowihLqcyGYPxjsrm3vYExzWdPY=; b=OpS9qp9dTpSHCz/lTlfeHgurW9A6/eb69ZT/1aFTU5f3U1dsqRdnJrzXRzw7garMfAILNy15Z iRk+zfO0tzaB9oO9KtEOelzOX91aLF/GVBR5IgQAshkNqfEh1vJelav X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PEPF00000142:EE_|CH2PR19MB3862:EE_ X-MS-Office365-Filtering-Correlation-Id: ba8e1bdb-245c-459e-c7f1-08dd1861b9bf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|376014|7416014|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?rRxnn+s+F7W1ukAeROKqEBtmHnKd4qg?= =?utf-8?q?29NdAOnlXNCWj1x4BCUBmlSnqh1Ty2JZwo/Ovc/At0jON1unY0STI5uIiPYcjx6k0?= =?utf-8?q?fB6xRKNo1+b+gV4D0oAPahdt1GbxN9TjtI58nxzqiIwYVBKjo/9EHv85JnxIbfFFZ?= =?utf-8?q?b65idZk9kycq97xA/I6Q+GnwbAVk0zZvKRDja4mB4qCVieNMCkI+iL1zU83+7f+B2?= =?utf-8?q?Hm04mN9O910Hy7gZztMv7CojMwPwpDykDl0lHfPrkKYxLUGuVojn50M5eA99V+XfS?= =?utf-8?q?C/rN6DnDkEu1yOnnF5pBaZmCjjZWfsCOhM05ZcEfWL11uAKwntv8g8zXnceXXF2bV?= =?utf-8?q?fUugXfVIBweScoRxMdkWvSix22hRqm3cfHRXOPJEr2icjydZAryqeityYzr7F36Nr?= =?utf-8?q?uF0VQpDTJqfXtRhZA/hW+ig63kfult2NINlRBMAuGPp9heGSrUYgktChKyTeVdpeI?= =?utf-8?q?6wuyY6WQSGDUerQUJbc62vZ0v1gm6ldRr/vDhDvLmfnghdC+ibKsI/+npcm6X8wMC?= =?utf-8?q?d3gpQZMYBpS9opHB/E3aI3IWE02E8ZGdyqBBC1xoVJ4/aYeOcumFyhqIf+ZHxMQp7?= =?utf-8?q?EFTdiGI6dxWorZpwJ5aZPLRVBu6nUV9ziCfcdcMr1SH4iuoqC61L+pU+R5Db7mJHr?= =?utf-8?q?SCeHpMLavcjztvHeHzxhKTdzvXideT6kt9nCtTiNmRRxJnGH5VIiItPn4146IjGSi?= =?utf-8?q?tfXBGXmLxyaupbdi4UCjRTOFTfHMB7MzQtldisVE2Jw41/ye639uk+np8JcAemwoO?= =?utf-8?q?FSSJrQrpqRTAQOVRc4XGj3ZW8Mk5sz4TfNW13RUaMi/yS8xODfHhkAUmTOteXbb1H?= =?utf-8?q?LpIQTfSyG/PK42F9oeevtJA6rhn12CctFBvXx1qFClwvhidMIpQUEb+MusMM/F7VO?= =?utf-8?q?PuLRDlnPhovRv+aVdwQtJP2yUuPcs+5wI935ITTV3DXbDR+RVoI5OxKPdbASP62Pf?= =?utf-8?q?TQwo73Blhvi/t/Te9EUSJl03lqwENp+M1luxxMxHoxqoIWZVJrryzquPIXH9HVYgU?= =?utf-8?q?UwwoY943lVMMw8pbUCeDLCf6DdKy/TsvzoKsXeNXzV+DK3KLQqzPNTsYJ8K0MzfBl?= =?utf-8?q?k6gjCDELFrWj5bLs/Mfg61UczIK83z/vsJsf67/JJ0ub9wY0j/cM0Cp1w4ifSd2lk?= =?utf-8?q?5i3wnTaQACpa+3oqu5YSZOhBDgPty2MhA34AciPuFNl2esCKubnG/XQYA3WxZN4Hp?= =?utf-8?q?+qYM8sxE7RExp/MNOruSX2II7ocnxZ3J/HRTndwtwrtgbs+JpPGcc33kL5Q7fHbHQ?= =?utf-8?q?UFIJMgqG4HBK0DjacVIzQrcfFjSkH28WBM/YUo1Xzu011WZlTtz9EWEWxFR+eg2IK?= =?utf-8?q?zA7pT0QqqEQYSix3MiTgyIAm56gs9Krp9hesA0dfSzJ6EgqeznHeBN6jOORC4fxx0?= =?utf-8?q?RXCbKb7iIYX?= 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)(7416014)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: yGT/jvnq49P3e9MTy8aE3+y5O8AuUBav6dgLu6jrL7WcsvNHnGTDO6hk7uGcn5aMStg2OdekutMMtiTVLhS64O83YzZu7xeT1VX511c23ytbl4I1TfE+c8kN7DPGOqPe2sB4gmOZQB6rpW9o4T4I08MxgF0kV9WMKb6nJ9xAHcUUauostHt0+YFoeWo1Lg/7/VyCG3rYL0tn4r5e/MrqHYro2MhmKuPborNXiEY0FS/NOPRsfmnJddDr1Sx2YFUTOQI6NYdSbaHnntMpMPP45TpetV+9rRpma6WA37rCycMCjrd1phTvZDZK6H8Ng66RHKdWQK6IreWYM5h7jK41VajrI8rsAwjO9+s87b8waBn9avc7YnVw6Qq7J9JT9Rk1J5vDqSsu3EtJcMpufynYkDq9S5AlEwKwGQXv2ghvmFaztgRrsPMxiK3/lh/UoqI7F5f02sxKu3rfmnmQdrJLzlY4NuexvMcXtUIKPj1918mAJORr3sglbWPkUr7u063tsCMMiYLq7npzJLBB1ckV7p8mnOLr6pN9ZoT5D7TbxQ/BR/HjEp/IUEmcVqeiz/ceozlx6TaickNgBYwUuxlKBAe6UeJWslQgmVHt3R/xzZv0ZkdVqHQ1FOpm1usB0VeBj/haZDeE1E5hHax8LFVyUg== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2024 14:56:56.2320 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ba8e1bdb-245c-459e-c7f1-08dd1861b9bf 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: CH2PEPF00000142.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR19MB3862 X-BESS-ID: 1733756220-105491-13364-2463-1 X-BESS-VER: 2019.1_20241126.2220 X-BESS-Apparent-Source-IP: 104.47.57.170 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVobGRhZAVgZQ0CQ5KcXQwNAk0S wpKdUgxdDU1NjYzCQp0SDZyDApOclUqTYWALAzpMdBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260997 [from cloudscan14-25.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE_7582B META: Custom Rule 7582B 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_RULE_7582B, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 All required parts are handled now, fuse-io-uring can be enabled. Signed-off-by: Bernd Schubert --- fs/fuse/dev.c | 3 +++ fs/fuse/dev_uring.c | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 8f8aaf74ee8dfbe8837f48811138d4ff99b44bba..e2b1d7d6ff67c77e029383419783c46cbdb53e78 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -2492,6 +2492,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 be7eaf7cc569ff77f8ebdff323634b84ea0a3f63..183917edfc1afe41e806528f762951a0233dd66f 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -1083,8 +1083,7 @@ static int fuse_uring_register(struct io_uring_cmd *cmd, * Entry function from io_uring to handle the given passthrough command * (op cocde 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;