From patchwork Wed Oct 16 00:05:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13837505 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 B1A2AE574 for ; Wed, 16 Oct 2024 00:39:25 +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=1729039167; cv=fail; b=qBNzh+s3ojGP0JLw2SdpU/MRch2N1ZKmHNtfAXRH8do9knLW7cKUEwykc9KPUE5UxdFwsE4CizWm8kdQ6zXHxfDOeXRGe/Tzf6ztr2U7HDdI9Lkq1sDG+CxBnz2xUZm8HJvLBlz0FzG41VKu093zJHx/0DnhAFBifVxSuqwRmAs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729039167; c=relaxed/simple; bh=7Xi4hyG04KMKxPwnWaeikRjAaezWNIGfJ7G/TvVGmzw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jYGk3jCorbGjFrwQ1jnYUDqZhe+yCo368HWsQWLfK7jGB7ZdQx3t+3lK+UIYaFii7hHuJriRve4saLqzkSSIdRSbgrnBcOovxFGzBQuarcfRasKQJgTI4di9NeuxR0toKCOo4/0bwcoH+cMjopyalYYnQTJzbUBM2i9TVEtEntI= 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=kVxv9VTO; 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="kVxv9VTO" Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11lp2170.outbound.protection.outlook.com [104.47.56.170]) by mx-outbound14-248.us-east-2a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 16 Oct 2024 00:39:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=IG66XH/Gkh5rz1qerzi5qpbwhEDuJ8Vjvp74s36OWvgJ4HaQjuohhNt2pztwImHxGAkdNWjgvczpkp+TRh/9KzEXrrlCF+Codffijp0796DbXnmNxAi7z2cPKd+v78LzudAJZ2dNPRv2Mrr8aOAfazmUyRdcV5ey0hBXaTV0yP8EislwCvFRERmfIYKygEiYoSEpNBiHJGfBQ8/uHc/Te1kOOAZHk/Eqko3/4A7FlwcJ9inLegJFg5aDx26npzwMaSoRi5fHdQwPuf6PW8ZF1dWUCU5U+jMY98m7y5FXcm+hMKWx/S1Xuv2mbR+iOJ/lpQGbbitURmMYffXTM8gkHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=oJZGXDrF/qYt5U60QDosKDvI8xNwlWRog24xMY9CxGo=; b=CRs5XWWZ7KkqwVjXwoWDeLgPCrmv+Tob1LrcAnOURSX4QD/vgFTpTbH0L6gNz0qpgbheNN5cRWlXKHmNMm9HTMs9Vcbjz99LLIqdM5rEag2FL+kiG3gQst+Cq/TU/RriCWCweGHTW8/1kU1SpQ9pxjsrXsVqzK611YtONl2pMez1mvv1MpBjA7XlXw7ZerOiq6KS/C10dib1/Ea4mT8IhJUDIbY+/L+RQtVldpRIC9Tr2NxaNSBfNvcbQSEqdHxKtfwlC1pjKGO4UManxubJlIc4VZJzTMPCnNBI/KA8hxENTMirJeUY5WHBEU8ylt7ta+B+XZM/lKaFnWtnTHkFGA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=ddn.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oJZGXDrF/qYt5U60QDosKDvI8xNwlWRog24xMY9CxGo=; b=kVxv9VTOBhtirCxVXsj5Ojpq4fxblXAAWlfqNmCt5lz263GQpZR5y4Pfu4oqs3T1ELTV52B6G7ancrLHshIm+lfJYQgWjqdMgg8gbVdbYM3G8TVBW1UpJ5iWpEkOm9RvrKhHhMLRtb5uUupScPjr6JDU368FLOFVw+jUQF6LtLY= Received: from MW4PR04CA0256.namprd04.prod.outlook.com (2603:10b6:303:88::21) by LV3PR19MB8559.namprd19.prod.outlook.com (2603:10b6:408:276::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26; Wed, 16 Oct 2024 00:05:25 +0000 Received: from CO1PEPF000066EC.namprd05.prod.outlook.com (2603:10b6:303:88:cafe::ee) by MW4PR04CA0256.outlook.office365.com (2603:10b6:303:88::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27 via Frontend Transport; Wed, 16 Oct 2024 00:05:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by CO1PEPF000066EC.mail.protection.outlook.com (10.167.249.8) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Wed, 16 Oct 2024 00:05:24 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 0224D7D; Wed, 16 Oct 2024 00:05:23 +0000 (UTC) From: Bernd Schubert Date: Wed, 16 Oct 2024 02:05:13 +0200 Subject: [PATCH RFC v4 01/15] fuse: rename to fuse_dev_end_requests and make non-static Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241016-fuse-uring-for-6-10-rfc4-v4-1-9739c753666e@ddn.com> References: <20241016-fuse-uring-for-6-10-rfc4-v4-0-9739c753666e@ddn.com> In-Reply-To: <20241016-fuse-uring-for-6-10-rfc4-v4-0-9739c753666e@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Amir Goldstein , Ming Lei , Bernd Schubert , Josef Bacik X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1729037122; l=2183; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=7Xi4hyG04KMKxPwnWaeikRjAaezWNIGfJ7G/TvVGmzw=; b=b/qp7uxA3T36qHfPHiK/6tX0mpbOZO9fujfnh38DNYTX+PSapF/B+UPWSibLQMat3ZDLE94vd plR3rRkTr6gBso8MiRz6hxKCNsYaLRoZdoOPgSLKIaBrk0uU9gJhgqn X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000066EC:EE_|LV3PR19MB8559:EE_ X-MS-Office365-Filtering-Correlation-Id: 567784a7-cd59-40e3-46bf-08dced763c1e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|82310400026|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?q?ux+3ZfyUmzovRRSahpfkgh6Bj8jb9wn?= =?utf-8?q?tlRAWS1uAoUj/8/pHriA0MLIaARP5VBwaAhNnEafG1D9WoHjtsRVjU9NYB31RUpSY?= =?utf-8?q?52fxCxv8wY249ia5UYJUhvA7kgaeifpXWguSdO0MbmSp27hGqrAbs6NlKAw0f3Ypr?= =?utf-8?q?bb/1TB4y/Ugn1a1ZNYywTVqQsLQY6lg2EzP09TIhGNigFeJv3aW2tJ4iEpSQiKFs+?= =?utf-8?q?1I0/9YfvVwkILNlA2O4X9MJUoIMoZZoINX9Gr7hehNMaV+m/J/vLoP+7PfrL1pljb?= =?utf-8?q?5cPsgwZTU8yG98MrQF/D/emABgoSq4KMFrXC970YSb1+PRF8ZRdffEUcXCwAyWYDu?= =?utf-8?q?xMobczlvJi4INMlTUPsZ+PkahcDoIfzSSJp2lqaJ5TE+xjm1d0oCtmBD+FK83R3gI?= =?utf-8?q?XqN20J/8FyuzVqXss4UzogyCBjXEyasxCNOE1Ojct8Tgeoip6ouXdi8xBGllsZKhM?= =?utf-8?q?FiuGN2k9OdURxYewDiUyKpZObWyRqq7t6btJSzHBYKcD7wKniwuBNeRrVum/M6z12?= =?utf-8?q?mLd+uI9HXwFNGKWkDVqaY4KKovFabf6pRDSkJXXXn1rUFkofSrldKk0r0J2yZuoBm?= =?utf-8?q?wX5IbKaFAxGagQntu2YdF2MWZuBzrxYiVBXY7L0IU2o3o4FEs9qSPO5exFIdH8kfY?= =?utf-8?q?Ed+HpPeJqrk22fM0kWwZspUVVqzBorgrtkY+ap25Q+2zQstA0SOplbgtRFII3h2Jd?= =?utf-8?q?hb0PmY6yTQLuva1GhOioxySbWf/KeOXE4wo7Nmo9PmvpYfJE6+768+FfVkk2v7J0t?= =?utf-8?q?OfZCTwC4VS3BKQBQlY13DlyvJdS0L0z2/6GTPtyGSm3dRquehW4W3zxd9CSOK7JxH?= =?utf-8?q?QWBQW3slMe/VEU0NL4zAFs61WQZPBunWmmzsAgy1YyhLlP9iVfPrMlAzxe2tnhVHE?= =?utf-8?q?ICcfg+ksvrdHt3dh1cQSovJ0qNe3VRUhhratIQ56Pl0cRb1+q9g6va2FjwwHfzrbp?= =?utf-8?q?1N2stfmW2k6QNv4jf3vddd6Shh2mkpcq9T3G5W0MXUejtM6lj/nHlO9JmWyKEpAEd?= =?utf-8?q?5DhUi9iFtskluH1bekerNy4TPRAsLi05sK0g/1wP57py+C4BhMRRVRfDPN+XVVYo6?= =?utf-8?q?PIdJKvZ/gx4JzSEoDiBFe5Tlyjb4MeaBxsN7nfKngx4P8CoCA/dTs271ZReXCbtZk?= =?utf-8?q?p3Gl1ysfnAPzRzB79Qr6+fFIBOYnY10zQcqnQ8V4bVbV8xKRsI4C03g2k4YPWUGsz?= =?utf-8?q?EqcLg6VccVMxzFLDeYGqKey/pXrAeTQz3slxav5A4SXEIVG0yYVLBnHC7kkoVvtF7?= =?utf-8?q?ym3UWqozDkemiaW2p6EbbVbuFvfU9MguLdh8YDg3DFH5Qx5LIp31VKtc=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(82310400026)(1800799024)(36860700013);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: te3/hcKOYr6mXlcavF2CGGkko1wQl0eSuUo5p3SBQW7fJmEp2ioEOimj2VJuAtYKmkLV6QdAfIvXqKzeYk91VFO1amUU9xxGQT3hDHbZMRzWFILwylx88+p+k0KE+9AJ3XkFEfumz66R4mOESUk9Mpa2JWUJUERqO2WoJLD64rxkuycsOzffLxel9l/4XEn0gCU2Y/CZabf+tAz3/9+5ITmhYkJGVgAb1qx/ER8KzsEOruT2SuH/kNNJsjX+rMIG40o9oe5XGCdcFa2ERhLwrmdQPT+LOFcN4R5HT0g3YRMv1W1knFRg9HJpltY1G/eia8qaU39m54NUVQU5i0ZgsTvRy5j6HUjJn2hCDU70QwKbeG7XZTMIcXxCnSVLaaL6yJcYig4CSjF/1qnF8Ha5h+XR/6S6DDOvHC6VvdDGzRUPb4vDR0zb7hDISWPVFi0db90pwhNseEgWbk27noquPnm/LujnSwY44b/BCmSF6wkW7bxfiVeUg3ulKkOOKp4LVaPApbouJSOr8eyTbIjijxvChWB/hdlunA0Qt/l1gxd/M5uz8IxUg+LpPAv2osp+TPRtcc/PA6MMuiKCkXHyHyvQ2kXl6e4ugsdcAvf21OE7qw5tQq+wOxV5w6sQqqUdYw1MW7Lkk56s1A6naKUnnA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2024 00:05:24.9527 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 567784a7-cd59-40e3-46bf-08dced763c1e 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: CO1PEPF000066EC.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR19MB8559 X-OriginatorOrg: ddn.com X-BESS-ID: 1729039163-103832-12774-12547-1 X-BESS-VER: 2019.1_20241015.1627 X-BESS-Apparent-Source-IP: 104.47.56.170 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVkaGhgZAVgZQ0MLS2DLN2NLQ1M TcMNXcyNwoMcXY0jzNJMnA0sgsJdlUqTYWADHjmkBBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259752 [from cloudscan17-118.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_SC0_MISMATCH_TO META: Envelope rcpt doesn't match header 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_SC0_MISMATCH_TO, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 This function is needed by fuse_uring.c to clean ring queues, so make it non static. Especially in non-static mode the function name 'end_requests' should be prefixed with fuse_ Signed-off-by: Bernd Schubert Reviewed-by: Josef Bacik --- fs/fuse/dev.c | 7 ++++--- fs/fuse/fuse_dev_i.h | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 9eb191b5c4de124b3b469f5487beebbaf7630eb3..74cb9ae900525890543e0d79a5a89e5d43d31c9c 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -7,6 +7,7 @@ */ #include "fuse_i.h" +#include "fuse_dev_i.h" #include #include @@ -2136,7 +2137,7 @@ static __poll_t fuse_dev_poll(struct file *file, poll_table *wait) } /* Abort all requests on the given list (pending or processing) */ -static void end_requests(struct list_head *head) +void fuse_dev_end_requests(struct list_head *head) { while (!list_empty(head)) { struct fuse_req *req; @@ -2239,7 +2240,7 @@ void fuse_abort_conn(struct fuse_conn *fc) wake_up_all(&fc->blocked_waitq); spin_unlock(&fc->lock); - end_requests(&to_end); + fuse_dev_end_requests(&to_end); } else { spin_unlock(&fc->lock); } @@ -2269,7 +2270,7 @@ int fuse_dev_release(struct inode *inode, struct file *file) list_splice_init(&fpq->processing[i], &to_end); spin_unlock(&fpq->lock); - end_requests(&to_end); + fuse_dev_end_requests(&to_end); /* Are we the last open device? */ if (atomic_dec_and_test(&fc->dev_count)) { diff --git a/fs/fuse/fuse_dev_i.h b/fs/fuse/fuse_dev_i.h new file mode 100644 index 0000000000000000000000000000000000000000..5a1b8a2775d84274abee46eabb3000345b2d9da0 --- /dev/null +++ b/fs/fuse/fuse_dev_i.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0 + * + * FUSE: Filesystem in Userspace + * Copyright (C) 2001-2008 Miklos Szeredi + */ +#ifndef _FS_FUSE_DEV_I_H +#define _FS_FUSE_DEV_I_H + +#include + +void fuse_dev_end_requests(struct list_head *head); + +#endif + + From patchwork Wed Oct 16 00:05:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13837504 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 81DFFE574 for ; Wed, 16 Oct 2024 00:39:22 +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=1729039163; cv=fail; b=JiNC0lVY7eI7jaDMKvQWqxpAihyvXw4CyoqnBVY/X+lJ/zihDY2917EgxO2gBRxREhOEbhPO4a9uexV++LpWcYVwHOVAotM53WZgEP6po6IbJIoIPtGeYpFXXbWGM7BD9A3SnKYeYULI67W6aUqCuyqTzzdah8U2XS6HhYT4K/w= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729039163; c=relaxed/simple; bh=qp3XmdsI95RnpqhMvcQU6Y6BK+0DGMicc5TzsLF6qBE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BWBps1sxg/TpMWsx34bI+Cn35nZVZJk6pxqPOnm2b96YsrEBHsHea1oHk4LFizeRMGzncG2kxkeMktiMuRTwc3Ta4mMLPK9O1oSTR4FHKagpa5mRZbIRorjn0NGBktvWkpyt2ipCq4Uaj5+G5MJ2KFj46sGOgh4TUzmDh4HI894= 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=MKKUikkY; 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="MKKUikkY" Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2176.outbound.protection.outlook.com [104.47.58.176]) by mx-outbound46-22.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 16 Oct 2024 00:39:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ndH9+fqyDQqxrzpvWUaPCRBGeO8VHy9tqFRnn8G1fawhAwcgy3B8yzaIu+vJzJrpT0aHwOBVsA6b5N6jj1y25cLAx6AzxSBdU8JyQgCs2TzERNAwQP8A/izchMsS+NfyleuV5Tr5xUy8s7QhFTMkFD7xDygViuN05gldMf5cCwEXryBXOKUMI7tmkk69AohzeMBymO5v8zXgTeNBs5tT5Zbn07wcNf1WPPke1qRB19rk5Y7acVsNSQoUkM8Ddrj2N6tZngSkdKTerxQaarMvQFuZeRrdt7w1iOfKPowGRF8a+hMAqTO4g3Zj87lC2Nji+zOiEkyrn4hyusNMdQghyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/oNa4TMLLXFZIwEaJyUIRnKy/4MYwHse8Yj0xKhVyRI=; b=DNri+EmxjGZcMpDIm09aIavZj3noiYYq8dG8jrWIVZuN4/DB2FQiGHUQBDbHscLYLZH72ahHb476N4V8SvbxsnSQ/ggsxEtJGECsxz/yN1f9Kco5j3vS4FMB20CenCrw5rgNBR8rJEyfXloWVa697iHLedfv8Zl/q/5aaVEfot9GCasBnKp9Un68Olf/PUvHRJ8qckHGujJZviNuXVlBVeWf3iY2mJJaM9blUI9pM1EDVbZcBYODI4O7A3EgVi6s8zI61JcLcpBbhdU0YhHWk4GHqwuukXm6msfTPZU9ykZFRnJ9jjlZLsLts1BudXrRNtxmN3TiBueFHq0i70wdgQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=ddn.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/oNa4TMLLXFZIwEaJyUIRnKy/4MYwHse8Yj0xKhVyRI=; b=MKKUikkYMEcbU7JiOkJfsSWXKPh9XSgk52+9FhRWkpw24DIwrjR/4LqojjMnOj7H+d6qc9yBZsE9awGuT/9ncYF6bmD3yU852jqD0Tad2sRoQ1sxeQgVD3DNhkpdtb8RHBvLxdMwsx8qpM6GA2OXN3NUn5eyNcPbG9qckHI0sMQ= Received: from MW4PR04CA0374.namprd04.prod.outlook.com (2603:10b6:303:81::19) by SJ0PR19MB4541.namprd19.prod.outlook.com (2603:10b6:a03:285::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27; Wed, 16 Oct 2024 00:05:26 +0000 Received: from CO1PEPF000066ED.namprd05.prod.outlook.com (2603:10b6:303:81:cafe::a3) by MW4PR04CA0374.outlook.office365.com (2603:10b6:303:81::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27 via Frontend Transport; Wed, 16 Oct 2024 00:05:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by CO1PEPF000066ED.mail.protection.outlook.com (10.167.249.10) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Wed, 16 Oct 2024 00:05:26 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 1B59429; Wed, 16 Oct 2024 00:05:24 +0000 (UTC) From: Bernd Schubert Date: Wed, 16 Oct 2024 02:05:14 +0200 Subject: [PATCH RFC v4 02/15] fuse: Move fuse_get_dev to header file Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241016-fuse-uring-for-6-10-rfc4-v4-2-9739c753666e@ddn.com> References: <20241016-fuse-uring-for-6-10-rfc4-v4-0-9739c753666e@ddn.com> In-Reply-To: <20241016-fuse-uring-for-6-10-rfc4-v4-0-9739c753666e@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Amir Goldstein , Ming Lei , Bernd Schubert , Josef Bacik X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1729037122; l=1579; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=qp3XmdsI95RnpqhMvcQU6Y6BK+0DGMicc5TzsLF6qBE=; b=cMsrnJE/o1Cdv6LzMMt9fU2+MlEdeth7Q4ZW73Fm6IXyn/rPydinpw0LU/3O49pmNMkpUp55z zUou4mOq/q6C8pfmr1tKM6bFsu8qJQBTesZFAfxoep9B3bC2Hr7Hj5T X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000066ED:EE_|SJ0PR19MB4541:EE_ X-MS-Office365-Filtering-Correlation-Id: f07dc235-1e56-4b6a-bd9c-08dced763cd9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|1800799024|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?Xxf1gbq1TmYtolpLucSx/vPDrdVSjQT?= =?utf-8?q?OIqTY1hzUC7bBGxJUNByxjy8iWjRH/CEJIxSf0cgO/pD8kvzJPaRVUGQg1s6zGmwH?= =?utf-8?q?fDhgtGBZrqKtw989NOeBPRkOj1aWyyC5qdikFiD46uJZ1dL+uWwSQwemIeg1K+6qx?= =?utf-8?q?EYDOEBWfFxuMdv7teyQa/hf4tz7U51yN1ek9yZWla357e52EFZj7AvqTCaT37ebpD?= =?utf-8?q?VyLepfVUxcwmuA2jnM9jifUX9JhcAfzOrq8c9LmBMLDh1Vp9dsy6gXm771K9KPgG2?= =?utf-8?q?xsDXEPhtJaRVaP1+lRvTCDU5WB7s8uHw5NJv50odfJK6pfkybMiSkEShFKsQ9e7Rg?= =?utf-8?q?CZlvcdDQgOF4JzQMsS/vY/mTCdQeCh7tG//xdtHzKRLBqLw4mAZAO/TaYA4zwMovf?= =?utf-8?q?REJjIp3vLx7Yo+InuSQLEE48BCmFJP434Cgzj20/q8rRxpKmW3OO4LdU8PnDm89TE?= =?utf-8?q?n6bEjggQmDBGf9qyujQeKvp+Uzu229uMDMYEzsTHNnk9ZRquQYwMDi2U53uH/hjIB?= =?utf-8?q?8CXfgAvvRqUjaocIqMalSfvxEfoyz6Im1kwnWq/LKFmlkRFZ4ZXhQpftsSF3OXGKi?= =?utf-8?q?5DTnXG9DHL/ha2UL3PzqeNEwWjG/3CFg9AGTlUCBRfWMAASVnlR7vnlR1RZhlxPUU?= =?utf-8?q?xVaRsj21YKBWliwxgprhjwQ57CwTWxriyfwk91fk+0/X1Gh+D4bzpUZ4pfcgNaneM?= =?utf-8?q?c4tCbnCFj+0PHf7L5XLC8ZAGUQVEXKxNnxJvVfoxzWY9dpHbSzHNpIckMMVCZ58Di?= =?utf-8?q?OEJNwI3wcJiVv9jFv6fniNKeU1iY2WvZ8gjswoFzrjohit04Nme5Sqi3I9qCNPV10?= =?utf-8?q?fRftIFHP2zHTqOzoTRoxSwJSceuQ8mlkQUogDhbSuOyR2xc/4Zw1+oU49IyWVDVxW?= =?utf-8?q?oZia002Ms7nxZV3t7OZV1Vdf/x1QQzRLtq6CymHItlf91uJobFNFbI0fd8DfZNpuu?= =?utf-8?q?VfJMg1NsgrUnd8BkRJsDPkO0FH/HcupSNFncGSYIYVR+du/vChUhx6/IBLlUExl4m?= =?utf-8?q?VzeBIH6fVM5/Gm5sy9XEmBCLhQHfmHE2P18qh1d6AEVgUfrvofymTfWL62qUPDFda?= =?utf-8?q?KC/ZCO8Ue6UgdBgxCbUuw9VlGItbAyWmrbb35cfizRLLIwBdA+zvvFjX85vU3NwI7?= =?utf-8?q?0xnNpJFh5Ht1sQIKdLTpFyg81OMyxC7EBOkfHoQOGwEiaZ11bk4l3LVQkkI/N/Lhe?= =?utf-8?q?rQ1vDmUPYX3pNGOYRYsmUhu2ThS2WctubCl0vIb2ebZkK5sMuNABZrNY/19vnj5cI?= =?utf-8?q?67+C1R8MagWmHpmQ/GVj/UuTfFZGrOsRezXDq+ALnRL/GKBP8eo4stn0=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(1800799024)(376014)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 0if7ZEiultOILlT4fKZy2Ex0W2xbhz/2YAcK9861VyNV2jmE/yXHt/mLyzA+IvjibOL24eeqfeKY6In5RMGxnGbpb39bSr4A3DxGyN/lH4J2IbrjMBvE/SW/HP2QbXm4dMrXxviT4MydNo4DrBk5sjeBo/j6TM23sc9hwrCdibKXNFSIDNKln2POi35W52qIk2ai8F6vV+Ys7+WjGiwMZrviLKBDKnZBH1hfnIpjHWf0/GdGFvsZsq1NB6zNeVjlsHD0Le0RXHQ5TJS8l7SykDUtKJO1fs6YO+/VAK388ZI6qE9mnfBpcmaJ7taaLfLlSoVApzdo0Fv3bDgY1xWxzJzHnyeuCQRCiGUfUACGD8QPzxpyzbUGry+4KLObk1Mz7PKa7npg0i8+Fxu9ubILcTAMZH+f26k5PXvpueFbd11oxpuzNrocvDZc/TbgwTkQNS95MVOB7zoN2p+U+8mPxw/fTIum+QMCmkzI5Ju9FVSwAUKvT3nn3QNgKKOmnxPb/n9w3Vv5efAzh3JS5H8Xs9gwg3/EZV9hulu9JkBwbUsJdBmuTHw4sNS7B/G/5q4Rb4z8xa4Ovr0MLauwsHOd+9/3856tiQAmO1Pg/PQiZGZmeNnpmmCxANo8q00hMK23n7lHtYiyhMNLZfRnjx8NAg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2024 00:05:26.1656 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f07dc235-1e56-4b6a-bd9c-08dced763cd9 X-MS-Exchange-CrossTenant-Id: 753b6e26-6fd3-43e6-8248-3f1735d59bb4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=753b6e26-6fd3-43e6-8248-3f1735d59bb4;Ip=[50.222.100.11];Helo=[uww-mrp-01.datadirectnet.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000066ED.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR19MB4541 X-OriginatorOrg: ddn.com X-BESS-ID: 1729039161-111798-10775-61145-1 X-BESS-VER: 2019.1_20241015.1627 X-BESS-Apparent-Source-IP: 104.47.58.176 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoamRuZAVgZQ0NzY2DzZLNUyyS DV3CIpNdk8NdEixSwxxdjSNMXE3CBRqTYWAE+IqGRBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259752 [from cloudscan13-183.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_SC0_MISMATCH_TO META: Envelope rcpt doesn't match header 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_SC0_MISMATCH_TO, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 Another preparation patch, as this function will be needed by fuse/dev.c and fuse/dev_uring.c. Signed-off-by: Bernd Schubert Reviewed-by: Josef Bacik --- fs/fuse/dev.c | 9 --------- fs/fuse/fuse_dev_i.h | 9 +++++++++ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 74cb9ae900525890543e0d79a5a89e5d43d31c9c..9ac69fd2cead0d1fe062dc3405a7dedcd1d36691 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -32,15 +32,6 @@ MODULE_ALIAS("devname:fuse"); static struct kmem_cache *fuse_req_cachep; -static struct fuse_dev *fuse_get_dev(struct file *file) -{ - /* - * Lockless access is OK, because file->private data is set - * once during mount and is valid until the file is released. - */ - return READ_ONCE(file->private_data); -} - static void fuse_request_init(struct fuse_mount *fm, struct fuse_req *req) { INIT_LIST_HEAD(&req->list); diff --git a/fs/fuse/fuse_dev_i.h b/fs/fuse/fuse_dev_i.h index 5a1b8a2775d84274abee46eabb3000345b2d9da0..b38e67b3f889f3fa08f7279e3309cde908527146 100644 --- a/fs/fuse/fuse_dev_i.h +++ b/fs/fuse/fuse_dev_i.h @@ -8,6 +8,15 @@ #include +static inline struct fuse_dev *fuse_get_dev(struct file *file) +{ + /* + * Lockless access is OK, because file->private data is set + * once during mount and is valid until the file is released. + */ + return READ_ONCE(file->private_data); +} + void fuse_dev_end_requests(struct list_head *head); #endif From patchwork Wed Oct 16 00:05:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13837503 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 871F1E574 for ; Wed, 16 Oct 2024 00:39:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=209.222.82.36 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729039148; cv=fail; b=gHXqSLVBibIiWi+gfcnYiP/zh19e5eRuCEDePi+YcsuRHJHgQbA2yFUj9GtOd22oPlxqdjLVSz3wegbvkp7NHgGTBpEG5mmtKnMV4c4Hz6yVBhcwKdbXXkOG63TF9lOTY5iHVze19PZ9yVXWtu47hQDcwD5Bz6U0ANOpSfFT/oc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729039148; c=relaxed/simple; bh=kxd7WZI62yzyG8I2jj0Qg1Mf0LWeh2pb5fEjZ+QpxYc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=c8HderYysOzuYFB+yDcgv0GY9fDTIYOEOxxNXvDVufMboITbwM1ROtNx4Kn24rVSo9Nt/AYjujveMSu61cXh7vSVQgOG2dqpmKCnVzFJOx0QBkCqyafrrTR/zykXALcKIZWAzzwAwPkv9DF4i85gix3ERn+yPdm4hOT0M14MsP4= 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=XRAxDc8B; 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="XRAxDc8B" Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2042.outbound.protection.outlook.com [104.47.66.42]) by mx-outbound14-248.us-east-2a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 16 Oct 2024 00:39:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Tgs/WGuFLiS8DREecXjWgB64i4bRvKJUjDJeXwDXAKKyM3Y9j5eLsPLCpDXSjKbB9Tn9P+k2I02KDff8YbN64z2qAbMSHPVXR2mAulsQOKd7S6iJJaeOzUOSOsgygBg11QdNi1/mtMSETiRgfpnhihWQgvSep4FRPNIrWprR2ooGExTWfLqse9xrTV1m7YTfQAMCCsEW7Nu0KODeGesxumAoz8C3OuwNAIrwHK+vc7QKU6OV6G4b04a+C88ZT1WIyoLmlcLVeWzgrH1GYML0DwpH2KF0Vdio8HrhFyvEpQL3IoUWzjNJtaV6kZA9WRhQHeZ+y0YyM53hosRmH4uPKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=KcIGYKzNIixd5dmjaCE4zhPOtcctg7hqHSHo7mkIorA=; b=xPmPMLUOKPArznSuMz2099KK/9vHfa+6UNZQBoJdilTiRi/bMwPO0EGl61BttWlK/XQK4ycGd6eeWNQAq8xJE+78iSbvFZBUM8qwA7juiZP4BXakFAceXTwEqogG1rQo+S7D22Q+StHzxTN804aCf+Yl6NDT/4tcJmxngFs8Cuhbbuigzok4EuuZg2qGWEiFXj/JiX6DO5itnjz1BZPJ3Wl0vhA5FQ3vgQ2W7N9Mz2LhV5y73Vqx751zVsEGEoC4RsI9TEfdNt3/jqeq7fVlWbNgQFQnkSppOyuUF6eNt+SRvn0atbBT6SdfmIhJx1iqRc0wcApVlXMF9jxmgRY/dw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=ddn.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KcIGYKzNIixd5dmjaCE4zhPOtcctg7hqHSHo7mkIorA=; b=XRAxDc8BPtRo63nDgdISg16b2OTcXNrEekAvGc0kKQ3avr/iXwdK9MilxmtMj+3HManVd3RkpmehrLqXglD7t1UiONBxQLxKl5X5FONFUtVfh9owbDm2jYWRjxwH3TXrK7fp59pskJ/qLqtwEFKp8vm/zFuGVaaZlb/MH4xix50= Received: from SA1PR05CA0005.namprd05.prod.outlook.com (2603:10b6:806:2d2::7) by PH7PR19MB6978.namprd19.prod.outlook.com (2603:10b6:510:201::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26; Wed, 16 Oct 2024 00:05:27 +0000 Received: from SN1PEPF000397B4.namprd05.prod.outlook.com (2603:10b6:806:2d2:cafe::e5) by SA1PR05CA0005.outlook.office365.com (2603:10b6:806:2d2::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Wed, 16 Oct 2024 00:05:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by SN1PEPF000397B4.mail.protection.outlook.com (10.167.248.58) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Wed, 16 Oct 2024 00:05:27 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 3B2E17D; Wed, 16 Oct 2024 00:05:26 +0000 (UTC) From: Bernd Schubert Date: Wed, 16 Oct 2024 02:05:15 +0200 Subject: [PATCH RFC v4 03/15] fuse: Move request bits Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241016-fuse-uring-for-6-10-rfc4-v4-3-9739c753666e@ddn.com> References: <20241016-fuse-uring-for-6-10-rfc4-v4-0-9739c753666e@ddn.com> In-Reply-To: <20241016-fuse-uring-for-6-10-rfc4-v4-0-9739c753666e@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Amir Goldstein , Ming Lei , Bernd Schubert , Josef Bacik X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1729037122; l=1326; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=kxd7WZI62yzyG8I2jj0Qg1Mf0LWeh2pb5fEjZ+QpxYc=; b=AYdIp7AyzLZh4LMyZUqJ4KJbEMDaMWZhfswnUOWySPLzuUOJ8QTtzS7yfrio4dqmdEHPovYUT NBUT+yHtBmWAXvL4Nzpem7MN4wZPegjO3rH/H8fpplzcyD3+ZH77hah X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF000397B4:EE_|PH7PR19MB6978:EE_ X-MS-Office365-Filtering-Correlation-Id: fcae5824-7a95-4495-f1d3-08dced763d64 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?7eSToc9/o8x5aGRnPuWZ3ZK9x0wxKX9?= =?utf-8?q?eBQH7LtNzf5oAdM1PDWmpIGjpk29L4ErkRfNp6GXJbGft4yY53cUMEfZdEqNNo9Gi?= =?utf-8?q?jUCHMrn26IZ8gFsbrjguKr6GGEAAG7i4T3gJDJqkkwlpROQo+DjECnO+ETDqaDDYV?= =?utf-8?q?rrDqlJN3XDJQ4WG65BotpmJy4UbqtPJJ/DpoWhSzUivewv2Nc33DzELZMPkFmlZmm?= =?utf-8?q?02Fo0/VSNHEOGfpBnjJec1pXRcnvDggdDUAFElK0ytuiKX8YQuTSIX3mNLTAky+tH?= =?utf-8?q?l/yPydmiOm4rAZY6T4+usT2h6h24Sm1SsQn3D3On7SXiZO0PfoWb6avJZ37xiHdgt?= =?utf-8?q?PxWGQ/y5QwvzgdNS+/HSSuScauSQ1IELhcIoHyJH4GQY08KOAyE9RziQ+Fc2xR6Af?= =?utf-8?q?zMHxNyFu2kWzQogaZEVOy17Tur5ZkhoiRq3KgC5j/88k0pHJSKMe0lotJCsJs4EGA?= =?utf-8?q?fCMjHCJl5EdZ7WDb/cRRmCuVgijzMm3LEJcE/hK7H/IyA4Apm7dQsPL3Y/X+3XzF9?= =?utf-8?q?6SLqCR19y+zxLXOO7a9wT/yNv88qF3v0hKTI4vd69tWsSeZ2QuJKSVTcjI4FB8w1Y?= =?utf-8?q?xKEHl1k59x2cwXCs09tusU9Im6I6FdfTUzTMfNGrMavr7IocNj1KrOffPwbfupL+N?= =?utf-8?q?Ji3862RLpbmGGCst831KpwCW8LvSFLUiUzO/K7QJgsYLYcSAwhDnaBe093n0Mq4zX?= =?utf-8?q?3XHBA5gA0J/C2cw6fQdgf2+Gv0ykaCa3k+7wUd7PZ5EB6LUaXkpJQ2p84J/TfBeo3?= =?utf-8?q?ypTz1P+ipec9noeWJJqAM4nu838/FlGe4KrOb1PeePiHn4qBeddR8fTA9jRac5Hf4?= =?utf-8?q?jTV5sv5PfcvonE03dbgSsLWgmOItfbD0T72wkkGZiQoUOYhHlM5HBpWvdY+T0fZxo?= =?utf-8?q?lEZ9ilSSvuMPBcDHGrOGYKz/lrpbnOucJs5G47gGXmyNmO3Xya0JUvVQC/gwANNa1?= =?utf-8?q?zBZcImcvGJYIYMzhziiRoRYUo3SXMKTorbbmr6LXWwZWdeuTzixgQP5TyDzKcZGip?= =?utf-8?q?nwd2Ai2EDIoRXDJZndmQD9HghcZL6hCACJUvRtoo6iDaQ3mmHJlI8DrQSCgIN8RBX?= =?utf-8?q?H3nHhKB6ysFPIwxFdKEIlqeGjVBERBaC6RTbqAwtmXcjyOkt0UL3ngJ6N7daA1cUx?= =?utf-8?q?lCsitgzvujLvzeWtWMrN08c29odwWyY51LlfgzFsaDLqotbBqe+bn6VoEBaOZFlW2?= =?utf-8?q?JF4hTBZXcLjGw97A1DRqXeh7CMw1ity8s1i9RO8fwrCFCOY3AQXvfrRPo8NsSnGrh?= =?utf-8?q?XQK0zHLKsGTxwjsz5qRga7tAx/UoEttbLEmcSgW3x1+xxlsow3tXd6xA=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(1800799024)(36860700013)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: +cD5s9tJuxiZrKEt3zQ0KoOgd9Zaa7j3yzA5YJEFccPAABh+NBE+g7+vIJGum2LDHeYon6Ibg89hhx9WRq1otWmEdVov+KlQuzX4VbKbiRUZD+dhzRUm2hF02VDLw1NykybCIHeGkzHxzrPhxi/peXwjf5YZI+vBZDVlmXFKMOsBrBx0hpy17vpbgyeIIzaUxHvKAPzpMJyIt49JNHgH2J01DI9ydoXYOka+wJFDj2QTpVLyx3lYYLp+b8WThFNL6Y4kbBJNqdmWnkK1Yw9avhDFaI6vqEZiw78aazmtZJJzifsZDWIVUgCp5+NryDy8QSsJOrPz7Ny3Jg6SYBtHUSH5RaAqhGxo6Aa6DPknJn0hA3ifG7qMQhlH0UW5fLwuB/bOZTi0b8T3Y1tMQCB++ivzswoFagucw6hfEVR7CLT/TtFUfCbMVSoNBIkRrgqzWR4mYxdfKYeSaOs193/XofMKZ6RZjCV622kje2AMZsDU0XUcZp9IhlfcWB7ojNJeNX2NxwtpoweJWpj0igHZu6j5Mt3IgpXJptk5xE9AUBkkXPGXFH+YJxZlOiWuSfAGJq//j5ASgX7h6ee6qbTh6dzv5dXL8srLK9V7AmzP5xJguuOg9zwkwxZoEm7ujEaPaJejsXqylp/xKG8U4f60Ow== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2024 00:05:27.0936 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fcae5824-7a95-4495-f1d3-08dced763d64 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: SN1PEPF000397B4.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR19MB6978 X-OriginatorOrg: ddn.com X-BESS-ID: 1729039145-103832-12748-12509-1 X-BESS-VER: 2019.1_20241015.1627 X-BESS-Apparent-Source-IP: 104.47.66.42 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoZGFqZAVgZQMMXEONEwJdkkxd LMyDTZ2MTE1Mws1dQ01TTZyNzMKNlAqTYWAFfTRnhBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259752 [from cloudscan18-90.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 0.00 BSF_SC0_MISMATCH_TO META: Envelope rcpt doesn't match header X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, BSF_BESS_OUTBOUND, BSF_SC0_MISMATCH_TO X-BESS-BRTS-Status: 1 These are needed by dev_uring functions as well Signed-off-by: Bernd Schubert Reviewed-by: Josef Bacik --- fs/fuse/dev.c | 4 ---- fs/fuse/fuse_dev_i.h | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 9ac69fd2cead0d1fe062dc3405a7dedcd1d36691..dbc222f9b0f0e590ce3ef83077e6b4cff03cff65 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -26,10 +26,6 @@ MODULE_ALIAS_MISCDEV(FUSE_MINOR); MODULE_ALIAS("devname:fuse"); -/* Ordinary requests have even IDs, while interrupts IDs are odd */ -#define FUSE_INT_REQ_BIT (1ULL << 0) -#define FUSE_REQ_ID_STEP (1ULL << 1) - static struct kmem_cache *fuse_req_cachep; static void fuse_request_init(struct fuse_mount *fm, struct fuse_req *req) diff --git a/fs/fuse/fuse_dev_i.h b/fs/fuse/fuse_dev_i.h index b38e67b3f889f3fa08f7279e3309cde908527146..6c506f040d5fb57dae746880c657a95637ac50ce 100644 --- a/fs/fuse/fuse_dev_i.h +++ b/fs/fuse/fuse_dev_i.h @@ -8,6 +8,10 @@ #include +/* Ordinary requests have even IDs, while interrupts IDs are odd */ +#define FUSE_INT_REQ_BIT (1ULL << 0) +#define FUSE_REQ_ID_STEP (1ULL << 1) + static inline struct fuse_dev *fuse_get_dev(struct file *file) { /* From patchwork Wed Oct 16 00:05:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13837502 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 D7C6A1097B for ; Wed, 16 Oct 2024 00:38:53 +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=1729039135; cv=fail; b=ZbrsqpVRynv1NIN7QurU+IYPFp6Za/CuGotHhw0KuIYAY5NNmW4nx+PjoYilC6CeFiT0jQzjTsD9fWlm2F7QEZ/gB5ZiHLva5Gf6yBJIQz5+ZZD9OS1cT87gMe3Jb5f4RV+lceDqwxt0DjnIPoomeatJIXaM4DBIrIuXPCsOyUU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729039135; c=relaxed/simple; bh=LFN5iHBpQL1ZELcsQiNVADSnkWR8kAU4UAejqcRjIy4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hJ1v2KuaZa5Qd0mnTCNsl83K2qOMMj/SZOPrknAV4/etrrUSYgDFhJFpBfJT+h39/JLR04zzTt7bM3yU/sC51D7Ekp9/esrSLwnUUem35pPQAGn1psHxEad961CmI1HRqB+HkKWYY2K/VuRQ9NBtrvGiLxqyugPXZzzInrsuzdQ= 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=CZJj8ZQc; 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="CZJj8ZQc" Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2049.outbound.protection.outlook.com [104.47.58.49]) by mx-outbound10-224.us-east-2a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 16 Oct 2024 00:38:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GD72BO5u/GJvkakEmxXC2zqhrR9eWdozbZkTyU+yVWGJK/drRmSy8bS+y4TGVwGMMaudOC5E8uZ4sS+5xu5l/fB5vx9gpa7prCeZZLaxX6drTlYg53XZWPn4Ue/m55HiPG2w0uSHymgUPwWDMGm9sZ+rxjo0BTbeZjG9ZVHOCXFy2A3uqj41CMCNgQOCfRezosZXlv7fTj9aFi8+s+hPFXehg+F9id0c8hbERUI4tjz1mqmEhnJKVS06h1qKy4LeHIu32oPAybY7bLwpOqU1DdXJC5AdOQnSuDln48EUZN0Bc0gArr3cf/2MuBhe1Xw0XXxGVZ4wMctyyCSevn3LqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=LHa7n4UGF0oKchdUGLawEi6S0wIRCEXCHai9Y5sQ2zM=; b=sOTDsJOyqGzsXjvr6//DDAPDMkp7qS7gf1Y0HE3zpjYXkurB2cX8vhuAFWu0LFOfAH3VUoPLmkVfh1SznYNBaLJoKMsBTV7KMI0pQATvHLHlb9NkVGVuqtNMqqmFqL/UwTcWAREG2mpZc7lHLl74OyK6dMg9eYiq2ibq8l4XxcOJ0qxqBZmRILUwO+dc2HUJpdBJmD1yrEQnkTni4z/Qkt33btK8oQ00Uk6HHZMxPApNYNiRZMXlhHQuRxYQON9ObuynG2lLNI3N6lTkEoqi7vrghDS9LvT9M0GxB8kXfri8pRxJy5cE63+LLQtFTyTasHHTSwki9O5DXHOULHYb2w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=ddn.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LHa7n4UGF0oKchdUGLawEi6S0wIRCEXCHai9Y5sQ2zM=; b=CZJj8ZQc+8kHPWT1hwK6n2A+i/USG4fYAjCilrpVF6l6jkgi75ItvQna2Zh/Bj1HjlGwvFdlgb/4NwC00YBWFGOOTTcgWov3mOL82Wc1ti36CVY+SAob3eCxNnd4+wprrVSJy0o6vaeU6Y7KJucW4CxrZI5hr2lFpEmEjeNZZQg= Received: from MW4PR04CA0363.namprd04.prod.outlook.com (2603:10b6:303:81::8) by SA1PR19MB8114.namprd19.prod.outlook.com (2603:10b6:806:373::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.18; Wed, 16 Oct 2024 00:05:28 +0000 Received: from CO1PEPF000066ED.namprd05.prod.outlook.com (2603:10b6:303:81::4) by MW4PR04CA0363.outlook.office365.com (2603:10b6:303:81::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Wed, 16 Oct 2024 00:05:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by CO1PEPF000066ED.mail.protection.outlook.com (10.167.249.10) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Wed, 16 Oct 2024 00:05:28 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 5348B29; Wed, 16 Oct 2024 00:05:27 +0000 (UTC) From: Bernd Schubert Date: Wed, 16 Oct 2024 02:05:16 +0200 Subject: [PATCH RFC v4 04/15] fuse: Add fuse-io-uring design documentation Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241016-fuse-uring-for-6-10-rfc4-v4-4-9739c753666e@ddn.com> References: <20241016-fuse-uring-for-6-10-rfc4-v4-0-9739c753666e@ddn.com> In-Reply-To: <20241016-fuse-uring-for-6-10-rfc4-v4-0-9739c753666e@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Amir Goldstein , Ming Lei , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1729037122; l=4808; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=LFN5iHBpQL1ZELcsQiNVADSnkWR8kAU4UAejqcRjIy4=; b=jBkO9pkHA+ceIRZ8CiLX7qpJTm4Xckber3dNxpSB1xX3G2+udu8FlBR2e6cZXSePFMhNdLZZG zScSIh8dunnAmYHDhYgSAYPfLBML44i5LRR8OC1LY+nsY7nmMaoA78A X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000066ED:EE_|SA1PR19MB8114:EE_ X-MS-Office365-Filtering-Correlation-Id: 7fe4e6c9-3392-4775-fda9-08dced763e1d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?YPXI50PY+Q5dBwGskZLrh5vGv5XOnUZ?= =?utf-8?q?oS927rdh3X9Mc7btmxL3Hsfig1nR65If03Qrt5Fvp+JxMCajEiH2pI4FbDMx5eSgK?= =?utf-8?q?tO3y6XiISxb+pbj9WejaHPSNjvAkJsEOrqFgK3loD9YygW2VSgqHT+smM0U3oxXnc?= =?utf-8?q?NHf9g36iRAkBPdT7R+A/dyvmpefxyFPaUgF6IZN/yhyLf+GG6jY9wRVmoYH765eym?= =?utf-8?q?yNxmHNZW3w55EkdHzO/ND+Lbx5Lzb5fxp4hyST36qFDfgRzTDJPRJoTAT3urcFyRt?= =?utf-8?q?PY+OhDB0cnOSg81cHx27jVJgoyFDTJSLx1aUcT0rcrLlH8yOZ2rs2lGjHLsBSLcQG?= =?utf-8?q?Fh774VZe7jPmpcjJpnp5JQUSSE68TiZVmLSzfNZJ0O4uoN8EowBPqbh7F0xtVkUXL?= =?utf-8?q?Pw7/nNMge44ZjKBxS8eNxjFs7c1kIIl4ZFVxTbNHakMUxkiU5b10QUrSMcUlH8ChH?= =?utf-8?q?tzyyr8m/Dkh7Kuoxs8pltYz4P2zxiXt/zui/wi+xOixOqMWgTtY0snVjDAWyr/CsH?= =?utf-8?q?3e7w/wGJKH29KNDxdoWaq7iBGPSGoIjPpr9OT9AxzasyD6Z2SqsQ38T2VCNZC+4VX?= =?utf-8?q?j5KqfMGsxyQZbL5jPqRanLeUer0KFzuONXAn/9RTbVZQGaYZ4+ZqiL1vbagu3A5MF?= =?utf-8?q?pD5DQdjZnR4EqRFFVujRsz6jHt72vyyIrlWq4NVildOzKQx3JLWh6cfzl+3OPox0p?= =?utf-8?q?CtlaTCUCiZwINKbSBrmG2G2QYCoK7RR+GBTB2m6sgSXtOt/cmbeet55vpaPIyXMwl?= =?utf-8?q?CohS1Yu1A9y+kqlS/UgQhz90M3ZgoPgP5aN4s+kSIlO4PSPU/l7wDVWF7vzViiW9G?= =?utf-8?q?JOzF9MtbzkulaXB5ZPkhrAgaVIxJoXO+WBbK0tMhHHEqgUtaC5GxTOfxdguxmiDQE?= =?utf-8?q?/oIbrN8t1QGZMGBBiuizYH46whgLIlrdQa95JhBh05ySvcQz4/U70mHW+HWSuIzoV?= =?utf-8?q?SlShAS0JIA01dZoAhFGZ90D/6VX+T7GiH5Z5z9lZD/hpo6PCazcxPLRmx9OJdY3pr?= =?utf-8?q?qqe7yXm6Qtf2V5TciZsSIwbPo4G1PMUfmd4r5v9KfWY60trVFMl/Wh8Lgx/f3lDZQ?= =?utf-8?q?FLMCZMR7vUnz91RsDPEpTONKD8pOEg5Dfu7QpyOFmp9Mupf8PYLLiAdGH9F6V5jzO?= =?utf-8?q?U1RCNTnn5qujYkxkLqCK8LVjJSDk2TA+wA9nFUtoxnB9hRCRiHiOtqe7+DA+4IclG?= =?utf-8?q?7QYyjqlrr/X7YRh056N8eGM1Y5IuivubCi13OLMNUIoekO6KuClux9NI929RZjN9f?= =?utf-8?q?0wdS/FUqIrrVrt3+mvnQ5PWWDIK+wjVxdqmCWkZ1OH32MxVIZFuXKTZqr0qQhTQKS?= =?utf-8?q?UEcpO5f47PSn?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(36860700013)(376014)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 6CXVHz3TxtAA+OtD8wSgG+9aD8s1PBpUQV39e5ptzDJFFqsBKvBigVXDeeyHqcSbyhGRsR64yNFw0P60Lv0C6pZ457cM5bRtFm7MnoNBkmqw8v0tUb8kd9mWHGuyc2baLixfZ1DwPHeoOwfpW4+ECetLBZXZOfF6xnMMmwQgd/yzIcgJg+r1MmCcmgiYnMkIl0tcZp9hvNkLI37GXsx2u59BBM7OKBKNLq4wXrKUqC4DW2rUt6bokyz/DU3boazxHGhsrcQKttGTgfO5LjylLfO1pVHarjybWR/qydAiZLyd7X5DOQdG+gxQvH041uIQupZd9PLjmzoq9T07aZT3scYW+aBmiJ64GjCPdUzGT3CNFNm7pm/vsHHzmEOYbH2yXFl/qANO0eHOqVDvDH5N3kJazovAWiMkN7yFdrqispu4h9QsNJ1iPW4/niiB8AgkGw1FjPZIJqZ/MT6usHb7bw1mt/6aSDpJLds15TFAiwgtrtIc1DuFZ3X2mcbHKa8HBOPGfparPukmhjAUs4ljuKnuHsIazFJvWaVPRWgyIlg3OaTwXzMja8nouMNwnpuMaEtxerK3/q7OGm7RhYunvhVYjx7TSqej9goNMAfjSk0MHMy7cN82de9E3/1tCbdI1++A5lvPyGQFR2YxA/maOw== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2024 00:05:28.3063 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7fe4e6c9-3392-4775-fda9-08dced763e1d X-MS-Exchange-CrossTenant-Id: 753b6e26-6fd3-43e6-8248-3f1735d59bb4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=753b6e26-6fd3-43e6-8248-3f1735d59bb4;Ip=[50.222.100.11];Helo=[uww-mrp-01.datadirectnet.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000066ED.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR19MB8114 X-OriginatorOrg: ddn.com X-BESS-ID: 1729039131-102784-12841-4646-1 X-BESS-VER: 2019.1_20241015.1627 X-BESS-Apparent-Source-IP: 104.47.58.49 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKViZmliZAVgZQ0MLE0ijFNMU8Nd HA0sjQ2MjcPM042STZzMTIIi3FKNlcqTYWAKwEH+ZBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259752 [from cloudscan8-219.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_SC0_MISMATCH_TO META: Envelope rcpt doesn't match header 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_SC0_MISMATCH_TO, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 Signed-off-by: Bernd Schubert --- Documentation/filesystems/fuse-io-uring.rst | 101 ++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) diff --git a/Documentation/filesystems/fuse-io-uring.rst b/Documentation/filesystems/fuse-io-uring.rst new file mode 100644 index 0000000000000000000000000000000000000000..50fdba1ea566588be3663e29b04bb9bbb6c9e4fb --- /dev/null +++ b/Documentation/filesystems/fuse-io-uring.rst @@ -0,0 +1,101 @@ +.. SPDX-License-Identifier: GPL-2.0 + +=============================== +FUSE Uring design documentation +============================== + +This documentation covers basic details how the fuse +kernel/userspace communication through uring is configured +and works. For generic details about FUSE see fuse.rst. + +This document also covers the current interface, which is +still in development and might change. + +Limitations +=========== +As of now not all requests types are supported through uring, userspace +is required to also handle requests through /dev/fuse after +uring setup is complete. Specifically notifications (initiated from +the daemon side) and interrupts. + +Fuse io-uring configuration +======================== + +Fuse kernel requests are queued through the classical /dev/fuse +read/write interface - until uring setup is complete. + +In order to set up fuse-over-io-uring fuse-server (user-space) +needs to submit SQEs (opcode = IORING_OP_URING_CMD) to the +/dev/fuse connection file descriptor. Initial submit is with +the sub command FUSE_URING_REQ_FETCH, which will just register +entries to be available in the kernel. + +Once at least one entry per queue is submitted, kernel starts +to enqueue to ring queues. +Note, every CPU core has its own fuse-io-uring queue. +Userspace handles the CQE/fuse-request and submits the result as +subcommand FUSE_URING_REQ_COMMIT_AND_FETCH - kernel completes +the requests and also marks the entry available again. If there are +pending requests waiting the request will be immediately submitted +to the daemon again. + +Initial SQE +----------- + + | | FUSE filesystem daemon + | | + | | >io_uring_submit() + | | IORING_OP_URING_CMD / + | | FUSE_URING_REQ_FETCH + | | [wait cqe] + | | >io_uring_wait_cqe() or + | | >io_uring_submit_and_wait() + | | + | >fuse_uring_cmd() | + | >fuse_uring_fetch() | + | >fuse_uring_ent_release() | + + +Sending requests with CQEs +-------------------------- + + | | FUSE filesystem daemon + | | [waiting for CQEs] + | "rm /mnt/fuse/file" | + | | + | >sys_unlink() | + | >fuse_unlink() | + | [allocate request] | + | >__fuse_request_send() | + | ... | + | >fuse_uring_queue_fuse_req | + | [queue request on fg or | + | bg queue] | + | >fuse_uring_assign_ring_entry() | + | >fuse_uring_send_to_ring() | + | >fuse_uring_copy_to_ring() | + | >io_uring_cmd_done() | + | >request_wait_answer() | + | [sleep on req->waitq] | + | | [receives and handles CQE] + | | [submit result and fetch next] + | | >io_uring_submit() + | | IORING_OP_URING_CMD/ + | | FUSE_URING_REQ_COMMIT_AND_FETCH + | >fuse_uring_cmd() | + | >fuse_uring_commit_and_release() | + | >fuse_uring_copy_from_ring() | + | [ copy the result to the fuse req] | + | >fuse_uring_req_end_and_get_next() | + | >fuse_request_end() | + | [wake up req->waitq] | + | >fuse_uring_ent_release_and_fetch()| + | [wait or handle next req] | + | | + | | + | [req->waitq woken up] | + | X-Patchwork-Id: 13837508 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 044D31078B for ; Wed, 16 Oct 2024 00:40:07 +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=1729039209; cv=fail; b=QxsGlgI6YCiBEWypc0SVSvuyHizhBl1ZjOdKzWdoH7nGw8cM8onz3HmNLU+O4qaWHOJXf5f/fUYlGWSncFDpbg6L1ehLxqloeP3RNKW1PO+IzJ/FR2y0SyDSDu8gBnigI1+9UD35aKzlPcvcOTAm39pCGjCWllfGPTs2AK0pVqI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729039209; c=relaxed/simple; bh=bMP2JIFlayPyBgELylas5hqmzcJTK3hYSmxuEgReymI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dyERXgcD6LSEcgGOVVndlEC2CMaidsF1kUCt0YTHC6NH214Mpti8HgPZ5lPo3USUMlXf/dxomtvrLvibmwSYGBX0Rjge+lulKSXY6cPKsppi8j5fu7/AdlNhxc+s79SGJftJFCGQ+YItjdtVFxHgYnKHXKTZ+lxt1SOy8YTjwSY= 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=lCv3C0dG; 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="lCv3C0dG" Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2048.outbound.protection.outlook.com [104.47.66.48]) by mx-outbound46-22.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 16 Oct 2024 00:40:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=v0+nPfW6FzgO8SxD7XmejIULNysL6PAXAZgKoCpfF4pPN0M053yLnYhrzGvVDVvEBn5uPnxqQJU1gkT4yDL6o2krEtQv1dlEL8173l0NPMR65K2B+rzzYCt5CAABAw5Py7HkZie2OPcT9htzSsXBipKHvxVCZCTauNzKznLdHn2BLca201SdDdyxYcB2JgqTe3cF7TB86zh8/03nWcotBFfm0N4UtoBh+j9O6PNr7OfFOGz+S/PDvSDwficnoLxzR8Yn2nuqI9CYxaYXivjQsVQd0bKpUd4KEXcqJZweE4lqb4foyHJ2qayBrZ8/Zh8r50pIKi2DBztZZw1KaGa35Q== 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=O+4PJU9GrAmjg23YbohJMHlXW+2NaOlc5yOcApaQ+/g=; b=edZySJREB3U0k8ixPYPBndgXuVnKylZgA2rDRT374hr8E03F3dfPp7EITWMU7eY7YfPc4Wbq2LwUwgmge4ZB6d82LrZhAXiQt4NBRG3PxjGoOFRsf/IhtjklkIrC+boGda6juXT/mbA2Lm3Nx7v511cf6KXa1UJXgN7GnGNCwIwH0pVKQunHCFi2cR3pdT4ibirRN/cACJ3j4aV+50xPATKGZUUkDCihiwCD13mvxIQRXC/pSuUhH1bGZwQXaYCLBfgwS0XG58lhGMCdSOTb54/jPcmZTfPOdEcuK45koTQmjjpbIb8LxIsAN7MWZAyK21bTE+N1Q8n+VwA2uDCazA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=ddn.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=O+4PJU9GrAmjg23YbohJMHlXW+2NaOlc5yOcApaQ+/g=; b=lCv3C0dGzxCH1M0nDck1lwthNJ+rgtU2Pz2bMF4ZorG0FqUKnjAv8bn2wFQzLdKkD1isw24YVxg/Gs9tu+44BRfl0vQZepYkaSQBFgie0r5rSMQpDNI4/EAL3UU3LAQWG2/vx6SZYBNo5NnWMQsKSp4R100QaQ/bd7Wa7ccg/TM= Received: from SA9PR13CA0033.namprd13.prod.outlook.com (2603:10b6:806:22::8) by CY5PR19MB6267.namprd19.prod.outlook.com (2603:10b6:930:25::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17; Wed, 16 Oct 2024 00:05:29 +0000 Received: from SN1PEPF000397AE.namprd05.prod.outlook.com (2603:10b6:806:22:cafe::8c) by SA9PR13CA0033.outlook.office365.com (2603:10b6:806:22::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Wed, 16 Oct 2024 00:05:29 +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 SN1PEPF000397AE.mail.protection.outlook.com (10.167.248.52) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Wed, 16 Oct 2024 00:05:29 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 6CB047D; Wed, 16 Oct 2024 00:05:28 +0000 (UTC) From: Bernd Schubert Date: Wed, 16 Oct 2024 02:05:17 +0200 Subject: [PATCH RFC v4 05/15] fuse: {uring} Handle SQEs - register commands Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241016-fuse-uring-for-6-10-rfc4-v4-5-9739c753666e@ddn.com> References: <20241016-fuse-uring-for-6-10-rfc4-v4-0-9739c753666e@ddn.com> In-Reply-To: <20241016-fuse-uring-for-6-10-rfc4-v4-0-9739c753666e@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Amir Goldstein , Ming Lei , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1729037122; l=15621; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=bMP2JIFlayPyBgELylas5hqmzcJTK3hYSmxuEgReymI=; b=5ZKkP74CKZQZrhpe7lko48Ifu8wmnlkl/g06xtUVICQasihxiNV6PxRxH3JOXsHM9jpElF3ng p0vGexU8uLQCHpen5jN7Da21ablPxENNZ/dCW3wj6DgSkwev5suV7DR X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF000397AE:EE_|CY5PR19MB6267:EE_ X-MS-Office365-Filtering-Correlation-Id: 5ea3c45e-3985-420d-d6f5-08dced763ebb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|82310400026|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: =?utf-8?q?nctwEhFaPODpsRQlYOnIqsRbxTKDXQ1?= =?utf-8?q?bcY/Y4SlyvZ0+kYcyzAAVGewD5iaqjHiByj/N7Ps5KMczXKo+AIuXuzHtFtyszjkz?= =?utf-8?q?2+MHlD7ZD4wK0vlugJSccHVqGUeT66Qkq2mO7JyiiSgugeB01fock674P3OnWruh7?= =?utf-8?q?dPZBSb+2uR12hkeNPgdzxBG4JuyRZbMkZx3OBkQZUX6jpkJMbMrTxVVR2UfIYHBF0?= =?utf-8?q?YFzR75rxpRjGZWXjSYc1ZeUwTC6BMCb7CRnWriQRqIiTxHZiadfoZNZiW1jbau61P?= =?utf-8?q?+PkgOaxSePBHM5drSyIncbVgbGs+xkp2rHcEKMK/HhPOrd9ZnJIeI0Jpb1n96JiVK?= =?utf-8?q?VYk4gIEv7PznlPiAsUeOIpPyqxMcPmpuUx2RyoQvwxuzBbo2cGvxPp7x0bbyCuDib?= =?utf-8?q?py+bSaCrY71RvwfqFGutVa1poaBJmikAy1x4ipCZFPZpowZ1StLMyi/rMuHc1fNti?= =?utf-8?q?3Rbsz37H/Nl1bQVZVdaMg3JihRfJxucqAwfqdjEVg4iJ55K+CjQtLGKeQXusj7/lf?= =?utf-8?q?NDh4GsYX9qu71Bgul/F2Le9FqoN7EWpxC8Q/LsKdmFdIDpoCfRBOz74Ie7bTjxoUB?= =?utf-8?q?Euvic2AngyUZQAIFvNA6X+8VN6ICEOI7VsX3WO40xV9zSyjXEhY1CNpIn5e1XxMDd?= =?utf-8?q?7UECDIR3Ztwm03OoGup+Y8TmTYLhhmsRS5NWBzVz2WmZNDd6QI23o/7IBnbXHrsjN?= =?utf-8?q?y4ho9EkcBFEZrI/4xfOG/dqqxDA5o710xv8o48I31P5neM7M1fwcvBSddEO3M60Sd?= =?utf-8?q?bg9ekVeU37QGFzRS09d107TEHucbsNsi9x0ly5P09TFfJnLk1DozHOWktQZ/B1qsJ?= =?utf-8?q?s5UqPExIV9xeemQQ/X1H9StIiAib9qaCI8JA//2Jkwe1Hes4tThjsaKxO4reP13mb?= =?utf-8?q?9e8s6L9U674aIjuKUQuW8eo0NTs3pZNQDnxYCsFjro+9xiyeofUkZ3Xut8rYcBUBI?= =?utf-8?q?suvCen8IHRlLeg0Y5OTPMnkI4ekUVp4gk+bqK2ekZvZTMrLyVZsyMqq/9P2OoRsMY?= =?utf-8?q?E0Y9wjBvDunnkByANaJaMFg7q0s9eZd0n4SI24scwzLRW2wXgujXNF31SFXoLelrD?= =?utf-8?q?ZUo7B0raQHFop6XNGAnKGd/dumeQDBDt3rRurXSuu9h7fNP2jx/LPpiFYhBEKZEEv?= =?utf-8?q?NEsOm0WXMgU39nk41l5vNwy4fSZdSp7RCx3rz4utkpTPgkVYSReQlRylhxlUmnHwY?= =?utf-8?q?fEaoHGaNPDd68HcNM+usU/guHL9army22EZnU+XQWlgmUcOEQOghkRQrN0kRL97pn?= =?utf-8?q?/8VIGXDMbW1sCo32VnUOE1Fz1QgT/2z59oe5KoQOqV8PYDp0VS8AMS2itpQYyf6ze?= =?utf-8?q?NE8KCOtXTZ+B?= 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)(82310400026)(36860700013)(1800799024);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: nJxTEUE+FmeMJ299o1WNLLcFOvjpRSpwvx7o9CBI3hlRCuw1Xks+LTeYYRbRiFSKGGHQLpX9dDvPpVxQl6yw6jjsgzUXDej7CE687YPiGjcdS9D1w7oCSEKlkXE4l8mBlhfFz/vN5NAst7OZNv1ErtnhB5bf/8ya1ZxROYEuydYz85QQo/8GrHifai46gyFy497LCjZC7OtL1OoY7PD5b/XqIs4OyKjYYbGZxiC8kytV0tPPs76Jt9f2kE8Esdg5RwID8qJ/ciPWkRnvH8RvcaZMJBDrCKt4rIlaRoO63hO2JsDr6DLoCDmurRpTkCBh1cajM6yi0M1TDlT+8AhdiiRt1rtNpAfQqiAX9FdWNogqZQW9oV3kvn41d+iVWS59lsOScpjk2FP3VgDtMgS/edMxYdjdLwPhaZg9dYxAaBbB1XRjFE1oNDylILL8P+rwFlCeB6C24mE6iiAqUP2YcWV92H+uvonI7rZpdKo0XrZNuofjBE7GQulPQxyix71ChqJDVJp2ytl8q0K+Gu6UxvjRFB3n45i6WixP6+JBaELK5rH8d5BdFAcK8FW78kVrQ5IfRArwYpz/w0rdZtTHvI5chCeksA9VodxHbY5Oo+mDksUiJKOkeECV9sDJdYFKbd4rVpdcEf/3omlpT2Yaeg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2024 00:05:29.3251 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5ea3c45e-3985-420d-d6f5-08dced763ebb 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: SN1PEPF000397AE.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR19MB6267 X-OriginatorOrg: ddn.com X-BESS-ID: 1729039205-111798-10775-61302-1 X-BESS-VER: 2019.1_20241015.1627 X-BESS-Apparent-Source-IP: 104.47.66.48 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoamBgYWQGYGUNTMJNnE3NwkMT kl2TLZKNHc0DTNMNnC3MzIwiglxdLQTKk2FgCc6+8CQgAAAA== X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259752 [from cloudscan12-129.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_SC0_MISMATCH_TO META: Envelope rcpt doesn't match header 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_SC0_MISMATCH_TO, BSF_RULE7568M, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 This adds basic support for ring SQEs (with opcode=IORING_OP_URING_CMD). For now only FUSE_URING_REQ_FETCH is handled to register queue entries. Signed-off-by: Bernd Schubert --- fs/fuse/Kconfig | 12 ++ fs/fuse/Makefile | 1 + fs/fuse/dev.c | 4 + fs/fuse/dev_uring.c | 297 ++++++++++++++++++++++++++++++++++++++++++++++ fs/fuse/dev_uring_i.h | 105 ++++++++++++++++ fs/fuse/fuse_dev_i.h | 1 + fs/fuse/fuse_i.h | 5 + fs/fuse/inode.c | 3 + include/uapi/linux/fuse.h | 70 +++++++++++ 9 files changed, 498 insertions(+) diff --git a/fs/fuse/Kconfig b/fs/fuse/Kconfig index 8674dbfbe59dbf79c304c587b08ebba3cfe405be..11f37cefc94b2af5a675c238801560c822b95f1a 100644 --- a/fs/fuse/Kconfig +++ b/fs/fuse/Kconfig @@ -63,3 +63,15 @@ config FUSE_PASSTHROUGH to be performed directly on a backing file. If you want to allow passthrough operations, answer Y. + +config FUSE_IO_URING + bool "FUSE communication over io-uring" + default y + depends on FUSE_FS + depends on IO_URING + help + This allows sending FUSE requests over the IO uring interface and + also adds request core affinity. + + If you want to allow fuse server/client communication through io-uring, + answer Y diff --git a/fs/fuse/Makefile b/fs/fuse/Makefile index 6e0228c6d0cba9541c8668efb86b83094751d469..7193a14374fd3a08b901ef53fbbea7c31b12f22c 100644 --- a/fs/fuse/Makefile +++ b/fs/fuse/Makefile @@ -11,5 +11,6 @@ fuse-y := dev.o dir.o file.o inode.o control.o xattr.o acl.o readdir.o ioctl.o fuse-y += iomode.o fuse-$(CONFIG_FUSE_DAX) += dax.o fuse-$(CONFIG_FUSE_PASSTHROUGH) += passthrough.o +fuse-$(CONFIG_FUSE_IO_URING) += dev_uring.o virtiofs-y := virtio_fs.o diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index dbc222f9b0f0e590ce3ef83077e6b4cff03cff65..8e8d887bb3dfacec074753ebba7bd504335b5a18 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" @@ -2398,6 +2399,9 @@ const struct file_operations fuse_dev_operations = { .fasync = fuse_dev_fasync, .unlocked_ioctl = fuse_dev_ioctl, .compat_ioctl = compat_ptr_ioctl, +#ifdef CONFIG_FUSE_IO_URING + .uring_cmd = fuse_uring_cmd, +#endif }; EXPORT_SYMBOL_GPL(fuse_dev_operations); diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c new file mode 100644 index 0000000000000000000000000000000000000000..724ac6ae67d301a7bdc5b36a20d620ff8be63b18 --- /dev/null +++ b/fs/fuse/dev_uring.c @@ -0,0 +1,297 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * FUSE: Filesystem in Userspace + * Copyright (c) 2023-2024 DataDirect Networks. + */ + +#include + +#include "fuse_i.h" +#include "dev_uring_i.h" +#include "fuse_dev_i.h" + +#include + +#ifdef CONFIG_FUSE_IO_URING +static bool __read_mostly enable_uring; +module_param(enable_uring, bool, 0644); +MODULE_PARM_DESC(enable_uring, + "Enable uring userspace communication through uring."); +#endif + +static int fuse_ring_ring_ent_unset_userspace(struct fuse_ring_ent *ent) +{ + struct fuse_ring_queue *queue = ent->queue; + + lockdep_assert_held(&queue->lock); + + if (WARN_ON_ONCE(ent->state != FRRS_USERSPACE)) + return -EIO; + + ent->state = FRRS_COMMIT; + list_move(&ent->list, &queue->ent_intermediate_queue); + + return 0; +} + +void fuse_uring_destruct(struct fuse_conn *fc) +{ + struct fuse_ring *ring = fc->ring; + int qid; + + if (!ring) + return; + + for (qid = 0; qid < ring->nr_queues; qid++) { + struct fuse_ring_queue *queue = ring->queues[qid]; + + if (!queue) + continue; + + WARN_ON(!list_empty(&queue->ent_avail_queue)); + WARN_ON(!list_empty(&queue->ent_intermediate_queue)); + + kfree(queue); + ring->queues[qid] = NULL; + } + + kfree(ring->queues); + kfree(ring); + fc->ring = NULL; +} + +/* + * Basic ring setup for this connection based on the provided configuration + */ +static struct fuse_ring *fuse_uring_create(struct fuse_conn *fc) +{ + struct fuse_ring *ring = NULL; + size_t nr_queues = num_possible_cpus(); + struct fuse_ring *res = NULL; + + ring = kzalloc(sizeof(*fc->ring) + + nr_queues * sizeof(struct fuse_ring_queue), + GFP_KERNEL_ACCOUNT); + if (!ring) + return NULL; + + ring->queues = kcalloc(nr_queues, sizeof(struct fuse_ring_queue *), + GFP_KERNEL_ACCOUNT); + if (!ring->queues) + goto out_err; + + spin_lock(&fc->lock); + if (fc->ring) { + /* race, another thread created the ring in the mean time */ + spin_unlock(&fc->lock); + res = fc->ring; + goto out_err; + } + + fc->ring = ring; + ring->nr_queues = nr_queues; + ring->fc = fc; + + spin_unlock(&fc->lock); + return ring; + +out_err: + if (ring) + kfree(ring->queues); + kfree(ring); + return res; +} + +static struct fuse_ring_queue *fuse_uring_create_queue(struct fuse_ring *ring, + int qid) +{ + struct fuse_conn *fc = ring->fc; + struct fuse_ring_queue *queue; + + queue = kzalloc(sizeof(*queue), GFP_KERNEL_ACCOUNT); + if (!queue) + return ERR_PTR(-ENOMEM); + spin_lock(&fc->lock); + if (ring->queues[qid]) { + spin_unlock(&fc->lock); + kfree(queue); + return ring->queues[qid]; + } + ring->queues[qid] = queue; + + queue->qid = qid; + queue->ring = ring; + spin_lock_init(&queue->lock); + + INIT_LIST_HEAD(&queue->ent_avail_queue); + INIT_LIST_HEAD(&queue->ent_intermediate_queue); + + spin_unlock(&fc->lock); + + return queue; +} + +/* + * Put a ring request onto hold, it is no longer used for now. + */ +static void fuse_uring_ent_avail(struct fuse_ring_ent *ring_ent, + struct fuse_ring_queue *queue) + __must_hold(&queue->lock) +{ + struct fuse_ring *ring = queue->ring; + + lockdep_assert_held(&queue->lock); + + /* unsets all previous flags - basically resets */ + pr_devel("%s ring=%p qid=%d state=%d\n", __func__, ring, + ring_ent->queue->qid, ring_ent->state); + + if (WARN_ON(ring_ent->state != FRRS_COMMIT)) { + pr_warn("%s qid=%d state=%d\n", __func__, ring_ent->queue->qid, + ring_ent->state); + return; + } + + list_move(&ring_ent->list, &queue->ent_avail_queue); + + ring_ent->state = FRRS_WAIT; +} + +/* + * fuse_uring_req_fetch command handling + */ +static void _fuse_uring_fetch(struct fuse_ring_ent *ring_ent, + struct io_uring_cmd *cmd, + unsigned int issue_flags) +{ + struct fuse_ring_queue *queue = ring_ent->queue; + + spin_lock(&queue->lock); + fuse_uring_ent_avail(ring_ent, queue); + ring_ent->cmd = cmd; + spin_unlock(&queue->lock); +} + +static int fuse_uring_fetch(struct io_uring_cmd *cmd, unsigned int issue_flags, + struct fuse_conn *fc) +{ + const struct fuse_uring_cmd_req *cmd_req = io_uring_sqe_cmd(cmd->sqe); + struct fuse_ring *ring = fc->ring; + struct fuse_ring_queue *queue; + struct fuse_ring_ent *ring_ent; + int err; + +#if 0 + /* Does not work as sending over io-uring is async */ + err = -ETXTBSY; + if (fc->initialized) { + pr_info_ratelimited( + "Received FUSE_URING_REQ_FETCH after connection is initialized\n"); + return err; + } +#endif + + err = -ENOMEM; + if (!ring) { + ring = fuse_uring_create(fc); + if (!ring) + return err; + } + + queue = ring->queues[cmd_req->qid]; + if (!queue) { + queue = fuse_uring_create_queue(ring, cmd_req->qid); + if (!queue) + return err; + } + + /* + * The created queue above does not need to be destructed in + * case of entry errors below, will be done at ring destruction time. + */ + + ring_ent = kzalloc(sizeof(*ring_ent), GFP_KERNEL_ACCOUNT); + if (ring_ent == NULL) + return err; + + ring_ent->queue = queue; + ring_ent->cmd = cmd; + ring_ent->rreq = (struct fuse_ring_req __user *)cmd_req->buf_ptr; + ring_ent->max_arg_len = cmd_req->buf_len - sizeof(*ring_ent->rreq); + INIT_LIST_HEAD(&ring_ent->list); + + spin_lock(&queue->lock); + + /* + * FUSE_URING_REQ_FETCH is an initialization exception, needs + * state override + */ + ring_ent->state = FRRS_USERSPACE; + err = fuse_ring_ring_ent_unset_userspace(ring_ent); + spin_unlock(&queue->lock); + if (WARN_ON_ONCE(err != 0)) + goto err; + + _fuse_uring_fetch(ring_ent, cmd, issue_flags); + + return 0; +err: + list_del_init(&ring_ent->list); + kfree(ring_ent); + return err; +} + +/** + * Entry function from io_uring to handle the given passthrough command + * (op cocde IORING_OP_URING_CMD) + */ +int fuse_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags) +{ + const struct fuse_uring_cmd_req *cmd_req = io_uring_sqe_cmd(cmd->sqe); + struct fuse_dev *fud; + struct fuse_conn *fc; + u32 cmd_op = cmd->cmd_op; + int err = 0; + + pr_devel("%s:%d received: cmd op %d\n", __func__, __LINE__, cmd_op); + + /* Disabled for now, especially as teardown is not implemented yet */ + err = -EOPNOTSUPP; + pr_info_ratelimited("fuse-io-uring is not enabled yet\n"); + goto out; + + err = -EOPNOTSUPP; + if (!enable_uring) { + pr_info_ratelimited("uring is disabled\n"); + goto out; + } + + err = -ENOTCONN; + fud = fuse_get_dev(cmd->file); + if (!fud) { + pr_info_ratelimited("No fuse device found\n"); + goto out; + } + fc = fud->fc; + + if (fc->aborted) + goto out; + + switch (cmd_op) { + case FUSE_URING_REQ_FETCH: + err = fuse_uring_fetch(cmd, issue_flags, fc); + break; + default: + err = -EINVAL; + pr_devel("Unknown uring command %d", cmd_op); + goto out; + } +out: + pr_devel("uring cmd op=%d, qid=%d ID=%llu ret=%d\n", cmd_op, + cmd_req->qid, cmd_req->commit_id, err); + + if (err < 0) + io_uring_cmd_done(cmd, err, 0, issue_flags); + + return -EIOCBQUEUED; +} diff --git a/fs/fuse/dev_uring_i.h b/fs/fuse/dev_uring_i.h new file mode 100644 index 0000000000000000000000000000000000000000..9a763262c6a5a781a36c3825529d729efef80e78 --- /dev/null +++ b/fs/fuse/dev_uring_i.h @@ -0,0 +1,105 @@ +/* SPDX-License-Identifier: GPL-2.0 + * + * FUSE: Filesystem in Userspace + * Copyright (c) 2023-2024 DataDirect Networks. + */ + +#ifndef _FS_FUSE_DEV_URING_I_H +#define _FS_FUSE_DEV_URING_I_H + +#include "fuse_i.h" + +#ifdef CONFIG_FUSE_IO_URING + +enum fuse_ring_req_state { + + /* ring entry received from userspace and it being processed */ + FRRS_COMMIT, + + /* The ring request waits for a new fuse request */ + FRRS_WAIT, + + /* request is in or on the way to user space */ + FRRS_USERSPACE, +}; + +/** A fuse ring entry, part of the ring queue */ +struct fuse_ring_ent { + /* userspace buffer */ + struct fuse_ring_req __user *rreq; + + /* 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_ring_req::in_out_arg size*/ + size_t max_arg_len; +}; + +struct fuse_ring_queue { + /* + * back pointer to the main fuse uring structure that holds this + * queue + */ + struct fuse_ring *ring; + + /* queue id, typically also corresponds to the cpu core */ + unsigned int qid; + + /* + * queue lock, taken when any value in the queue changes _and_ also + * a ring entry state changes. + */ + spinlock_t lock; + + /* available ring entries (struct fuse_ring_ent) */ + struct list_head ent_avail_queue; + + /* + * entries in the process of being committed or in the process + * to be send to userspace + */ + struct list_head ent_intermediate_queue; +}; + +/** + * Describes if uring is for communication and holds alls the data needed + * for uring communication + */ +struct fuse_ring { + /* back pointer */ + struct fuse_conn *fc; + + /* number of ring queues */ + size_t nr_queues; + + struct fuse_ring_queue **queues; +}; + +void fuse_uring_destruct(struct fuse_conn *fc); +int fuse_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags); + +#else /* CONFIG_FUSE_IO_URING */ + +struct fuse_ring; + +static inline void fuse_uring_create(struct fuse_conn *fc) +{ +} + +static inline void fuse_uring_destruct(struct fuse_conn *fc) +{ +} + +#endif /* CONFIG_FUSE_IO_URING */ + +#endif /* _FS_FUSE_DEV_URING_I_H */ diff --git a/fs/fuse/fuse_dev_i.h b/fs/fuse/fuse_dev_i.h index 6c506f040d5fb57dae746880c657a95637ac50ce..e82cbf9c569af4f271ba0456cb49e0a5116bf36b 100644 --- a/fs/fuse/fuse_dev_i.h +++ b/fs/fuse/fuse_dev_i.h @@ -8,6 +8,7 @@ #include + /* Ordinary requests have even IDs, while interrupts IDs are odd */ #define FUSE_INT_REQ_BIT (1ULL << 0) #define FUSE_REQ_ID_STEP (1ULL << 1) diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index f2391961031374d8d55916c326c6472f0c03aae6..33e81b895fee620b9c2fcc8d9312fec53e3dc227 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -917,6 +917,11 @@ struct fuse_conn { /** IDR for backing files ids */ struct idr backing_files_map; #endif + +#ifdef CONFIG_FUSE_IO_URING + /** uring connection information*/ + struct fuse_ring *ring; +#endif }; /* diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 99e44ea7d8756ded7145f38b49d129b361b991ba..59f8fb7b915f052f892d587a0f9a8dc17cf750ce 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -7,6 +7,7 @@ */ #include "fuse_i.h" +#include "dev_uring_i.h" #include #include @@ -947,6 +948,8 @@ static void delayed_release(struct rcu_head *p) { struct fuse_conn *fc = container_of(p, struct fuse_conn, rcu); + fuse_uring_destruct(fc); + put_user_ns(fc->user_ns); fc->release(fc); } diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h index d08b99d60f6fd6d0d072d01ad6bcc1b48da0a242..b60a42259f7f735f79e8010e5089f15c34eb9308 100644 --- a/include/uapi/linux/fuse.h +++ b/include/uapi/linux/fuse.h @@ -1186,4 +1186,74 @@ struct fuse_supp_groups { uint32_t groups[]; }; +/** + * Size of the ring buffer header + */ +#define FUSE_RING_HEADER_BUF_SIZE 4096 +#define FUSE_RING_MIN_IN_OUT_ARG_SIZE 4096 + +/* + * Request is background type. Daemon side is free to use this information + * to handle foreground/background CQEs with different priorities. + */ +#define FUSE_RING_REQ_FLAG_ASYNC (1ull << 0) + +/** + * This structure mapped onto the + */ +struct fuse_ring_req { + union { + /* The first 4K are command data */ + char ring_header[FUSE_RING_HEADER_BUF_SIZE]; + + struct { + uint64_t flags; + + uint32_t in_out_arg_len; + uint32_t padding; + + /* kernel fills in, reads out */ + union { + struct fuse_in_header in; + struct fuse_out_header out; + }; + }; + }; + + char in_out_arg[]; +}; + +/** + * sqe commands to the kernel + */ +enum fuse_uring_cmd { + FUSE_URING_REQ_INVALID = 0, + + /* submit sqe to kernel to get a request */ + FUSE_URING_REQ_FETCH = 1, + + /* commit result and fetch next request */ + FUSE_URING_REQ_COMMIT_AND_FETCH = 2, +}; + +/** + * In the 80B command area of the SQE. + */ +struct fuse_uring_cmd_req { + /* User buffer */ + uint64_t buf_ptr; + + /* entry identifier */ + uint64_t commit_id; + + /* queue the command is for (queue index) */ + uint16_t qid; + uint8_t padding[6]; + + /* length of the user buffer */ + uint32_t buf_len; + + uint32_t flags; +}; + #endif /* _LINUX_FUSE_H */ From patchwork Wed Oct 16 00:05:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13837500 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 3F1EB11711 for ; Wed, 16 Oct 2024 00:38:30 +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=1729039112; cv=fail; b=ZYYKSm+IGcbl0pxfx8V1qRfJzSYvvqmWzrAX2ajVkIC2ZFwto0Ac61OA3tDLRIW5QU/2tteXtK7iVsMu2fEQl10oOD2b9e6RzQd1Gdq2GnCyf6j6iC+mO17U2ydWRSG/2ORfVP6/WljVso9Y/QsjHfrsKFRFt8Ed2KEKFLjpssA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729039112; c=relaxed/simple; bh=J9SSQv17ODP07Ds5z6GaMJIQhHLKhHt6Q3b1Pb5OBXI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=H6ro5I2e5QGKysLSSYPGx11w6qvTpgxm0VeFdYrLKSJ5a2c9507TLZmtuoQv88xKyPUb0FmfdxuP6nl1ZIg0xvzGHZbXfNhOQZ8RY1qLkdMtFfRpWL6qYTps0JaYdISsXh0ObbFcMCNfNN3L6h4622xlK5hTQlOFMzAbRbhEwB0= 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=Dwe2CFHi; 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="Dwe2CFHi" Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2174.outbound.protection.outlook.com [104.47.58.174]) by mx-outbound46-22.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 16 Oct 2024 00:38:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=EsnLzhzwcalCMt48ChYXNeJJ6zlrHOHcuSmOWrqjoEg6xRYuXfJioe7BU73vTSAoQHabZXzBTVafU/hlsQSpmjUB5AfpFkrG7x5iRIxMsoK2QaE2+6kJtxWwOVekXjdAVQLGcQHjnKwIOXiVo4suxuhqi8FRkuWd3Ah1HcyB5RQBBica+v7W8wEPHhT3ehHA1zJQDEiAOrktqhvfrC4wLtPR0anHfkx9U1CMejwyt2zk33686tIGUrXWOyZQWIOms9BphKWg140EHmz4aFiKKuiFiwXDwV29zHIVY7KCyoNPutvBvzCSuetvJpvS4gNcgu9mFuTdJ97Wmc7yJhv7qg== 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=Z5nOAIXqSlgSEtNSF2O2ZJWiV84h2viHI4IXNhXz20o=; b=aHIGkzf0qhNN3xyGgzFpWNkOhdEJ1VNZuRAiuRabVqm1UV5Y9kSrOichGBOwH/ahzxE+Q+yVpCS+jAWU7lz1v3nuBooQ/T0RKnTdWYqsiAmGTIbbx0T8ePx7CUxlR2gG3GpwdfIusKl1HxLMeTx5aGj3Rt86y3vun8bQ7d9qR+9QVKpLwI2B35HJFmLBK64Esc4/pUacTn8k/qipAUXg+yVc/OmqYaQDD83WFxZZWrSnIUgHjXRHyOLel8fh7wYFE4Y1hKo5DhIt/7fbQtiwsTy7DqdJMWfrS+rHnM+boOmSVSx8kgxAuGhPVLhmuMfC9/LG+K/oj4SNIWLoxgXumw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=ddn.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=Z5nOAIXqSlgSEtNSF2O2ZJWiV84h2viHI4IXNhXz20o=; b=Dwe2CFHiCOQmeMwSmtOxC7mAfeToUKUc7UGWcIe0csDWI88aPZu8iVtqdltNXGHsl0JHwAsAgfc1PtXUbatCapKXgBXsW6epWgLn0K9dyxIuVTn4PGNdPg3rbqYqlmjbwTInUDISWQJ47iU8yCqsnRTHGDOfvs0cMVy8GAaI5dE= Received: from BN8PR12CA0005.namprd12.prod.outlook.com (2603:10b6:408:60::18) by SN7PR19MB7066.namprd19.prod.outlook.com (2603:10b6:806:2ad::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26; Wed, 16 Oct 2024 00:05:31 +0000 Received: from BN1PEPF00004680.namprd03.prod.outlook.com (2603:10b6:408:60:cafe::52) by BN8PR12CA0005.outlook.office365.com (2603:10b6:408:60::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Wed, 16 Oct 2024 00:05:31 +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 BN1PEPF00004680.mail.protection.outlook.com (10.167.243.85) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Wed, 16 Oct 2024 00:05:30 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 8759D29; Wed, 16 Oct 2024 00:05:29 +0000 (UTC) From: Bernd Schubert Date: Wed, 16 Oct 2024 02:05:18 +0200 Subject: [PATCH RFC v4 06/15] fuse: Make fuse_copy non static Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241016-fuse-uring-for-6-10-rfc4-v4-6-9739c753666e@ddn.com> References: <20241016-fuse-uring-for-6-10-rfc4-v4-0-9739c753666e@ddn.com> In-Reply-To: <20241016-fuse-uring-for-6-10-rfc4-v4-0-9739c753666e@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Amir Goldstein , Ming Lei , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1729037122; l=3663; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=J9SSQv17ODP07Ds5z6GaMJIQhHLKhHt6Q3b1Pb5OBXI=; b=SqFTSOURt04x6PkDH1bgA5Sxz+T3eb65J7ftw6cMXfVSS5PPnL2XoEhWpA6H48lta6QLEBGyd wOubv6V0Km6CmYGMWLgEjsmqbL/jlbSvG0ItSM91Zl3fhoC7iBD+LSg X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00004680:EE_|SN7PR19MB7066:EE_ X-MS-Office365-Filtering-Correlation-Id: 88a2d3fe-c972-4969-1b5d-08dced763f8e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?utf-8?q?8ZYeZXKixjUm3iQQ4wRPNJC4ZMbS1KL?= =?utf-8?q?m/05Krc5HR6tBMe+vyqEo4L1p2P/e05PffWXLPPG/4oOon91vlBiauGhBvhtKXm/M?= =?utf-8?q?lJRgA/ydHaRDjr8BARVuXyWq/Y0Xp2xYbyikTCHEn1IFXdMyQH9owsp07c0Wgq82M?= =?utf-8?q?Eezkuhp6pSalE9EA2POOBglSqtt272iSgBpi55r4FCM/RALUWTMutAcqxHOMc+SM8?= =?utf-8?q?60GDd7lLzc8JZTo9x287wCjqmX8ewtIu/iFyrbNwK9bQFHdamq4VyGsJk1eNjkxND?= =?utf-8?q?0+3zXKkWpaS5714YpPls0v2O/PGKigP5OY8915s3BrXL3r0x4bhRJc6fsUlGF7oIl?= =?utf-8?q?E1vDzAXgkx9frH3NltRkEJK1RoZKe8Zkwv2aAekFeJqEuaJyKJqyGqEcX0So4v3Yg?= =?utf-8?q?bjtj/Vj4gBgg+uvsSSv2wNQtotW0J1WISBCtdkCuIgf5qsBuI97f+SycGazgOTXLa?= =?utf-8?q?4/EFBGbIiIUdrChAZgUn4NLfU53d/EzA3qfi9eNmXwbNMH1kXwFKF/Yp6dLVzuLtG?= =?utf-8?q?frKImjCOAKf8UG/lvHucpP898KsSZxr2/sorFT+a4WEliQIrD/2mcH4rxuyyMvJB3?= =?utf-8?q?J8szyWaZpUMAP8tuGxxCOAHyTcwTaDyghkp9Q6iyG5wboLR2Y8GpwumUhJ6tx5qZP?= =?utf-8?q?W/U2rezEV+Xv4ML557GLErykTSh213pTJt+sHrCGJW3nDNA7zpsIngpJakFEm1v9C?= =?utf-8?q?FlE6J40z/QwpoctSCzfqpajCKTpmx4+cv95PpIwXBRTu+rYCldyeMm+D1y76PCYZT?= =?utf-8?q?JnuoMdafeXe0EnL4s9y8+ynk/8mIMEQgItPC41DfKKsXaFMV7QcHkRyUqNkBcjWBd?= =?utf-8?q?rXSh6ErUyOUT4rPIzdi6nGz8EV+NIqWgzMGA2msM/BeFCd8gW4ZkDsCbiiV1MdOm5?= =?utf-8?q?cncHmFDQ1I5kFO44gVe0R+WaFU4ly8FNCsNsdhTw00CshYQQOz7Vfi8IU9J+jxxfd?= =?utf-8?q?B+vLEG7OWe/6RDPp555FykwScU3AQiIVCP8CdjuiIZE9Zdc/C5Oy9wg5K67C0MhxR?= =?utf-8?q?iS24qraG3rEfM9vFpomFuhEJ+36sAmSEi5sAtJPMWz4qoShqbDPyV/OhmpkLHWrKq?= =?utf-8?q?srIxemIetvinlD90ZVCZBNV/m+iHCPRXCrl84mqjHshiZIto5dMyj87GUXbgcTffP?= =?utf-8?q?VBZF5nXHbMg6JLlQ26n4rA66UjaISckFkgFqwUqwaQAL5MznmIZSwcDBoedHaxICo?= =?utf-8?q?MWgAWalTdYPxZUTJY3CO1KdHldecpOeoGNr5ZXC5mJw9c+2wTOvTlsoF+q/vUX0ew?= =?utf-8?q?cE+1u3JpmNWiIHHG9t57Uvo9k3ZeT7s/LM4eQQRi81XNxkNpAcJVqeyIEWwALvRf9?= =?utf-8?q?5qXjYC15JGHj?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(376014)(82310400026)(1800799024);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: YTLB1j9FqQ0mLCDEGdf9zxho6Y99qEjX81iUGyLeAQJfHsNRKOOI7xUSK4zO/qtI3fm5SR1SKmATcrUT1EM3ZWj3iTd9UAw1AWcM1JcLBWa0DUFpRD/TRDGb34+HII1r7Ee4JnIRAU+FXgenFB+ckO/yefzF4IGmBND/cw/xSQMkMTPqQWaswOYnKqJbcWreOQttZK9m2EPHxT/sGBlt299lBYLIKPk5q2cywY2zk4Ba9WSe8FU+ivod+qB6caUCwRH+jEsFN/7tvoddsSMQqsBLwxMOQZxy3NUsbH1Hzb41G9WYOnhB+IownnNVOmd91D+qH3OWmcMhvoD+Pxi4GzJi+I0q9cqGIToJA5ubbd748n4oVgZJ1wyXZ7GKiSxeHIfATRotBSxq/COhFHkBdbr2HFHvk3pttUdUHPohRpVLq05sbj54luVPY5a6jun3eML2QPnNwMhj0rwbkPt/HLEDo0yGRyIIhDjXSz/X5iXyuVlImW7pzS8gL/HnEXlmR1sp61VrsM7W4dpq6gfvFBwVREhpIzTKB3Liz5pywLH4brqPQepaAeUkYbR5n4W5xhqpcNT3Sp+P1Zn/aveZ2laCRftuv3yYXDEK6fCiLDhs3Rpd8mUBt4vxrd798mWH3rzpfATQZnNwpZ0zFtUcGw== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2024 00:05:30.6563 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 88a2d3fe-c972-4969-1b5d-08dced763f8e 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: BN1PEPF00004680.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR19MB7066 X-OriginatorOrg: ddn.com X-BESS-ID: 1729039109-111798-10774-62304-1 X-BESS-VER: 2019.1_20241015.1627 X-BESS-Apparent-Source-IP: 104.47.58.174 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVsamJmZAVgZQ0MDc0DzZMtHMwt DUKM0k0cDQKM3c1DDZ1MQ8ySAtxdJcqTYWAGuER25BAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259752 [from cloudscan12-160.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound 0.00 BSF_SC0_MISMATCH_TO META: Envelope rcpt doesn't match header X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND, BSF_SC0_MISMATCH_TO X-BESS-BRTS-Status: 1 Move 'struct fuse_copy_state' and fuse_copy_* functions to fuse_dev_i.h to make it available for fuse-uring. 'copy_out_args()' is renamed to 'fuse_copy_out_args'. Signed-off-by: Bernd Schubert --- fs/fuse/dev.c | 30 ++++++++---------------------- fs/fuse/fuse_dev_i.h | 25 +++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 22 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 8e8d887bb3dfacec074753ebba7bd504335b5a18..dc4e0f787159a0ce28d29d410f23120aa55cad53 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -630,22 +630,8 @@ static int unlock_request(struct fuse_req *req) return err; } -struct fuse_copy_state { - int write; - struct fuse_req *req; - struct iov_iter *iter; - struct pipe_buffer *pipebufs; - struct pipe_buffer *currbuf; - struct pipe_inode_info *pipe; - unsigned long nr_segs; - struct page *pg; - unsigned len; - unsigned offset; - unsigned move_pages:1; -}; - -static void fuse_copy_init(struct fuse_copy_state *cs, int write, - struct iov_iter *iter) +void fuse_copy_init(struct fuse_copy_state *cs, int write, + struct iov_iter *iter) { memset(cs, 0, sizeof(*cs)); cs->write = write; @@ -999,9 +985,9 @@ static int fuse_copy_one(struct fuse_copy_state *cs, void *val, unsigned size) } /* Copy request arguments to/from userspace buffer */ -static int fuse_copy_args(struct fuse_copy_state *cs, unsigned numargs, - unsigned argpages, struct fuse_arg *args, - int zeroing) +int fuse_copy_args(struct fuse_copy_state *cs, unsigned numargs, + unsigned argpages, struct fuse_arg *args, + int zeroing) { int err = 0; unsigned i; @@ -1867,8 +1853,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); @@ -1970,7 +1956,7 @@ static ssize_t fuse_dev_do_write(struct fuse_dev *fud, if (oh.error) err = nbytes != sizeof(oh) ? -EINVAL : 0; else - err = copy_out_args(cs, req->args, nbytes); + err = fuse_copy_out_args(cs, req->args, nbytes); fuse_copy_finish(cs); spin_lock(&fpq->lock); diff --git a/fs/fuse/fuse_dev_i.h b/fs/fuse/fuse_dev_i.h index e82cbf9c569af4f271ba0456cb49e0a5116bf36b..f36e304cd62c8302aed95de89926fc894f602cfd 100644 --- a/fs/fuse/fuse_dev_i.h +++ b/fs/fuse/fuse_dev_i.h @@ -13,6 +13,23 @@ #define FUSE_INT_REQ_BIT (1ULL << 0) #define FUSE_REQ_ID_STEP (1ULL << 1) +struct fuse_arg; +struct fuse_args; + +struct fuse_copy_state { + int write; + struct fuse_req *req; + struct iov_iter *iter; + struct pipe_buffer *pipebufs; + struct pipe_buffer *currbuf; + struct pipe_inode_info *pipe; + unsigned long nr_segs; + struct page *pg; + unsigned int len; + unsigned int offset; + unsigned int move_pages:1; +}; + static inline struct fuse_dev *fuse_get_dev(struct file *file) { /* @@ -24,6 +41,14 @@ static inline struct fuse_dev *fuse_get_dev(struct file *file) void fuse_dev_end_requests(struct list_head *head); +void fuse_copy_init(struct fuse_copy_state *cs, int write, + struct iov_iter *iter); +int fuse_copy_args(struct fuse_copy_state *cs, unsigned int numargs, + unsigned int argpages, struct fuse_arg *args, + int zeroing); +int fuse_copy_out_args(struct fuse_copy_state *cs, struct fuse_args *args, + unsigned int nbytes); + #endif From patchwork Wed Oct 16 00:05:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13837494 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 91C7E10A0E for ; Wed, 16 Oct 2024 00:37:38 +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=1729039060; cv=fail; b=uXbIWEhut5Hx7gmm/3+lES3bV4VT00T+EofrhmyVoMtXdTba5sHlBaM9HACrpR2toj7dNF7zzFQx9LMfe/X8abQJLJ6i319yBaOWM0psRyJQfT3zTxR04i9FUXhhb55pOrlOMc6g5lDtVdhTqRYCEzLLpkB1iN1xql3We7gZT1c= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729039060; c=relaxed/simple; bh=pNuXHqYBMelL+iq3r157MkqfPX8Plp4UFsidoOeclY4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=B7rpvcwjuMzBZtchu8XYb7GC9YFVGTazdXe5R6/hrXXo3TNvxecXsrZE7TpeRXaGyl2L48WK/hNX1NVxcU9AhWFa3n8UDSyOtlNOP15yINVWNAef4eR6DMxUbIc9yNZq+39Eh1++hKdPrysXrhvgGkJRVb+G/fECxATFO7gYUAg= 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=HnBfLGNA; 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="HnBfLGNA" Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2048.outbound.protection.outlook.com [104.47.55.48]) by mx-outbound10-224.us-east-2a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 16 Oct 2024 00:37:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=G4gq17YjXqrfsMwEQjBu9urn9VN/oXK4qoo8ZOWrk8yDeJblgrIEVenmWt+QALcLbP/RliGpEpLD3xQdvhy8cF67btso4dVLRkOvMnhDAWqwg6Lufh97FTAWLiwCH3/wylRNEDSUO+yD7QydHP4jl0l/ZA3dGY8uIXhgzFiJEp2i2hU5nZCF2Cq0qvpZpQOQStxC/13L4bN94urFRc6+K7iUCgAb9/1+93j++AzjcG7zPJr3L8WblnL2rJPSBOtZ4PPdAq2yxOK68hlYeHPFPMfUPXpMV6NYBe8hMzRGAtwYHRTXU31KNq4EuLoRbP36zOPy0qEFJmJ7/xCmt3nSrg== 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=VfnHHdzb39eJZ8k53FfikwN0df4vGqbRyNXofbLxbVg=; b=uR1CsDO6Nx71r2dbu7om5VCi+816gjpq50tNHS4ufkLJbOCUhpSvK1PW1SDLD8+uf4MoOuuC4GQcVWtemTDflkwJKRKzyRqpoTvURAW6EcDKNPiZ0Ys9SbvBFwjufQdUMWCJGVdHWAAwwlQ2dwOg0phiunflZAj26iXerTYElMR3iU2OILhgaFqPVn5O7kzqtsgYzExm/Nuj8ZebtB5LcXOQnKQcUiftKoRaJRljVUtcHbfUCfNyw7FcPkVVz+7As4/y3WSJqLrjawCFQamWKago/QuB6x+h1zga3z9NfKN1uQf+5QA87sQ6udMw6225NLVn1lVnezA417SmXiNlSQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=ddn.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=VfnHHdzb39eJZ8k53FfikwN0df4vGqbRyNXofbLxbVg=; b=HnBfLGNAmdH798l5cr7Jx0HQ7+FG1o4G075mRREg8JxkhfiZW8U95SePLKzgk3HaJc4TiHrrf6kRv4pKthLYp04A9zCmNRku6fP7GaXplz2q/2XXIiCLuh/MCywfkgU7kTvyMFmiqHOfi/vAaFBy1v257nNXJGPOstQZQadIDPY= Received: from MN2PR14CA0028.namprd14.prod.outlook.com (2603:10b6:208:23e::33) by LV8PR19MB8352.namprd19.prod.outlook.com (2603:10b6:408:201::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27; Wed, 16 Oct 2024 00:05:32 +0000 Received: from BN1PEPF00004686.namprd03.prod.outlook.com (2603:10b6:208:23e:cafe::59) by MN2PR14CA0028.outlook.office365.com (2603:10b6:208:23e::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Wed, 16 Oct 2024 00:05:32 +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 BN1PEPF00004686.mail.protection.outlook.com (10.167.243.91) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Wed, 16 Oct 2024 00:05:31 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 9FFD97D; Wed, 16 Oct 2024 00:05:30 +0000 (UTC) From: Bernd Schubert Date: Wed, 16 Oct 2024 02:05:19 +0200 Subject: [PATCH RFC v4 07/15] fuse: Add buffer offset for uring into fuse_copy_state Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241016-fuse-uring-for-6-10-rfc4-v4-7-9739c753666e@ddn.com> References: <20241016-fuse-uring-for-6-10-rfc4-v4-0-9739c753666e@ddn.com> In-Reply-To: <20241016-fuse-uring-for-6-10-rfc4-v4-0-9739c753666e@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Amir Goldstein , Ming Lei , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1729037122; l=1743; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=pNuXHqYBMelL+iq3r157MkqfPX8Plp4UFsidoOeclY4=; b=aqaW2yUyFQ2jU2qooXUHW2BixrNMMde6j3r6zW14Uyd36u8EWqXYPN0ySCga/N/dNwDDgcrSN t/J09wl/J3uCN7+C++32Sn5cTJ1NIacVh/DzTf3IOPWCUu/j/sUgWQq X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00004686:EE_|LV8PR19MB8352:EE_ X-MS-Office365-Filtering-Correlation-Id: 6ad4e6f0-c704-4797-576c-08dced76403b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|82310400026|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?PHYfetgihCxePjkU7JpFeqOAAh0dNsT?= =?utf-8?q?mMwJK7EZMx3r4naGOKVXZwmQcNQycuZDRL++MGrLHkZcgF/gMY2TVVn1mYQgBl5Bt?= =?utf-8?q?nSc6fKyyLW0Zeojj3gJuDoUgX4vl+xs4YkNG0QnOdnu6Ti21kCty25lgt7I1Qjs1r?= =?utf-8?q?8Y9sySYZtBFrf+Abkdidkbd6LvqDzGUdMNvBaMfU4ROFnrwnoObFaWodHx3QaXNsw?= =?utf-8?q?4LqLChHV0gxa/8A8kVwH6PDfZPrDTFWhvW2qwVuPPJZcswthIaO+lsHlvf7jMqhAW?= =?utf-8?q?sCMNOGFz4XrwTm3fc1XKIygckLgslgKLRQ9liklOIhrju8zaX8Ud7qQX3E2d9oeRX?= =?utf-8?q?e7tp2bJMi0fHzwov1V+fpHulBDPKVlzUdsuzVxpMHU6jKKVxXNwk5WQIQw74ScL28?= =?utf-8?q?SGtrgC/Gi/jcEKMCJ121Vdaw0qhGLsjj6mEmEZK4jRY3WkGDY2o49Omjzyyw5ZtX8?= =?utf-8?q?4906gfof7V3Q26eEwyKcPG2lOWxch4IPPDefPUHmTtMDbUxrd3xlG0Xf071sg5ZKS?= =?utf-8?q?K9rmX1DlmX1fpFKo5nWhu455M1QJJinJdN8Irkx2GpT723mWldS6sysI+v5VDNHwp?= =?utf-8?q?yl12HRL+x1wdp6J2zbiTEydH7pB2ijQodUMDOPSCQt3k/WY/cjew/C4O7KcJy2gTW?= =?utf-8?q?01TVBwDnS3rFdf2iB4cvkOy0OGli2Km/UWVuDkSJ08GjNwYm4Jr/8qsWOrDnwKMY5?= =?utf-8?q?AEPju7ffrDAC7gvfnMwuXXHoHyqeZv1X4BQ4yZY+Qa565BMyWN1LKPA2OPdWIoAed?= =?utf-8?q?VmjJuw4O1sEafoWdGfHeU93WFu0i7LGP03vyXfc1HNOW5eAWSi5AvltPD9dqsiAe0?= =?utf-8?q?9zVWgwXpUno+HpOtvKRm5DBydysLGx9ZkCjijRoPEdxhAa3fpYkaORTKeb/HcY311?= =?utf-8?q?cs05oiRvB5LHJZGKV0G/po2PjFYHOetuo3uAkc1UqncDBfHntawGBS1x734YFPOYg?= =?utf-8?q?Rw0I5bGOZHZfr+k3CZ0uAzOH/hZ9aehg8HD295LrzEC6ohoC/EWjSfULNQjlQhFLV?= =?utf-8?q?Y9h80EjrsvOCxY+iVCalpSRzYZcpFuFuQmp0iWrddtvd5GUjS4HDFeMNbycxrlhKo?= =?utf-8?q?hy4ShSCUWFc/fklXYEcwJyGemDzmYBvx/zaDsSlb4fwGlh/EFS6oFqw+zoWlVi1P2?= =?utf-8?q?xxqEkdzNL5wg+V0kpdlYNtUcRXH8Fk+QUCm9NQtlCA+3XnL62HFJTijmdDXGDI76X?= =?utf-8?q?VCbBicX+6rVTajlF94xVA13VxAaIXzh96rAmav8tvtbhFUOfxbFp250dUkUcNV+qv?= =?utf-8?q?oY+MKyCiyf8xRyBVmVlgoDdkG+k/VEopUiIDHeSfkKwU+5dH+qYL5N2ubOfXD5Zrf?= =?utf-8?q?6H2DClOeiJcm?= 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)(376014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: P6HNpNvOOQ15XjSwEk1nsve2FJ4Z0d8XPYXxwXN/JE/Ln9Q68xmrpBRQNYu4nW5tuTWqiXBVew1pdVH50Dx9WAfndh/onMMW2/XqA3iFxbHzQ5ILnjGkm98YYudE6K+jYZCSyepu/SA8IzOM4ZbS0IVB7KbfcBEh2PUhh+kvqgiAWskiJmAcBQ/HGUW2/duN9otifNffz0SZm5DFzh1R1AucaYmyvl1AGaGKzBmouEnrig867dZoYB9z7pdDaD399ObopEOY1fF/7W/Zy5w6EmMIYCDoHAPE3d6YJMnQ2NmeSghHqmPmTbvgqMi9gc+9PuHzHbuIs0/rZEQeP74V0OJVFpyVAf7oXr+nbu3MbMM75izFOYeeihylISc6NDRX1t720T5TVWrezGlL6qVMaCauQxSeyxDglJJp0qN23ubMCQpQOBdHFfvRT9bCZQ+QrcK9jrsq0q/wjoR/dyTQBpx/QYR2iHTy+6eDALPSjamaYSbaYu5AddFWiEb90GtAkDIYceykE470yVWLvbJLcMta7MK9fkdujq/pNESmRBx1uNmJ4G8s9sIYXJ38yHTRfgdn+7GeaGypw62vOgSFWB4eK3lJSUE/ZnmAnbgJtKMpZnDzkZmkMKWF8HW7vvfDSVC7a5qlcPufkroqRH2GJg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2024 00:05:31.7760 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6ad4e6f0-c704-4797-576c-08dced76403b 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: BN1PEPF00004686.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR19MB8352 X-OriginatorOrg: ddn.com X-BESS-ID: 1729039056-102784-8768-66017-1 X-BESS-VER: 2019.1_20241015.1627 X-BESS-Apparent-Source-IP: 104.47.55.48 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoZmFmZAVgZQMCnNzDLRKCXV1D DZ3NTcKM3Y0tTMyMDCxMIkySINiJRqYwGzmMVrQQAAAA== X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259752 [from cloudscan16-20.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_SC0_MISMATCH_TO META: Envelope rcpt doesn't match header 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_SC0_MISMATCH_TO, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 This is to know the size of the overall copy. Signed-off-by: Bernd Schubert --- fs/fuse/dev.c | 13 ++++++++++++- fs/fuse/fuse_dev_i.h | 5 +++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index dc4e0f787159a0ce28d29d410f23120aa55cad53..12836b44de9164e750f2a5f4c4d78c5c934a32b4 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -738,6 +738,9 @@ static int fuse_copy_do(struct fuse_copy_state *cs, void **val, unsigned *size) *size -= ncpy; cs->len -= ncpy; cs->offset += ncpy; + if (cs->is_uring) + cs->ring.offset += ncpy; + return ncpy; } @@ -1856,7 +1859,15 @@ 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 the out header outside of args + * XXX: This uring exception will probably change + */ + if (!cs->is_uring) + reqsize = sizeof(struct fuse_out_header); reqsize += fuse_len_args(args->out_numargs, args->out_args); diff --git a/fs/fuse/fuse_dev_i.h b/fs/fuse/fuse_dev_i.h index f36e304cd62c8302aed95de89926fc894f602cfd..7ecb103af6f0feca99eb8940872c6a5ccf2e5186 100644 --- a/fs/fuse/fuse_dev_i.h +++ b/fs/fuse/fuse_dev_i.h @@ -28,6 +28,11 @@ struct fuse_copy_state { unsigned int len; unsigned int offset; unsigned int move_pages:1; + unsigned int is_uring:1; + struct { + /* overall offset with the user buffer */ + unsigned int offset; + } ring; }; static inline struct fuse_dev *fuse_get_dev(struct file *file) From patchwork Wed Oct 16 00:05:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13837507 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 386DC156E4 for ; Wed, 16 Oct 2024 00:39:52 +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=1729039194; cv=fail; b=B9QyyU1Sges+y8ABkOIqp1NeQnV0Qs+FGsO7Q4RCses4QBH0YHMJpwtAPsz6kinSBLmv1qqim1T/fnNS/Idcr1XWSfZOorO7St1FN67GDshgqbO7pLLpQGMK8p/A5aRviYNamq7k2S84AvzWak58FxIZO5U/HPuR3N9KSbU9QGI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729039194; c=relaxed/simple; bh=Xyu4lzOIYK3rydC7fD7Qp2upw2uHgx6RcLTassdicXk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=djxJ4LO61OjR1+QHtWCtczRlumlaSRlQ4/G8QKlH0BW9pJR8CnAXCOuvHnwdGrSKf2cCTUR6UFd89yt6ut6ucZ6hvjKiGLwMSrBArnCX6n5qTCxstxofkRyk9hTSGr/QQyaDwbD7PEj2s3NrLXEqZvrDj3cmf8v0ljU2lh6aX5s= 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=Bwf0fltm; 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="Bwf0fltm" Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2041.outbound.protection.outlook.com [104.47.73.41]) by mx-outbound-ea22-15.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 16 Oct 2024 00:39:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DHwKe0BQwZ8MNwQNOIZPp+5xbJ8CZoXzTXk3WHlHuuJF3DzX1CvTPfHQsS/yFKiI3kSQhSqFKRpD1xiqXnC1u1AhSHn6a6rcfG5lCTCw8DcAA3MRw6I3PfnsDdgvniz1NfAGzOOXifVkr5hvJfltASbkuh8LH3vamyhItGnOKRggQKH33cLHYhFBA3N/9mVOhePYOAMxzTB9ZWR1eGeo/04nnO6XrCdHUUBGnLt4BN9adxIkC9iqqNYCCpEfVCtPc+o57GU7ssoGviV5y3e8n6W62TnKJZtifYHqo4N5lzAdjNWG125oPytXXcTMHlDFtvm/Afi8sZ1s6SoQJ+dN8A== 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=N41cDtaw3XrpYKhdfFo1lNO2AIt7smgvknmSUcdyQ4I=; b=axlAlQlNSQ2Wzz+ICadaI9beB7XDJGNZxe72TeTP3X9u0A1vA3bScwJ0TdH+kJyxJ6iMRAPCcZX5pds9t6ggCWG4oVoGpwp8v57Smte+zKn9W0PwDcMap0GAv94NrJcbnjMrZX0kFbCAkbk3ds633RDg/PD0R/Ttz7zcJt7BTAD0kWbMcVy5U1KbO1FHXWBEN6TzwtiVZ+GGhw4cpN5uuhQi+GMUBL4nHH66SntGS5QoeBKmNVyocJLSnYJIAWRLbXSsQlYdgRuhAwptE7rVycZEtyFVBxi0E3JZmuuyzI6WwRlrvotRzQgIfIjj/A+PUJpq1ZXJ2GndWJtRB+4fXA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=ddn.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=N41cDtaw3XrpYKhdfFo1lNO2AIt7smgvknmSUcdyQ4I=; b=Bwf0fltm5qSmGr1z/691KSB3ZohdPXuZKz2hmisnRoVdmJHTm3OfR2gcD1vQNOVMJGeM1/HFGYIpVauMTb6/7GUHuXdvPcxhXiYlvk0AnjmRDeZKee/DICwOQbV+4/MD7kFZnvrhyImYXDAmr5c5gLx3SJB6RiEfB7UfnGEjGlw= Received: from SN6PR2101CA0024.namprd21.prod.outlook.com (2603:10b6:805:106::34) by MW5PR19MB5506.namprd19.prod.outlook.com (2603:10b6:303:192::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26; Wed, 16 Oct 2024 00:05:33 +0000 Received: from SN1PEPF000397B3.namprd05.prod.outlook.com (2603:10b6:805:106:cafe::9e) by SN6PR2101CA0024.outlook.office365.com (2603:10b6:805:106::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.5 via Frontend Transport; Wed, 16 Oct 2024 00:05:32 +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 SN1PEPF000397B3.mail.protection.outlook.com (10.167.248.57) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Wed, 16 Oct 2024 00:05:32 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id BBF0929; Wed, 16 Oct 2024 00:05:31 +0000 (UTC) From: Bernd Schubert Date: Wed, 16 Oct 2024 02:05:20 +0200 Subject: [PATCH RFC v4 08/15] fuse: {uring} Add uring sqe commit and fetch support Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241016-fuse-uring-for-6-10-rfc4-v4-8-9739c753666e@ddn.com> References: <20241016-fuse-uring-for-6-10-rfc4-v4-0-9739c753666e@ddn.com> In-Reply-To: <20241016-fuse-uring-for-6-10-rfc4-v4-0-9739c753666e@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Amir Goldstein , Ming Lei , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1729037122; l=18785; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=Xyu4lzOIYK3rydC7fD7Qp2upw2uHgx6RcLTassdicXk=; b=WRqbtKM51kkY7AUij2BYE+0w3Yi3qrihVV8Itop01JgjVfbSB2WKvR/u9wN/0SkVtSjdhylrD UlhkQROQ5aICkzL8TcSCO0HueBBNTXYRoI7UNPpVlbEnXuSxOU9uF7s X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF000397B3:EE_|MW5PR19MB5506:EE_ X-MS-Office365-Filtering-Correlation-Id: f0a784b8-4142-43d2-86a9-08dced7640bc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?fUK4EfQfsFJiL3N6H7yfM5gB+CBwgZ2?= =?utf-8?q?tC17VuKWtcy4nTIWNmT/Dm2/7XfgmfYH4SkIgzbh2BLA0khQkwcGLS8NfvVW2MjND?= =?utf-8?q?QEDqH5NT+3D5IprWkZHCW+UoyAQEPGHrxTxxE7RYZ+0w3EhgkYAMOOsFxlvhtr5/b?= =?utf-8?q?0NidCV49fbYq0M+C87rNFal5LEc1FE2s7AIgfsMPpHtm2jMPHGHmJn6h0C24QBicz?= =?utf-8?q?zce4gD4mOG73d53WH+xKe/cDgQYvAr7D1BdMhANgr0M72yBkDnPwQPicwGwd18aWQ?= =?utf-8?q?9s/7KENHjbhautm9S/X79uIhIk0bKeS88hNkZy49AmSEwlpItX8teIEffUjgYUFSx?= =?utf-8?q?d0vtE71LULsPy1BCA72Dmoq1BGmcGC/NUuL4+R3N4SZZt2t0b3YJpY7bHXSGgGuhQ?= =?utf-8?q?larxOXoWbMi8+HIarMma64Kfph9ch7nHNh4c8PYM60dVhjQUm/ed/8K4Pu6I5gOjq?= =?utf-8?q?P0EWoRkrld6ByQ6UU5lH6Qy/ZECQpAs2HG1uAzNGA5KFCrXjgphR33Dghe3O9SANX?= =?utf-8?q?2SRVyXgQLo/5/JzNr7C7U03/WDoDbXGGUsGiuUh7VT7pDyOSzlIke6oLMoyy8LoEF?= =?utf-8?q?lsJWhA6+qb12tz21mmqT586Zj6y6+9T16cpJfSLl6Z8kKWgHVPO9mokbucXpl74HY?= =?utf-8?q?zmhtjj4LisqFGq6jOhj8sfilMjt+/VMEeS7nlqHX9N3mB1iwe5blZUeMPk4dZP/sN?= =?utf-8?q?WhNiTe2hZWnffsrMnArKrHwsnzP9ar0ScXCDv0eQt8RaC8jpWNq/7IPEnCQoaEItY?= =?utf-8?q?ib8g1Z23zju38q97YuR8mZfBH50v66r88qAzdpHdmJs7952Rm47oZM2Ga845AThBn?= =?utf-8?q?O/gD42dD6KoMyzRjy0a/oPgMi/ZkboAywq54NQ/gq1q6gkCupuWAAO+/hr37Dc+1I?= =?utf-8?q?YeTMlEG87bQLSqmoON1l8Ju16SiNCSE5ar34UaVFS+SNb5KULLcUeA+gK/m2JDd9y?= =?utf-8?q?jRFG2PZJThFY6tqdUa1yzoy1gpsfDBhL5J9s8yAX1GMUxobWhFiKrunMLdn1jgqMG?= =?utf-8?q?FmV9kRQAzkfTsgKkHNAF7O2LylJ1IsUwUDOljcK6mHDQtAWKGt745BMPwlmjy5nh2?= =?utf-8?q?u6o49q+ZQcQsi6ZS0WrUzORfETG3y3Etm5jjEIJEz9fEgJzd7MOwRCFOAIaSkCfzR?= =?utf-8?q?KSg8TWkIBxhkTTDDelnOTbSmYRcDbQlWcjJsL9sXTK/WnoHELsHh7nB9ylBVZrIvv?= =?utf-8?q?RjRd3AfViD249QVfocPnZZM5JsHEPqs5C1gKGes6188MHuu/0HJ2kXYcWKbWWaGz3?= =?utf-8?q?ur55fQu5fK+6gQHA1oxg1NGyd0Yuiaff13XXD5X7yVpWvI/habmGkJX4J5JmOnKes?= =?utf-8?q?yv8TTYXmHZyd?= 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)(1800799024)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: LNoCR6oA+zYedqU5eR+etLu4+buEvfMB/MSu4QWmWAeevU/IjuxppYkh1EKOax1/DwKL3m2En5/wz+lDKYC0OMGC0UWpuOPoWMULP7Mps8x5H/FsItfo0IGQeCftMl40QLAEwp4/Al7K2TbEqGjrIjs0Kte1gYV1f5XsN1ETLyyn9HkPuIfFYtMr/i37AzswXXg9APkk0vhzUmfscD1PGjNCZFtFN5xAi2o7JFGRdAsj5U6gVB1UIRcEs/YJRTHfFiHMziG7QPUnwwQ8Bgb+Jc/xKtQ1HYdIx1XRbHOTPWVePHAz1HssL+SaKKDYUWWUNaJXapM62bYxebNAvf0AxoN76+RwBbfdWRy2N7addCggACrGSdEfm6hvSaBXJyn9rmufvkrGqAyXm8YghERHZSHvjzJ2jLIDdPWyIkumXV10iQTW3fI6KyqY+PwVXLhuaIstZl+LNk97fB1Bi/XsZ9niYF+cYKwhmy05hFznCrRm45aBvIx0RcVlxWj8qvjO4kQZKs7Y1qzHrfattvjjSJMbNa1IHSQOZsZIVrAeFo2e3Rn5GoNbA0QhzTi/DHk0F6MIAS/S0DGcx2aydGtjBl0za1ObqntcE/oHuF3+UZ2It21b1wNIer9tAutDbKdqMxJXTCCMpVBtiRZ+VCWtcw== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2024 00:05:32.6851 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f0a784b8-4142-43d2-86a9-08dced7640bc 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: SN1PEPF000397B3.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW5PR19MB5506 X-OriginatorOrg: ddn.com X-BESS-ID: 1729039190-105647-17923-34648-1 X-BESS-VER: 2019.3_20241015.1555 X-BESS-Apparent-Source-IP: 104.47.73.41 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoYWhsbGQGYGUNTQ0tDYwszAON koMdEw1Sgxxdw8ydTQJM3Q1CjR3DzRXKk2FgDpjgbwQgAAAA== X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259752 [from cloudscan21-66.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_SC0_MISMATCH_TO META: Envelope rcpt doesn't match header 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_SC0_MISMATCH_TO, BSF_RULE7568M, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 This adds support for fuse request completion through ring SQEs (FUSE_URING_REQ_COMMIT_AND_FETCH handling). After committing the ring entry it becomes available for new fuse requests. Handling of requests through the ring (SQE/CQE handling) is complete now. Fuse request data are copied through the mmaped ring buffer, there is no support for any zero copy yet. Signed-off-by: Bernd Schubert --- fs/fuse/dev.c | 6 +- fs/fuse/dev_uring.c | 430 ++++++++++++++++++++++++++++++++++++++++++++++++++ fs/fuse/dev_uring_i.h | 13 ++ fs/fuse/fuse_dev_i.h | 7 +- fs/fuse/fuse_i.h | 9 ++ fs/fuse/inode.c | 2 +- 6 files changed, 462 insertions(+), 5 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 12836b44de9164e750f2a5f4c4d78c5c934a32b4..fdb43640db5fdbe6b6232e1b2e2259e3117d237d 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -188,7 +188,7 @@ u64 fuse_get_unique(struct fuse_iqueue *fiq) } EXPORT_SYMBOL_GPL(fuse_get_unique); -static unsigned int fuse_req_hash(u64 unique) +unsigned int fuse_req_hash(u64 unique) { return hash_long(unique & ~FUSE_INT_REQ_BIT, FUSE_PQ_HASH_BITS); } @@ -1844,7 +1844,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; @@ -1929,7 +1929,7 @@ static ssize_t fuse_dev_do_write(struct fuse_dev *fud, spin_lock(&fpq->lock); req = NULL; if (fpq->connected) - req = request_find(fpq, oh.unique & ~FUSE_INT_REQ_BIT); + req = fuse_request_find(fpq, oh.unique & ~FUSE_INT_REQ_BIT); err = -ENOENT; if (!req) { diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index 724ac6ae67d301a7bdc5b36a20d620ff8be63b18..0c39d5c1c62a1c496782e5c54b9f72a70cffdfa2 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -19,6 +19,22 @@ MODULE_PARM_DESC(enable_uring, "Enable uring userspace communication through uring."); #endif +/* + * Finalize a fuse request, then fetch and send the next entry, if available + */ +static void fuse_uring_req_end(struct fuse_ring_ent *ring_ent, bool set_err, + int error) +{ + struct fuse_req *req = ring_ent->fuse_req; + + if (set_err) + req->out.h.error = error; + + clear_bit(FR_SENT, &req->flags); + fuse_request_end(ring_ent->fuse_req); + ring_ent->fuse_req = NULL; +} + static int fuse_ring_ring_ent_unset_userspace(struct fuse_ring_ent *ent) { struct fuse_ring_queue *queue = ent->queue; @@ -50,7 +66,9 @@ void fuse_uring_destruct(struct fuse_conn *fc) WARN_ON(!list_empty(&queue->ent_avail_queue)); WARN_ON(!list_empty(&queue->ent_intermediate_queue)); + WARN_ON(!list_empty(&queue->ent_in_userspace)); + kfree(queue->fpq.processing); kfree(queue); ring->queues[qid] = NULL; } @@ -107,6 +125,7 @@ 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) @@ -114,6 +133,7 @@ static struct fuse_ring_queue *fuse_uring_create_queue(struct fuse_ring *ring, spin_lock(&fc->lock); if (ring->queues[qid]) { spin_unlock(&fc->lock); + kfree(queue->fpq.processing); kfree(queue); return ring->queues[qid]; } @@ -125,12 +145,228 @@ static struct fuse_ring_queue *fuse_uring_create_queue(struct fuse_ring *ring, INIT_LIST_HEAD(&queue->ent_avail_queue); INIT_LIST_HEAD(&queue->ent_intermediate_queue); + INIT_LIST_HEAD(&queue->ent_in_userspace); + INIT_LIST_HEAD(&queue->fuse_req_queue); + + pq = kcalloc(FUSE_PQ_HASH_SIZE, sizeof(struct list_head), GFP_KERNEL); + if (!pq) { + kfree(queue); + return ERR_PTR(-ENOMEM); + } + queue->fpq.processing = pq; + fuse_pqueue_init(&queue->fpq); spin_unlock(&fc->lock); return queue; } +static void +fuse_uring_async_send_to_ring(struct io_uring_cmd *cmd, + unsigned int issue_flags) +{ + io_uring_cmd_done(cmd, 0, 0, issue_flags); +} + +/* + * Checks for errors and stores it into the request + */ +static int fuse_uring_out_header_has_err(struct fuse_out_header *oh, + struct fuse_req *req, + struct fuse_conn *fc) +{ + int err; + + if (oh->unique == 0) { + /* Not supportd through request based uring, this needs another + * ring from user space to kernel + */ + pr_warn("Unsupported fuse-notify\n"); + err = -EINVAL; + goto seterr; + } + + if (oh->error <= -512 || oh->error > 0) { + err = -EINVAL; + goto seterr; + } + + if (oh->error) { + err = oh->error; + pr_devel("%s:%d err=%d op=%d req-ret=%d", __func__, __LINE__, + err, req->args->opcode, req->out.h.error); + goto err; /* error already set */ + } + + if ((oh->unique & ~FUSE_INT_REQ_BIT) != req->in.h.unique) { + pr_warn("Unpexted seqno mismatch, expected: %llu got %llu\n", + req->in.h.unique, oh->unique & ~FUSE_INT_REQ_BIT); + err = -ENOENT; + goto seterr; + } + + /* Is it an interrupt reply ID? */ + if (oh->unique & FUSE_INT_REQ_BIT) { + err = 0; + if (oh->error == -ENOSYS) + fc->no_interrupt = 1; + else if (oh->error == -EAGAIN) { + /* XXX Interrupts not handled yet */ + /* err = queue_interrupt(req); */ + pr_warn("Intrerupt EAGAIN not supported yet"); + err = -EINVAL; + } + + goto seterr; + } + + return 0; + +seterr: + pr_devel("%s:%d err=%d op=%d req-ret=%d", __func__, __LINE__, err, + req->args->opcode, req->out.h.error); + oh->error = err; +err: + pr_devel("%s:%d err=%d op=%d req-ret=%d", __func__, __LINE__, err, + req->args->opcode, req->out.h.error); + return err; +} + +static int fuse_uring_copy_from_ring(struct fuse_ring *ring, + struct fuse_req *req, + struct fuse_ring_ent *ent) +{ + struct fuse_ring_req __user *rreq = ent->rreq; + struct fuse_copy_state cs; + struct fuse_args *args = req->args; + struct iov_iter iter; + int err; + int res_arg_len; + + err = copy_from_user(&res_arg_len, &rreq->in_out_arg_len, + sizeof(res_arg_len)); + if (err) + return err; + + err = import_ubuf(ITER_SOURCE, (void __user *)&rreq->in_out_arg, + ent->max_arg_len, &iter); + if (err) + return err; + + fuse_copy_init(&cs, 0, &iter); + cs.is_uring = 1; + cs.req = req; + + return fuse_copy_out_args(&cs, args, res_arg_len); +} + + /* + * Copy data from the req to the ring buffer + */ +static int fuse_uring_copy_to_ring(struct fuse_ring *ring, struct fuse_req *req, + struct fuse_ring_ent *ent) +{ + struct fuse_ring_req __user *rreq = ent->rreq; + struct fuse_copy_state cs; + struct fuse_args *args = req->args; + int err, res; + struct iov_iter iter; + + err = import_ubuf(ITER_DEST, (void __user *)&rreq->in_out_arg, + ent->max_arg_len, &iter); + if (err) { + pr_info("Import user buffer failed\n"); + return err; + } + + fuse_copy_init(&cs, 1, &iter); + cs.is_uring = 1; + cs.req = req; + err = fuse_copy_args(&cs, args->in_numargs, args->in_pages, + (struct fuse_arg *)args->in_args, 0); + if (err) { + pr_info("%s fuse_copy_args failed\n", __func__); + return err; + } + + BUILD_BUG_ON((sizeof(rreq->in_out_arg_len) != sizeof(cs.ring.offset))); + res = copy_to_user(&rreq->in_out_arg_len, &cs.ring.offset, + sizeof(rreq->in_out_arg_len)); + err = res > 0 ? -EFAULT : res; + + return err; +} + +static int +fuse_uring_prepare_send(struct fuse_ring_ent *ring_ent) +{ + struct fuse_ring_req *rreq = ring_ent->rreq; + struct fuse_ring_queue *queue = ring_ent->queue; + struct fuse_ring *ring = queue->ring; + struct fuse_req *req = ring_ent->fuse_req; + int err = 0, res; + + if (WARN_ON(ring_ent->state != FRRS_FUSE_REQ)) { + pr_err("qid=%d ring-req=%p buf_req=%p invalid state %d on send\n", + queue->qid, ring_ent, rreq, ring_ent->state); + err = -EIO; + } + + if (err) + return err; + + pr_devel("%s qid=%d state=%d cmd-done op=%d unique=%llu\n", __func__, + queue->qid, ring_ent->state, req->in.h.opcode, + req->in.h.unique); + + /* copy the request */ + err = fuse_uring_copy_to_ring(ring, req, ring_ent); + if (unlikely(err)) { + pr_info("Copy to ring failed: %d\n", err); + goto err; + } + + /* copy fuse_in_header */ + res = copy_to_user(&rreq->in, &req->in.h, sizeof(rreq->in)); + err = res > 0 ? -EFAULT : res; + if (err) + goto err; + + set_bit(FR_SENT, &req->flags); + return 0; + +err: + fuse_uring_req_end(ring_ent, true, err); + return err; +} + +/* + * Write data to the ring buffer and send the request to userspace, + * userspace will read it + * This is comparable with classical read(/dev/fuse) + */ +static int fuse_uring_send_next_to_ring(struct fuse_ring_ent *ring_ent) +{ + int err = 0; + struct fuse_ring_queue *queue = ring_ent->queue; + + err = fuse_uring_prepare_send(ring_ent); + if (err) + goto err; + + spin_lock(&queue->lock); + ring_ent->state = FRRS_USERSPACE; + list_move(&ring_ent->list, &queue->ent_in_userspace); + spin_unlock(&queue->lock); + + io_uring_cmd_complete_in_task(ring_ent->cmd, + fuse_uring_async_send_to_ring); + return 0; + +err: + return err; +} + /* * Put a ring request onto hold, it is no longer used for now. */ @@ -157,6 +393,197 @@ static void fuse_uring_ent_avail(struct fuse_ring_ent *ring_ent, ring_ent->state = FRRS_WAIT; } +/* Used to find the request on SQE commit */ +static void fuse_uring_add_to_pq(struct fuse_ring_ent *ring_ent) +{ + struct fuse_ring_queue *queue = ring_ent->queue; + struct fuse_req *req = ring_ent->fuse_req; + struct fuse_pqueue *fpq = &queue->fpq; + unsigned int hash; + + hash = fuse_req_hash(req->in.h.unique); + list_move_tail(&req->list, &fpq->processing[hash]); + req->ring_entry = ring_ent; +} + +/* + * Assign a fuse queue entry to the given entry + */ +static void fuse_uring_add_req_to_ring_ent(struct fuse_ring_ent *ring_ent, + struct fuse_req *req) +{ + lockdep_assert_held(&ring_ent->queue->lock); + + if (WARN_ON_ONCE(ring_ent->state != FRRS_WAIT && + ring_ent->state != FRRS_COMMIT)) { + pr_warn("%s qid=%d state=%d\n", __func__, ring_ent->queue->qid, + ring_ent->state); + } + list_del_init(&req->list); + clear_bit(FR_PENDING, &req->flags); + ring_ent->fuse_req = req; + ring_ent->state = FRRS_FUSE_REQ; + + fuse_uring_add_to_pq(ring_ent); +} + +/* + * Release the ring entry and fetch the next fuse request if available + * + * @return true if a new request has been fetched + */ +static bool fuse_uring_ent_assign_req(struct fuse_ring_ent *ring_ent) + __must_hold(&queue->lock) +{ + struct fuse_req *req = NULL; + struct fuse_ring_queue *queue = ring_ent->queue; + struct list_head *req_queue = &queue->fuse_req_queue; + + lockdep_assert_held(&queue->lock); + + /* get and assign the next entry while it is still holding the lock */ + if (!list_empty(req_queue)) { + req = list_first_entry(req_queue, struct fuse_req, list); + fuse_uring_add_req_to_ring_ent(ring_ent, req); + list_move(&ring_ent->list, &queue->ent_intermediate_queue); + } + + return req ? true : false; +} + +/* + * Read data from the ring buffer, which user space has written to + * This is comparible with handling of classical write(/dev/fuse). + * Also make the ring request available again for new fuse requests. + */ +static void fuse_uring_commit(struct fuse_ring_ent *ring_ent, + unsigned int issue_flags) +{ + struct fuse_ring *ring = ring_ent->queue->ring; + struct fuse_conn *fc = ring->fc; + struct fuse_ring_req *rreq = ring_ent->rreq; + struct fuse_req *req = ring_ent->fuse_req; + ssize_t err = 0; + bool set_err = false; + + err = copy_from_user(&req->out.h, &rreq->out, sizeof(req->out.h)); + if (err) { + req->out.h.error = err; + goto out; + } + + err = fuse_uring_out_header_has_err(&req->out.h, req, fc); + if (err) { + /* req->out.h.error already set */ + pr_devel("%s:%d err=%zd oh->err=%d\n", __func__, __LINE__, err, + req->out.h.error); + goto out; + } + + err = fuse_uring_copy_from_ring(ring, req, ring_ent); + if (err) + set_err = true; + +out: + pr_devel("%s:%d ret=%zd op=%d req-ret=%d\n", __func__, __LINE__, err, + req->args->opcode, req->out.h.error); + fuse_uring_req_end(ring_ent, set_err, err); +} + +/* + * Get the next fuse req and send it + */ +static void fuse_uring_next_fuse_req(struct fuse_ring_ent *ring_ent, + struct fuse_ring_queue *queue) +{ + int has_next, err; + int prev_state = ring_ent->state; + + do { + spin_lock(&queue->lock); + has_next = fuse_uring_ent_assign_req(ring_ent); + if (!has_next) { + fuse_uring_ent_avail(ring_ent, queue); + spin_unlock(&queue->lock); + break; /* no request left */ + } + spin_unlock(&queue->lock); + + err = fuse_uring_send_next_to_ring(ring_ent); + if (err) { + ring_ent->state = prev_state; + continue; + } + + err = 0; + } while (err); +} + +/* FUSE_URING_REQ_COMMIT_AND_FETCH handler */ +static int fuse_uring_commit_fetch(struct io_uring_cmd *cmd, int issue_flags, + struct fuse_conn *fc) +{ + const struct fuse_uring_cmd_req *cmd_req = io_uring_sqe_cmd(cmd->sqe); + struct fuse_ring_ent *ring_ent; + int err; + struct fuse_ring *ring = fc->ring; + struct fuse_ring_queue *queue; + uint64_t commit_id = cmd_req->commit_id; + struct fuse_pqueue fpq; + unsigned int hash; + struct fuse_req *req; + + err = -ENOTCONN; + if (!ring) + return err; + + queue = ring->queues[cmd_req->qid]; + if (!queue) + return err; + fpq = queue->fpq; + + spin_lock(&queue->lock); + /* Find a request based on the unique ID of the fuse request + * This should get revised, as it needs a hash calculation and list + * search. And full struct fuse_pqueue is needed (memory overhead). + * As well as the link from req to ring_ent. + */ + hash = fuse_req_hash(commit_id); + 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; + } + ring_ent = req->ring_entry; + req->ring_entry = NULL; + + err = fuse_ring_ring_ent_unset_userspace(ring_ent); + if (err != 0) { + pr_info_ratelimited("qid=%d commit_id %llu state %d", + queue->qid, commit_id, ring_ent->state); + spin_unlock(&queue->lock); + return err; + } + + ring_ent->cmd = cmd; + spin_unlock(&queue->lock); + + /* without the queue lock, as other locks are taken */ + fuse_uring_commit(ring_ent, issue_flags); + + /* + * Fetching the next request is absolutely required as queued + * fuse requests would otherwise not get processed - committing + * and fetching is done in one step vs legacy fuse, which has separated + * read (fetch request) and write (commit result). + */ + fuse_uring_next_fuse_req(ring_ent, queue); + return 0; +} + /* * fuse_uring_req_fetch command handling */ @@ -281,6 +708,9 @@ int fuse_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags) case FUSE_URING_REQ_FETCH: err = fuse_uring_fetch(cmd, issue_flags, fc); break; + case FUSE_URING_REQ_COMMIT_AND_FETCH: + ret = fuse_uring_commit_fetch(cmd, issue_flags, fc); + break; default: err = -EINVAL; pr_devel("Unknown uring command %d", cmd_op); diff --git a/fs/fuse/dev_uring_i.h b/fs/fuse/dev_uring_i.h index 9a763262c6a5a781a36c3825529d729efef80e78..9bc7f490b02acb46aa7bbb31d5ce55a4d2787a60 100644 --- a/fs/fuse/dev_uring_i.h +++ b/fs/fuse/dev_uring_i.h @@ -19,6 +19,9 @@ enum fuse_ring_req_state { /* The ring request waits for a new fuse request */ FRRS_WAIT, + /* The ring req got assigned a fuse req */ + FRRS_FUSE_REQ, + /* request is in or on the way to user space */ FRRS_USERSPACE, }; @@ -43,6 +46,8 @@ struct fuse_ring_ent { /* struct fuse_ring_req::in_out_arg size*/ size_t max_arg_len; + + struct fuse_req *fuse_req; }; struct fuse_ring_queue { @@ -69,6 +74,14 @@ struct fuse_ring_queue { * to be send to userspace */ struct list_head ent_intermediate_queue; + + /* entries in userspace */ + struct list_head ent_in_userspace; + + /* fuse requests waiting for an entry slot */ + struct list_head fuse_req_queue; + + struct fuse_pqueue fpq; }; /** diff --git a/fs/fuse/fuse_dev_i.h b/fs/fuse/fuse_dev_i.h index 7ecb103af6f0feca99eb8940872c6a5ccf2e5186..a8d578b99a14239c05b4a496a4b3b1396eb768dd 100644 --- a/fs/fuse/fuse_dev_i.h +++ b/fs/fuse/fuse_dev_i.h @@ -7,7 +7,7 @@ #define _FS_FUSE_DEV_I_H #include - +#include /* Ordinary requests have even IDs, while interrupts IDs are odd */ #define FUSE_INT_REQ_BIT (1ULL << 0) @@ -15,6 +15,8 @@ struct fuse_arg; struct fuse_args; +struct fuse_pqueue; +struct fuse_req; struct fuse_copy_state { int write; @@ -44,6 +46,9 @@ static inline struct fuse_dev *fuse_get_dev(struct file *file) return READ_ONCE(file->private_data); } +unsigned int fuse_req_hash(u64 unique); +struct fuse_req *fuse_request_find(struct fuse_pqueue *fpq, u64 unique); + void fuse_dev_end_requests(struct list_head *head); void fuse_copy_init(struct fuse_copy_state *cs, int write, diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index 33e81b895fee620b9c2fcc8d9312fec53e3dc227..f1ddaba92869518db8854512ec8dd5ed0a0eeaa7 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -435,6 +435,10 @@ struct fuse_req { /** fuse_mount this request belongs to */ struct fuse_mount *fm; + +#ifdef CONFIG_FUSE_IO_URING + void *ring_entry; +#endif }; struct fuse_iqueue; @@ -1200,6 +1204,11 @@ void fuse_change_entry_timeout(struct dentry *entry, struct fuse_entry_out *o); */ struct fuse_conn *fuse_conn_get(struct fuse_conn *fc); +/** + * Initialize the fuse processing queue + */ +void fuse_pqueue_init(struct fuse_pqueue *fpq); + /** * Initialize fuse_conn */ diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 59f8fb7b915f052f892d587a0f9a8dc17cf750ce..a1179c1e212b7a1cfd6e69f20dd5fcbe18c6202b 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -894,7 +894,7 @@ static void fuse_iqueue_init(struct fuse_iqueue *fiq, fiq->priv = priv; } -static void fuse_pqueue_init(struct fuse_pqueue *fpq) +void fuse_pqueue_init(struct fuse_pqueue *fpq) { unsigned int i; From patchwork Wed Oct 16 00:05:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13837496 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 CE17DE574 for ; Wed, 16 Oct 2024 00:37:45 +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=1729039067; cv=fail; b=Md+ZzDwSbVXZrEvJLZuYPNbqVdNCzlKlePGr/ESkqTBoMIPjPIUH7vjrLNqubuQi2sxF7vE62kCsdjniNfhGRZu9XkF6B1LtQuxh0kMhz2p0sfAkaVdBO2UdgAwAbvdHQIfQ5dmOYi3pqS8JBoS/RuBAfDak8aRioMlmldNuLKs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729039067; c=relaxed/simple; bh=IE8QCr28JAiz4NNIavd24adYQOb1l5pJXij9/+pcj8M=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iHAQvfl6yL6qo8zeRYtxkP7N7JgSU/rl9/I9qVSlla4v+qCx0Gt2QYgtWG9MQ3A1eVxZv34rpGR+ATnNsnx8AKCBV/c4YqBeXUSb7XAsRprOWJAGslkCdz0haXVUj6q+df0wsv8qc8g5LqXYq2LA0YdiVc7kyF2PpmuUBgmMAK0= 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=Sbc0OFB1; 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="Sbc0OFB1" Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2171.outbound.protection.outlook.com [104.47.57.171]) by mx-outbound10-224.us-east-2a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 16 Oct 2024 00:37:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=c7Wu2+fr+ljQMdl0JEPpiXAejk9SQkoHI9+46VO3MxQDXD3b4zc7OX9ows+f4d+3oZLL+TazS1NmLOzmjlA/BeUpCjsrJ8H8ZkH6+OyPSO2kKXB9ZFiA2HV4qFyaN7ffw6ZCVB6oUKFkjPniYHy5z0iKkiyo8ZiMlI7ciUTbIgXsO+3O/USiWdulLX+NjZE/1fvDSCWRMseWSM8PvHseVkhHMC0uSb81pSLTYsItizhpcYDd3Eolm0olIwfAvtwgbwgjESofuyYQCtK5X9RmOGI0Rlri2QwOzmftUHIhbQ7eDkFkZ2DEYfhV+pwrROkwGS+da4uyV7M4KnNNvHml1Q== 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=XolP/wFDM5oXFa4Iva8NqB4zQqiZdfPjrPeeAZh1SS8=; b=BlHYQ9pfxVU3VPTkNv58KNX5WuOfjk1agd5og5sk01AmIKtIjAS47HtA14EOegfaatR/E6GA751NBygsVCtfcciXPr1dunqkCfPJw5bx/LHq85N3bTTjJr70CRjAq1lvT3VQrzqm2plUI5yDnQkII11/sucIj1QHjzwocVMAOPZV0UmpJZo4HYi0svdxBANk7p3vYMIixgZcDLF8wKbBNT2HLNCbw+pUS9pxiJT5awUOkYkU4jGH8uKHtQ/1TPv42ikn099rdY4APa0H+76avyLXWT9cW7zlXlDCS2cGqLInb7Qc21skywKfoOV6msCVwfurx86+PpL+u+bcr+ED0g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=ddn.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=XolP/wFDM5oXFa4Iva8NqB4zQqiZdfPjrPeeAZh1SS8=; b=Sbc0OFB1zzXUKqSd1066d9TuAHycotipcZJpFjuErNSq0/wxv49XE39Vnx8UofKiN/yTLuNAGOW6VKgOw6GaCW1/2vCln3nmBEIww6A3cWRJOXkZfYTMrCE2zZxmYw8hsCYovPDGonND9LtGeIwxoAjaN7LM9vsSYPQTBUqDIpU= Received: from BN9PR03CA0435.namprd03.prod.outlook.com (2603:10b6:408:113::20) by PH7PR19MB6061.namprd19.prod.outlook.com (2603:10b6:510:1dc::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17; Wed, 16 Oct 2024 00:05:34 +0000 Received: from BL02EPF00021F6C.namprd02.prod.outlook.com (2603:10b6:408:113:cafe::a7) by BN9PR03CA0435.outlook.office365.com (2603:10b6:408:113::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.18 via Frontend Transport; Wed, 16 Oct 2024 00:05:34 +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 BL02EPF00021F6C.mail.protection.outlook.com (10.167.249.8) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Wed, 16 Oct 2024 00:05:34 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id D7ABC7D; Wed, 16 Oct 2024 00:05:32 +0000 (UTC) From: Bernd Schubert Date: Wed, 16 Oct 2024 02:05:21 +0200 Subject: [PATCH RFC v4 09/15] fuse: {uring} Handle teardown of ring entries Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241016-fuse-uring-for-6-10-rfc4-v4-9-9739c753666e@ddn.com> References: <20241016-fuse-uring-for-6-10-rfc4-v4-0-9739c753666e@ddn.com> In-Reply-To: <20241016-fuse-uring-for-6-10-rfc4-v4-0-9739c753666e@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Amir Goldstein , Ming Lei , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1729037122; l=12675; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=IE8QCr28JAiz4NNIavd24adYQOb1l5pJXij9/+pcj8M=; b=pA7u1c6vCNOB3TZWyd3LjZpaa8GP+Z2kziUarTld9q+oEEVvdeeGzA81dYvY1FkoqS+NpBZbT hLLku1rJ59sBnNBfo84dTWp4KoCq4EsBLb9oLgENWkJGW309OBkyBF7 X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F6C:EE_|PH7PR19MB6061:EE_ X-MS-Office365-Filtering-Correlation-Id: c4678d82-ced5-4cf2-c4a0-08dced76418f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?9oUYSvpfTsC9X9tcx1yt+I0zmh8gNp7?= =?utf-8?q?KqkjGUgchGquxIlRebQsDVTPgIEiKdDTqRUj4Jt5VO4olqHZh3iAXLxRWCBZQGsJv?= =?utf-8?q?I3NpcbEKWw+OaxCqPbjD1Vvc7s8zqAS90LY6eyJXza5LWg+FwqQGXhMvf5a+0rvY+?= =?utf-8?q?x1EN4VNhcW6eZ0wI/ifUWwUX13NupH2VxBepnhkS3Gb+M/GDJIN+/IUoGGcIYRwvj?= =?utf-8?q?Y9zh7U8fR8svaRm7+ArY6DCJIfVywhBQxuLqw0jBN9gv+M2k6ikYRKVdXrQdNsI17?= =?utf-8?q?kUMUckc356Vki+zcDLqOUwdD7Ej8rpqvYVH/va7AzP2GIndOXEMxvYqZAEwZ4JO9t?= =?utf-8?q?JwJ7uzTALHCldWo/uk1ek6SMXYVpAH3bSzEZZVmiiAyKGtNIOnf5A4zMz6vhGuxbd?= =?utf-8?q?aklcgt/3RkLj1tihUB9ASaI7XHmvWZQjRGr4S3sQIZMduLjZ0mWXPccOkqNgOImB9?= =?utf-8?q?XPSjLlcGqj+Ovk9pTwlT7o7RfzJyL+MnMjs8tc2VV360W4fZpnUuMxYr09B+RefMA?= =?utf-8?q?HKEF7ebZQhGz/lAiuTFVoA9dINeG6u2VLtphuJS5zk9Az92txYnk6/OgaDSHyMCIQ?= =?utf-8?q?uE1NTPPwT3ooB/JC+RqrW+gqKtpKE6H0UGCcfCfpDNOLWbA84WWlyoMSTycpLHBi9?= =?utf-8?q?rfzvuBIfszFbiXQb1oU5qEBjviSCoJ6+2HT1d6Yrbpjb8Ej/lK9xFPVfaCS/cOFQE?= =?utf-8?q?sGnzQaY1LJXasVt1ykubPTkE+GTHbb8kgFGpGcHnaLpQLa5fF1xnAcxdMWgkYfgGe?= =?utf-8?q?00DPRoCkgGhepk4duFz5SiVM+nAhCZdBBTNeXWGGGlpWOrTev0Vi9CAOThWpuP4jk?= =?utf-8?q?4GotIQZjggfryAHFGM6wwd2Slr9SFWwrLj0S+jkgqgnMJ8+iSdGydGXUqEJQBJ3ug?= =?utf-8?q?Pit3pqDBss7ycwn4B1xlniIAj9MQLVtoh2Uo9rYE6nu6028lFyAuG7KAVM6UFqnFi?= =?utf-8?q?X6nwq7tRlrwZKWPvr3jJZOuqmKZuEd8ITjK2YRGiwpSBDxi3LzWISCO0BE4S+OCp8?= =?utf-8?q?KSacwo8fvqCQu4RjT7mKY/VIrofiDatX0Ru7W2uV5gf+rXaPKRHoleK+2vODn69HR?= =?utf-8?q?c9NDO6Rj2lk52ByUuj6AtPP4XyCuqklg95R9eAVDiqVdJjO1KoVUT/+S3k6uy6WSZ?= =?utf-8?q?nOhqzDOwdzC7AVN/GW+fCY7z2jjvK8PM0MwktZ56BrSiivi792ITl/l0wouVuXBv/?= =?utf-8?q?uTWEarRaC0D45D1wbGFSwbNBSv1JqvAQehzrK8zD/GOsG8Zxabb759cedNJ2aAdSd?= =?utf-8?q?+FfQm3YtxXJMRqIoJqokxMog64lKvyxyPvrU1bPfVE8Xe1UjGD0Cgd+HZ7Jb4zOqH?= =?utf-8?q?N3jY3nqKwRFJ?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(36860700013)(376014)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: J1D3Y/x14X75TCuTSAzzeYrXpH4sWKAPk4Q7ss9qFOvIYQQq0kw1vZJBiHxtRAQi/HpGFKZwcIhxxtQWK/VBGqVR6q1QN1kN4f/z+CZCx+JRRRdQo/WDxYzyINU2nurunKy++NETcvwZQ0+wcRdG4MXlP8a+7YG5OdOtMnZYnvmzP+HBMZssKaKfMAz40vAc5M8k8f5Wz3covP9EKuan06Xe8gg6MXAnbyUyVJ0jNCK5Smpx2kTzU7q1uelPIKfZUt0NcbrILHAedV/F7RhhD65pI7BDgn6+waHhgNDAWwbfv+OhOy0pHj7dmkkh/M5jV31jUvXw+aTCSZJroYZ+BchFSYSHKR3vIPo/ZA7vjq9ctj3ZVTH6WiBY2yGDvt9BcAKqLfrAtc62kvZpG2cxvG5ns5B4HN3EpjWZ0jJgbGi5+FQmqxtwFubrIhbNbm+cgmj37JenNKJJVHLbJawESwIchsBTFl3dONm+MUS0P54b/5uHJvo7+ouUtn1tSjUoX/fXJ8/XKk3cOZlFkDzfO9cld6b0q/JwmEBUJxvV6Ckb0Ssi9rodnMlCR4I4q1KUYR8tMNAN6XyFT7OJF1T433TgzacCcg+Ezyac1QHVsQ3p6TxSiHaO/le/83H3cJGH7peBE2jnzqeZisJyQm+gPg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2024 00:05:34.0070 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c4678d82-ced5-4cf2-c4a0-08dced76418f 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: BL02EPF00021F6C.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR19MB6061 X-OriginatorOrg: ddn.com X-BESS-ID: 1729039064-102784-17746-3315-1 X-BESS-VER: 2019.1_20241015.1627 X-BESS-Apparent-Source-IP: 104.47.57.171 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoZGRsamQGYGUNTSzMLA2MDE1C wpycIy1TIlxcLQyNzA2NTcyMjc2DDNSKk2FgBNBTWkQgAAAA== X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259752 [from cloudscan8-195.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound 0.00 BSF_SC0_MISMATCH_TO META: Envelope rcpt doesn't match header X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND, BSF_SC0_MISMATCH_TO X-BESS-BRTS-Status: 1 On teardown struct file_operations::uring_cmd requests need to be completed by calling io_uring_cmd_done(). Not completing all ring entries would result in busy io-uring tasks giving warning messages in intervals and unreleased struct file. Additionally the fuse connection and with that the ring can only get released when all io-uring commands are completed. Completion is done with ring entries that are a) in waiting state for new fuse requests - io_uring_cmd_done is needed b) already in userspace - io_uring_cmd_done through teardown is not needed, the request can just get released. If fuse server is still active and commits such a ring entry, fuse_uring_cmd() already checks if the connection is active and then complete the io-uring itself with -ENOTCONN. I.e. special handling is not needed. This scheme is basically represented by the ring entry state FRRS_WAIT and FRRS_USERSPACE. Entries in state: - FRRS_INIT: No action needed, do not contribute to ring->queue_refs yet - All other states: Are currently processed by other tasks, async teardown is needed and it has to wait for the two states above. It could be also solved without an async teardown task, but would require additional if conditions in hot code paths. Also in my personal opinion the code looks cleaner with async teardown. Signed-off-by: Bernd Schubert --- fs/fuse/dev.c | 8 ++ fs/fuse/dev_uring.c | 212 +++++++++++++++++++++++++++++++++++++++++++++++++- fs/fuse/dev_uring_i.h | 62 +++++++++++++++ 3 files changed, 279 insertions(+), 3 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index fdb43640db5fdbe6b6232e1b2e2259e3117d237d..c8cc5fb2cfada29226f578a6273e8d6d34ab59ab 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -2226,6 +2226,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); } @@ -2237,6 +2243,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 0c39d5c1c62a1c496782e5c54b9f72a70cffdfa2..455a42a6b9348dda15dd082d3bfd778279f61e0b 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -50,6 +50,36 @@ static int fuse_ring_ring_ent_unset_userspace(struct fuse_ring_ent *ent) return 0; } +/* Abort all list queued request on the given ring queue */ +static void fuse_uring_abort_end_queue_requests(struct fuse_ring_queue *queue) +{ + struct fuse_req *req; + LIST_HEAD(req_list); + + spin_lock(&queue->lock); + list_for_each_entry(req, &queue->fuse_req_queue, list) + clear_bit(FR_PENDING, &req->flags); + list_splice_init(&queue->fuse_req_queue, &req_list); + spin_unlock(&queue->lock); + + /* must not hold queue lock to avoid order issues with fi->lock */ + fuse_dev_end_requests(&req_list); +} + +void fuse_uring_abort_end_requests(struct fuse_ring *ring) +{ + int qid; + + for (qid = 0; qid < ring->nr_queues; qid++) { + struct fuse_ring_queue *queue = ring->queues[qid]; + + if (!queue) + continue; + + fuse_uring_abort_end_queue_requests(queue); + } +} + void fuse_uring_destruct(struct fuse_conn *fc) { struct fuse_ring *ring = fc->ring; @@ -106,9 +136,12 @@ static struct fuse_ring *fuse_uring_create(struct fuse_conn *fc) goto out_err; } + init_waitqueue_head(&ring->stop_waitq); + fc->ring = ring; ring->nr_queues = nr_queues; ring->fc = fc; + atomic_set(&ring->queue_refs, 0); spin_unlock(&fc->lock); return ring; @@ -168,6 +201,175 @@ fuse_uring_async_send_to_ring(struct io_uring_cmd *cmd, io_uring_cmd_done(cmd, 0, 0, issue_flags); } +static void fuse_uring_stop_fuse_req_end(struct fuse_ring_ent *ent) +{ + struct fuse_req *req = ent->fuse_req; + + ent->fuse_req = NULL; + clear_bit(FR_SENT, &req->flags); + req->out.h.error = -ECONNABORTED; + fuse_request_end(req); +} + +/* + * Release a request/entry on connection tear down + */ +static void fuse_uring_entry_teardown(struct fuse_ring_ent *ent, + bool need_cmd_done) +{ + struct fuse_ring_queue *queue = ent->queue; + + /* + * fuse_request_end() might take other locks like fi->lock and + * can lead to lock ordering issues + */ + lockdep_assert_not_held(&ent->queue->lock); + + if (need_cmd_done) { + pr_devel("qid=%d sending cmd_done\n", queue->qid); + + io_uring_cmd_done(ent->cmd, -ENOTCONN, 0, + IO_URING_F_UNLOCKED); + } + + if (ent->fuse_req) + fuse_uring_stop_fuse_req_end(ent); + + list_del_init(&ent->list); + kfree(ent); +} + +static void fuse_uring_stop_list_entries(struct list_head *head, + struct fuse_ring_queue *queue, + enum fuse_ring_req_state exp_state) +{ + struct fuse_ring *ring = queue->ring; + struct fuse_ring_ent *ent, *next; + ssize_t queue_refs = SSIZE_MAX; + LIST_HEAD(to_teardown); + + spin_lock(&queue->lock); + list_for_each_entry_safe(ent, next, head, list) { + if (ent->state != exp_state) { + pr_warn("entry teardown qid=%d state=%d expected=%d", + queue->qid, ent->state, exp_state); + continue; + } + + list_move(&ent->list, &to_teardown); + } + spin_unlock(&queue->lock); + + /* no queue lock to avoid lock order issues */ + list_for_each_entry_safe(ent, next, &to_teardown, list) { + bool need_cmd_done = ent->state != FRRS_USERSPACE; + + fuse_uring_entry_teardown(ent, need_cmd_done); + queue_refs = atomic_dec_return(&ring->queue_refs); + + if (WARN_ON_ONCE(queue_refs < 0)) + pr_warn("qid=%d queue_refs=%zd", queue->qid, + queue_refs); + } +} + +static void fuse_uring_stop_queue(struct fuse_ring_queue *queue) +{ + fuse_uring_stop_list_entries(&queue->ent_in_userspace, queue, + FRRS_USERSPACE); + fuse_uring_stop_list_entries(&queue->ent_avail_queue, queue, FRRS_WAIT); +} + +/* + * Log state debug info + */ +static void fuse_uring_log_ent_state(struct fuse_ring *ring) +{ + int qid; + struct fuse_ring_ent *ent; + + for (qid = 0; qid < ring->nr_queues; qid++) { + struct fuse_ring_queue *queue = ring->queues[qid]; + + if (!queue) + continue; + + spin_lock(&queue->lock); + /* + * Log entries from the intermediate queue, the other queues + * should be empty + */ + list_for_each_entry(ent, &queue->ent_intermediate_queue, list) { + pr_info("ring=%p qid=%d ent=%p state=%d\n", ring, qid, + ent, ent->state); + } + spin_lock(&queue->lock); + } + ring->stop_debug_log = 1; +} + +static void fuse_uring_async_stop_queues(struct work_struct *work) +{ + int qid; + struct fuse_ring *ring = + container_of(work, struct fuse_ring, async_teardown_work.work); + + for (qid = 0; qid < ring->nr_queues; qid++) { + struct fuse_ring_queue *queue = ring->queues[qid]; + + if (!queue) + continue; + + fuse_uring_stop_queue(queue); + } + + /* + * Some ring entries are might be in the middle of IO operations, + * i.e. in process to get handled by file_operations::uring_cmd + * or on the way to userspace - we could handle that with conditions in + * run time code, but easier/cleaner to have an async tear down handler + * If there are still queue references left + */ + if (atomic_read(&ring->queue_refs) > 0) { + if (time_after(jiffies, + ring->teardown_time + FUSE_URING_TEARDOWN_TIMEOUT)) + fuse_uring_log_ent_state(ring); + + schedule_delayed_work(&ring->async_teardown_work, + FUSE_URING_TEARDOWN_INTERVAL); + } else { + wake_up_all(&ring->stop_waitq); + } +} + +/* + * Stop the ring queues + */ +void fuse_uring_stop_queues(struct fuse_ring *ring) +{ + int qid; + + for (qid = 0; qid < ring->nr_queues; qid++) { + struct fuse_ring_queue *queue = ring->queues[qid]; + + if (!queue) + continue; + + fuse_uring_stop_queue(queue); + } + + if (atomic_read(&ring->queue_refs) > 0) { + pr_info("ring=%p scheduling async queue stop\n", ring); + ring->teardown_time = jiffies; + INIT_DELAYED_WORK(&ring->async_teardown_work, + fuse_uring_async_stop_queues); + schedule_delayed_work(&ring->async_teardown_work, + FUSE_URING_TEARDOWN_INTERVAL); + } else { + wake_up_all(&ring->stop_waitq); + } +} + /* * Checks for errors and stores it into the request */ @@ -542,6 +744,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 @@ -659,6 +864,7 @@ static int fuse_uring_fetch(struct io_uring_cmd *cmd, unsigned int issue_flags, if (WARN_ON_ONCE(err != 0)) goto err; + atomic_inc(&ring->queue_refs); _fuse_uring_fetch(ring_ent, cmd, issue_flags); return 0; @@ -680,13 +886,13 @@ int fuse_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags) u32 cmd_op = cmd->cmd_op; int err = 0; - pr_devel("%s:%d received: cmd op %d\n", __func__, __LINE__, cmd_op); - /* Disabled for now, especially as teardown is not implemented yet */ err = -EOPNOTSUPP; pr_info_ratelimited("fuse-io-uring is not enabled yet\n"); goto out; + pr_devel("%s:%d received: cmd op %d\n", __func__, __LINE__, cmd_op); + err = -EOPNOTSUPP; if (!enable_uring) { pr_info_ratelimited("uring is disabled\n"); @@ -709,7 +915,7 @@ int fuse_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags) err = fuse_uring_fetch(cmd, issue_flags, fc); break; case FUSE_URING_REQ_COMMIT_AND_FETCH: - ret = fuse_uring_commit_fetch(cmd, issue_flags, fc); + err = fuse_uring_commit_fetch(cmd, issue_flags, fc); break; default: err = -EINVAL; diff --git a/fs/fuse/dev_uring_i.h b/fs/fuse/dev_uring_i.h index 9bc7f490b02acb46aa7bbb31d5ce55a4d2787a60..c19e439cd51316bdabdd16901659e97b2ff90875 100644 --- a/fs/fuse/dev_uring_i.h +++ b/fs/fuse/dev_uring_i.h @@ -11,6 +11,9 @@ #ifdef CONFIG_FUSE_IO_URING +#define FUSE_URING_TEARDOWN_TIMEOUT (5 * HZ) +#define FUSE_URING_TEARDOWN_INTERVAL (HZ/20) + enum fuse_ring_req_state { /* ring entry received from userspace and it being processed */ @@ -82,6 +85,8 @@ struct fuse_ring_queue { struct list_head fuse_req_queue; struct fuse_pqueue fpq; + + bool stopped; }; /** @@ -96,11 +101,61 @@ struct fuse_ring { size_t nr_queues; struct fuse_ring_queue **queues; + /* + * Log ring entry states onces on stop when entries cannot be + * released + */ + unsigned int stop_debug_log : 1; + + wait_queue_head_t stop_waitq; + + /* async tear down */ + struct delayed_work async_teardown_work; + + /* log */ + unsigned long teardown_time; + + atomic_t queue_refs; }; void fuse_uring_destruct(struct fuse_conn *fc); +void fuse_uring_stop_queues(struct fuse_ring *ring); +void fuse_uring_abort_end_requests(struct fuse_ring *ring); int fuse_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags); +static inline void fuse_uring_set_stopped_queues(struct fuse_ring *ring) +{ + int qid; + + for (qid = 0; qid < ring->nr_queues; qid++) { + struct fuse_ring_queue *queue = ring->queues[qid]; + + WRITE_ONCE(queue->stopped, true); + } +} + +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; @@ -113,6 +168,13 @@ static inline void fuse_uring_destruct(struct fuse_conn *fc) { } +static inline void fuse_uring_abort(struct fuse_conn *fc) +{ +} + +static inline void fuse_uring_wait_stopped_queues(struct fuse_conn *fc) +{ +} #endif /* CONFIG_FUSE_IO_URING */ #endif /* _FS_FUSE_DEV_URING_I_H */ From patchwork Wed Oct 16 00:05:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13837499 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 3088FE574; Wed, 16 Oct 2024 00:38:26 +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=1729039110; cv=fail; b=A8H5Et2qzbjQOMpr9p34RgIauBzLZBdPodJ5dzf4+avWCKpu1kLy9ZepjFGQ0u5f6rle4QIwWNyylYjVb+bB/gqmkGyzxABV7G7VTRzSkdEmvqlbv3Asatv41tIDp83HSScaHpZfPewpagIuutGlg4YECUlGZ0hjJosNWTPtw6w= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729039110; c=relaxed/simple; bh=BgFfhvEGN7m+wreSHkg6j6jdrq5eYLwkMz2PHkavrEc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BlH1mgq23IUVbStqh+MHCeWpUU1g4LBQei/XAuygyCekVcfVCppeCELjZ1DvnQIhTzAuTO5AsjeuPkKp5J5hEROhjZM5H7ddYRWOrmjTyzxQruMivXnXzPPIMWictKbWmcgUcSIey6b7GrV1SLJcAKcrS2RhMLn9EI86INNXOcU= 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=phbG/qis; 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="phbG/qis" Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2040.outbound.protection.outlook.com [104.47.58.40]) by mx-outbound19-158.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 16 Oct 2024 00:38:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ncKsGxndADt7KnPA4IsZjOqfyfXxt5CsSIteiZrIs6LtjUx1EpVkF5pkGr2XdbkJl7VAnLZRXiPeClS+Nh9xHFrgnGDndLDJMQ13beNDhPoQIbFuulYXlThx6ttjUKALNm9H6f1/45w+EQgGUGceXM56+HTlG7ra7keTy2gOcifueXsioPDOY0Mb6OAtTvu7IMBFqA6g9zu0/Py2VrSZ0FfEiSagNsZHtPv/gBH6En9LOawCLfLi4KWdGW0Afm068T0X3fCk6kXFCUKN3TQNa5HX92tFOKidqGGpzDu5mlCSSQKmoXGSc/zX0BAf8CxYaFjF2VTC3KQI6dsGQTye1Q== 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=Wbj8GKOEap7E+5/Lr5bDNxYBjpGT/1hlPblIhM/ZU7s=; b=Bfokc4G5wgeN0E5W7DBXkns/AIaU8TeFtOmfxTa2SLyyvM4/12E20L3nKvA8Mgzu3JAOKzh2TQo9oUaX1LFLIkvut9MC7f27taVHKMkilNiPMuxON4QSSM9HjXpSQvEfakFkerfaYDVs/WbsZ3OssyZuA3eITpikDO0K3anaL0aXOJSUWz1TlNfvcQ0EX0rqMwbON62o3vclpHeIcM5iI+TJgU1GzzMMXy83E/gqU65yJonreIUum3NssC4tet2LUr7ZoiVMCI8LbD5Oqcc6gsq8Pqv20fnBJLNCL/+hRv2ZNpxyprzhHLv12dDbaRrCeuTeGyZh3TPqerReNt9cyQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=ddn.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=Wbj8GKOEap7E+5/Lr5bDNxYBjpGT/1hlPblIhM/ZU7s=; b=phbG/qisvrqw7MA3EbPSKfFPupUPTe046F6kEAUP/045qaZjoJ15mCjs4QLaWcGa669Cb7QnuE/f3Y7MuKb/9CzMvmBjC8DdlCdYL30W18OBsssi149fUSVAcGB/HNRv/O46NfD4IildN7NV5ljYN3Ku0OAPsKptKC8xXYbxMpM= Received: from CH0PR13CA0049.namprd13.prod.outlook.com (2603:10b6:610:b2::24) by SN7PR19MB6565.namprd19.prod.outlook.com (2603:10b6:806:26f::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17; Wed, 16 Oct 2024 00:05:35 +0000 Received: from CH2PEPF0000009D.namprd02.prod.outlook.com (2603:10b6:610:b2:cafe::87) by CH0PR13CA0049.outlook.office365.com (2603:10b6:610:b2::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.16 via Frontend Transport; Wed, 16 Oct 2024 00:05:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by CH2PEPF0000009D.mail.protection.outlook.com (10.167.244.25) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Wed, 16 Oct 2024 00:05:35 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id F203029; Wed, 16 Oct 2024 00:05:33 +0000 (UTC) From: Bernd Schubert Date: Wed, 16 Oct 2024 02:05:22 +0200 Subject: [PATCH RFC v4 10/15] fuse: {uring} Add a ring queue and send method Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241016-fuse-uring-for-6-10-rfc4-v4-10-9739c753666e@ddn.com> References: <20241016-fuse-uring-for-6-10-rfc4-v4-0-9739c753666e@ddn.com> In-Reply-To: <20241016-fuse-uring-for-6-10-rfc4-v4-0-9739c753666e@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Amir Goldstein , Ming Lei , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1729037122; l=4852; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=BgFfhvEGN7m+wreSHkg6j6jdrq5eYLwkMz2PHkavrEc=; b=6cgw9Ub19Xrn5acWZ7ab0Fd4VfBhS9V8bwfBwN+1sBzDNJlO3HyPdyUWcr+JAsnfNpWEPtJ04 TJA53loaGc5CjdDEHxMAjCzDTmMg8Q23y3VMWpeXXoW13SHLR4fgB9c X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PEPF0000009D:EE_|SN7PR19MB6565:EE_ X-MS-Office365-Filtering-Correlation-Id: 788a4c69-fabe-49ab-d848-08dced76423c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700013|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?utf-8?q?CGO43KNaPrpggUO61onV8ocKRfrt9W6?= =?utf-8?q?agOwP32rhTRSzIessSQx0Egs29SagJA/l3vVpLGV1gcZwauBPBi0ze+zwL1kkapQZ?= =?utf-8?q?JbEajdBn/IM7ZCqf/eKq2vOOIL0rXsWgp6lCm1FluHCUiVTVOSEizMm3/aLK82qwB?= =?utf-8?q?Dxtm5HZ6mSMODeJqdnI2wB2YfO37lSOMLWeHws9Nx+dm7k2sFkDzedZdD/U6iu8fy?= =?utf-8?q?MThsnMk5BO45Se4DE/mH00Y6XXBh7dTKFEMDer7DbnsJVDln08OkkvcWqjvum37U/?= =?utf-8?q?FqPeiPdNi72/TLiGDm8fRwbd6vxvzoOzv6mFpWSvob2BVvUrhDQoBT4a1tWODw4vC?= =?utf-8?q?EhI92H1JzGNXttiwxOhzALOVCt9P9S6ycpH4vIRfKIFlIngHMZEdcSTNVP2M+KIWQ?= =?utf-8?q?o9BLUXf93fffZiLEbteFnNdWZwo/wLfNzlT7uev25tr70YqP5JJFn2idNYkjTQ9K6?= =?utf-8?q?0yU4AAufTVZRot4REyR0U2OHqijO5DiS0RtLuWtcwdZ3Zm6P4GOizq4cFHP0gmGkD?= =?utf-8?q?AC/mz953QcnfjJ0lDB2VRlM6X8r3k3yadbxI6LGLfHmU1zuvr6q9j41CqtnTyaCwT?= =?utf-8?q?kVfi4EK96yNaILZB8qpo8yUxLE55xW4NDjIqdyMYup1lWJuOUQuehHQNcj1wBmXXj?= =?utf-8?q?OQpmrFEG9d0jtSBBlZx+tQe29zJ9FmwWx/0GpylXWsUFzBnrFgDiJF6wYEBdE6LIE?= =?utf-8?q?4v+/CaWFvwhH/jvse288U/M6Ewk5RK2NvKQGz5NxFDPXfO+YbUCvz27qzweMplUbe?= =?utf-8?q?IHp871W40hxHDvv/cyJ4IeCBcYzJqzJRJOI6u5UJtefsv7GasixQKGxHz7LDz7lJh?= =?utf-8?q?DZKXR807XKwU9t/FUKKUlIshGas8b/Zoo985UaSUWy6D60M8fu111PXy5FxO9cR5m?= =?utf-8?q?rg4B7nZdSm9vmlJF7jQbj0a8DbT1UVCPj3bcUGEKaAsZeqMwp6z6+6urhMKLJ8DK/?= =?utf-8?q?iGZgI23wLgg+D+BKiyYVHFfMn1aMIETHrEvL9ajONEoGMjJxpcPJESDnLq8TZKDZY?= =?utf-8?q?08Q7tn5FYcEtx8PjZfc+VxM1M2oULCZvktxwrkYlYMoI3dl8XXkQz7LrvqlzZ/9k7?= =?utf-8?q?WbmHKPHY2Z1b38E7IiyNOLbdamyqpBOD3ZK8t6utQnlEoZt+fBxilQ0zM6Y29Ak37?= =?utf-8?q?Syes/CfgL/uC+Z81N8wq9GkXeVPAUYQ9I2Ky75ZYiEGxdCYswQKJZ9AmarkQbTchU?= =?utf-8?q?zryTycwKbqAA57B1AiNlwCQazKnsXB5MiCYoyzCVLcjeYkamqilMWcR7azBzh2kTG?= =?utf-8?q?D31s6WWnOaTrNnPteF5nPT2X9bvf4BUIgWGiBknnTxW+otxCPHh1H9PPnWxo9vpf1?= =?utf-8?q?jXrSbCLs+K6E?= 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)(82310400026)(1800799024);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 0+OZ0NMnzfOxF0LbV1CWtW63Mu6I+6me5vH5HCwi+t68ABzOPdovzkhOiEtXrjVqOwLLnFXTfzcTOyqE8Yz+cw/idJh0vmfE/z6LhikwxgoQbpK6L155VShDjpz8AvDk54WVYXMEjwHzn+WHr8CRlJW/+avYYbwQPHJgUwCnD0e/rrYka2wRx4pKMTFZYB3xdR8d59/DgwuQm5SWcHYnLNdRIyAELaLACUC4QINF+nQkTuc0g7SLXAyssW0jssqeKClkCg84J1sLzr6I305nk7l8/x69MbgPO6EofD5WNHTo5ijx4UDNW6p+wddXRvrQ59ngA7wYVK2LhHfM9LWY+l3Dq6vpDtEsFYphaXjExUuNnzHXIS+jzCIguwj/9LZXljGes1Kdf5RTqL/LmTOZ5pwfsGHH3n0PUJZ8iXBgAvm8JFGothmDI3oYqBTnOlJEoAJgf4XfZCtO0WuphMaIkNDVBiqoADvOJpWUhGL7t3RAdhxYwSYWwDA9lvfiCbJd1KVGtsGMe0W7Bbsk0Bm30UXAyFsP8a4WbJX/1u3mAEM9VB3K1CjcdxgzJKhNRkZnfvLlMLjZgN30tU5z8qS24GinFgUaLIbkR7RytPCE55u5aOyL7LrBLPROc1XzSNZhqhYHZrVJz1Y2wBhgKXROSA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2024 00:05:35.0631 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 788a4c69-fabe-49ab-d848-08dced76423c X-MS-Exchange-CrossTenant-Id: 753b6e26-6fd3-43e6-8248-3f1735d59bb4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=753b6e26-6fd3-43e6-8248-3f1735d59bb4;Ip=[50.222.100.11];Helo=[uww-mrp-01.datadirectnet.com] X-MS-Exchange-CrossTenant-AuthSource: CH2PEPF0000009D.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR19MB6565 X-OriginatorOrg: ddn.com X-BESS-ID: 1729039105-105022-12728-62650-1 X-BESS-VER: 2019.1_20241015.1627 X-BESS-Apparent-Source-IP: 104.47.58.40 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVibmBoZAVgZQ0DLRyCQt2SItMS 3NwiQp2TQtOTXVwDDR3DAlLTktNdVSqTYWAPdO7OpBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259752 [from cloudscan13-9.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 through io-uring. Signed-off-by: Bernd Schubert --- fs/fuse/dev_uring.c | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++ fs/fuse/dev_uring_i.h | 7 ++++ 2 files changed, 108 insertions(+) diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index 455a42a6b9348dda15dd082d3bfd778279f61e0b..3f1c39bb43e24a7f9c5d4cdd507f56fe6358f2fd 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -19,6 +19,10 @@ MODULE_PARM_DESC(enable_uring, "Enable uring userspace communication through uring."); #endif +struct fuse_uring_cmd_pdu { + struct fuse_ring_ent *ring_ent; +}; + /* * Finalize a fuse request, then fetch and send the next entry, if available */ @@ -931,3 +935,100 @@ int fuse_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags) return -EIOCBQUEUED; } + +/* + * This prepares and sends the ring request in fuse-uring task context. + * User buffers are not mapped yet - the application does not have permission + * to write to it - this has to be executed in ring task context. + * XXX: Map and pin user paged and avoid this function. + */ +static void +fuse_uring_send_req_in_task(struct io_uring_cmd *cmd, + unsigned int issue_flags) +{ + struct fuse_uring_cmd_pdu *pdu = (struct fuse_uring_cmd_pdu *)cmd->pdu; + struct fuse_ring_ent *ring_ent = pdu->ring_ent; + struct fuse_ring_queue *queue = ring_ent->queue; + int err; + + BUILD_BUG_ON(sizeof(pdu) > sizeof(cmd->pdu)); + + err = fuse_uring_prepare_send(ring_ent); + if (err) + goto err; + + io_uring_cmd_done(cmd, 0, 0, issue_flags); + + spin_lock(&queue->lock); + ring_ent->state = FRRS_USERSPACE; + list_move(&ring_ent->list, &queue->ent_in_userspace); + spin_unlock(&queue->lock); + return; +err: + fuse_uring_next_fuse_req(ring_ent, queue); +} + +/* queue a fuse request and send it if a ring entry is available */ +int fuse_uring_queue_fuse_req(struct fuse_conn *fc, struct fuse_req *req) +{ + struct fuse_ring *ring = fc->ring; + struct fuse_ring_queue *queue; + int qid = 0; + struct fuse_ring_ent *ring_ent = NULL; + int res; + + /* + * async requests are best handled on another core, the current + * core can do application/page handling, while the async request + * is handled on another core in userspace. + * For sync request the application has to wait - no processing, so + * the request should continue on the current core and avoid context + * switches. + * XXX This should be on the same numa node and not busy - is there + * a scheduler function available that could make this decision? + * It should also not persistently switch between cores - makes + * it hard for the scheduler. + */ + qid = task_cpu(current); + + if (WARN_ONCE(qid >= ring->nr_queues, + "Core number (%u) exceeds nr ueues (%zu)\n", qid, + ring->nr_queues)) + qid = 0; + + queue = ring->queues[qid]; + if (WARN_ONCE(!queue, "Missing queue for qid %d\n", qid)) + return -EINVAL; + + spin_lock(&queue->lock); + + if (unlikely(queue->stopped)) { + res = -ENOTCONN; + goto err_unlock; + } + + list_add_tail(&req->list, &queue->fuse_req_queue); + + if (!list_empty(&queue->ent_avail_queue)) { + ring_ent = list_first_entry(&queue->ent_avail_queue, + struct fuse_ring_ent, list); + list_del_init(&ring_ent->list); + fuse_uring_add_req_to_ring_ent(ring_ent, req); + } + spin_unlock(&queue->lock); + + if (ring_ent) { + struct io_uring_cmd *cmd = ring_ent->cmd; + struct fuse_uring_cmd_pdu *pdu = + (struct fuse_uring_cmd_pdu *)cmd->pdu; + + pdu->ring_ent = ring_ent; + io_uring_cmd_complete_in_task(cmd, fuse_uring_send_req_in_task); + } + + return 0; + +err_unlock: + spin_unlock(&queue->lock); + return res; +} diff --git a/fs/fuse/dev_uring_i.h b/fs/fuse/dev_uring_i.h index c19e439cd51316bdabdd16901659e97b2ff90875..4f5586684cb8fec3ddc825511cb6b935f5cf85d6 100644 --- a/fs/fuse/dev_uring_i.h +++ b/fs/fuse/dev_uring_i.h @@ -122,6 +122,7 @@ void fuse_uring_destruct(struct fuse_conn *fc); void fuse_uring_stop_queues(struct fuse_ring *ring); void fuse_uring_abort_end_requests(struct fuse_ring *ring); int fuse_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags); +int fuse_uring_queue_fuse_req(struct fuse_conn *fc, struct fuse_req *req); static inline void fuse_uring_set_stopped_queues(struct fuse_ring *ring) { @@ -175,6 +176,12 @@ static inline void fuse_uring_abort(struct fuse_conn *fc) static inline void fuse_uring_wait_stopped_queues(struct fuse_conn *fc) { } + +static inline int +fuse_uring_queue_fuse_req(struct fuse_conn *fc, struct fuse_req *req) +{ + return -EPFNOSUPPORT; +} #endif /* CONFIG_FUSE_IO_URING */ #endif /* _FS_FUSE_DEV_URING_I_H */ From patchwork Wed Oct 16 00:05: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: 13837509 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 687D710A0E for ; Wed, 16 Oct 2024 00:40:27 +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=1729039229; cv=fail; b=YXJV4CKOBvuve1RurZApSq1AdDgUUY9mqA34In2zuHBdGONYilQPkbf1dIRtF9UKrdrygpdqqn6Engjb8C/B5f88+LRRLNUHIQpIfHAcaHFtKWFoZyqWSo/BEEGpVb93IgEHeHZKyJNScJw9W4Ys3b0nqIqr4Sr5yOTunpgMcT4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729039229; c=relaxed/simple; bh=0Y1IyT/hgBu6I3Aqfc5RI8c5rxwN7dwCeZDd51oJbXI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=suM1FmG+FelqNximHHZAAGalx1D5xhs21KAVIkTfpnGHq2m81Uyq2W2Oip5bjudu4H/XbvkztVJAKL+DRzGmfX5TFB5diRQCWsYVC+iHhoa5RPkdHQoHBu6D/04UNCUvJjXkU8Hq/M88wpXMuFZqgYO5+rDtTdfhW/4SSfADGSY= 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=NN8M7UnA; 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="NN8M7UnA" Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2043.outbound.protection.outlook.com [104.47.73.43]) by mx-outbound46-22.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 16 Oct 2024 00:40:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Le6lTfaJ4oPN/4uJrxL07MFOeuCw6b0vtowskeXiGzVaiq1RIHv372cAexUF9Hc30EM2yLKP1XG2uyYOxj0UI4pUVwYNRF2hhPYBtdS3hYk6lFfAtTaUb4nUF0R8NToJoNwqGUM8j+P5OA1qtWjlTmNeUJYf4F80z9KVzgvQxpsKmKAnpaZ/Xi3mdUTw6b9TNqmyA5Ll+ejvY4Uk6QduXUeAFFe8cK4whLuOB7HUsonOFLenCSY2Jwop0cLJFK7HvrMZBOg34dK+5NnEnByduGkhrlwKJox3cK4aB5J3Vlf226liMCNMG2k3xOUp3xYk2FRra07MpIurJUjScyzt3A== 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=HrZRMOmZDYRIPpnMY/X+kOnoUjYjGoSGV152UAnWirU=; b=baBN/LCw3qcPEINQFWSWg5VQ/tQzwR9Xle8wNVUiAcIYgq54erIHKXHxJFAm/eWw011LFmkItqWjFoNLcckzzneHHAqBAFSAGWryKV2upXf4qTZKQQKEjJkFfKAoqy+fm0gYZ7RN9Q6b3S2715/3D0eJMCnCkD1qf0ilmCoujlPgu8engy2FpvhqW2n9iSR0KFrmKDpDsOB3FHps6/4gnb5qfkrFYUlmP6j4lB0AjUR9I7RD9zHa8FcT4R0Q3zhY4AjzmZDBs20ND+kNkbpw+4F3NNk+62rgyC7gMPsbqj73mlv60CK8Pl5+fXVilRTeGS3yJAYrhxCNZTajD6cosw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=ddn.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=HrZRMOmZDYRIPpnMY/X+kOnoUjYjGoSGV152UAnWirU=; b=NN8M7UnAoU/JK6Q24GKxFBpY76GvhnaUxyguwHddrEDFmKH++lv5lgvBPpMcGdY3c7hA9XK/Pt1+yMN90xy1PVtmc/zd2RbpZNlU0mv34zp//1WX+nbcEXQxZstYhkxw3JBe75XHMy1ZgtgFvDZs7bgGwPXwXnWddChEBb1HK6s= Received: from BN9PR03CA0570.namprd03.prod.outlook.com (2603:10b6:408:138::35) by SA0PR19MB4175.namprd19.prod.outlook.com (2603:10b6:806:84::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27; Wed, 16 Oct 2024 00:05:36 +0000 Received: from BN1PEPF00004682.namprd03.prod.outlook.com (2603:10b6:408:138:cafe::3) by BN9PR03CA0570.outlook.office365.com (2603:10b6:408:138::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27 via Frontend Transport; Wed, 16 Oct 2024 00:05:36 +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 BN1PEPF00004682.mail.protection.outlook.com (10.167.243.88) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Wed, 16 Oct 2024 00:05:36 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 1626A7D; Wed, 16 Oct 2024 00:05:34 +0000 (UTC) From: Bernd Schubert Date: Wed, 16 Oct 2024 02:05:23 +0200 Subject: [PATCH RFC v4 11/15] fuse: {uring} Allow to queue to the ring Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241016-fuse-uring-for-6-10-rfc4-v4-11-9739c753666e@ddn.com> References: <20241016-fuse-uring-for-6-10-rfc4-v4-0-9739c753666e@ddn.com> In-Reply-To: <20241016-fuse-uring-for-6-10-rfc4-v4-0-9739c753666e@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Amir Goldstein , Ming Lei , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1729037122; l=7954; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=0Y1IyT/hgBu6I3Aqfc5RI8c5rxwN7dwCeZDd51oJbXI=; b=UyvA/t6gjKTMEB6m2rFhXIiBAIBqR7mi8BFxkMRNytO3ZAZZCwubzumIKqwhRozzspoH9bNZi a45F3XYSqVmApjafRG1LaSP2JxOx+exDgR59CEZQ4xFmJeZ83bJnsR4 X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00004682:EE_|SA0PR19MB4175:EE_ X-MS-Office365-Filtering-Correlation-Id: e23260a3-2a19-412d-fffa-08dced7642eb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|36860700013|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?Naz+8/UaPN5kTKDVwIIjWqe+ui0AXfK?= =?utf-8?q?ToBrOxrLIc2BTydRxwQwWL1KYv7FhXmz/FTkBNUp4vUv20owbypcyDJQ00euKNIK7?= =?utf-8?q?IKsq8Ja+9HrjxNoH6U0r2i7CAeFCfllYupi9x2jgvo7Cl2Oag33o23TOpowlOMZzf?= =?utf-8?q?EO/5Q20q1Ls2CXJy45DXlVksHIp7kj7EBLnnyptHi08n5Alx2293bft+Ss21H2n5G?= =?utf-8?q?wdVqVJan0jVREGJ9YVlNwcMMQ1MmuGIw+4e6mGwXKlQeXkq6v8FZJon5XfGrdCHnR?= =?utf-8?q?4O9dK3uruHvtoee2NCNk0AWJPfmKTeXhuHTFngYwHDBqYV3edjE7e81aU3airnyUH?= =?utf-8?q?FW4XPMiani1yvbtQYTbJ5D4E/U477pXjfBY+80/RHXAJKHVPbCkI0zyqoXEzQLhrL?= =?utf-8?q?FPY3A24YiCllQ+FIGBR0K1mYsAYuupltntiSbyb5/NTnsSzlpLMyWcFJL1qOYRU4A?= =?utf-8?q?GUywZDBEMktG9e1r+SJiiLi2J/EBehlg8ag6ofwqMOjv5quSQNfl9c5qa4R2h69U3?= =?utf-8?q?JtAHLJVubNoBog4bYRH9wzUavMaxyX7V77skOu3upVZs8UHfyylD0Npz08apBO/Yq?= =?utf-8?q?fhiZo5518z5gWt1+3iJI1TEcjFrhhx42Q75Y8G+Xt2ekb15GvyzCoibnvmftxpM/Y?= =?utf-8?q?TTv8ztVhERFHfZuahfOih2KUGAJcXiS+1v/2h8qbPg0L8t64+N9QgcM2NspVU3d17?= =?utf-8?q?ztX1w39R0dvrzkfzGK7pcxq5HJcIh9Bf63tdMIK9Ear5ZROPJDZGzm9TrV6cB19f3?= =?utf-8?q?5JX1ZxT3kMgzAMvvjz+BH6/UjGUDF1TwzTgkI9Cm8bnEboApymtNNfXrQLy+tmomA?= =?utf-8?q?Z5w9boeQdeyK3TiOPjoQdBTqnl+9PQP55PxsP+NQ0k86MJ315mPnKRQq+S7Ag16d0?= =?utf-8?q?LWokOD7vpovjbzwG3e6flX0/NCAH1Upf6JdItyr5maj8SragDgdq+lOJ5eErQHI8S?= =?utf-8?q?IegxQu5Ir+0sT0qqwlZR4RjzzmUYE9ToAIT0yAEUMyYtcf2sisVaioDFzjWf3Ahne?= =?utf-8?q?WN8OM+ID16w+3Lc/v8JfM2waP3Q8BnHSTxJnCCu1UJ54xTd98P4XePlX5bPPzPUBh?= =?utf-8?q?5qVGVrxkhJmwD9c5Eus/YBo4WuyRKgujkHu7jcEHNz+kNziXMiraJEK6nIsxMDsnS?= =?utf-8?q?o5/FignHOFJrUKJXkPd6Kafa3COmzbnCoiWBA7FAJSroTQQJdpHqt2tSE9whVjRMO?= =?utf-8?q?od8SOWSLrdbIoWhV9rWZMVfPhnvdCsw11FYbJWlR/6spC0K0MJ/juBUVhLbA9a/8Q?= =?utf-8?q?LaZzW479kh8DliWQuPXEML6PxyG1dBdwMGtmmcTdA5/DFhL8nuKqgQczJ5g1+BLpE?= =?utf-8?q?HmAZWszMwFC5?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(1800799024)(36860700013)(376014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: VkRF8cXbDTsbT0EoM9Q3amzewjHuWIbw1kMaJYwc4frdl/I4PGbFPi1YucViJujl9e5nDVQVZOsnfQccP5yF65FDwdJwgn8bMQoq3Tv28L03beijHJbwsL8civoRtj9mDnW9pmIS+JhhYUeuPI/2zFExSmpv3SdrDGkFkQPkBX/L9Xi08zMcn2MH4sJizU/TTFR9RQLzmnhTwBd9QJUOe3b57C67Tnt1vIwGOfsSXWWS1L2MeJEpBT7OLBhnDyIT56raN4pFeKOer5+TCXZC3Ga4icMxwR6UXBFGmsEUHFHFbNriz/oRtIT4rbv3WEHG2BUMuLfVVrpU/eWQl49KdEbL7VQDO89clhNfAd29D8pDzoUS4yy2s/vX5GEvYKfQKhiVzCcU0RqmUAL1f4CukVPkHBKeuqCBxKC/JVgJZjDr3AJXSoc1Em8hHlt7zDOPSST09uDkal+qxjFs+r7qyZ5ZnzRKsEiWGNbuMpVAyo7DDtDYjEgNaBBkJRD6davxTrC11WLl5FBOZ5RBo13Mthw+lwA5z67QD8EouiLxhVz47bP1gulA/i2qb38apCtuESP9cKNhzLTBm+h52UQ+/xbTmlEkDJwQaUWh8UcOpXKlVycWTLwDbdh/Y3PdoqAs6H4RFEgHwO+P05DpFhGWLw== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2024 00:05:36.2891 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e23260a3-2a19-412d-fffa-08dced7642eb 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: BN1PEPF00004682.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR19MB4175 X-OriginatorOrg: ddn.com X-BESS-ID: 1729039226-111798-10777-62662-1 X-BESS-VER: 2019.1_20241015.1627 X-BESS-Apparent-Source-IP: 104.47.73.43 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVuZmFuZAVgZQMNnc1MzExMgsyT w5zcAkKc3UKNks1djQxMjU2DQ10dRMqTYWALY8tCdBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259752 [from cloudscan13-246.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_SC0_MISMATCH_TO META: Envelope rcpt doesn't match header 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_SC0_MISMATCH_TO, BSF_RULE7568M, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 This enables enqueuing requests through fuse uring queues. For initial simplicity requests are always allocated the normal way then added to ring queues lists and only then copied to ring queue entries. Later on the allocation and adding the requests to a list can be avoided, by directly using a ring entry. This introduces some code complexity and is therefore not done for now. FIXME: Needs update with new function pointers in fuse-next. Signed-off-by: Bernd Schubert --- fs/fuse/dev.c | 74 +++++++++++++++++++++++++++++++++++++++++++++------ fs/fuse/dev_uring.c | 33 +++++++++++++++++++++++ fs/fuse/dev_uring_i.h | 12 +++++++++ 3 files changed, 111 insertions(+), 8 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index c8cc5fb2cfada29226f578a6273e8d6d34ab59ab..a8b261ae0290ab1fae9c8c0de293d699e16dab2c 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -211,13 +211,24 @@ const struct fuse_iqueue_ops fuse_dev_fiq_ops = { }; EXPORT_SYMBOL_GPL(fuse_dev_fiq_ops); -static void queue_request_and_unlock(struct fuse_iqueue *fiq, - struct fuse_req *req) + +static void queue_request_and_unlock(struct fuse_conn *fc, + struct fuse_req *req, bool allow_uring) __releases(fiq->lock) { + struct fuse_iqueue *fiq = &fc->iq; + req->in.h.len = sizeof(struct fuse_in_header) + fuse_len_args(req->args->in_numargs, (struct fuse_arg *) req->args->in_args); + + if (allow_uring && fuse_uring_ready(fc)) { + /* this lock is not needed at all for ring req handling */ + spin_unlock(&fiq->lock); + fuse_uring_queue_fuse_req(fc, req); + return; + } + list_add_tail(&req->list, &fiq->pending); fiq->ops->wake_pending_and_unlock(fiq); } @@ -254,7 +265,7 @@ static void flush_bg_queue(struct fuse_conn *fc) fc->active_background++; spin_lock(&fiq->lock); req->in.h.unique = fuse_get_unique(fiq); - queue_request_and_unlock(fiq, req); + queue_request_and_unlock(fc, req, true); } } @@ -398,7 +409,8 @@ static void request_wait_answer(struct fuse_req *req) static void __fuse_request_send(struct fuse_req *req) { - struct fuse_iqueue *fiq = &req->fm->fc->iq; + struct fuse_conn *fc = req->fm->fc; + struct fuse_iqueue *fiq = &fc->iq; BUG_ON(test_bit(FR_BACKGROUND, &req->flags)); spin_lock(&fiq->lock); @@ -410,7 +422,7 @@ static void __fuse_request_send(struct fuse_req *req) /* acquire extra reference, since request is still needed after fuse_request_end() */ __fuse_get_request(req); - queue_request_and_unlock(fiq, req); + queue_request_and_unlock(fc, req, true); request_wait_answer(req); /* Pairs with smp_wmb() in fuse_request_end() */ @@ -480,6 +492,10 @@ ssize_t fuse_simple_request(struct fuse_mount *fm, struct fuse_args *args) if (args->force) { atomic_inc(&fc->num_waiting); req = fuse_request_alloc(fm, GFP_KERNEL | __GFP_NOFAIL); + if (unlikely(!req)) { + ret = -ENOTCONN; + goto err; + } if (!args->nocreds) fuse_force_creds(req); @@ -507,16 +523,55 @@ ssize_t fuse_simple_request(struct fuse_mount *fm, struct fuse_args *args) } fuse_put_request(req); +err: return ret; } -static bool fuse_request_queue_background(struct fuse_req *req) +static bool fuse_request_queue_background_uring(struct fuse_conn *fc, + struct fuse_req *req) +{ + struct fuse_iqueue *fiq = &fc->iq; + int err; + + req->in.h.unique = fuse_get_unique(fiq); + req->in.h.len = sizeof(struct fuse_in_header) + + fuse_len_args(req->args->in_numargs, + (struct fuse_arg *) req->args->in_args); + + err = fuse_uring_queue_fuse_req(fc, req); + if (!err) { + /* XXX remove and lets the users of that use per queue values - + * avoid the shared spin lock... + * Is this needed at all? + */ + spin_lock(&fc->bg_lock); + fc->num_background++; + fc->active_background++; + + + /* XXX block when per ring queues get occupied */ + if (fc->num_background == fc->max_background) + fc->blocked = 1; + spin_unlock(&fc->bg_lock); + } + + return err ? false : true; +} + +/* + * @return true if queued + */ +static int fuse_request_queue_background(struct fuse_req *req) { struct fuse_mount *fm = req->fm; struct fuse_conn *fc = fm->fc; bool queued = false; WARN_ON(!test_bit(FR_BACKGROUND, &req->flags)); + + if (fuse_uring_ready(fc)) + return fuse_request_queue_background_uring(fc, req); + if (!test_bit(FR_WAITING, &req->flags)) { __set_bit(FR_WAITING, &req->flags); atomic_inc(&fc->num_waiting); @@ -569,7 +624,8 @@ static int fuse_simple_notify_reply(struct fuse_mount *fm, struct fuse_args *args, u64 unique) { struct fuse_req *req; - struct fuse_iqueue *fiq = &fm->fc->iq; + struct fuse_conn *fc = fm->fc; + struct fuse_iqueue *fiq = &fc->iq; int err = 0; req = fuse_get_req(fm, false); @@ -583,7 +639,8 @@ static int fuse_simple_notify_reply(struct fuse_mount *fm, spin_lock(&fiq->lock); if (fiq->connected) { - queue_request_and_unlock(fiq, req); + /* uring for notify not supported yet */ + queue_request_and_unlock(fc, req, false); } else { err = -ENODEV; spin_unlock(&fiq->lock); @@ -2184,6 +2241,7 @@ void fuse_abort_conn(struct fuse_conn *fc) spin_unlock(&fc->bg_lock); fuse_set_initialized(fc); + list_for_each_entry(fud, &fc->devices, entry) { struct fuse_pqueue *fpq = &fud->pq; diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index 3f1c39bb43e24a7f9c5d4cdd507f56fe6358f2fd..6af14a32e908bcb82767ab1bf1f78d83329f801a 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -793,6 +793,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 */ @@ -801,11 +826,19 @@ static void _fuse_uring_fetch(struct fuse_ring_ent *ring_ent, unsigned int issue_flags) { struct fuse_ring_queue *queue = ring_ent->queue; + struct fuse_ring *ring = queue->ring; spin_lock(&queue->lock); fuse_uring_ent_avail(ring_ent, queue); ring_ent->cmd = cmd; spin_unlock(&queue->lock); + + if (!ring->ready) { + bool ready = is_ring_ready(ring, queue->qid); + + if (ready) + WRITE_ONCE(ring->ready, true); + } } static int fuse_uring_fetch(struct io_uring_cmd *cmd, unsigned int issue_flags, diff --git a/fs/fuse/dev_uring_i.h b/fs/fuse/dev_uring_i.h index 4f5586684cb8fec3ddc825511cb6b935f5cf85d6..931eef6f770e967784bbe9b354bc61d9bfe7ff8d 100644 --- a/fs/fuse/dev_uring_i.h +++ b/fs/fuse/dev_uring_i.h @@ -116,6 +116,8 @@ struct fuse_ring { unsigned long teardown_time; atomic_t queue_refs; + + bool ready; }; void fuse_uring_destruct(struct fuse_conn *fc); @@ -157,6 +159,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; @@ -177,6 +184,11 @@ static inline void fuse_uring_wait_stopped_queues(struct fuse_conn *fc) { } +static inline bool fuse_uring_ready(struct fuse_conn *fc) +{ + return false; +} + static inline int fuse_uring_queue_fuse_req(struct fuse_conn *fc, struct fuse_req *req) { From patchwork Wed Oct 16 00:05: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: 13837501 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 139FB1097B for ; Wed, 16 Oct 2024 00:38:49 +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=1729039131; cv=fail; b=PGcsw0IxU+Jmnn4DhxeBHOGKqu9umIj8H77BuVl5Q32YQrVMhoSeyC4hKwac8R2g7/LJEH/44YFYVBoWkWwE/EshJ9izavbAoloRWaue4Jx8+OIIvCugDMsaPEo6/MUh0UCg47tC46PgTHIx2Z9MwYHM7jgxKafF8VYhNV/4RhE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729039131; c=relaxed/simple; bh=JEJEokcOCc05jtJsubXuaCfG17CCGx3VZOLL4a2JKwI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lgDToAY8lkSJ6wBtw3XdL1vN4a0ZcrBsegylrcqJbYXbVCJ7EH2ZFVdfxH56vMmNM7ynitTZO3jeLMs2Um4z4ceTk4FkLZpmant9swUsrc2vdubxUolYR4ydCEMYLHQskyFTv0M0kBbBDkMGHz7CNbVPv4NfGlwifX6dn0ws/Xc= 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=DLByn9ZX; 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="DLByn9ZX" Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2173.outbound.protection.outlook.com [104.47.59.173]) by mx-outbound17-97.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 16 Oct 2024 00:38:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wn2h49Rqdd7phDBFZdx11PcMMXHWY47lXb6F2spItImBhZkRD8q/aUAk4eoiRvpJ306Gjl/HYZ2qPi28tigyCkB3fXnuH9oyTJROhNN8AHMrDIFWOZERiWcM2CfEUbsDUEZ3N2YGhrBJ3s1JNM3A1+tMnsH1LNfYigvoCi3wOaABBLE6O8uPFaXP74CqbAHaf4YcK47cfBAgwZ9P0wauA+YfsflsdNChHY2gkVe40IkMaPoNwGlDEDeXlPt+ut1JSc4+yCPkL/bw7Cgh5T7fs1sWvx/K3NA69XnOl10D/X1n0gi8iMdJWnokjuIitJPJXfO4r9IciBp+Ai6B3Fp4fA== 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=Y4HGVIpBllPu0xVIkA4Sr+ZgSNQ3TER0bdtjkdpsSbU=; b=TJix/MqIXtu750sUku+RM7cFZRMBu5OasMrf4O1EoHfR705HcRvIYQj8XllSYQ8b4lRQ8pb1VueEW3oHM6UFpmXgE4kLMsSwL5LjwqurQaTW2BiEy5UY8gPxhwerwXo6l3GnFiwhDn68YLJyxELiQn9UMhHNKT1swUvGX5iIXX4QMSMb5QhJ9na/zWidveP+YL6me242/i4v03uRpg9wYWayOMGj5XiDBdNR9m8MqxpOyh7Dlp9kg00vg08mK+/pjloVPOb5ZUJs2Wu9G/rPVneFcxcxwryYYyJ5JYOVdIom3Giby591fFtejv4hHIkQ8aXWHcaCY6dr4ONn6JrB2Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=ddn.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=Y4HGVIpBllPu0xVIkA4Sr+ZgSNQ3TER0bdtjkdpsSbU=; b=DLByn9ZXN/yUQGdHIO6dBm/cv+f0Bjrz/zF4YlD+VYX4DvsLk5EdE3dwRBKAg3Ap5MI6aJmS0/hXYY4Gl/2yftQQgxWE1iOmbK3pT1hIq4KipqrRBhQ++EzFj/0RTlm2wQhsv0q94QDQ5G/WCMDhQi1KMYY67zcGQE7aLjNuWpo= Received: from BLAPR03CA0106.namprd03.prod.outlook.com (2603:10b6:208:32a::21) by IA3PR19MB8592.namprd19.prod.outlook.com (2603:10b6:208:524::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26; Wed, 16 Oct 2024 00:05:38 +0000 Received: from BL6PEPF00020E62.namprd04.prod.outlook.com (2603:10b6:208:32a:cafe::19) by BLAPR03CA0106.outlook.office365.com (2603:10b6:208:32a::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.18 via Frontend Transport; Wed, 16 Oct 2024 00:05:38 +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 BL6PEPF00020E62.mail.protection.outlook.com (10.167.249.23) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Wed, 16 Oct 2024 00:05:38 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 2EDEA29; Wed, 16 Oct 2024 00:05:36 +0000 (UTC) From: Bernd Schubert Date: Wed, 16 Oct 2024 02:05:24 +0200 Subject: [PATCH RFC v4 12/15] io_uring/cmd: let cmds to know about dying task Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241016-fuse-uring-for-6-10-rfc4-v4-12-9739c753666e@ddn.com> References: <20241016-fuse-uring-for-6-10-rfc4-v4-0-9739c753666e@ddn.com> In-Reply-To: <20241016-fuse-uring-for-6-10-rfc4-v4-0-9739c753666e@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Amir Goldstein , Ming Lei , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1729037122; l=1907; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=+fzHnSTkiWQEiYWdcON6N8NsnwP07vKgm8D+2K3HAhk=; b=lvykcPLOz0+E3lvcXwhaBJsNTfIWpVbAAgFu4RQ2eudgqOaPJRb/85cnvaK58SQsZu+F8MXoz GwppeW90uheAOxnHz2+hpInD/JOGPEnoAmzNiPwi/2gNUyf9rSYCUT4 X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF00020E62:EE_|IA3PR19MB8592:EE_ X-MS-Office365-Filtering-Correlation-Id: 204b4fc1-ad94-44fa-ab39-08dced764434 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|1800799024|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?r0toHosHpZyDoCPwWGzYiuawW0zHPfS?= =?utf-8?q?O3+IFptswkRMHj4Bw4SC60lt3H+TA6xixgjpIBrTS780hxfSlyZihn2cXjzQCG1nE?= =?utf-8?q?NhJty84xsQ1a4FPXxwwr9LURXBt2KYpLeMakdROP3+r92b+yydMhH477Ojuh4T6fW?= =?utf-8?q?rBrwxy032zqv36seoEEhfOUlJZTLQhNwH2qiwLQOksRtxpRQvKiHTzWcdIJ6BMR1u?= =?utf-8?q?iPM9ggWUOZr2kt12ChhwXzPahfmH1W6B2aeegmh5kD7g7dWp5A0qLxXGBzDHElrNn?= =?utf-8?q?9w6kxDVlGD8gY6Ee1da5n3zqC19h54zedcImZS/DSnJOVA7Ypxw6u5Ba8EuyrgD24?= =?utf-8?q?0afc3SAX/unbIpEMeU8v8D1bJGifXKDdeNej7vfOtwFFtZ6oNzXCq8HtxjbyQfMsp?= =?utf-8?q?FyH8xE4MmqAk7E+pijDBJW5E6JCg1qGr0jdJzOSG1B5eFjJxEPAN0g80XTOojr+Xk?= =?utf-8?q?W/EaHu6wulxVJZRdzncBNDhan9PtFs2Und3JCdSx5R5yN9rSPNIW5zban06LTs38J?= =?utf-8?q?1iVOHQJruw89WVl2Df+4x3RW72C+xQMpnu4iBGg8gxqPJwmtJIaq79U1SIU44LuV9?= =?utf-8?q?mWfrmVsccliHlJs2mret7sgWOemRCof0O7/r98PumQkbQDs83F8Nc8WZoZRtXpYP6?= =?utf-8?q?nBdsZWvDnZpQm7786K6LP7mio0sTfBy+NXdVGhij1/kmcZLMcyca4cO/TbAN5EiAT?= =?utf-8?q?N6yl7CCRavfEbGM5rWcAsnaP0I3m8SWGI5RRxz09wUuIgJ6+5tsHXyoMLRZqzfCbe?= =?utf-8?q?jbW91SUPwHt3SGVTPEcWDDwh6v1nWIcut5PxYmsspe3T2Ev0tk0sxcecacjrv2yT2?= =?utf-8?q?NXwsIwZ+Vl7SXVRiVXql1KcryKUXz6WzhN9xsN7CVq68F95og4cY7mM2TGDqkEHeV?= =?utf-8?q?7ZDuxMQ/GmMMOtSSUc6YRZTrPmdLNCRYMHV1gYe8e/R/OrOugnkrmtK3V3yAKWZMF?= =?utf-8?q?3tMp47YNk+4wfgLGSBfG7ppoDuEDBgL6KHIghyjQm/if1wgLTK+KTeGpAQ9+j418h?= =?utf-8?q?xon8MPErgpd32RlebnAu70DHVzznQ4dSBMtucmjRjvYlxOIesoycYQybdCbLc+Kt3?= =?utf-8?q?TOqmkSpHd0P7VSu2Y7c2KbiT1Ospm+ZUpuVcUSY6aMWDYKtjsOa0gERbxq1/1Tw28?= =?utf-8?q?cDzuvWuCD05dkvowXkbtUhg3qZPYSsnosrLYtT+6OJX5mi5Y7E5jxgwF26407r45j?= =?utf-8?q?+wKHOOh5WgslDn2mbwzznsw7Jx45A/jQ7u4kIlN/FEiHtXlHbE5PzXszHGPs6IkCz?= =?utf-8?q?UYEn3EA+h7a+qWmhO9L6GSbsWkZV1ZBLjLX5hI4slnEPBgrTHDpbjSo6AtH/8eMDt?= =?utf-8?q?luh/w8Vgi88y?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(36860700013)(1800799024)(376014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: VWoubJttg2/cQ4dbgRowpwZDZHCa0lO20d1mXi9QVNvl2RysZ+ZscgCmq0BkTjmFUdtnuqFClLVf1BFgyiABvgQpLTxGzY9mofKq4jV9LWh1GwMyDNs5B/RWaSOUJcj92zr82HqZfFlVur7A6UfAepxf2aRMVdIz8KPc3EkHPbsQHQfUkMYz1aJwBgEYoUxPAWaWn20gkVe8uxR0CAOgo3YDmzqn7MgxqQLgkdBZXL0sGEboO3hUfplPdiWqawoLyE552/sixqRhrEOb9NchM6i3P+LTQCfqytnUXepCTWjTZqEYLu0i4IE1eD2w09eiwhr+eI5yN56OWbt668H/ulnOEJQlupPS4WicilgK2dW6TFU4dPebTBigJ4JIj5jSzBGZyOD4daMtX3BCmw+PA+ZbLWt+26iUH6U8aYb3jhVf0cZIHYy32JnJ9mSasvOQEoixbDD+hl2Xge5L8MI7WWAQUm5gBFkjjYXQ73O/DRZ+fAUTFIO8Zu0lM8VK2Bb/KvIaQIMa3gB8HibQIPXtSHxfVE2xGRbRWSPa96eBQjjV1FVrQVi9ff9SBsshnDIAbbqR3ZbxGKVc8Xsxif4eFjwIlQg5W+jnpd21/5jvQy1c3qBNjYJA5UWPn2MbB+l6F97w6ErgR/5fbB5TBG5KOg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2024 00:05:38.4587 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 204b4fc1-ad94-44fa-ab39-08dced764434 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: BL6PEPF00020E62.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA3PR19MB8592 X-OriginatorOrg: ddn.com X-BESS-ID: 1729039128-104449-26725-16014-1 X-BESS-VER: 2019.1_20241015.1627 X-BESS-Apparent-Source-IP: 104.47.59.173 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoaWBhZAVgZQ0NDYLMnIJC0pMd EizdLAxNLEzMTczNzQNM3I0tQ8ycBUqTYWAFYIL05BAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259752 [from cloudscan20-140.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_SC0_MISMATCH_TO META: Envelope rcpt doesn't match header 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_SC0_MISMATCH_TO, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 From: Pavel Begunkov When the taks that submitted a request is dying, a task work for that request might get run by a kernel thread or even worse by a half dismantled task. We can't just cancel the task work without running the callback as the cmd might need to do some clean up, so pass a flag instead. If set, it's not safe to access any task resources and the callback is expected to cancel the cmd ASAP. Signed-off-by: Pavel Begunkov Signed-off-by: initial author Signed-off-by: person 2 --- include/linux/io_uring_types.h | 1 + io_uring/uring_cmd.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/linux/io_uring_types.h b/include/linux/io_uring_types.h index 7abdc09271245ff7de3fb9a905ca78b7561e37eb..869a81c63e4970576155043fce7fe656293d7f58 100644 --- a/include/linux/io_uring_types.h +++ b/include/linux/io_uring_types.h @@ -37,6 +37,7 @@ enum io_uring_cmd_flags { /* set when uring wants to cancel a previously issued command */ IO_URING_F_CANCEL = (1 << 11), IO_URING_F_COMPAT = (1 << 12), + IO_URING_F_TASK_DEAD = (1 << 13), }; struct io_wq_work_node { diff --git a/io_uring/uring_cmd.c b/io_uring/uring_cmd.c index 21ac5fb2d5f087e1174d5c94815d580972db6e3f..82c6001cc0696bbcbebb92153e1461f2a9aeebc3 100644 --- a/io_uring/uring_cmd.c +++ b/io_uring/uring_cmd.c @@ -119,9 +119,13 @@ EXPORT_SYMBOL_GPL(io_uring_cmd_mark_cancelable); static void io_uring_cmd_work(struct io_kiocb *req, struct io_tw_state *ts) { struct io_uring_cmd *ioucmd = io_kiocb_to_cmd(req, struct io_uring_cmd); + unsigned int flags = IO_URING_F_COMPLETE_DEFER; + + if (req->task != current) + flags |= IO_URING_F_TASK_DEAD; /* task_work executor checks the deffered list completion */ - ioucmd->task_work_cb(ioucmd, IO_URING_F_COMPLETE_DEFER); + ioucmd->task_work_cb(ioucmd, flags); } void __io_uring_cmd_do_in_task(struct io_uring_cmd *ioucmd, From patchwork Wed Oct 16 00:05: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: 13837497 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 36344E574 for ; Wed, 16 Oct 2024 00:38: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=1729039087; cv=fail; b=qASeq/Gupn46/lxlcK5HiE2w50FCCU/aLjLtnaf4AOMVowmOlaWUVdJJ4izQUJiZ9eWmB5BACF+Hf/Ju2545Lwc3vbBoucw/wzFOmqOwYASmmYuswX1KQYtU0OJztXCB+02+HO+CYsww2yDaAU6xchm8MnzKdVvhsGVxOQVTh4g= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729039087; c=relaxed/simple; bh=4aej8Q309HVdsLZ+KC2yW0OlMYe5WL12QUhlElP9L/s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BZK6jsEQlsprCI3oH/IDAvpcn/V8qSOvNZHIty07Mor2fuCqWG5fSZepRZsJwMq36ZbGHbTSOi5jPHgzLqe1m8832rR1Dp012mfarlqA3OcAQcka4rQS8G8ebezvT0TPtQ1Zds2y4y4YE9JOmWR3maMh4TKxx9LKAMnPk6aziwc= 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=FxT80JRQ; 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="FxT80JRQ" Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2048.outbound.protection.outlook.com [104.47.73.48]) by mx-outbound-ea46-177.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 16 Oct 2024 00:38:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=B4sV3ICCJz9hZ2dbolBkf78auri22nGp42giWdgTsgp2BY1Oercj4QcKELezbQpRhfFna9f6xNeuL3RK4N+fRjXr25GCnNjV3z6nYMk0P2KIoEZDaW/Uyfeg7myzJAslDFd4stC2g1tTYjUrGQIvaxCoCdG3oceeuJYnfBtw0Pm7+9ZHo14cET2kWx+YFIGKUelb4qTB1eGPfG9TS3hM1SzFv631sp2pz+3I3sAgkxWy3uN3gLlM4t6gNZmbYnSVfo6ArXNQpsFDaL06EHk7dgmimaqYG2UW/GN8JojasW3sUX2yQnYl+fsXCtqu1rlpPWTubkkQ1eunGYRZ3OEzgw== 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=QP20MrM72ZPBWJig3YallASttR3UM3rXUUsgiM+d2lk=; b=dmEQhVys4CY0hCCAhiYZU09t8sZ9+uA7Qlg2GIb4yoeN7EAonSwBFZ+WgCSbG+Tc95F6k+o16aJbLplU/lMhNvf6VFeyJRa00Wt/5oUQB15GBstuQZc9KQQtNJrjOmBQJSPm2P/fRTF00LWqU2fVV6sETnUOqOaSjyAf/XNQ/nblMNeAuQWt8eyHu2UC1YsDs2c8kVdnzjsAYFhvETUYbdzPNdvIz5DtJjTZySZtzmhuyt8xs+4kaUi3FvEbWdrk9T1xZeS4hbqwu8ijYOwATS2BE+BvvHbcwBFHCudALwjL/cTmci21rTSEmE67JtgSNT2Lvmm3gMdnorc4p0t0fA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=ddn.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=QP20MrM72ZPBWJig3YallASttR3UM3rXUUsgiM+d2lk=; b=FxT80JRQoEe0rgBh58uz/OqUd9C9AxFUD3uklGuCk3RXLMuOaeUuOeKeH0sk+qdNanQ5lbBq6DBxVQ9icI5T7fndFX+Cd30+Te6YduA+Wt7dlVk3n5XuUxgQ8GpvbXUaRvwbxy9mcTKmSvNi0MGqGCIA46TW0GAwk5H7kNhO/xM= Received: from MN2PR15CA0032.namprd15.prod.outlook.com (2603:10b6:208:1b4::45) by LV2PR19MB5790.namprd19.prod.outlook.com (2603:10b6:408:179::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17; Wed, 16 Oct 2024 00:05:38 +0000 Received: from BN1PEPF00004683.namprd03.prod.outlook.com (2603:10b6:208:1b4:cafe::5e) by MN2PR15CA0032.outlook.office365.com (2603:10b6:208:1b4::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27 via Frontend Transport; Wed, 16 Oct 2024 00:05:38 +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 BN1PEPF00004683.mail.protection.outlook.com (10.167.243.89) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Wed, 16 Oct 2024 00:05:38 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 4C6E37D; Wed, 16 Oct 2024 00:05:37 +0000 (UTC) From: Bernd Schubert Date: Wed, 16 Oct 2024 02:05:25 +0200 Subject: [PATCH RFC v4 13/15] fuse: {uring} Handle IO_URING_F_TASK_DEAD Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241016-fuse-uring-for-6-10-rfc4-v4-13-9739c753666e@ddn.com> References: <20241016-fuse-uring-for-6-10-rfc4-v4-0-9739c753666e@ddn.com> In-Reply-To: <20241016-fuse-uring-for-6-10-rfc4-v4-0-9739c753666e@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Amir Goldstein , Ming Lei , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1729037122; l=1122; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=4aej8Q309HVdsLZ+KC2yW0OlMYe5WL12QUhlElP9L/s=; b=QI8HKRcAEt4pqYZlFImnPX+NSL3Dt1T6GfFCXk9XeDhBisiyBUJipnQ3qldJ1iE3F4UWFaUQ/ zta/CnO3bPSDy2RdCXfO0NFQKq8bSOKHixTCVoT778MZSE66Q1ctuLD X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00004683:EE_|LV2PR19MB5790:EE_ X-MS-Office365-Filtering-Correlation-Id: 84ed494c-89ac-44c4-769b-08dced76442f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700013|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?utf-8?q?lukAMO4GOq4UPQ9eBYnHEb1gmuac11U?= =?utf-8?q?1xMDrJSM3A6onkj5gJndkmDd4FJ+huLSquc4YiBjxisYQU46qZ/SAD7t6rUNyI/OB?= =?utf-8?q?2cbQwSj34PwXSD7sg4KWN3luv179EbNkaVBO92lCzU8/3EH6XaZpQgRDwX6TCJimX?= =?utf-8?q?BQOuN5wuNmx+0A+Uyuly+y9Urv2hM2pLbMUrz9kfQxyXdu1iJ+VAr0Hg4BJtUWdse?= =?utf-8?q?u03VgOgz1+LkHALZlSbAsNVeZWQqIdVk6OchItFk3gQxY8T2t5hfK3Zqe2ui0FYvV?= =?utf-8?q?G+g5RikVeehoWrzVtq0Z5hccxGKwNm2pw0mOVjzGyEV4BAFaD5775Tki0kmtEs7eC?= =?utf-8?q?tfXCqAgtbHM47JVhQAJGz7y7CNblCeMQFrU97RC+okyMsIh3ujIMbewdPKhAn0/t5?= =?utf-8?q?ZmAr0AHyddRNPb8VE0JdPXHUp2R3FCCCv4FLHPfVodswpTdGdIneouFH09r4MZij7?= =?utf-8?q?ZZTuqRUFguZXtgyIJ8JZ6MDdmG36EKLeUa+nky/Ez1cmuoJqjWlyps0WqtBavWjuN?= =?utf-8?q?LuIRKBYOBU5EL8Q7CGAzJBvswaFbCFKzyqk1goHsxTfXL5a6/Tv2Zi1/xBGrqTSyA?= =?utf-8?q?nHhlZnGvg7ULOlC0SH61PuMVN0HvTakGtupcvlhfhzsuHEOJ+IzB1kvJhT3nNCzyH?= =?utf-8?q?11l4m5Gsc0y/X/UPgNaAH3s9KMbO+AX6mJVHd5qYXzhcUwpswW0aP6Q8EDWPSPju6?= =?utf-8?q?eT0rUtwZqJl8x4W0rymUeF2jyAD74bYYghBh11DDFDDArt2Cp1P9KojqIcktTT18/?= =?utf-8?q?qriTrjbAXc5KyWU/VkAoaFwuLtiR/MWjBwuCNLt2mtR4mA3TxGtHR3yjyfft3/uwQ?= =?utf-8?q?LHwsTibvWEdrk49HqZooOfQgh5ZIZPt5QviTSWvE02YmAQAA/vjTe4ECLaJElOg2F?= =?utf-8?q?5lC60OJCi/Rr/r9z5v80ZtjyCKRVttUCz11psawGkMU+7wzsOuZUGIZNawoBzdxmW?= =?utf-8?q?h3YwF7syde6lV4vBDkyjsFl1tO+hOIV5zaWsj6U8YP0nXGzu8uqWWN2n3MF0LwpCr?= =?utf-8?q?yHWZWE4+cZB23yfGFUp0ubwEIj6fJUxe8FICpQoTU3w6i3ujgv3aYy7HB9CGE/3ax?= =?utf-8?q?+bBKnKOWatk0gJhp5vNcxQVxPn02/wGx1D+F/oV3aJu9j/i54BcwmcJjDvNA/Ysmt?= =?utf-8?q?gTLa10O5/g4W23Y0bq0w5FUnKlwHO/glWguoQNoWMgr4SH1m5FF4yFBqPycptVSI2?= =?utf-8?q?qv8i3+TmquDmrUmSGS0pY1WFl3G+cY5mSTOtp/l3rk9uO9GmwclgsApfJ22/pcB2U?= =?utf-8?q?d8eSFSJlsjUUf3TNaPPIeL5zaPOQBpdge5EvvEmfZ06xoZmhH4XcjJBg=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(36860700013)(82310400026)(1800799024);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 23hDnS9LywscdQaxKN+SccGbnz4WbJa5VVQMZQa50/tw1Modo0/AGqMr8qb4cAnirRFb02S6ScDBPkiCyycjYzTD9twnFkS91DTZchnuXaOhL1OuGTm1dLC1FFBTMUCMMYM+AKRcnbp89FEo0pyqzPKC8OBHi2v07+h3NnpS1Ov5quU6cjrk9EwR6Bvt9nBO1BP9aWOVk2XkNlOkkVnCQpUA9vqClc55miquRI7+DpxTJ4NyTyY76ZhVNxbZtKohW7VvumTnSFHgzAr6Hso4FzM8Ogok6XoAD2d0ie5MBtOHDN4sU5zthAHQcwgiWJDBEazMT6+CuHIqQubwqegCPG/+mQpn3v611skISuo6xa5Ktozv13NNNaDUy3kauyjdLdoGK2uOZ131KeAo6gWqunjDL8G0psdSgfKWenC8AcCZaDgknWpoc0I6XYdYillsFbX6gJrwvRSC+Wl2dYxN1b35uQx64iXpXknlzfk6xX7RvW9MVndGGr4tiMSfr87eEUymD1oatFSGEJh8VFRQ59y8WWR3Ih3gl0CaZRiykacvm/cwxKEv6oaP6MVR/x+TcZEhhEQslCdLc9uHkF/PdnNM86ocbS7g6HdZJ+T4dvEPR0UFQXfNi3IlnNm3kaMV6ydUKbUrCXm6OuVuaAzGAQ== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2024 00:05:38.4090 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 84ed494c-89ac-44c4-769b-08dced76442f 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: BN1PEPF00004683.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR19MB5790 X-OriginatorOrg: ddn.com X-BESS-ID: 1729039085-111953-26388-18957-1 X-BESS-VER: 2019.3_20241015.1555 X-BESS-Apparent-Source-IP: 104.47.73.48 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoYGFsZAVgZQMMXQOCXVyNTC3M AyxdLM0tIyySzRxNTYKMnQzMQiOTVNqTYWAOEiGAJBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259752 [from cloudscan20-251.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_SC0_MISMATCH_TO META: Envelope rcpt doesn't match header 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_SC0_MISMATCH_TO, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 The ring task is terminating, it not safe to still access its resources. Also no need for further actions. Signed-off-by: Bernd Schubert --- fs/fuse/dev_uring.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index 6af14a32e908bcb82767ab1bf1f78d83329f801a..6632c9163b8a51c39e07258fea631cf9383ce538 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -986,16 +986,22 @@ fuse_uring_send_req_in_task(struct io_uring_cmd *cmd, BUILD_BUG_ON(sizeof(pdu) > sizeof(cmd->pdu)); + if (unlikely(issue_flags & IO_URING_F_TASK_DEAD)) { + err = -ECANCELED; + goto terminating; + } + err = fuse_uring_prepare_send(ring_ent); if (err) goto err; - io_uring_cmd_done(cmd, 0, 0, issue_flags); - +terminating: spin_lock(&queue->lock); ring_ent->state = FRRS_USERSPACE; list_move(&ring_ent->list, &queue->ent_in_userspace); spin_unlock(&queue->lock); + io_uring_cmd_done(cmd, err, 0, issue_flags); + return; err: fuse_uring_next_fuse_req(ring_ent, queue); From patchwork Wed Oct 16 00:05: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: 13837506 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 A997C3A8D2 for ; Wed, 16 Oct 2024 00:39:46 +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=1729039188; cv=fail; b=QIB0a37EfyC5muO6rc5AVmXPEAh7OgJYV9T1ba9GGLAqUjF80QGmwxKfNVPsm8hSPrGdfTfkypmtp8mYSxj2Nfm/04qPTmtq46X2YF72o224uPAyJAeIvVMZiNk3cLV6ZytVxfcKvAukTaXCfzu0XskWBVKj89zejO0c8+gUDws= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729039188; c=relaxed/simple; bh=LNRjk1BQzlDUsM9lv7ATvb3bUoxo9H0fgwLuky5tTO0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=sdcx6YkxtJBOSnWd7HWXY0ItZG6I/ei4t+x68chJsGh/UdLTqrxM8ct6x5mnyO/N2gf/iIzOfwbK/eGM0aK2AtcEKub0KbI1U50uAMQwvOOcocF8f+AAlmYDDgCtDmiwwHA/9cVdhE8dLhC1CgzFRo9ikD8+y/s2f81ibLG6vZM= 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=LqVTt29W; 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="LqVTt29W" Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2175.outbound.protection.outlook.com [104.47.58.175]) by mx-outbound15-86.us-east-2a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 16 Oct 2024 00:39:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=XyI1gunq0EwOPmE+euQvvzlfCUTDcTvzxRig5E+4e+qpCkgxqsPdYgq81rIyYVmZ1wDzIQZAL7UqUMVxEqaOuiPFXbjqPjUXIddUHVJjOO7mibA+IPAuXZBudn0ZoFBCt9QsoYM7sT4A39YosJBtv5PYBXiE/WSug+iz3D0gNXbObHsBUPac6FTe4nZ6HcjIujFy2YhlEcmsEJ00fELFXNLc/JqvlNDhRdnvgCBOcZQMrBhg1H0TKvCoixQdCLavcS9V0AV1E2XyQg02Wev+nOivOzU/wMpmKO+v8S1FtGYZ4LMGe4Oer2d2gBeRzFSvoWaRwX5DtZoTSh/C2hsYOw== 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=sJzM04F5auMPqTC4+F6onlxqr84QUG4DCTOySQU1uKA=; b=QJoVJwBO5+AgtCqplQktZd0X5VW/31/8Y7pjFXdG2TBLfHMQomXVyCZtW/U9OkygIAvOqXp40E21bU/2ACbytTLWe86DsKUfjUxKeDdOvwCZ2sgU2VMqbwRdj7Ow0o07UTIUsOeGvQLJyf5gcA32TFEzqjWMp8B9dj38FZtZ/j4UeYTPRqS/uRjPMyLsW9WiQEwfr76TE4byKxhIy35jau/b9TmbJFIXbDp3Sn7vBxVO8wf+bNdUAfHCh7hu6iIREuKakYn2S91IoO5Qif2zJJbIQiDPp+CGIDadtLDjetNaXp8zVaSwtewrSnlXjynzaPsMwUbYV5FUFMoiBUx3XQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=ddn.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=sJzM04F5auMPqTC4+F6onlxqr84QUG4DCTOySQU1uKA=; b=LqVTt29WohiODgNuwFBdjwxdbzSTLU+s85OOPEqa/Zp/wTLMHaY71JmhmVGnYPUkEuVSjYTjs6Ca2pW1cENmJm3gQhAMh/N4xHjm4bDjp4zw+zCsW15kmq/DsCWzpmgHOZVdlLWrXc3A7kemLd29wUm5OhVr34qdnYXEJZQmdNI= Received: from SA9PR10CA0009.namprd10.prod.outlook.com (2603:10b6:806:a7::14) by DS7PR19MB6133.namprd19.prod.outlook.com (2603:10b6:8:87::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.26; Wed, 16 Oct 2024 00:05:39 +0000 Received: from SA2PEPF000015C9.namprd03.prod.outlook.com (2603:10b6:806:a7:cafe::f6) by SA9PR10CA0009.outlook.office365.com (2603:10b6:806:a7::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.18 via Frontend Transport; Wed, 16 Oct 2024 00:05:39 +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 SA2PEPF000015C9.mail.protection.outlook.com (10.167.241.199) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Wed, 16 Oct 2024 00:05:39 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 644F880; Wed, 16 Oct 2024 00:05:38 +0000 (UTC) From: Bernd Schubert Date: Wed, 16 Oct 2024 02:05:26 +0200 Subject: [PATCH RFC v4 14/15] fuse: {io-uring} Prevent mount point hang on fuse-server termination Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241016-fuse-uring-for-6-10-rfc4-v4-14-9739c753666e@ddn.com> References: <20241016-fuse-uring-for-6-10-rfc4-v4-0-9739c753666e@ddn.com> In-Reply-To: <20241016-fuse-uring-for-6-10-rfc4-v4-0-9739c753666e@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Amir Goldstein , Ming Lei , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1729037122; l=3263; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=LNRjk1BQzlDUsM9lv7ATvb3bUoxo9H0fgwLuky5tTO0=; b=OSxHr7iE5Z9jpuEd/Hh4hKpj+WZY6v6a1lCErC19rnFjofITSCT53k5PGozETC9dAjChOkLTO 6aJ9zQx/6x8D2QdJHwaFwVObWLsitRFVH5igA8X+uj9j7VpqG0HAyTR X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF000015C9:EE_|DS7PR19MB6133:EE_ X-MS-Office365-Filtering-Correlation-Id: 07ccda9f-6189-4c09-3d69-08dced7644aa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?q?rVlXsNFp3VNM1j+92nAeQ5BSAewQtrC?= =?utf-8?q?pdO4YeAAkGB0HKf09ckNN4Q0pNH5Lxgi2IIG3uEme2UczcK9a3RB18R9LxagpHUY4?= =?utf-8?q?vCic5RyKPZaGEhCXgrLK9X+y8kubruvGIHeI5aVDKrqyFxjBXp1AccA3MMlvEyYeU?= =?utf-8?q?k26UZXrYUnHNqmjuZz6xHhc17+Yb01/WDaXIFCMK4/FqwatLjp+5rY0Q9S1tWuk96?= =?utf-8?q?6iHeKQjExqQouV5RZJiq9jIR5OU99klRqb5T9dMoX68vAXkSc8RFVK6xBnPKWCe/i?= =?utf-8?q?UWJAtonijgcVyDzJZa8kHCuyGUHQgHIBlPr+e4udYuEaGA5rs8wib8l9QLz/zTNzZ?= =?utf-8?q?+P/PjdcxDv18CS9OCGtFa2MprPYouDNdjjKcWDAVtWEm2fq2NrtsIn8bAZC46P3e4?= =?utf-8?q?L8NomHeTG+TItrWVZePycVaZRF5mt64p4EEUm4BqR6XuWKG5v6qlBSNOBK3KwMSzX?= =?utf-8?q?CA8+w8o7+I4dzjGN3bV0+eDNSjpVesWgTHRolKYlcSyEMWzipf8fGv9ogftYD8WWX?= =?utf-8?q?hSdVsWnYS6uOk2rbrYigGrVCE4vg6ABMtPLdOp00iiIrx24wrVBJHYJY0C9YAwA4w?= =?utf-8?q?ddZs7+mIGVl9lM3aAYuC+6ni12uPLgq5k023g9ln9faB6TAHjr/sY9LIDHlC9CBa8?= =?utf-8?q?aMH+kFzWCZ86aYL4KEYkVpMNu8biF8cCK9pPSCneXXv2i5EBNkPOv6NwkD9zDY9ET?= =?utf-8?q?xn91gnXnUNA+2Rtcj4ypFaBqdOgej8bsvlqs9PkABlCrSNKNLbGSfuxgVG1xXOZqH?= =?utf-8?q?6PBQ912E9ghOEj8l4zuriMinp2VE20ttDDNyGRVnqE+dlbi07VwU+fL9/mMjmFz1s?= =?utf-8?q?+25WCC1qnaRzX4+Rui95mDzpQF/YwGv+WQcyF9QeemoonUX9wBcvBM+w892nJNKNv?= =?utf-8?q?ezSEDpeVrrktdNsBzTqyzPdT94mexYbEOpQvpDwm28mN6aGRVomqKEUCT8u1/bAyM?= =?utf-8?q?VtM/UJSPO6e7CpxBbhjlHO/ACq/fZX0HSISjblTHJnoY6sVfuUENeHI7PKRW2Cjye?= =?utf-8?q?HxqmcR+F1qLHpYhygUmJl3fax9MdCya5lwoguIr+rlYYdMPYuAAAQL1agnJUJALRo?= =?utf-8?q?6CsXfC6UObbv1X4aqaHPjxGLV75jibwP3+m63wdiFIueAM7vdguzh3DsU77z6hrAH?= =?utf-8?q?QiMqlYzLIAAGHNjVBEzrbC1LxI76gfPFaE1S0Im2LUVL4MSQCatBiIkc092d4+o45?= =?utf-8?q?FQ+T/UVq6mDJNEd+IHOQnFiSv942m2lITvZa24PY9QUlGxBOddWBUZc1KDXrfYmuB?= =?utf-8?q?S9fA8TULmaAGux65p7UZ/GgDWK4YMAg4/Z84I3j2CykUIDVlS2BF9OK9jsZbltsGd?= =?utf-8?q?8Acq9D/X87bP?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(376014)(1800799024)(36860700013);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Hcyr/Jz/8OIZxRWrfKtKDoEb9Y1b1kKn6WYuEr8Pk/jfaRFHhMUqf7gGMA7XGqJu6D96Mf05SE4cp0s9M+ufra3C+XWyjrv1MtJ94VQvHX8/2ezyV+jOxZuKg3MIwJ15bBTLszghE9k2og3yTBipMQzfm5u7EaFnW+zO+C1HYW+Rvqhdcl0yk//hcGLcMD879X3qB8R+933HFlUCd5RxA2Ek8+iZ3q3RFpwZO/Pr+5zYSsvvd6QTVZPg5yZPXIECDiQY/5Th2H4JveOZPsh3W2mMggxuMNTJUF6MkU7k/AsmjGdZiPdlRr5vIx4AKZxLG9PXbNy1QDL9/LsMctDmYrdzWSGQkVB7+LAaMEF4xqZFCoCfGaO5uCJ/+/8kw1DZD6Jd4nlHyFxlofVxCikp2E6UfGOrQH2QDkiBhNBeXqE+DYHtxw3DaMqkofnYUDjf8vGOkj5LW9Svyz5sq/F7tr/RJfpjHK18Xz+M+i0Z8/NEu3ewxzUGqX85mvaklyCU6RBORMelrPlFZ8td3HaaDUzwLd25P1kbpm4hGtfM8oDxL5h4bUdGy4IWWZ0lCzHHAXAQ4BpMyJtBxw3DOdscwQwXg4T4YtFvEyHGA7BLD6h3zbZnG1cHixxLbJMFs1lJ5GJll+aCXLh72CrLsJS8Pw== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2024 00:05:39.2917 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 07ccda9f-6189-4c09-3d69-08dced7644aa 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: SA2PEPF000015C9.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR19MB6133 X-OriginatorOrg: ddn.com X-BESS-ID: 1729039185-103926-12767-18337-1 X-BESS-VER: 2019.1_20241015.1627 X-BESS-Apparent-Source-IP: 104.47.58.175 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVsaGpkZAVgZQMDkx0dTAzDzJ0D LRMC3NyMzUwNw4MdHQyMDSwsTUIDlFqTYWAKwjkepBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259752 [from cloudscan20-251.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound 0.00 BSF_SC0_MISMATCH_TO META: Envelope rcpt doesn't match header X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND, BSF_SC0_MISMATCH_TO 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 | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index 6632c9163b8a51c39e07258fea631cf9383ce538..5603831d490c64045ff402140c317019e69f8987 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -21,6 +21,7 @@ MODULE_PARM_DESC(enable_uring, struct fuse_uring_cmd_pdu { struct fuse_ring_ent *ring_ent; + struct fuse_ring_queue *queue; }; /* @@ -374,6 +375,61 @@ void fuse_uring_stop_queues(struct fuse_ring *ring) } } +/* + * Handle IO_URING_F_CANCEL, typically should come on on daemon termination + */ +static void fuse_uring_cancel(struct io_uring_cmd *cmd, + unsigned int issue_flags, struct fuse_conn *fc) +{ + struct fuse_uring_cmd_pdu *pdu = (struct fuse_uring_cmd_pdu *)cmd->pdu; + struct fuse_ring_queue *queue = pdu->queue; + struct fuse_ring_ent *ent; + bool found = false; + bool need_cmd_done = false; + + spin_lock(&queue->lock); + + /* XXX: This is cumbersome for large queues. */ + list_for_each_entry(ent, &queue->ent_avail_queue, list) { + if (pdu->ring_ent == ent) { + found = true; + break; + } + } + + if (!found) { + pr_info("qid=%d Did not find ent=%p", queue->qid, ent); + spin_unlock(&queue->lock); + return; + } + + if (ent->state == FRRS_WAIT) { + ent->state = FRRS_USERSPACE; + list_move(&ent->list, &queue->ent_in_userspace); + need_cmd_done = true; + } + spin_unlock(&queue->lock); + + if (need_cmd_done) + io_uring_cmd_done(cmd, -ENOTCONN, 0, issue_flags); + + /* + * releasing the last entry should trigger fuse_dev_release() if + * the daemon was terminated + */ +} + +static void fuse_uring_prepare_cancel(struct io_uring_cmd *cmd, int issue_flags, + struct fuse_ring_ent *ring_ent) +{ + struct fuse_uring_cmd_pdu *pdu = (struct fuse_uring_cmd_pdu *)cmd->pdu; + + pdu->ring_ent = ring_ent; + pdu->queue = ring_ent->queue; + + io_uring_cmd_mark_cancelable(cmd, issue_flags); +} + /* * Checks for errors and stores it into the request */ @@ -902,6 +958,7 @@ static int fuse_uring_fetch(struct io_uring_cmd *cmd, unsigned int issue_flags, goto err; atomic_inc(&ring->queue_refs); + fuse_uring_prepare_cancel(cmd, issue_flags, ring_ent); _fuse_uring_fetch(ring_ent, cmd, issue_flags); return 0; @@ -947,6 +1004,11 @@ int fuse_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags) if (fc->aborted) goto out; + if ((unlikely(issue_flags & IO_URING_F_CANCEL))) { + fuse_uring_cancel(cmd, issue_flags, fc); + return 0; + } + switch (cmd_op) { case FUSE_URING_REQ_FETCH: err = fuse_uring_fetch(cmd, issue_flags, fc); From patchwork Wed Oct 16 00:05:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13837495 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 0980810A19 for ; Wed, 16 Oct 2024 00:37:38 +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=1729039060; cv=fail; b=NlpTzz2cT+M9fmpUHadBPjpsdUjIhmfGGWROxWDWDFM4MFJ9oqyXn7u/dFiGRyodLshaQdniwRObnrLPSQqVCyp3QxeMNrimFurNdtQpQj0Fjh8QDytGiZGsEVxbvoiJYt41L0Q4b8moAJ8YjFKnWaEDgftnUSI0S2IHn5m5GZY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729039060; c=relaxed/simple; bh=JWQE/T8olYYyXZ/ARWzno7FNBWNmjoHiOSb+sjvaFL0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=D8NpagpsyZau9jT1WFAAFy8n54Sg+z3KHJPrBNbK3XPjOjE2No331JCEUYVt+uwp1Ipb//y2EacFgOWOoc9NNUru9Pc6rdJ71xTU36/eHkOdC5yOPydvFsHYEtyLJEgSYY4+PHVwAVicT58RrSHuO/iw4NwaUpvLE0oDR9ehutc= 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=JECCgha8; 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="JECCgha8" Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2169.outbound.protection.outlook.com [104.47.59.169]) by mx-outbound40-93.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 16 Oct 2024 00:37:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=K8+klRN34Lt5CTtmOgrzsQnilbFi8ZzyBNuQiV2x2OEkJiXvXbK9iFgysatq5fIR648zuWi9toEbl17ZQsmBU7NbssCLD7l6HHkG9A/hk0L8n0dff7DlRfj3Z60YRUrKdgPeBAHS08ugXwIesWE6xbp5bvWVXgX5VAq5CK/wCjY/LCZPoeEZ/NoyD5TNlLOt4vnYsxiiVH6IimXXeeoGADQGPIAhVqDcOLhsRYqo3JqBXcbBcFghNNVWbC8sOcpyGCjiXO4R7WfYLRbaMWjR2bFEdrO+4jv9KQ9fFFqNF5+mv2sS0VBtMXAHNe6DHCUPawnYiXMHd/4xDyilmSLkdQ== 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=MXJtTIFM67HNQ88b7dVqM0hO+Yu4etm+gVXpgiFJxF0=; b=bTXQN8zd325bm67Z/jv1pQD/WRZmhvwB82qwQD2IqNBH10eI4UYEetMlDSiIA+KP6k+AwxD7u35CwkT7H6ek/nvGQ6ywSSTVsaSjxceh4oZar/6WKW/cf1MKCf2d/lOMu4aSAuxEJneoGS+PvKv7C31WiwXNhSk60TT3Is/tDsaEojP5PYLVpVR7peyyueuuDiIMBJQbu8TaZPqbNCi2h3DDECl+oIQNt89TJhy+wxkmkNZze9Q20bSyzMrlhlzXriwmGfBe5g0ACrDMqf2pqAoixznhyy4Eq0Mdec6Ezmq7D8YKDmet+U25c9KG7Quk7qQWUQm4wk7d4ic8RZS0Qg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=ddn.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=MXJtTIFM67HNQ88b7dVqM0hO+Yu4etm+gVXpgiFJxF0=; b=JECCgha8vmrk/xfZR0yfdcNzAvzxhFO99L/3rgEfI0h6bS52U3fyaldTQjeU1on8sNHu2VxOl9Z9RDQcURwiq/AZxTli+w+onKCo+5BS4nCb9l2w8YVi93m5pDMR1GeG8tYmbLDkOOh9plJUz4aqtyjGTvV9gm+QRb32ZzyAmBQ= Received: from SA9PR13CA0169.namprd13.prod.outlook.com (2603:10b6:806:28::24) by DS7PR19MB8857.namprd19.prod.outlook.com (2603:10b6:8:253::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27; Wed, 16 Oct 2024 00:05:41 +0000 Received: from SA2PEPF000015CB.namprd03.prod.outlook.com (2603:10b6:806:28:cafe::36) by SA9PR13CA0169.outlook.office365.com (2603:10b6:806:28::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.18 via Frontend Transport; Wed, 16 Oct 2024 00:05:40 +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 SA2PEPF000015CB.mail.protection.outlook.com (10.167.241.201) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Wed, 16 Oct 2024 00:05:40 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 807F529; Wed, 16 Oct 2024 00:05:39 +0000 (UTC) From: Bernd Schubert Date: Wed, 16 Oct 2024 02:05:27 +0200 Subject: [PATCH RFC v4 15/15] fuse: enable fuse-over-io-uring Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241016-fuse-uring-for-6-10-rfc4-v4-15-9739c753666e@ddn.com> References: <20241016-fuse-uring-for-6-10-rfc4-v4-0-9739c753666e@ddn.com> In-Reply-To: <20241016-fuse-uring-for-6-10-rfc4-v4-0-9739c753666e@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Amir Goldstein , Ming Lei , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1729037122; l=826; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=JWQE/T8olYYyXZ/ARWzno7FNBWNmjoHiOSb+sjvaFL0=; b=kRtVuh7K3BCqPfXQV2fVr4VUpHkv5f4VJKJQT1YOUDHprBIKGgdP8moo++gW+Cyo/7A/ik/+m tx4YESiecXZB2GLiwJPmg+ZFNjGAu4ftx/XS9K6sa+DnJC92Kytn0LX X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF000015CB:EE_|DS7PR19MB8857:EE_ X-MS-Office365-Filtering-Correlation-Id: e0875fe6-61bb-4805-38ac-08dced764552 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|82310400026|36860700013|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?+JnUePlFYMdM72l59CaOhv7spS76DG4?= =?utf-8?q?rxqhRi9x5Igf256YKMhZsMBG9OkuX05GHaNzFB67v7s+azSrOLjAV7FWWtJb1yAMk?= =?utf-8?q?x1Y4I2nVkzr9rG2d+yQ48SQLDXdtPEv0G9yzhQVbRzUzhQk5cr5O9U1zFaMReayqS?= =?utf-8?q?kznDbpgSA7SyF8SwvVIUx82zmaeCAdcKj4cNYN+4IQcUeQC4rOFprcj8JVqDo5QHb?= =?utf-8?q?zMaqtj+JdeTdqP3eCYuCzSMRGywfAIYcCOeKUMWAghYhAjHguX1jV0bEUO9K7Gexu?= =?utf-8?q?mhCvf6/H7xpHiyDUDnkZkVfdcBtYjtQaDi/8YJvxRq7kl03ea1xwdZPjAmf4a8ZjY?= =?utf-8?q?Eimg2LjzedAebkjBrJhOrChQLdoMgIPZzBZ+57xBALnpUHoNlr3q5SNXKdtLdCKvl?= =?utf-8?q?C1fc/ECxmNcMH5/jTVy+7YOfW8nuWl/4XHk335vPRuXFfHJ2eYT6ppKNu/WU7jI+P?= =?utf-8?q?jJg+iAZbfPayn4P7MGt8zMasFnNkBE/gXFv+UcO6xe3aM5p5gfCWBeLjNEVGo+G1w?= =?utf-8?q?Ej5kejW6evGMTYtrsF459K4chv5NGJe0WH0HTIhmJ+FKJZkbC23pwveVKyriWPs6/?= =?utf-8?q?955A+CLfMiNVZ+VOiydt5wzNfR8NuFeE5iXyN35OxjlWC4qBE7jKK3tc1DJHkfyW/?= =?utf-8?q?AJ5DQ10HL4UAhFJa58J6mJXpOltPJTgtNaix4VgiCtdZj+wJY5Ay+9GF/JTC2gpKW?= =?utf-8?q?KLmtLQWXlryf3DN7uc50i57ildVNfIz/fBFiaUZB0rEq5EXxiR1IuAG3wx9SH1kue?= =?utf-8?q?DdSo3h6NfID0TwpN4H3VyBqHkO3FaD2KruYRgTsEZ1MCbZXXKxG6iK5dZ5pyW4yh4?= =?utf-8?q?MplKofron+VL9JibbSAVHKkOP9V7etqPfDc6x2vHn5tGZDpr2CJlmosWX4r2xMC5l?= =?utf-8?q?ZmuMQF6BB5UDaPa1EfQbpBXXJ91kg7Gtngw3JY0aiygwIllSQQ99qCFLSQhq5ttiW?= =?utf-8?q?0zngGV2cz7b1pbvB0lkxY799wn4vyhTUXYfXNX1Zg+rIN/OrZOAGaXK4qFFEBp+S0?= =?utf-8?q?6gveFYQJco/ZIPPJfqr4NumsaShcxrCy3498/1gIN9VdX4VQ8M3yM5AKLfqVezIp/?= =?utf-8?q?R/I7ohpyiU40dN+fko7WUgPWR/wa5unfnk/qFDApI+IPmHhtS3mb6eRsFencPEMsp?= =?utf-8?q?W/SZpuuNUZ1YYww1b9QvtuNBznLzOz9yFztAUCSDMSVYrqDS8onMj6u3DiqMPL6E7?= =?utf-8?q?SQZX7dAKcYHWP1COQ/JX4/4ZMNRM8uuj3bAQPrlybrHxWiuthXCyzKufCjgGC3SIt?= =?utf-8?q?fcDS7SeN0t3E8qP2i2AnT+R4CZKCLW0QntzpM7j3sFACYNDrHaVgmSg16Y97usLoG?= =?utf-8?q?L5zQkBo52BSz?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(82310400026)(36860700013)(376014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: CURe6KrqnilNHvfzYcjDyhS2t/9ffZtJOMyFXrkCLGHEhHC9ww72ZHTpISBRuq+Q8ZcafZdNqE8BsJcWiuv9lUGqTT0a/F1mCEs0bTtWFvvkeSaHbI3RDnb6iNgw0zfL7LAlce87OumwVR90ai2xJyX3zWGBkMgu9Djw7qVdurWpO/zML2qYG26pO0dMpnvlrlUw7QiZcvK8EpkZLejD5+pe4zIBmNjoRxPVnBgFbpeO3PjnnuESAJvvodoSaMB4oVHSFIKV3jNzRLIIIoCpjcNAcBasbGEBGMzBtulTX7yZbLABqdigiamNeprUgWLJ5ZcP6DN2C+Amfzl94Yq11Ai+Q0kAy/NU43CIxWZSF8hxf0od2Q3koru09ldY1jScUx01jv0bYwCJqP0U8Esak6nR0aHBuxunx5IdKEmiC6hQRZJzPGP18hDYSDu+up32kHFqgE6rQHVCtUR9W3Z0IolqnihArshveijkJ6JsRMK2fyRREMsi9FmXzWztKuv+hHEOJhFnHEhAvkvg7UknqT8SkT05ONwVg0UDUy33F5O5chjytPi2tuMXXagnJWk68me5XpYmWOZxJwXf4SOKIUlyl8WMuRn5UGVOMPhEe+aMuekrfFX20vFemHy02hIGbaFwJPNe04mjW8mYLkhHJw== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2024 00:05:40.3770 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e0875fe6-61bb-4805-38ac-08dced764552 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: SA2PEPF000015CB.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR19MB8857 X-OriginatorOrg: ddn.com X-BESS-ID: 1729039057-110333-12863-22921-1 X-BESS-VER: 2019.1_20241015.1627 X-BESS-Apparent-Source-IP: 104.47.59.169 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVhYGBkBGBlDM0CDFMNXY1NA0JS 3V2MzM1MzAyCw12SQp1dLQ1MQy2UCpNhYArSrDJEAAAAA= X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259752 [from cloudscan14-124.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_SC0_MISMATCH_TO META: Envelope rcpt doesn't match header 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_SC0_MISMATCH_TO, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 All required parts are handled now, fuse-io-uring can be enabled. Signed-off-by: Bernd Schubert --- fs/fuse/dev_uring.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index 5603831d490c64045ff402140c317019e69f8987..e518d4379aa1e239612d0776fc5a734dbc20ce90 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -980,11 +980,6 @@ int fuse_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags) u32 cmd_op = cmd->cmd_op; int err = 0; - /* Disabled for now, especially as teardown is not implemented yet */ - err = -EOPNOTSUPP; - pr_info_ratelimited("fuse-io-uring is not enabled yet\n"); - goto out; - pr_devel("%s:%d received: cmd op %d\n", __func__, __LINE__, cmd_op); err = -EOPNOTSUPP;