From patchwork Wed Nov 27 13:40: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: 13887002 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 B22765B1FB; Wed, 27 Nov 2024 13:40:56 +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=1732714861; cv=fail; b=gTMAgMDoGVYCeuukXM3Jl/cOtNHSi0f/NUiY0EdbZK41gYUE6SiuJVRFsLqgmZTaT/xKK4y2RnvH6FxuSYznCBOb6crJe1++LPrI5MdZQ8N7RkDZ/uReXFpZDNRtbY0+BhQZN2ID2VY5ojKs65nb1KfnQ8ybZmYmf1yU2zy4ako= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732714861; c=relaxed/simple; bh=sEIiB7AIiRc3jMjR3gv1PdToWrjtBVAJ4sQGmmcVMqk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ErA8fTpPYzasqFfLwKkJcRUdOROqqJ5DpY+r1zHe1QyQf68I6i6RRL7NfZyjsXbOcGSkDTLtQjjZ9Y8CsAhMp3WmBGHwlG/IsAMKXyDjAJ2sY63/fGpOfubbjuOUx/wQQK4dmjB88LTY1DxO4XePPswjEv5irixZ7BkpVHoi4ag= 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=lmEYKcuH; 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="lmEYKcuH" Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2173.outbound.protection.outlook.com [104.47.58.173]) by mx-outbound20-30.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 27 Nov 2024 13:40:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ODFXl9wobYrrcG0TfpaQXDJIC+ZFWfbqjqUVF/toGNAHXm7No9K9z9vqUIoEMYp5e/HXr7xqptJXSdVvtonjluCS1MrtIhNEMwd9H/eXfNGFWO+G8WA7vNI7MN4RhQvoWvqU1w3Sq/H56d0w2sc+uMNQDY6iUTP2jy6ywnHmB6TSda0e8c+APSoL0suMSYCH0CqR4FovDMWwsZVAQKgZbq0fDYhp/oaRnBHyVIlbCA9g5dZVT8WNN8qcSrySR3OIFa3Hw6xqBCQ02YbsrykDo0i9mAheM1QGyOaX2qwug1CrdFfAFJWiJPNwpKBgq/Rga8MSBoy8OZHkMdtvBHuYKQ== 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=ZOj4aqAydY/9noAr2EY9n3L9DL+3fCRE1kSPSGv99KU=; b=Eua9vrRk6sJaIbIdCrTvUv2Y5jQSKaQaIgR/z+fco71P9RwLB7rfsKlasEGdaNjKzv8G/55rf+GHUbb8EhbzT4xUoOkrCTawoGu582ANcE0Nz3u/aKu3v9MoxofnKE/DiAdwcQWw2cDQKCvvM2uMx21kl3n8orpsvvZeSstfK1P/Y7PasEg+rkB0+k/0xGKL+kFN1akCquHvcS1Jnng0wehR+rpZfcD07OG3BLDDJIkBx9D2fUv6cOXkhw4zpD2T/ehEFnjxgCkdDC6IIXfmwjCF1zxoFUgEfrOQjKPs8x8AIftYIXpXFWAXK5DR0xdHloPTBUojV8ACmNE7bXry1Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=bsbernd.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZOj4aqAydY/9noAr2EY9n3L9DL+3fCRE1kSPSGv99KU=; b=lmEYKcuHMjVdxHXDE46VtC4v1/V+PV1fRxm9aOQbw+rqtvjYiWBgWlTGmayn3WSlQG1FaAyPVbFA4uge3rgUqal8B9DPPLyLs0Tle8ivTqHQd4cZ6f7+uwjIgu+GC55lsCGQrO1qdQorRupSo/Jw3e02d/U34eLNOEJG+jvx5mg= Received: from MW4PR03CA0012.namprd03.prod.outlook.com (2603:10b6:303:8f::17) by SJ0PR19MB4637.namprd19.prod.outlook.com (2603:10b6:a03:286::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.13; Wed, 27 Nov 2024 13:40:41 +0000 Received: from CO1PEPF000044FA.namprd21.prod.outlook.com (2603:10b6:303:8f:cafe::80) by MW4PR03CA0012.outlook.office365.com (2603:10b6:303:8f::17) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8182.19 via Frontend Transport; Wed, 27 Nov 2024 13:40:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by CO1PEPF000044FA.mail.protection.outlook.com (10.167.241.200) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.0 via Frontend Transport; Wed, 27 Nov 2024 13:40:41 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 5311732; Wed, 27 Nov 2024 13:40:40 +0000 (UTC) From: Bernd Schubert Date: Wed, 27 Nov 2024 14:40:18 +0100 Subject: [PATCH RFC v7 01/16] fuse: rename to fuse_dev_end_requests and make non-static Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241127-fuse-uring-for-6-10-rfc4-v7-1-934b3a69baca@ddn.com> References: <20241127-fuse-uring-for-6-10-rfc4-v7-0-934b3a69baca@ddn.com> In-Reply-To: <20241127-fuse-uring-for-6-10-rfc4-v7-0-934b3a69baca@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1732714838; l=2729; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=sEIiB7AIiRc3jMjR3gv1PdToWrjtBVAJ4sQGmmcVMqk=; b=m3DkHEAypBLj9lFlU8yLNiwkbe1aHTj28w9wSIhk44sdF/kXBSAM5OfmSWU9A1SNaLeb3Hf7e ozws6m0VSs1Chxe5JHZm0XrZeEGK1N6HmHEiUaYYcVnaPYPTnGuQK9t X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044FA:EE_|SJ0PR19MB4637:EE_ X-MS-Office365-Filtering-Correlation-Id: be88f5cc-0f32-4ab7-fc3c-08dd0ee915c0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|82310400026|376014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: =?utf-8?q?SILt+hPfjw2/HNkeIuSen9FVXhxh2f8?= =?utf-8?q?Y8FAP7e08+h9/j49Dxpl1GceBgkw6x5/jSWs9Q3MwlZM8Fpk14KwZJSjdDOEDEiff?= =?utf-8?q?/BRH49PzsCrlEOLmRfA+Cu0qQyvcu3lc4fRu4cPHFmFlRcMypjlrNJx9DYAW2AlWn?= =?utf-8?q?jWmTAXAWGHVKNg97Qnn2dhEFiOf3xsrOSBZXfQtXX5LgG1PrxOfJ7kCeJ6++SGKlz?= =?utf-8?q?iX89RojD0j//nbbMq0kEQHRFxV7oNW+q9OzkagLqHhVDOn/9mN5jhW12Jw4uG6PLG?= =?utf-8?q?thrXscoGeKKwSxbRvqLz0Q2UQDo0bLT1rePVRHkSeITn6svg1ORlNrqlbqHNoEz+L?= =?utf-8?q?hVqws40hbzGHko4thxuqV6DScipOm9PcDJTE2O0dsqe8wPo9Gld3rsyL9iOOeFV+D?= =?utf-8?q?eaKdRdHiX2duEwZTOfxhmWPPxJMtYkYqbt7htzQFUaBnD40Ah9tKRotyTXqbsRY/g?= =?utf-8?q?SE2tCeqQ5SbpriRj76FA+dArsa/+L9G2DDdbBA+KvcV0li/12emuE6XewtYZ9hruA?= =?utf-8?q?DwSSkSVV0c8lObBWx1n8Ao1r8MDyG+980Slmcm4uR7lsCacc+1Zz95VM9mBtsTrN9?= =?utf-8?q?w/hQWERFWBGc6/yCETa6vwl3Y3UaF39aqPtuowdKiIMt59sPKEOOzXzTZX6PIEEkN?= =?utf-8?q?o5dpAtFDoFxKLJx6aQVYpDMdas0U9+NWxq1NrvLcNWAnEgSIroF5DYrLTupFqwlyz?= =?utf-8?q?t9aS3QrF/NVcYtLHOSICQwqf7JBLxnXFivE2hsJRDLuTZZtMD+PdI8wxrNeNvYeM3?= =?utf-8?q?cd+slEeB/z6zq70KUerCymSkPCLm+6wYhrMuuG+kvM/6OCdSubW0nUpDPQyeygozE?= =?utf-8?q?VbAXZTFRqWoM3MR8SQrPRCe7daScqWAULOrc+IGM4LLNzUKjwsKtXPdMMeHX9tBPF?= =?utf-8?q?3GO5c0i1QhFbg9SxhQ4dzV0vW5EGj70CqcuU1HOpET3uJIsoNoAJVF1O401djiRU+?= =?utf-8?q?PFH8JV8WnH+44havvexMblCgHc04BsP2gpJVtzgMm/PiobGvtVAUBCcT83fTXT3cb?= =?utf-8?q?XRUHjIzk+RGBZb4qYlsZfkrSWRmWSqEKoW7r221wvY0jOshOKD6d/fPZ1lyCgZ71U?= =?utf-8?q?ixcNWa0X6oJSuHaqO+TKRzbo+jGcq9U33LH/OlgBEwrPzKqlybcY7Pq59FJyKPgFp?= =?utf-8?q?TcxHqebX+B+reqFYhyTlnTpoRozFhOMyvigmcEEAOiXqLaDZhTifIYclvs0PjBrfR?= =?utf-8?q?zIPnoaxtJ0HBS1J4m8AxgZquaGkjvGgFCW7WVP9IC0y1KTcoemVQSEfX+Pg4FsJlM?= =?utf-8?q?9rXg9FDIxrk8ZA4EHW9Jro1qlRt1griTAImsJOOblRBjnJZ8afF66VhaBrU7TWBKV?= =?utf-8?q?27/ZrBqkTStfNrTXJBjWIfVp6nCMsiFSN4cDFyjvxG38aaV1J6DiK5qfutdftEJA0?= =?utf-8?q?zm8tGPa+qvZ?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(7416014)(82310400026)(376014)(36860700013)(1800799024);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: HuEHe5qTtdlk/i60LDB7oi36cKN+YqBGQM0vODLSNKDwZihzb/A4Yin5ZSUYp59RXmJAOw2X7ZKwReC9yuvTA62D/a7GCytRlY3B8sTaGyJQQRrZhFfOuN1PLV8z1pADSPRGsF0rHeb0JLRk9HQ0fb5Xk6Gxvpk/GmE73T7vwALuSoLo1HZKCIJOt/co1hMVyHTbv4OTWURGm4Mp8+XFB5ayd6lLXwcH5fJRLMdlLSxY1rIK/FVmi8ZWn0EjAgxNZ/rlhAeHTdvul2E60BYCawgKkBEsdVl6Ex3fZO5DfPQ39fkP9MxALXZlBDWuy/s8YbT8mGUztExxTmKA9RSIlHYZSLJSun9BcEdcaqwtu3ib8MaxrSifn/oArU85pVViB6hPAvQRVXQknNe8Jltqm9ePpr1an270EMVDWNQNv25xxmgPQtRzOWY6/xTOnUEhUdLh+rM0WBrzKDOYY0P9VwtxlAv/ky9L4tf17PHqYhnCkj6gO38hfVCahasnBI0w1IdukfBSTavzlP9V/X7UxnK5E7yhayb/RgP0Py2m0FNo/SuxZOirnSHehS9560znWXp/zwFK1SJki3zTGR4Gldb21deAc2U4gxuatqtt1xqieejqRFVTXItoCqmZWBdR9FEhAqBmMDj3fcHyWCll9A== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2024 13:40:41.0678 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: be88f5cc-0f32-4ab7-fc3c-08dd0ee915c0 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: CO1PEPF000044FA.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR19MB4637 X-BESS-ID: 1732714844-105150-13382-4953-1 X-BESS-VER: 2019.1_20241126.2220 X-BESS-Apparent-Source-IP: 104.47.58.173 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVkZmxpZAVgZQ0CQlzTAtNck8Kd HIINHCwjAxzczYMDU5KcUgOSkpydRAqTYWADEYJS5BAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260718 [from cloudscan18-239.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 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 | 11 +++++------ fs/fuse/fuse_dev_i.h | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 1f64ae6d7a69e53c8d96f2e1f5caca3ff2b4ab26..09b73044a9b6748767d2479dda0a09a97b8b4c0f 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -7,6 +7,7 @@ */ #include "fuse_i.h" +#include "fuse_dev_i.h" #include #include @@ -34,8 +35,6 @@ MODULE_ALIAS("devname:fuse"); static struct kmem_cache *fuse_req_cachep; -static void end_requests(struct list_head *head); - static struct fuse_dev *fuse_get_dev(struct file *file) { /* @@ -1873,7 +1872,7 @@ static void fuse_resend(struct fuse_conn *fc) spin_unlock(&fiq->lock); list_for_each_entry(req, &to_queue, list) clear_bit(FR_PENDING, &req->flags); - end_requests(&to_queue); + fuse_dev_end_requests(&to_queue); return; } /* iq and pq requests are both oldest to newest */ @@ -2192,7 +2191,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; @@ -2295,7 +2294,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); } @@ -2325,7 +2324,7 @@ int fuse_dev_release(struct inode *inode, struct file *file) list_splice_init(&fpq->processing[i], &to_end); spin_unlock(&fpq->lock); - end_requests(&to_end); + fuse_dev_end_requests(&to_end); /* Are we the last open device? */ if (atomic_dec_and_test(&fc->dev_count)) { diff --git a/fs/fuse/fuse_dev_i.h b/fs/fuse/fuse_dev_i.h new file mode 100644 index 0000000000000000000000000000000000000000..4fcff2223fa60fbfb844a3f8e1252a523c4c01af --- /dev/null +++ b/fs/fuse/fuse_dev_i.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0 + * + * FUSE: Filesystem in Userspace + * Copyright (C) 2001-2008 Miklos Szeredi + */ +#ifndef _FS_FUSE_DEV_I_H +#define _FS_FUSE_DEV_I_H + +#include + +void fuse_dev_end_requests(struct list_head *head); + +#endif + From patchwork Wed Nov 27 13:40: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: 13887003 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 D26891FCD18; Wed, 27 Nov 2024 13:40:56 +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=1732714861; cv=fail; b=b76qz5SrK4TwaRynqa5IwD5trx5VjmdI/6H5BGl5T241IBFGUyR/kYONcQKKOJ1T6mP6VPee4YHAsKBWwAlob6kK/DxjGThqCWLBVAjssaAC5p15yISlacPaxA+cEdEfaIBuAWsedsQjgUmpq7hbITJeR8aF7vAaGOD7q2K9WZw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732714861; c=relaxed/simple; bh=szaN+y2fLmTNfOBhEI2vFya7Z4dRZQ4sSBKyIgYSltM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kTwl4ulrmfttI5yxRMdK84uf43D9dgfW3+9vgpixk4DRt9GqtC9WrrZz72Y8hhlHTEg9U9PU5kfKc8mUgj++xT7gkGa/Slm4oN6MagtHC178Hb0aCrPYX2QN/K0jOZqLKe31TW4BGGpMXYanQWiUGjmZzoZAcN2BN9DYxt4LZlc= 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=gfhZNxce; 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="gfhZNxce" Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2174.outbound.protection.outlook.com [104.47.57.174]) by mx-outbound9-173.us-east-2a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 27 Nov 2024 13:40:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AJs82i0wiYt3GAI8iMN6Xo0OVA2NAWYVqAvnEqn6jClDrknA1+KC3dxfczA3ju5T2X2lVaAPcZXhEgtwj6jse31tWxqp3i3e/GjA5Yg5Z+WOnYJtSCONNKcFDLk7KgFD3vh3Qyj5U8FkhBtvUCWi7QfSrxoinSpJRq2rx0lKodwx0wMGpgiD9hw9GHRXw1TShY9HCqd827dr6IXZd9dq8JeLdpp79znVs8fWFolqsgvB9ALTXbN+dWdRAW52HOtzQYaKjgSSMXjo9BwVI2LIpdkKSzotjw+7xTtmuYM6Znc7DCaAPa4WtNjQe5f/vuHYXH5TWnwSM1xFswxM6/XUNQ== 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=+3DvuxZt7uWbRE9rJ9xj17h4w0W6zV9i/nhMklV+GAU=; b=RtI3mZpfn3m84K3vMgrNOee2TdsZ8decEno9MNqQJeeRXoyCWZXDjlJNzbJbCPlu9+SR1L689RDFq3EQvtRnvHaAwHWTcfTQA498kjw5Db/soE53juoZqUfLOTTOqTjL4wUf+XlUR4vEu4E9ZURh+QWegojpJ/v7QCQ4aUkwQlSS3OeX/WfWMAnAsQewaH4rhd2IAMaLTattjq9LfGEsxJlWfE42ZpZtj6x8eIA5w/DOoUs325uH+FJza29EdB3XwRmeWvynJgAoCCpiY4h3ZPCzfNf2IqCnC/DdAeSgZiwollos9kneVNurFP/YsVPl8bTTlbsqQkcpJseSbII2lQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=bsbernd.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+3DvuxZt7uWbRE9rJ9xj17h4w0W6zV9i/nhMklV+GAU=; b=gfhZNxce6jYBeCiPbGO021sFK+z0wrQ12KmAfPdMLHgQcKN8nnAXHiRoUQaC9JZHz1Faj+n6wjhXOaL5bpANCSRBNdpfPmmkX5v0RHv0BDGpGydjvPZnZjzqWo7CgshFkZIkMKpTscvDbswlPoNMHASKL1ERjyk+anQGJp7KU08= Received: from BN9PR03CA0325.namprd03.prod.outlook.com (2603:10b6:408:112::30) by DM4PR19MB6121.namprd19.prod.outlook.com (2603:10b6:8:6c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8182.20; Wed, 27 Nov 2024 13:40:42 +0000 Received: from BL6PEPF00022575.namprd02.prod.outlook.com (2603:10b6:408:112:cafe::51) by BN9PR03CA0325.outlook.office365.com (2603:10b6:408:112::30) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.12 via Frontend Transport; Wed, 27 Nov 2024 13:40:42 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by BL6PEPF00022575.mail.protection.outlook.com (10.167.249.43) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.12 via Frontend Transport; Wed, 27 Nov 2024 13:40:42 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 4BB3E55; Wed, 27 Nov 2024 13:40:41 +0000 (UTC) From: Bernd Schubert Date: Wed, 27 Nov 2024 14:40:19 +0100 Subject: [PATCH RFC v7 02/16] fuse: Move fuse_get_dev to header file Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241127-fuse-uring-for-6-10-rfc4-v7-2-934b3a69baca@ddn.com> References: <20241127-fuse-uring-for-6-10-rfc4-v7-0-934b3a69baca@ddn.com> In-Reply-To: <20241127-fuse-uring-for-6-10-rfc4-v7-0-934b3a69baca@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1732714838; l=1579; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=szaN+y2fLmTNfOBhEI2vFya7Z4dRZQ4sSBKyIgYSltM=; b=PH/3Ae/a/hCwO53XsFHSET/EYOfdAJFI6Z0gwScCIySeLk0jzuGe0JNcim9aKcrPZ2usxONBT fmsHedvEECQBO4H8dEQCc6fDDxRmpa8erg3Y5p591QcyXmHzDUy7YKE X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF00022575:EE_|DM4PR19MB6121:EE_ X-MS-Office365-Filtering-Correlation-Id: 2efd1cb0-4088-4081-1286-08dd0ee91684 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?ljLosIkGtWdgcFr8THlAwRIBwZ3lG53?= =?utf-8?q?JCgZzZFxi7qMokD6zMiXyIvI0s6RhzA37KC8x4U5sbC4mXtezFy9ah0mrPoXCq41+?= =?utf-8?q?mORR9sEKlT5JeZoUg7eSnvRUwpUEXi+Y5C+7XzIbmDZCgJwxg8CDoh0g4YfV3PYn+?= =?utf-8?q?2fHJDNSIdE2cScKKK2f/yF4zmuGZtjQnQu0KOgAxBnm8Z7+w5beFp3QJn3kTWkDgS?= =?utf-8?q?xEL14iX61D2neG1zeYHCNirV3kWSS0JA9EpkGQnPjUMIR8+868V54jdIDw0EGdpii?= =?utf-8?q?rBV8uEnIziNbZ0NX+cR1RqimdTQLBb5Ohdb2qUos0FLB6fbCmZ6xN4gfIUqC8Zg/R?= =?utf-8?q?fngOhuf74MSlwXZ2vlo+FWlwgOIJILfu+x/bLWONM7p9GnqZQfxOXOuyHKoIbJQ7b?= =?utf-8?q?Lh8UMqkzEZRk81ST0FVYZuLB7yhNF9sb6FeKT/cz8d7rzEULNsZaPQBs4EmMWjzYK?= =?utf-8?q?vGuciF9u2Rezniy0bKzb+4Q+ZCFClH+39CInzF52cRWyHC8wcHGD4QP61pTEkJbNO?= =?utf-8?q?Yf76j6tp/hRZZJXFAxtuvAjCFyq8q0KfadpqmpsHuM1S9Wl7CtXZzFulhEagwi2dT?= =?utf-8?q?wY53rFYE21RscFuO0ppuxsh+svnpQnpNozqv2yDsO24qU9WnN3ujAys9T9zxGhQuY?= =?utf-8?q?kx7f1BGOkei6/YNVw45fPCiDBlKHqQRXZBK/WAeAoyCcd9SB5n7KtI0MaMO3mQMPZ?= =?utf-8?q?SS41x9V4Osh7PdC/k+Flc7sy3BhLtdnpPzPFpaWyL7PgNn3j69cyrBF0wNIVsFXjm?= =?utf-8?q?xzpUnHbuDSY/v9NNjh8VN1KRvWDecXeLKa2D0cTZh3wfPGL4G0tZhqHOU+24Xmns+?= =?utf-8?q?yW12uOwC0KV7wKVM+FZkTOalMwggoYBXi0RN3VGAKWPHWAKZUnwuufp50SWQySK+y?= =?utf-8?q?mXPXjzDbGcxr69zBL/r5kCpJSDjCC1DCi09n9rwB2GrSvVbyjR9wcsnZ+6giDKCpo?= =?utf-8?q?Z8vJyoKPUEXnRKNIgC3isUcD03DPKe+VvYa8eQ3LHtWWP6YNPf91RD24KKjOIVHoN?= =?utf-8?q?DOIjP6l5dVXqMqOisuc8Wd4+m9EIvLrj/nJcVdHyw2beSVepTdg7PFAuxB7ANdUBx?= =?utf-8?q?whgA/F8XxIyifKk2OK1DKiVusdnx5efYt5Y8WQcmqZRM5XfdOShdpQ9dogOqoE09b?= =?utf-8?q?WeGfd3DvfPXNfDEGl19QwCOW+Fz33ixHmdvnAvhJYl53r3GPf7eFxUTPnBPfBX4EG?= =?utf-8?q?TG9sqf1JGJxVQVhVcG1Sbp1/1TZ3WmZLr42jQ002bns2/lq5+IbYxG2LOBhYrPEHK?= =?utf-8?q?F6+HlgA2OFxYdjnEpjJBc1ZowEQxM3gDsOJPdQxliSOo7QvLgfM56nuDGsPSGTzA2?= =?utf-8?q?aSThl63E+FozqhjmW+v1qK4NxV3YhDY2Y2HIZsHZjDD4rzMD73vLdpQkmN3JVAC+J?= =?utf-8?q?kgfMlP85T7O?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(7416014)(376014)(36860700013)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: pqZbPPBmI1x3P8oYTWHJn4+z6wQlq5mQTEHGDcgXnGUQpvdEJoju+Fw+haYrz2AoeOYzAdqFm98qW8CLysyY46IeA0xRqpojfqongfzlcrfpLqTRzyJwXWow6SOYROiHRizOIOAq9LwCKY0EyoG5O2oCvKd/3tnLS1kjDRzCr0vvsNpvzElvSilbRVwxcPLv9juvgYNSScbD7pXfuR2bWfjb6Zwpv+WuoUt0DUNPvbgNy9o5BDnFqMLE8/FF2XRqZCA8Yco496RRhX7JhN5wmh4XgdTBKcv5fqagTkaa3D0lyogbwa/M6wuBQ5jE0VBLRPILAOHpIl/Oz8j7P0bEwHpEfXrkjHXfHAeEgct6jEj1hFJUVjAFWXQ3YTP4KVcW5hCCms0vQHUr4l4gP2iPr2lQ05XAq3KMy+CbB5SGc+2yzq+D+Ri5KtP9ZDQeJHt8a7CQHmPKGButSmumpAMiSTazzRf9RZsvr+/2qCjXKW+gpS+sreAwByGMswth0OYhCHiL23fP8YG7sbNJnSgiPZpQ1FxP35pEMux8Izp329Tu0rMI/zhmDFejs0lsbiEy293pdQmy0vsMhrYr7J2mGjMkmj+SNkOXukoqtLzQXsaQ2ZsrNzluO8svf5G3Lgfw5UpalDAUcBxTWrzJho1nxw== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2024 13:40:42.2839 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2efd1cb0-4088-4081-1286-08dd0ee91684 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: BL6PEPF00022575.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR19MB6121 X-BESS-ID: 1732714846-102477-13344-4638-1 X-BESS-VER: 2019.1_20241126.2220 X-BESS-Apparent-Source-IP: 104.47.57.174 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoamRuZAVgZQ0DzVLNHQ1DzV3M LA0iIp1TTFKNkkOTU1Oc0o0SA12ShRqTYWAH3DWvNBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260718 [from cloudscan23-134.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 Another preparation patch, as this function will be needed by fuse/dev.c and fuse/dev_uring.c. Signed-off-by: Bernd Schubert Reviewed-by: Josef Bacik --- fs/fuse/dev.c | 9 --------- fs/fuse/fuse_dev_i.h | 9 +++++++++ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 09b73044a9b6748767d2479dda0a09a97b8b4c0f..649513b55906d2aef99f79a942c2c63113796b5a 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -35,15 +35,6 @@ MODULE_ALIAS("devname:fuse"); static struct kmem_cache *fuse_req_cachep; -static struct fuse_dev *fuse_get_dev(struct file *file) -{ - /* - * Lockless access is OK, because file->private data is set - * once during mount and is valid until the file is released. - */ - return READ_ONCE(file->private_data); -} - static void fuse_request_init(struct fuse_mount *fm, struct fuse_req *req) { INIT_LIST_HEAD(&req->list); diff --git a/fs/fuse/fuse_dev_i.h b/fs/fuse/fuse_dev_i.h index 4fcff2223fa60fbfb844a3f8e1252a523c4c01af..e7ea1b21c18204335c52406de5291f0c47d654f5 100644 --- a/fs/fuse/fuse_dev_i.h +++ b/fs/fuse/fuse_dev_i.h @@ -8,6 +8,15 @@ #include +static inline struct fuse_dev *fuse_get_dev(struct file *file) +{ + /* + * Lockless access is OK, because file->private data is set + * once during mount and is valid until the file is released. + */ + return READ_ONCE(file->private_data); +} + void fuse_dev_end_requests(struct list_head *head); #endif From patchwork Wed Nov 27 13:40: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: 13887005 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 B60391FCF57; Wed, 27 Nov 2024 13:40:58 +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=1732714862; cv=fail; b=FWQpZVjf3nVUQ1frHfUbfeQLNty2+Y4FhMxWbwMdBDEl+QLurwxYs9Bm6T7+lmtwLYudajnguUGfYJjCtKiwJAaEkPPQ9jdmGbIU1xZn5JwEBumy1Alyb551etyQDWKMaMLTpMOnx75zrRFcQ5UmewyNKFvRWNtt+48S9DsvF0U= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732714862; c=relaxed/simple; bh=Hvdj48XTvHWAGv3oZzMk2KNxy+ZAm2o2i30g94rND2U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pun9z2fb9I9Md1FxESaW/F2DkDNwPBBJxdCsU6ouAVc2AAbuG1OKgBTW4XaOo/DwD9Ij/LsjdoNxjtub0JjYlTG8k5xhNPOXrjwmBzfxa7uquo0B+4LAvG0WH4klsOSgq2rLsLLMN7zfhZGfyacOMzIW3oMDLJPDMebzlc+LplQ= 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=wLEJCtod; 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="wLEJCtod" Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2044.outbound.protection.outlook.com [104.47.66.44]) by mx-outbound46-88.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 27 Nov 2024 13:40:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dpWGyfJ1b28iZehMMg5OP8pVN4A9Y1Cg1rIDwNdTFrp4Jiomh5DaE3KIkXNK0PN/JSSxUrU8VMsPCcM/Vs4QtJFOfPpmWHAkPusGJqmKHNPcol2xSWVR2j7cadkTvXkLZhpd9v3pFTsxN2P/+Slu94LRCKTogfqlrAhdxKoSi/VhAkTEsWjWntZzCFdGk5JIiGcAkLu1SsxdeNRMFXxtttWQrhA7g+Fqk88ywhco3bfQP/COwZAxGeD4724XkLYIP7uy0gtHLoGO2IO/LEC2hdl61ZsmFvuJETzLp/pbSg9wX0SdG3AFtFb46Rg+4tZDACozszHFHsyXJ/v8XRwm4A== 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=NVkUI1NJhiwly1p7uHhgjY960IAxKet8B5FS6iQXEYk=; b=r2EaEsek67xg5OLElQj1CtiFj7vNO1MhhZzextU8r6TFR/Mwkg2HYJy29cBt2Wwhxyp0smdKDjZmtQ+leOQpOfAo8UwAiBXXDrT+XVA3pLUL5uf9cJLjuZw3o3Ket0BJbpzd5VgJNzIYbTz6LEthr9NdbwogLk52pxxDTjIhqp/mFbr/E8XJSQ1LVtuM/L/CUjKz0fs4A9V/DfF9Viu+/loqCSkJFxYsvFcvrPRWvZppy1h8FwDNDI/W/WfDc6R4cgJ9WL8qnhCfLgo1FYI90KitmJDUqVk/Rp90WFJwJClIFVHFHXrITr7B8UCiNtsJgWl3bW1n93aR1+7fWRhnRA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=bsbernd.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NVkUI1NJhiwly1p7uHhgjY960IAxKet8B5FS6iQXEYk=; b=wLEJCtodc5tS+vxPUm2Rb2NgmOZH+JCDBZS5xp3Nv2loammrjop0r3zvTw6J343R4tLMYyr3m0DyZruxj0BcjpILYI4JD/kv3fM7Us5KNvNARsouZUPE5s+JjCjaWbcgkir1+8wqccvErg3mhqlr886SIOMRgQG7BhI/zo1Oj0s= Received: from BN9PR03CA0320.namprd03.prod.outlook.com (2603:10b6:408:112::25) by DM4PR19MB6343.namprd19.prod.outlook.com (2603:10b6:8:a6::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.13; Wed, 27 Nov 2024 13:40:43 +0000 Received: from BL6PEPF00022575.namprd02.prod.outlook.com (2603:10b6:408:112:cafe::a4) by BN9PR03CA0320.outlook.office365.com (2603:10b6:408:112::25) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.12 via Frontend Transport; Wed, 27 Nov 2024 13:40:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by BL6PEPF00022575.mail.protection.outlook.com (10.167.249.43) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.12 via Frontend Transport; Wed, 27 Nov 2024 13:40:43 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 44BFC2D; Wed, 27 Nov 2024 13:40:42 +0000 (UTC) From: Bernd Schubert Date: Wed, 27 Nov 2024 14:40:20 +0100 Subject: [PATCH RFC v7 03/16] fuse: Move request bits Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241127-fuse-uring-for-6-10-rfc4-v7-3-934b3a69baca@ddn.com> References: <20241127-fuse-uring-for-6-10-rfc4-v7-0-934b3a69baca@ddn.com> In-Reply-To: <20241127-fuse-uring-for-6-10-rfc4-v7-0-934b3a69baca@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1732714838; l=1326; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=Hvdj48XTvHWAGv3oZzMk2KNxy+ZAm2o2i30g94rND2U=; b=fhe5hehX/gIaRZW9B0rl7PvfNEGr0iinu7ktxWAbqX6XKtQjl8SvJoD6WpJAh8RRMJphL2AJU OYIfzyyJv6LBi76H0qGSNfw78RZV5QRHc2pZa3i5kNUP2Wnm7QGT3Nx X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF00022575:EE_|DM4PR19MB6343:EE_ X-MS-Office365-Filtering-Correlation-Id: 40dc1c8f-135c-4847-5b21-08dd0ee9170e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|82310400026|36860700013|376014|7416014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?VlEPscGZiAvO1RJnt+meSbOFoDJ1sfI?= =?utf-8?q?h8p3wdQVbc+F+lrYMsKmJLKt/U3vW/byKni+XjTTMVYtBBRVb34UYuOgcc1sVB/YE?= =?utf-8?q?+dDDrqucg9DXyrFv0RH1u0QbKRcW/GKK+iXh4nkJTJ/fgj023tLLqfErA0y+PL3ZK?= =?utf-8?q?nHrxl+M5HdIpCam3T7/2XsaBcJGk4Udh0ZAng9JYHS8WQ64IV9ePs7pG/PyYba5vt?= =?utf-8?q?6SOnjV6N7FoiLarl63ZIOsjnPpUVQNqz0xohLEDM1wzy+XChq542ckY7zQHiiOXSh?= =?utf-8?q?0Jx2U5Cqn5jaKnJT9VfN4D+MuPNq1snqtO1o+7g0s3tJBP3muVgpE9k8DtodLiE2b?= =?utf-8?q?kcddfrIeHAJ+7ecYf0+8k7RXCFyWZsqUO0+p9kNX0ixYjpDwk6atht+AM47t8kGTt?= =?utf-8?q?EbFD1FiswgWEeDiY0Uz1637E6H8m4ZMiOiYPvEOSDbRqZXT5P6k4NgoBzngdPMMth?= =?utf-8?q?C0bAd+DDglBNsCsktOtQB9rSN+2mcCrMjrvm0cNFhWc0xgxs6JTkrV86p7VVJytIP?= =?utf-8?q?5alZFgybTSbYJ/41edzpt3tms9Qe0nWEof8cQSxZdIH1KGKPixFB48AP3HIL2XI99?= =?utf-8?q?sdn+2rThllyTrLmTRrwZ+Hlf4RI1oV4387L8aW3MfC4y4DVClJLkAOWeD/FqmsNcf?= =?utf-8?q?k6Ywas/2SRRFGUb1hgyfD/cLSBw8arzdOCASZ/ryucgPTQ86mbynWVxmAfh8LshyI?= =?utf-8?q?nElsmJX5x2NQY5tiWtrWhHZtbSFtHu+AIPNXXTpVgCtzZ7xT40lc4/ul8EitoaS0d?= =?utf-8?q?/V+kg+9SEUk9Xcj64austDrvjKi/HjopJmapYVlA1ihckvOEUo2ap9bFWx1UlttWP?= =?utf-8?q?C2I3UwaCS5NgZIV0nrBiIil9xAPK+hczOCDUhQP1QanwBj9cuvApH/WmOOT/AnpPI?= =?utf-8?q?m9C0wPIMNaY06nhs2F1k9uV/BqnkH4UjoM1FGhnpiojDUOxiUqc6ZKVdG6n0sskwj?= =?utf-8?q?61orB9jmkY5Wbtx63/Sydjjqr6ZzKsVmF4dJuvgNIbTXBygNAsZ3S7B4uhDZ440uM?= =?utf-8?q?AgTMSCaNphRfbnT6nsK72kk/dy5ANQV0RqCpREDG14hy/ffIDDVWdAriT1kUBEdqZ?= =?utf-8?q?qHMmZ328PrJsXSNW5Livg4cjzT32dotaIO0ibylWcKk18eDHM22WaMHJmj8Vr8TRE?= =?utf-8?q?kYh+sQjmFuzuGSI55S0VZFmIY1KC/xPxJjsDwYHJ1zS99j3DlVxj/sD2nmu7BX3Kl?= =?utf-8?q?MexR02bhBGPzZu+aUjyrhMp4LZk7e3EAw7MAZiFq/PRCoAevNDSpj2fzZOqZifXMB?= =?utf-8?q?mAAeQ1OP1bcbQO5AM9VC/E+xHVF9Ze3Oll0gM1+7l9jwwWBymaHpss1Nft9jyCjmh?= =?utf-8?q?ROG1NgSLX5BbB3zo5vxpqnKPNPYNZrPjw2+EVBEh+G697F1FKwHXRYH/MaF6s/oZk?= =?utf-8?q?tqT4vzngaWK?= 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)(7416014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 5R1pYaZ7oU63Cd0AIouo+Ar02bv8pUzMVfTNZWNwP4UjBri9OmfHKRp2UnrkgpbPpv2Y5Y3YBE2kOhfMV6qY+0tcugE3H4ODARhW1Je+Iont/6N+SgWtfJvsgWM1K+pTILevBFwT/Xin0YzIYwW5W7DcSdUx9Ae84wAhih0UYgvXz35nk6afw4RYBCOLdw5VgNL9yRtFosCGJ1oqiaCJmjX7HlfdbkBnyahocZbhUTfUK9DNpZkRqaK77cydj6fhwH6L3fG/7SL8Xxh0j7dXtK2HZwxDseFwAlzFpgzZDdjpi0CdtCFm40gWBdR28SygxTSIPQ1uKF+fEy0Qb+6yLHsTHolmNmRsMrRPML/0m7lpsAEo/7D/RvBF3TbuM9oqlUjPbELXS8xrK4b3obmyQLTJhEbnGFSx/C9pi1rT3mPpK1Y7yS5ALoJGQb29aV8KyVMIT0VKjRfhDMo5rEC42gukYhEDVuKPYPyitAAj4rAR5l7kleyB2FUhgCD0axKhCs5LkPn3DK5SWvUSWL386sBKQmhx0EZ5Tfm1+D5u1i8DQcX3enNEBzX+pOXmuF4CuJwxOGoOzxCqUHN+LqpuvTXvTREOaG815TOnNIh1CpH6XrkaoTznMT3kmkTEcnPPWKKiLL+4M/0tNrBBoYCFgw== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2024 13:40:43.2057 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 40dc1c8f-135c-4847-5b21-08dd0ee9170e 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: BL6PEPF00022575.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR19MB6343 X-BESS-ID: 1732714847-111864-13565-2153-1 X-BESS-VER: 2019.1_20241126.2220 X-BESS-Apparent-Source-IP: 104.47.66.44 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoZGFqZAVgZQ0Mg0ydgo2cjCKN Xc3ABIJ6daWhgkmiYbmSUapBkkmSrVxgIAF/PC+UEAAAA= X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260718 [from cloudscan19-156.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 These are needed by dev_uring functions as well Signed-off-by: Bernd Schubert Reviewed-by: Josef Bacik --- fs/fuse/dev.c | 4 ---- fs/fuse/fuse_dev_i.h | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 649513b55906d2aef99f79a942c2c63113796b5a..fd8898b0c1cca4d117982d5208d78078472b0dfb 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -29,10 +29,6 @@ MODULE_ALIAS_MISCDEV(FUSE_MINOR); MODULE_ALIAS("devname:fuse"); -/* Ordinary requests have even IDs, while interrupts IDs are odd */ -#define FUSE_INT_REQ_BIT (1ULL << 0) -#define FUSE_REQ_ID_STEP (1ULL << 1) - static struct kmem_cache *fuse_req_cachep; static void fuse_request_init(struct fuse_mount *fm, struct fuse_req *req) diff --git a/fs/fuse/fuse_dev_i.h b/fs/fuse/fuse_dev_i.h index e7ea1b21c18204335c52406de5291f0c47d654f5..08a7e88e002773fcd18c25a229c7aa6450831401 100644 --- a/fs/fuse/fuse_dev_i.h +++ b/fs/fuse/fuse_dev_i.h @@ -8,6 +8,10 @@ #include +/* Ordinary requests have even IDs, while interrupts IDs are odd */ +#define FUSE_INT_REQ_BIT (1ULL << 0) +#define FUSE_REQ_ID_STEP (1ULL << 1) + static inline struct fuse_dev *fuse_get_dev(struct file *file) { /* From patchwork Wed Nov 27 13:40: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: 13887004 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 53A059463; Wed, 27 Nov 2024 13:40:58 +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=1732714861; cv=fail; b=IIg/59wiZr5XWJWDtBq778dq3A6DDvhItXKKccVGKlZ6u/go5jqCOyAhjqqDaRUfOl2UOhGnZkI+WPFsSeEkTxob7IZJI89hGJAEkdU93dAPcRkVcRaeszQkYLIvjjK5Uq+dXV8ExNTe4QjZNIFgHWmkn4LXquP4cpLHIr5bau8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732714861; c=relaxed/simple; bh=LFN5iHBpQL1ZELcsQiNVADSnkWR8kAU4UAejqcRjIy4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=a6+31ORthdaml0ZSnUX/OMbKTh/S1+wiSmMou9D4HU9KaBOLp/gGBa3j0mZT6vvW3AyhEp/RKuY4G82baCfRa7jA3KyufxTKj4yg3trINDf2Tergm+PwPALRm/dFQR9WByccm3nM7PHm8CStZiipU83k7xhSY62GjnTXG6h4f0Y= 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=p4OQj/VO; 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="p4OQj/VO" Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2175.outbound.protection.outlook.com [104.47.59.175]) by mx-outbound-ea15-210.us-east-2a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 27 Nov 2024 13:40:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=e66/9sGburXIXEYZjJSNpH72a+TqBiTDlys5IA8Xsc0xojKvQwVN0gyn9Wl9vljywiGLbuguy3n1nyFl2o2qARQG+C5U6JacXDDT3DvtLNxH2uYbDkAJFFXKbBlq1zqq/JMWkl9iVqIMZrv3HoIaFKVrObruf8L9AaEDMlzcr5/5lm/MHggURVYbQV0RMybg1MJzBcoO09LHNsX8cWOkmlW009bQi0K/2Z+tELSO6OncZpcAw/aUFohAF8LLlerKex+TvFqVQ5vEe6+hj04GewXKA/k/1MFRo6iZbE01/gk3TTPyoAHcwzyuFvQU4km8A7l4CEyxkKsIDLwbE5FYMQ== 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=kdHFJS46CYEqIdwHxE3uGvNrreWDDzCAT7sCKAUJsjKC5Pm1w5yHImsnN5PHVlyqN7cS/K5S1J2CW46h4Jg3Pnt+Wdd4La4GCc2M8f5hKB/05fxfTW0HCQmRRFimpe6zKy+SHfMbGJecNtH2kcyPyFCcgSulEVbHS263h7K5t22a6up6F5tcyCtoYVm2zt/Q3iTRFShcr287s/0/kJFbMeerBf//3NWqg5+uJ6JmzL1FS+KvOVy+Qbs7h0Qhdh4BHT9cEy0pwvDjuZtrVNyXbRV3O5hJ+1hg6DxAEuaTckFNCLWzq6/HCfsT0s0N9h+DAhHkiKKNDwU8OywhDXxXog== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=bsbernd.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LHa7n4UGF0oKchdUGLawEi6S0wIRCEXCHai9Y5sQ2zM=; b=p4OQj/VO0elKyirRXkqZd0NhsV128Bppo8iQMLQ6VhGfsq9kgctW3FNdgzr7e34LarW2sTULKIpi/EunODKSbxUDlgaDpnmeBwSJl2YugyrJ1w+4EKdwZ7no8cIZG52pMcIjsehuu6tvxJ9kz6KX0cY8JUoWhwmKjzOgZcfzBuA= Received: from BL1PR13CA0383.namprd13.prod.outlook.com (2603:10b6:208:2c0::28) by BL1PR19MB5985.namprd19.prod.outlook.com (2603:10b6:208:39c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.18; Wed, 27 Nov 2024 13:40:44 +0000 Received: from BL6PEPF00022570.namprd02.prod.outlook.com (2603:10b6:208:2c0:cafe::f9) by BL1PR13CA0383.outlook.office365.com (2603:10b6:208:2c0::28) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.13 via Frontend Transport; Wed, 27 Nov 2024 13:40:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by BL6PEPF00022570.mail.protection.outlook.com (10.167.249.38) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.12 via Frontend Transport; Wed, 27 Nov 2024 13:40:44 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 3CBCA32; Wed, 27 Nov 2024 13:40:43 +0000 (UTC) From: Bernd Schubert Date: Wed, 27 Nov 2024 14:40:21 +0100 Subject: [PATCH RFC v7 04/16] fuse: Add fuse-io-uring design documentation Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241127-fuse-uring-for-6-10-rfc4-v7-4-934b3a69baca@ddn.com> References: <20241127-fuse-uring-for-6-10-rfc4-v7-0-934b3a69baca@ddn.com> In-Reply-To: <20241127-fuse-uring-for-6-10-rfc4-v7-0-934b3a69baca@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1732714838; l=4808; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=LFN5iHBpQL1ZELcsQiNVADSnkWR8kAU4UAejqcRjIy4=; b=SGF2kUgoIvEbK146SqwP32x55fJEBUxhbHC5cxemOMFFfKodLO66VAX8v4yApyAkQ9o4reL3L w6uuanYF6K7BQ1HT0tRbutvjE26AHHbio6tzopCSP8plejakvw+M1W0 X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF00022570:EE_|BL1PR19MB5985:EE_ X-MS-Office365-Filtering-Correlation-Id: 4f06f6b6-de76-4fd8-3eb5-08dd0ee9179f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?+MAq3kaWuE18cd790mztYnIJSy1i62g?= =?utf-8?q?KzkpHY3S3Z7Xk1ZkHsbC5VWeaBsIWTCFjlx/Aq4lwAnOG7jCmrTaj694pUAEEhpNf?= =?utf-8?q?s92bJESchqBf3obPeyc+ak4KbxkqBSKHIxEsWxV7KGiTgQ4a6U5yZTLQqYLmMdH+U?= =?utf-8?q?kMVWxv5sbEkqnsPjZtZDHtDy0e6Tlpv1IYqb0z+Y7w0Q3ga0woR9PQVb9f1fWtIvk?= =?utf-8?q?VtqTRxFvRRXY8pRYKi1wxIoA5La1xou9Xee50TQSUOyqBh67dAHX+Vxk46lXRUyAL?= =?utf-8?q?oSgPsS71cXplqgvQX3kRiUjs3gEMKSefIGkn0EIngEtQFBcT9ckkeMpsemj4+JIfS?= =?utf-8?q?m7jwi5B6OrQTJxupgOc1zVQqnizxZ1Z5s9YUnARPss4/wUkoCLANkpa3t3MlThMQ0?= =?utf-8?q?j/VC0oGIo75PSDhpzRsakPU/jSdM+6iVFAt6lx2BEPwvYF5IgJKUkBa0TO1DdcqA9?= =?utf-8?q?80mXtBB56pJWHyjfL1jx8+7JFt1ike21PsGC3TpOA82l8BW1JsS6NzmgCl5+J31Ta?= =?utf-8?q?UFgvYZTwYWOhCWhaxN15o1bMhrog4Q9kYfMpMCgBXwp+ffdNMp91wXhTMmoA6mo/o?= =?utf-8?q?Yw/zI+jEygTk3OLM75tHq74SiBMPVOAsjT+Po6XZbWpF2TOjQqw6oCho0HfRxLDVY?= =?utf-8?q?XVrWB582rmtu9Iz2Ctq8RFpWW+xVrdqjSSaPg9Y61kO64wwrsV+izqFHzuIc/w1OO?= =?utf-8?q?IKOwIGieq9jisgdOQGueUiXQLtBypca0RQpycDTG3wrHzeBEiR/g/DTLgPE0cFoYO?= =?utf-8?q?uMpUWSiMaTZeCGswZjlvI+WOqTHpdOdn2cuFP8TQCpTd9/2IO4vDITvLtSiYb29yG?= =?utf-8?q?Kwty71kYuosM/sG6dXfQ9YzqTi/2DlFJ1fMX7JB7/xDsSUrZxAGkOcTPFBmA7tLob?= =?utf-8?q?AFb0cJ+BhQjhR/5LAENZcCbcWzKar96+majoGYxAalbO3FE5hG1or0kwaPRl5JVQF?= =?utf-8?q?BAdXZZ8k/Uj6Iiw/XlQDLdVthMlAHoTaekHGwXZfU/6VEuzH0KU0yPA06EZbYS0mb?= =?utf-8?q?AEo6FuD3reHTwA0mGx9Pd1aM2ymdSES2xgMsxgXHn0UsTjG+oXggCQJLIEWpm758o?= =?utf-8?q?2GSGr94qRK0id5miJIGVHDtTLrHSFyitqZoulcsjBb1SP7oxRxK3foVcZJLMPIXPL?= =?utf-8?q?8zyIRr2FuGxosCXVmZVpx1j9+FCJ6aAkqhUfRdGtZtkBkQutDuxMAoGwRLB5GxNqz?= =?utf-8?q?5dfLlsjRUfbKrDOJFs7+ufz3WBDuqjGnMq+AClbB0hU5bi3mQ1UnzR2ud0/1cmSRL?= =?utf-8?q?QaK5Slbz8Bqmss5eeBDjEttuPbyZfh6R0Y0NqQiJ8xVFfTLTI71CI/sVceHZqGWpk?= =?utf-8?q?zzwpWVJ89GL7ydTbDOuWAfj/V5tkmaTAYEivFNvNQHhOJoWHFhewRDR+DHN/IThwJ?= =?utf-8?q?DyoOQWYHGcL?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(7416014)(1800799024)(36860700013)(376014)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: UxXdyxULGG1EZboSdgb6xmY1/srtt9b/QhdY3Az3yvouEiPLhP9jpNcMdQMYn6K999Ltr9Opht51A9XTkZOsJk7NVdPL0Y5OXjvpHm7IA5jPaKcXW6+fTOVdNsEIqjP6O6xlEJlaNe2dGo0WLOoMGs3xXwlso1DITma87OpRBQI++01NqolEaeDg1s3sev9OsYw4n6SKCX9ZeeHN33dWbojlX5SS0PBAgltW5yWSiSYAtGJo+Tm5P1CahUsmFgZFNxZ1TuEWbhHOVdTPSGLcTlyxkAschyU+NzThDf5CDM+pqtDXLc27fz0+TSCvrheJwwg6ejHdVjOYG0NGP+hfeUJciqMB9b9aGtTE9IJBL/iEVf6n2bpPztI4S/SFc7h4h8mCBgWUaqUq4rEheD23IUT3Ud7c4jadycZM8fgmTKW8vNeCK5i8eu9a/Slhg+SDNo+r75rryrAvVllLVfR9ZJeTGnRty9NLUY3p5vpHIyhPkZfVNNrw+iL5mVG6IbUJmXzN6xssgbZb909SMaAQdp4YotjohCjRqiLGtbiu4Ev6o4GB0obluBLX22Te5yqV79fxZdm6QD7/Lvf8xX0TYj/KN9HHsu1f6nTqjr+kQTxEAEbAaCsBAY7+7uHKnaDBGcLt6629AXdNspo5t3p32w== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2024 13:40:44.1240 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4f06f6b6-de76-4fd8-3eb5-08dd0ee9179f 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: BL6PEPF00022570.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR19MB5985 X-BESS-ID: 1732714853-104050-2077-13668-1 X-BESS-VER: 2019.3_20241126.2120 X-BESS-Apparent-Source-IP: 104.47.59.175 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.260718 [from cloudscan13-243.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 Signed-off-by: Bernd Schubert --- Documentation/filesystems/fuse-io-uring.rst | 101 ++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) diff --git a/Documentation/filesystems/fuse-io-uring.rst b/Documentation/filesystems/fuse-io-uring.rst new file mode 100644 index 0000000000000000000000000000000000000000..50fdba1ea566588be3663e29b04bb9bbb6c9e4fb --- /dev/null +++ b/Documentation/filesystems/fuse-io-uring.rst @@ -0,0 +1,101 @@ +.. SPDX-License-Identifier: GPL-2.0 + +=============================== +FUSE Uring design documentation +============================== + +This documentation covers basic details how the fuse +kernel/userspace communication through uring is configured +and works. For generic details about FUSE see fuse.rst. + +This document also covers the current interface, which is +still in development and might change. + +Limitations +=========== +As of now not all requests types are supported through uring, userspace +is required to also handle requests through /dev/fuse after +uring setup is complete. Specifically notifications (initiated from +the daemon side) and interrupts. + +Fuse io-uring configuration +======================== + +Fuse kernel requests are queued through the classical /dev/fuse +read/write interface - until uring setup is complete. + +In order to set up fuse-over-io-uring fuse-server (user-space) +needs to submit SQEs (opcode = IORING_OP_URING_CMD) to the +/dev/fuse connection file descriptor. Initial submit is with +the sub command FUSE_URING_REQ_FETCH, which will just register +entries to be available in the kernel. + +Once at least one entry per queue is submitted, kernel starts +to enqueue to ring queues. +Note, every CPU core has its own fuse-io-uring queue. +Userspace handles the CQE/fuse-request and submits the result as +subcommand FUSE_URING_REQ_COMMIT_AND_FETCH - kernel completes +the requests and also marks the entry available again. If there are +pending requests waiting the request will be immediately submitted +to the daemon again. + +Initial SQE +----------- + + | | FUSE filesystem daemon + | | + | | >io_uring_submit() + | | IORING_OP_URING_CMD / + | | FUSE_URING_REQ_FETCH + | | [wait cqe] + | | >io_uring_wait_cqe() or + | | >io_uring_submit_and_wait() + | | + | >fuse_uring_cmd() | + | >fuse_uring_fetch() | + | >fuse_uring_ent_release() | + + +Sending requests with CQEs +-------------------------- + + | | FUSE filesystem daemon + | | [waiting for CQEs] + | "rm /mnt/fuse/file" | + | | + | >sys_unlink() | + | >fuse_unlink() | + | [allocate request] | + | >__fuse_request_send() | + | ... | + | >fuse_uring_queue_fuse_req | + | [queue request on fg or | + | bg queue] | + | >fuse_uring_assign_ring_entry() | + | >fuse_uring_send_to_ring() | + | >fuse_uring_copy_to_ring() | + | >io_uring_cmd_done() | + | >request_wait_answer() | + | [sleep on req->waitq] | + | | [receives and handles CQE] + | | [submit result and fetch next] + | | >io_uring_submit() + | | IORING_OP_URING_CMD/ + | | FUSE_URING_REQ_COMMIT_AND_FETCH + | >fuse_uring_cmd() | + | >fuse_uring_commit_and_release() | + | >fuse_uring_copy_from_ring() | + | [ copy the result to the fuse req] | + | >fuse_uring_req_end_and_get_next() | + | >fuse_request_end() | + | [wake up req->waitq] | + | >fuse_uring_ent_release_and_fetch()| + | [wait or handle next req] | + | | + | | + | [req->waitq woken up] | + | X-Patchwork-Id: 13887007 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 ACAA61FCF69; Wed, 27 Nov 2024 13:40:59 +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=1732714863; cv=fail; b=rjsmScubHDOg6k22YendZnG+K2OSfrWUdcKb0ddoN7i61sCvI6o497fJT+9X/DhkuP6e2P/c1oO8BCJ7NGYOswSZiyZqYVTG9TFV1suYk2sAHLd+y3d9IZScl/mWECdqhM/NI8Mv0dkg/NXcqCXO/HGPnfaBbElntrDPp6ztO9c= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732714863; c=relaxed/simple; bh=YMDRA/9vyPHvJ4SYiHECXaAT2XkWqbd5Qmx9AghyOpg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qPnTyWObOgJ/k3vgqE1GG7PsGeieh8e77yPJSzYJ4ng0RPAQR6TG9Uh7llwysvPqO7PB2Ej1YUtEechD2g9e1O0x/B/RCP7fepxmv03Cn7CmeRURbEptcHl5xUgubBPjKKtz+zxzF6GdAoT1Xxs7SNZUtiWUaaX75F9rXhbfP3E= 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=XUpwcPHD; 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="XUpwcPHD" Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02lp2047.outbound.protection.outlook.com [104.47.57.47]) by mx-outbound14-13.us-east-2a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 27 Nov 2024 13:40:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=IDGtbQL7Wr9Iie1pBQZan0r7zXzmk3cnFztJWPGgPdE6DTY9BgOGMMfxVHXpTONwVh6HIRLI6Gt80xjvynedXVMFyMEFWz6ld9/yde+rWgWY7/uNDZRgWcPKNOYXWUDxRHrWwbU3xMM96T/JiURvV9eWYA4bztuSDesoMQvlOGK/tN/jmey3YXQaLuuha/gDc9IDyW+HCHBAKUyTzv/clS25fzDwp6zNA4WjCfY7E8au+AIQOFSbiXpvQDBulgICnywqYzBoOtnJ6g++EIKJOLADK/GqUChbKs583/bNgRzPvnmJneXqKoLUjk1bC8+z+vXXMMSt7dqpENpr1W8jxQ== 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=ArICW21BCfXstjqQ4sE5Z/YXHrwdQe2KHKQeEbeYLAk=; b=A6NCoxeZ1NNjGuBEMMFMaFCUaBb0Sl/acJNNhLiEdCr4mK8Y6G8IqKIctZTGqdVOd6HM5I62NGCeKiwpXt8P9CoOqqRgMufrt8L7c/YR2vUlAdSXaizoSAYjFwL/XnIpJKBAHAftLTxMbscbvIIWb6H2QCrTxyhRz3TTb9O7K0XKPj031aQLQr4zGfkwPbgyYIeckz/9j1rmv/8mmlAD6AoiR57oZNnNTthRkjm7joDSvax82IbtJ2SKkzKQ/8yCn5iD4sTkz3crS/ysSXvEuwjmmoL7eu9A5HC0T75iPBgPSRB75CZoQYK3bhxIY1epqJZHu+83x9UjOnhPQ97n4Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=bsbernd.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ArICW21BCfXstjqQ4sE5Z/YXHrwdQe2KHKQeEbeYLAk=; b=XUpwcPHDEuoxyCbMGPnOjd8e5WfEt3u8Zl1SNa4gIYU5R65yoerj6YPNOgYi8eIMccS1RUW+xcAsJqmVCThQ9/yFVVun41chiHrbD8koCyDPqnm4LcSgz2Hw4g4ogqigB9hjBYusbVvDTX+abpaZrJOtMq3qkL2/6EiR/Q59/M4= Received: from CH2PR04CA0019.namprd04.prod.outlook.com (2603:10b6:610:52::29) by SJ0PR19MB4448.namprd19.prod.outlook.com (2603:10b6:a03:287::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.13; Wed, 27 Nov 2024 13:40:45 +0000 Received: from CH1PEPF0000AD78.namprd04.prod.outlook.com (2603:10b6:610:52:cafe::39) by CH2PR04CA0019.outlook.office365.com (2603:10b6:610:52::29) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8182.21 via Frontend Transport; Wed, 27 Nov 2024 13:40:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by CH1PEPF0000AD78.mail.protection.outlook.com (10.167.244.56) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.12 via Frontend Transport; Wed, 27 Nov 2024 13:40:44 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 35BD555; Wed, 27 Nov 2024 13:40:44 +0000 (UTC) From: Bernd Schubert Date: Wed, 27 Nov 2024 14:40:22 +0100 Subject: [PATCH RFC v7 05/16] fuse: make args->in_args[0] to be always the header Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241127-fuse-uring-for-6-10-rfc4-v7-5-934b3a69baca@ddn.com> References: <20241127-fuse-uring-for-6-10-rfc4-v7-0-934b3a69baca@ddn.com> In-Reply-To: <20241127-fuse-uring-for-6-10-rfc4-v7-0-934b3a69baca@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1732714838; l=6435; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=YMDRA/9vyPHvJ4SYiHECXaAT2XkWqbd5Qmx9AghyOpg=; b=uwGcy6zA5MUVKGXUq+CLFp3A4KO2S984QeI3Oofg/etParW6KP8RAeVvCGooAzDzFKAzZSC3M xn78XuBr7GZBdDS9PJ7CBzZ7P4YjTQzUZsyR70ag6HXEfMdJvg3b0G/ X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH1PEPF0000AD78:EE_|SJ0PR19MB4448:EE_ X-MS-Office365-Filtering-Correlation-Id: 1641315d-16a1-4ed9-0a98-08dd0ee9182e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|7416014|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?55xbCjSWq/ef6+5rcMSx9ltrBAEMAhB?= =?utf-8?q?xhwFmTsoSECmr1UNRio0P8LRMxBtOgNNgfZBaH2YRjCCoJP51ELF13xhu9h4E3UHK?= =?utf-8?q?fgQI9sKdldN4SnyU9Vbe/Bnli7pwIlbokaI7q3kZoZjI11aU96roQRMQZb8L0lew6?= =?utf-8?q?UEMyH785xzzkZYssLXmMinKn0Lgb5x6kEyEEzEfEcRFWxKN/VvYh6CBxGQqBJTpaX?= =?utf-8?q?/5FfHY5dBehWJdYr7OnsAUf5roTbmxrTxa0T9GZ14VFMfGGFz+VNHPNL1KzZcUFyo?= =?utf-8?q?IvSr80bW09qjjO7mgcfeimETQcFW0ovZXn+mvj1eOG+I3mr7zjBNsFjazjMzDICCF?= =?utf-8?q?xJ+CZx+tlnADIKN1fX45QCWif+PHcTzS3REK2WyXPE/JKCH3FI7HbsBDKISa0vVdN?= =?utf-8?q?ciHUc7ZHW/Kxx3ayclYmyIDrsGH/Jqs/aWmxiQzSU/AvG0z+0PDTfkGfKwnEt9/DL?= =?utf-8?q?oNuSC0libgr5V5IYNkTY5/X0HWWFKJpUZZAgxk5cPyoCI2DvHBPvYFQLsPjcCjeZo?= =?utf-8?q?N66CywdFdj58s098R3YuBV2T9MB+SsSOC2ptKcVpfXY7zlDfRxsHBpbx7vzh2NsDL?= =?utf-8?q?/o/RounTFBGvPO+y9uiRziWslz8OAe1hflBS2AtnlCr6xktqByUlK0t4H5uhdI6vE?= =?utf-8?q?Z3lBplhzaten9fObCQi/yq4e8MuLaKQkz1KskX/TW6L1du3nAtoYs+OC2fZ6TnFIB?= =?utf-8?q?7eLO631KP+U4cCY0cI3ofzBxzMIUiPrqfEKqbRJhmNqbHDPYFMIdcS0oW27CfuJD+?= =?utf-8?q?mFvZYE3Dz/gb1bKHY8ixHXjtyVmQ+Acw99/iYtcCE1weCcQgTJjt3SnO8B0ZGUYru?= =?utf-8?q?Vo4tLW1NAprzuyANhWFVdLVjAe6+E6Kq+BjdwfYBzBjXZ6nAlwhI5I29/fklA+wvV?= =?utf-8?q?H/CscqR0M4sAy1M8ia+nKaY2hMLpw6VI4/CgZZXcqyyIk47EJQeo8RphqVZ3Yslt1?= =?utf-8?q?BqOeo1urWowWAbdk+TeONEJp5p5Mxp0UinxmytVucPclD8nc7Z7kkFwFExuxORa/I?= =?utf-8?q?btZimIvC8eVreKr22+d5YaSY33/kaMjXHQEAAfWPFYKPqq3JXf9KZL2WdZhX/gAOk?= =?utf-8?q?6jDoFJCcG3qMXzmIu/vVj4jtcCukhIQ5m+QucaV4fOnrXs35UGBS88njjaIVggwji?= =?utf-8?q?dp0QBBjom7d035imitAaoY7LSpIZXCeraXvaQokG3j7xojZIXTMX39/z/OMme/BnK?= =?utf-8?q?3pwIjbrI+kYR3rv2tVQXkhOIXDNjt2gWZ+NQ3rUwL6q7ZG0rvh26Z/Q4q3ZIin+xf?= =?utf-8?q?vg5msYJlaVHoQ8vefgQTmgukOcVCBGpGwo7DR0brpI201xiiA1puSutIRcguiATrc?= =?utf-8?q?aJ71bENcPoKvnii0awB2+UhkPog7TFC+9XHv44FnBM6z1K9W6SZ6QNYCY7dooN+LU?= =?utf-8?q?tGkpd/eMFus?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(376014)(7416014)(1800799024)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: xf8nfOK0k4uvxy0Fcu+ZTFhE0i6XY8X3zkYpZ3iHpsHzeHx2vbKvNogKIeKeoWy4WOssGiQSSbbEzK6RLh0uEtsHJS9781ZtnPrx7z3cWK0Ms4Aiv1VzZDJuW+zv42jkPuMFb8TQ6NIDbqQg7a4GKdrSQWCogemND0oX0gJIF5YXhXpcbWkLlm92pEZYk4EN8JSZe5PsOXPDe6c9YPl0XZfOQQcItFRYqh12lQMzcC5qiisd4ablXb1q05in9w3HuD03pwuKFG/FEY/Ri9XLaeZQZFk44wPxj3iFdB7X5R/LRk4YKnqtuEPZcf1q+ZYgzZ2KBBFoSmjcsnNDZFHsi7d6xDjwcM7yX4daN87xvTIfVDN+cQhp3KY7r/JeGIxPGi4lEL/f2TXPi23JsyKbpAhtrKleoq6jEIAsF9Wh5EKb8iXuCcNnRYmmAOtU0i4mOg2B47XfaKln1u4QnO+5xQzey1XTYH4JqRuz6p7xsA9S3TZRdZSZxVd7zjDXhDzLQtQg/uwii8aNmJUDmyw7vsNZ5f43mK6cZ55d0GA4l8t8p1Wx4yCJragg6HkdwigzQlUKnjXjF6f4BbusK6iWJzBQ19lbH5dgmP/0cPP0EJknc2rzO5kH5+qCw7mAIarXL9pZ0pgmY/cwe8V/OBJkzw== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2024 13:40:44.9661 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1641315d-16a1-4ed9-0a98-08dd0ee9182e 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: CH1PEPF0000AD78.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR19MB4448 X-BESS-ID: 1732714848-103597-13476-2193-1 X-BESS-VER: 2019.1_20241126.2220 X-BESS-Apparent-Source-IP: 104.47.57.47 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVmZGppZAVgZQ0MIiLdkkzTDVwj TFxMTMJM0gzcw0JSnZNNU41czQINlYqTYWADF/4GRBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260718 [from cloudscan12-255.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 This change sets up FUSE operations to have headers in args.in_args[0], even for opcodes without an actual header. We do this to prepare for cleanly separating payload from headers in the future. For opcodes without a header, we use a zero-sized struct as a placeholder. This approach: - Keeps things consistent across all FUSE operations - Will help with payload alignment later - Avoids future issues when header sizes change Signed-off-by: Bernd Schubert --- fs/fuse/dax.c | 11 ++++++----- fs/fuse/dev.c | 9 +++++---- fs/fuse/dir.c | 32 ++++++++++++++++++-------------- fs/fuse/fuse_i.h | 13 +++++++++++++ fs/fuse/xattr.c | 7 ++++--- 5 files changed, 46 insertions(+), 26 deletions(-) diff --git a/fs/fuse/dax.c b/fs/fuse/dax.c index 12ef91d170bb3091ac35a33d2b9dc38330b00948..44bd30d448e4e8c1d8c6b0499e50564fa0828efc 100644 --- a/fs/fuse/dax.c +++ b/fs/fuse/dax.c @@ -240,11 +240,12 @@ static int fuse_send_removemapping(struct inode *inode, args.opcode = FUSE_REMOVEMAPPING; args.nodeid = fi->nodeid; - args.in_numargs = 2; - args.in_args[0].size = sizeof(*inargp); - args.in_args[0].value = inargp; - args.in_args[1].size = inargp->count * sizeof(*remove_one); - args.in_args[1].value = remove_one; + args.in_numargs = 3; + fuse_set_zero_arg0(&args); + args.in_args[1].size = sizeof(*inargp); + args.in_args[1].value = inargp; + args.in_args[2].size = inargp->count * sizeof(*remove_one); + args.in_args[2].value = remove_one; return fuse_simple_request(fm, &args); } diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index fd8898b0c1cca4d117982d5208d78078472b0dfb..63c3865aebb7811fdf4a5729b2181ee8321421dc 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -1735,7 +1735,7 @@ static int fuse_retrieve(struct fuse_mount *fm, struct inode *inode, args = &ap->args; args->nodeid = outarg->nodeid; args->opcode = FUSE_NOTIFY_REPLY; - args->in_numargs = 2; + args->in_numargs = 3; args->in_pages = true; args->end = fuse_retrieve_end; @@ -1762,9 +1762,10 @@ static int fuse_retrieve(struct fuse_mount *fm, struct inode *inode, } ra->inarg.offset = outarg->offset; ra->inarg.size = total_len; - args->in_args[0].size = sizeof(ra->inarg); - args->in_args[0].value = &ra->inarg; - args->in_args[1].size = total_len; + fuse_set_zero_arg0(args); + args->in_args[1].size = sizeof(ra->inarg); + args->in_args[1].value = &ra->inarg; + args->in_args[2].size = total_len; err = fuse_simple_notify_reply(fm, args, outarg->notify_unique); if (err) diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 54104dd48af7c94b312f1a8671c8905542d456c4..ccb240d4262f9399c9c90434aaeaf76b50f223ad 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -175,9 +175,10 @@ static void fuse_lookup_init(struct fuse_conn *fc, struct fuse_args *args, memset(outarg, 0, sizeof(struct fuse_entry_out)); args->opcode = FUSE_LOOKUP; args->nodeid = nodeid; - args->in_numargs = 1; - args->in_args[0].size = name->len + 1; - args->in_args[0].value = name->name; + args->in_numargs = 2; + fuse_set_zero_arg0(args); + args->in_args[1].size = name->len + 1; + args->in_args[1].value = name->name; args->out_numargs = 1; args->out_args[0].size = sizeof(struct fuse_entry_out); args->out_args[0].value = outarg; @@ -927,11 +928,12 @@ static int fuse_symlink(struct mnt_idmap *idmap, struct inode *dir, FUSE_ARGS(args); args.opcode = FUSE_SYMLINK; - args.in_numargs = 2; - args.in_args[0].size = entry->d_name.len + 1; - args.in_args[0].value = entry->d_name.name; - args.in_args[1].size = len; - args.in_args[1].value = link; + args.in_numargs = 3; + fuse_set_zero_arg0(&args); + args.in_args[1].size = entry->d_name.len + 1; + args.in_args[1].value = entry->d_name.name; + args.in_args[2].size = len; + args.in_args[2].value = link; return create_new_entry(idmap, fm, &args, dir, entry, S_IFLNK); } @@ -991,9 +993,10 @@ static int fuse_unlink(struct inode *dir, struct dentry *entry) args.opcode = FUSE_UNLINK; args.nodeid = get_node_id(dir); - args.in_numargs = 1; - args.in_args[0].size = entry->d_name.len + 1; - args.in_args[0].value = entry->d_name.name; + args.in_numargs = 2; + fuse_set_zero_arg0(&args); + args.in_args[1].size = entry->d_name.len + 1; + args.in_args[1].value = entry->d_name.name; err = fuse_simple_request(fm, &args); if (!err) { fuse_dir_changed(dir); @@ -1014,9 +1017,10 @@ static int fuse_rmdir(struct inode *dir, struct dentry *entry) args.opcode = FUSE_RMDIR; args.nodeid = get_node_id(dir); - args.in_numargs = 1; - args.in_args[0].size = entry->d_name.len + 1; - args.in_args[0].value = entry->d_name.name; + args.in_numargs = 2; + fuse_set_zero_arg0(&args); + args.in_args[1].size = entry->d_name.len + 1; + args.in_args[1].value = entry->d_name.name; err = fuse_simple_request(fm, &args); if (!err) { fuse_dir_changed(dir); diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index e6cc3d552b1382fc43bfe5191efc46e956ca268c..e3748751e231d0991c050b31bdd84db0b8016f9f 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -938,6 +938,19 @@ struct fuse_mount { struct rcu_head rcu; }; +/* + * Empty header for FUSE opcodes without specific header needs. + * Used as a placeholder in args->in_args[0] for consistency + * across all FUSE operations, simplifying request handling. + */ +struct fuse_zero_header {}; + +static inline void fuse_set_zero_arg0(struct fuse_args *args) +{ + args->in_args[0].size = sizeof(struct fuse_zero_header); + args->in_args[0].value = NULL; +} + static inline struct fuse_mount *get_fuse_mount_super(struct super_block *sb) { return sb->s_fs_info; diff --git a/fs/fuse/xattr.c b/fs/fuse/xattr.c index 9f568d345c51236ddd421b162820a4ea9b0734f4..93dfb06b6cea045d6df90c61c900680968bda39f 100644 --- a/fs/fuse/xattr.c +++ b/fs/fuse/xattr.c @@ -164,9 +164,10 @@ int fuse_removexattr(struct inode *inode, const char *name) args.opcode = FUSE_REMOVEXATTR; args.nodeid = get_node_id(inode); - args.in_numargs = 1; - args.in_args[0].size = strlen(name) + 1; - args.in_args[0].value = name; + args.in_numargs = 2; + fuse_set_zero_arg0(&args); + args.in_args[1].size = strlen(name) + 1; + args.in_args[1].value = name; err = fuse_simple_request(fm, &args); if (err == -ENOSYS) { fm->fc->no_removexattr = 1; From patchwork Wed Nov 27 13:40: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: 13887012 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 A7CC51FCF71; Wed, 27 Nov 2024 13:41:00 +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=1732714864; cv=fail; b=PFLNpP66uprZBmabr6cRZPAOHiS1ammDBKoemWtumDIUwccoVuah8Qni9FkfctONApbIBYfx7rdhXDFQkQMc2lrlmQqLRExRj3pXZD0U7OSGdF58/e+hf3WRuhshcEXH2Ki4zXqmb2Bgii19HOYGx3v7v3UKA5PecEJJWL7lp6Y= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732714864; c=relaxed/simple; bh=lk+GOLceA/m4U6xVHEXUcPbTehzUGN295elqdpRFwHM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iVCFPBwt5nmruQ8/Kn2RumDcd7K9myVkaZIRnpJu2bRu8YQlD/YiaKRCjTGteX49i9FXBQYRhS8JvgK45AFnDVJsAWAmQNuO93kDxkSS+tchp97cgTyrOGVepvaghKH6KkT84q3f/Xq1jxp4xSlYUlSquJaWtU49K9J9DqAycRY= 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=HlImQ77j; 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="HlImQ77j" Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2169.outbound.protection.outlook.com [104.47.59.169]) by mx-outbound19-109.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 27 Nov 2024 13:40:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Snqexsm1C9XbU9mkqO+CkmuQPOQ8QnP7ftyPwgAbndBw7nwcNU1j1Dezgj0gP371JIH0HAK3LQk3w83+LmMvT/HHoBWDTEOF04zr69wNIKYGgGF6GjaeFcf02AfILXKJWWHYV4wXQIwdPGuIN1YFMNo03NxDi1qdshHiD8By7xDGn8MMAbdGNmm6RNNYclAHq7tGU8qCklEsVoRyag6/Wp//Gwpz/9MAXqf8vP3Zde8mzyrS+lGSjCEgJd0TqYtJzXUQxCJdmayW7agVso+5xw6sIOJUQ62pQWwRtbicCN1EvuR+MjboJNXloscvwJfeq20S9v+hBHFbWFuOcAmH5Q== 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=WsE01SpG6PNiWZe/CyqupLxZiKyJ2MHJDW56MaI/U7w=; b=xOsvsgpfFFJ7F7ClhkhyZShuHo65gnahKEI1qDi7GlbSn7HMsDH7ivZ1a1SNCsPwKzqTJgpPg6KpbEEXNCkFMaHK7rdI/DOS3ISHUXXeYNOoIIb/wanuthnk3ejXXrF7Ps7NBGZBYPW+pHU98DF3RRrLKTA5GkVD3/Xj8iBj7cesy4r2g57JdkaItLABMKHuZeGLMmSHLa/ENfsmyQHI66rAyMDPfEo7Lu2+Huebse7Hs44tXkknwNZqdiBY7XHzoDG1ZVBr9RDy3nZkuBLEZv2rLoBf1M+y0vVf0XNqYvw3KB/5D+/52NiM2JG3dZrj9uwZHcdajbRoYzqNGELHvQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=bsbernd.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WsE01SpG6PNiWZe/CyqupLxZiKyJ2MHJDW56MaI/U7w=; b=HlImQ77jC0lVmG+SXhq1ya2T9ertLthBGB3phVp0S6WhqytweAkCeHKTbD9SjyiB5f/l1ygaKj0TqYEF/NMkxjIquGs+KSj80/1yPP2l6dickeaAIWNNhgJuadDtjkxgzfuSVPTAWfY6LHeeLia3Kd2lmsRHYEsn+9sLFolVEzw= Received: from DM6PR07CA0046.namprd07.prod.outlook.com (2603:10b6:5:74::23) by SJ0PR19MB5384.namprd19.prod.outlook.com (2603:10b6:a03:3d7::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.14; Wed, 27 Nov 2024 13:40:46 +0000 Received: from DS3PEPF000099DE.namprd04.prod.outlook.com (2603:10b6:5:74:cafe::da) by DM6PR07CA0046.outlook.office365.com (2603:10b6:5:74::23) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8182.17 via Frontend Transport; Wed, 27 Nov 2024 13:40:46 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by DS3PEPF000099DE.mail.protection.outlook.com (10.167.17.200) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.12 via Frontend Transport; Wed, 27 Nov 2024 13:40:45 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 2D8DD32; Wed, 27 Nov 2024 13:40:45 +0000 (UTC) From: Bernd Schubert Date: Wed, 27 Nov 2024 14:40:23 +0100 Subject: [PATCH RFC v7 06/16] fuse: {uring} Handle SQEs - register commands Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241127-fuse-uring-for-6-10-rfc4-v7-6-934b3a69baca@ddn.com> References: <20241127-fuse-uring-for-6-10-rfc4-v7-0-934b3a69baca@ddn.com> In-Reply-To: <20241127-fuse-uring-for-6-10-rfc4-v7-0-934b3a69baca@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1732714838; l=17027; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=lk+GOLceA/m4U6xVHEXUcPbTehzUGN295elqdpRFwHM=; b=QG/7V9sxLogML1nLRv9+jZTHaK/XCc7FVXAQ0sAI/UB4xfQYQ49C3inreKIjtxzNonu/gPMhl EzbRT3tjASzAAGtfSEtcF0O11DYIzuAxEfSg1xGUEQVZB+YUMiKklVZ X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099DE:EE_|SJ0PR19MB5384:EE_ X-MS-Office365-Filtering-Correlation-Id: d1023143-068d-4028-1636-08dd0ee918a4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|7416014|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?6SghPWIfW8wtOj43SuK02I4rx8zKxPf?= =?utf-8?q?ZbbOOf+Xvra4Xn6tGSQ92XolmW2rSAhdybqSQiLCAkha+9FxIE6F0B4KVnmzi9Bex?= =?utf-8?q?Hm6C2ubEai+d2zd0mvL0lIkYpF5flJ3wcE0WL4yyPF5uuBYG11kwRfmf0oZOvFSll?= =?utf-8?q?JPrXmUd0gHhMQ7/Im0eRfJgxUkfUBMZKA0rQDSjTXx8ybM3o0P2pD/qPYJJLtuWPW?= =?utf-8?q?DA+w/aSiLQgiIjB0Myc2a8IzkMS9Hyl1CapP8e9E6YkFyaQ7jVwB6Y5c2dw2LG5aT?= =?utf-8?q?zIZh58bQ11tEV5nVZFj2GIOn/fEVQ9b0bzLZY3vixTSS4E+bniqWcI6cd8oR3ZLfq?= =?utf-8?q?/iqN11lT8plabmbS13pC+RA/eb1xnALh4kL/JT3AKyYTlGSHlkONjKNSIhR/5Rcjn?= =?utf-8?q?x6hDlouKlga5wDMjFOprsrjO7qAuiaVdD08NMxWDW9qF5+gaxgsA5fD0QDaD3vT57?= =?utf-8?q?URgGRupXVlRTl0gCUyPM0C3X9RJ/YFzx23o0myrjXvZ33I9qpnu7UjSpIekst9dNq?= =?utf-8?q?OJLigJpycYWNPy7o3Wb+T4xqhbAApwd4huWYvBXxUCi8AJoFOAoTktXcUuIqGAu9n?= =?utf-8?q?Hdw55tS/xXdTrjim+yvCMP1IK36S8eq5/YBfNIBmWRUgiqZtRIL7mT0bjRBa0mwgK?= =?utf-8?q?6bvA0dfsBv7G3MY+bwXVdHNI6abPxgqEkQ8ym8Dkil77DfpRjEaLvFvOYFjtoYHaV?= =?utf-8?q?fOe1fE0lMWK9qJV3/BFtQpAglxtlzUffgMEednNNXToyhTg66HQa9ei2k+Wixxjno?= =?utf-8?q?GodeNP1d1hNyig7hSnfgJYlNFLxJhbicfiYJDiSLCUog7EPGB03A/jSF5j8biBXie?= =?utf-8?q?4/81rUWzwyzBtlo/81i51pHwwsA/oOUlpcfy4q+pyZA0F1Lw1RMTJioq/hIu7WEPa?= =?utf-8?q?cPkhDeC8CIkPzJcDjA82P57LAmu3zpQU4gTy+zl57D+bMZ5yebs+nlovjJ+S9K55t?= =?utf-8?q?w8LvhxI9FyECTtOdRYkXVd+gAySsj0omdBV+5+gOq8OUIEPulNfG156mIqziTZJ7V?= =?utf-8?q?OVwYSzDNQJMld5wjklehaYjrK6RkmfCYQdX8X7TFx1NVDUFHnrXuvccFQglebFFli?= =?utf-8?q?KvVnxb4SKrILvdp6DuvEUAXB2guDKattVS6IEjTP1/Neu14O1UTcRTt2DU8ixP220?= =?utf-8?q?MLjw+cfKqBFfnZDDbUArWT9LllFhNin+Z/6n5hzE/g/BLEQ9BzSfn9vyfB4zPvom4?= =?utf-8?q?QeR3cHPbVk4JScJQnvkFQWUwPLu67GsMwJ19oRMPV+hRxmTNmXYmsSBQttUILrvMb?= =?utf-8?q?9L/TVKNX0R8aPzpupGyYmIGLH/4jAtnKTfv8IvOV5w0r+WuBURmZc7d3Kt3aX9UXW?= =?utf-8?q?N66GXkHldyJyDsg1W0rsjkWGOnBPl4M/NzwKUmGW9SOttImlCSbMJMy7GlS4skz79?= =?utf-8?q?vBCpH7YFqjD?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(36860700013)(7416014)(376014)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: bTRi5g6t6AfJ/EFsY//xZEGcTLRVy7IaXuM+lee7fxq2/57lUVyWZTdMrTPvhlGk+NF6WT6H+Cb+RL3EoHTvroByRT9klKSsMf4FuQB3YCClJoggqVJ9OzyJaoXj7zPNfmL7U5pNOsuONFv7miQxhfqcMMyT4gSRWxzeJsjzWFtq3O3+xjplpe7TLBRU3zF8wn1jreoMNanygHUsYe22bBjga24tilwup2Lr0bGGnCUj6weEoGPTU/UrYtJ4XIHptS3zIhcHIEkUvAMnXx6z99jdVQko83oB3W0HonLsciGSvKWcDn6HDnbivLOOSCMyArnsi7VWCsCJEpqpIT40hbopf/lJj/zryUFYNbGjnqGCImJ11gasWsG7qiUslUZOj0zrQMzfTp0xgG5OFWADve3Z+VI/NPJAylIfDhsPlL30/VmJqItbULRHqbTGHlXV9haVlWfwZZhUizHilE2TugsPCoP4DA7jWXsifYTC9SRLa+QCpvZTBShQZ+/8/EK/CFGR7hPjw8Yd4out7cZr1dmIP4F7ERfxlAD862Yvq5kSJo9B0x1c4+koaS8PxwzeVB+U7P5M13LYQzaAUYjpuhVyTtHAPAowSgCOuGvoAhGctlfXNL4m2yGIu1r6pnuF7+EvYGxnAajac/BaUq1ZJw== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2024 13:40:45.8022 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d1023143-068d-4028-1636-08dd0ee918a4 X-MS-Exchange-CrossTenant-Id: 753b6e26-6fd3-43e6-8248-3f1735d59bb4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=753b6e26-6fd3-43e6-8248-3f1735d59bb4;Ip=[50.222.100.11];Helo=[uww-mrp-01.datadirectnet.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF000099DE.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR19MB5384 X-BESS-ID: 1732714849-104973-13465-2348-1 X-BESS-VER: 2019.1_20241126.2220 X-BESS-Apparent-Source-IP: 104.47.59.169 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoZmxmYmQGYGUNQ0xcjM1MLU0C g11cLSLDHRwjjRwjzJ0jDRwMLMNDXZXKk2FgAT8Eo1QgAAAA== X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260718 [from cloudscan19-72.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 This adds basic support for ring SQEs (with opcode=IORING_OP_URING_CMD). For now only FUSE_URING_REQ_FETCH is handled to register queue entries. Signed-off-by: Bernd Schubert --- fs/fuse/Kconfig | 12 ++ fs/fuse/Makefile | 1 + fs/fuse/dev.c | 4 + fs/fuse/dev_uring.c | 318 ++++++++++++++++++++++++++++++++++++++++++++++ fs/fuse/dev_uring_i.h | 115 +++++++++++++++++ fs/fuse/fuse_i.h | 5 + fs/fuse/inode.c | 10 ++ include/uapi/linux/fuse.h | 67 ++++++++++ 8 files changed, 532 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 ce0ff7a9007b94b4ab246b5271f227d126c768e8..fcf16b1c391a9bf11ca9f3a25b137acdb203ac47 100644 --- a/fs/fuse/Makefile +++ b/fs/fuse/Makefile @@ -14,5 +14,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 63c3865aebb7811fdf4a5729b2181ee8321421dc..0770373492ae9ee83c4154fede9dcfd7be9fb33d 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" @@ -2452,6 +2453,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..af9c5f116ba1dcf6c01d0359d1a06491c92c32f9 --- /dev/null +++ b/fs/fuse/dev_uring.c @@ -0,0 +1,318 @@ +// 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 + +bool fuse_uring_enabled(void) +{ + return enable_uring; +} + +static int fuse_ring_ent_unset_userspace(struct fuse_ring_ent *ent) +{ + struct fuse_ring_queue *queue = ent->queue; + + lockdep_assert_held(&queue->lock); + + if (WARN_ON_ONCE(ent->state != FRRS_USERSPACE)) + return -EIO; + + ent->state = FRRS_COMMIT; + list_move(&ent->list, &queue->ent_commit_queue); + + return 0; +} + +void fuse_uring_destruct(struct fuse_conn *fc) +{ + struct fuse_ring *ring = fc->ring; + int qid; + + if (!ring) + return; + + for (qid = 0; qid < ring->nr_queues; qid++) { + struct fuse_ring_queue *queue = ring->queues[qid]; + + if (!queue) + continue; + + WARN_ON(!list_empty(&queue->ent_avail_queue)); + WARN_ON(!list_empty(&queue->ent_commit_queue)); + + kfree(queue); + ring->queues[qid] = NULL; + } + + kfree(ring->queues); + kfree(ring); + fc->ring = NULL; +} + +#define FUSE_URING_IOV_SEGS 2 /* header and payload */ + +/* + * Basic ring setup for this connection based on the provided configuration + */ +static struct fuse_ring *fuse_uring_create(struct fuse_conn *fc) +{ + struct fuse_ring *ring = NULL; + size_t nr_queues = num_possible_cpus(); + struct fuse_ring *res = NULL; + + ring = kzalloc(sizeof(*fc->ring) + + nr_queues * sizeof(struct fuse_ring_queue), + GFP_KERNEL_ACCOUNT); + if (!ring) + return NULL; + + ring->queues = kcalloc(nr_queues, sizeof(struct fuse_ring_queue *), + GFP_KERNEL_ACCOUNT); + if (!ring->queues) + goto out_err; + + spin_lock(&fc->lock); + if (fc->ring) { + /* race, another thread created the ring in the mean time */ + spin_unlock(&fc->lock); + res = fc->ring; + goto out_err; + } + + fc->ring = ring; + ring->nr_queues = nr_queues; + ring->fc = fc; + + spin_unlock(&fc->lock); + return ring; + +out_err: + if (ring) + kfree(ring->queues); + kfree(ring); + return res; +} + +static struct fuse_ring_queue *fuse_uring_create_queue(struct fuse_ring *ring, + int qid) +{ + struct fuse_conn *fc = ring->fc; + struct fuse_ring_queue *queue; + + queue = kzalloc(sizeof(*queue), GFP_KERNEL_ACCOUNT); + if (!queue) + return ERR_PTR(-ENOMEM); + spin_lock(&fc->lock); + if (ring->queues[qid]) { + spin_unlock(&fc->lock); + kfree(queue); + return ring->queues[qid]; + } + + queue->qid = qid; + queue->ring = ring; + spin_lock_init(&queue->lock); + + INIT_LIST_HEAD(&queue->ent_avail_queue); + INIT_LIST_HEAD(&queue->ent_commit_queue); + + WRITE_ONCE(ring->queues[qid], queue); + spin_unlock(&fc->lock); + + return queue; +} + +/* + * Make a ring entry available for fuse_req assignment + */ +static void fuse_uring_ent_avail(struct fuse_ring_ent *ring_ent, + struct fuse_ring_queue *queue) +{ + list_move(&ring_ent->list, &queue->ent_avail_queue); + ring_ent->state = FRRS_WAIT; +} + +/* + * fuse_uring_req_fetch command handling + */ +static void _fuse_uring_fetch(struct fuse_ring_ent *ring_ent, + struct io_uring_cmd *cmd, + unsigned int issue_flags) +{ + struct fuse_ring_queue *queue = ring_ent->queue; + + spin_lock(&queue->lock); + fuse_uring_ent_avail(ring_ent, queue); + ring_ent->cmd = cmd; + spin_unlock(&queue->lock); +} + +/* + * sqe->addr is a ptr to an iovec array, iov[0] has the headers, iov[1] + * the payload + */ +static int fuse_uring_get_iovec_from_sqe(const struct io_uring_sqe *sqe, + struct iovec iov[FUSE_URING_IOV_SEGS]) +{ + struct iovec __user *uiov = u64_to_user_ptr(READ_ONCE(sqe->addr)); + struct iov_iter iter; + ssize_t ret; + + if (sqe->len != FUSE_URING_IOV_SEGS) + return -EINVAL; + + /* + * Direction for buffer access will actually be READ and WRITE, + * using write for the import should include READ access as well. + */ + ret = import_iovec(WRITE, uiov, FUSE_URING_IOV_SEGS, + FUSE_URING_IOV_SEGS, &iov, &iter); + if (ret < 0) + return ret; + + return 0; +} + +static int fuse_uring_fetch(struct io_uring_cmd *cmd, unsigned int issue_flags, + struct fuse_conn *fc) +{ + const struct fuse_uring_cmd_req *cmd_req = io_uring_sqe_cmd(cmd->sqe); + struct fuse_ring *ring = fc->ring; + struct fuse_ring_queue *queue; + struct fuse_ring_ent *ring_ent; + int err; + struct iovec iov[FUSE_URING_IOV_SEGS]; + + err = fuse_uring_get_iovec_from_sqe(cmd->sqe, iov); + if (err) { + pr_info_ratelimited("Failed to get iovec from sqe, err=%d\n", + err); + return err; + } + + err = -ENOMEM; + if (!ring) { + ring = fuse_uring_create(fc); + if (!ring) + return err; + } + + queue = ring->queues[cmd_req->qid]; + if (!queue) { + queue = fuse_uring_create_queue(ring, cmd_req->qid); + if (!queue) + return err; + } + + /* + * The created queue above does not need to be destructed in + * case of entry errors below, will be done at ring destruction time. + */ + + ring_ent = kzalloc(sizeof(*ring_ent), GFP_KERNEL_ACCOUNT); + if (ring_ent == NULL) + return err; + + INIT_LIST_HEAD(&ring_ent->list); + + ring_ent->queue = queue; + ring_ent->cmd = cmd; + + err = -EINVAL; + if (iov[0].iov_len < sizeof(struct fuse_uring_req_header)) { + pr_info_ratelimited("Invalid header len %zu\n", iov[0].iov_len); + goto err; + } + + ring_ent->headers = iov[0].iov_base; + ring_ent->payload = iov[1].iov_base; + ring_ent->max_arg_len = iov[1].iov_len; + + if (ring_ent->max_arg_len < + max_t(size_t, FUSE_MIN_READ_BUFFER, fc->max_write)) { + pr_info_ratelimited("Invalid req payload len %zu\n", + ring_ent->max_arg_len); + goto err; + } + + spin_lock(&queue->lock); + + /* + * FUSE_URING_REQ_FETCH is an initialization exception, needs + * state override + */ + ring_ent->state = FRRS_USERSPACE; + err = fuse_ring_ent_unset_userspace(ring_ent); + spin_unlock(&queue->lock); + if (WARN_ON_ONCE(err != 0)) + goto err; + + _fuse_uring_fetch(ring_ent, cmd, issue_flags); + + return 0; +err: + list_del_init(&ring_ent->list); + kfree(ring_ent); + return err; +} + +/* + * Entry function from io_uring to handle the given passthrough command + * (op cocde IORING_OP_URING_CMD) + */ +int fuse_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags) +{ + struct fuse_dev *fud; + struct fuse_conn *fc; + u32 cmd_op = cmd->cmd_op; + int err; + + /* Disabled for now, especially as teardown is not implemented yet */ + pr_info_ratelimited("fuse-io-uring is not enabled yet\n"); + return -EOPNOTSUPP; + + if (!enable_uring) { + pr_info_ratelimited("fuse-io-uring is disabled\n"); + return -EOPNOTSUPP; + } + + fud = fuse_get_dev(cmd->file); + if (!fud) { + pr_info_ratelimited("No fuse device found\n"); + return -ENOTCONN; + } + fc = fud->fc; + + if (!fc->connected || fc->aborted) + return fc->aborted ? -ECONNABORTED : -ENOTCONN; + + switch (cmd_op) { + case FUSE_URING_REQ_FETCH: + err = fuse_uring_fetch(cmd, issue_flags, fc); + if (err) { + pr_info_once("fuse_uring_fetch failed err=%d\n", err); + return err; + } + break; + default: + return -EINVAL; + } + + return -EIOCBQUEUED; +} diff --git a/fs/fuse/dev_uring_i.h b/fs/fuse/dev_uring_i.h new file mode 100644 index 0000000000000000000000000000000000000000..75c644cc0b2bb3721b08f8695964815d53f46e92 --- /dev/null +++ b/fs/fuse/dev_uring_i.h @@ -0,0 +1,115 @@ +/* SPDX-License-Identifier: GPL-2.0 + * + * FUSE: Filesystem in Userspace + * Copyright (c) 2023-2024 DataDirect Networks. + */ + +#ifndef _FS_FUSE_DEV_URING_I_H +#define _FS_FUSE_DEV_URING_I_H + +#include "fuse_i.h" + +#ifdef CONFIG_FUSE_IO_URING + +enum fuse_ring_req_state { + FRRS_INVALID = 0, + + /* The ring entry received from userspace and it being processed */ + FRRS_COMMIT, + + /* The ring entry is waiting for new fuse requests */ + FRRS_WAIT, + + /* The ring entry is in or on the way to user space */ + FRRS_USERSPACE, +}; + +/** A fuse ring entry, part of the ring queue */ +struct fuse_ring_ent { + /* userspace buffer */ + struct fuse_uring_req_header __user *headers; + void *__user *payload; + + /* the ring queue that owns the request */ + struct fuse_ring_queue *queue; + + struct io_uring_cmd *cmd; + + struct list_head list; + + /* size of payload buffer */ + size_t max_arg_len; + + /* + * state the request is currently in + * (enum fuse_ring_req_state) + */ + unsigned int state; + + struct fuse_req *fuse_req; +}; + +struct fuse_ring_queue { + /* + * back pointer to the main fuse uring structure that holds this + * queue + */ + struct fuse_ring *ring; + + /* queue id, typically also corresponds to the cpu core */ + unsigned int qid; + + /* + * queue lock, taken when any value in the queue changes _and_ also + * a ring entry state changes. + */ + spinlock_t lock; + + /* available ring entries (struct fuse_ring_ent) */ + struct list_head ent_avail_queue; + + /* + * entries in the process of being committed or in the process + * to be send to userspace + */ + struct list_head ent_commit_queue; +}; + +/** + * Describes if uring is for communication and holds alls the data needed + * for uring communication + */ +struct fuse_ring { + /* back pointer */ + struct fuse_conn *fc; + + /* number of ring queues */ + size_t nr_queues; + + struct fuse_ring_queue **queues; +}; + +bool fuse_uring_enabled(void); +void fuse_uring_destruct(struct fuse_conn *fc); +int fuse_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags); + +#else /* CONFIG_FUSE_IO_URING */ + +struct fuse_ring; + +static inline void fuse_uring_create(struct fuse_conn *fc) +{ +} + +static inline void fuse_uring_destruct(struct fuse_conn *fc) +{ +} + +static inline bool fuse_uring_enabled(void) +{ + return false; +} + +#endif /* CONFIG_FUSE_IO_URING */ + +#endif /* _FS_FUSE_DEV_URING_I_H */ diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index e3748751e231d0991c050b31bdd84db0b8016f9f..a21256ec4c3b4bd7c67eae2d03b68d87dcc8234b 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -914,6 +914,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 fd3321e29a3e569bf06be22a5383cf34fd42c051..76267c79e920204175e5713853de8214c5555d46 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 @@ -959,6 +960,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); } @@ -1413,6 +1416,13 @@ void fuse_send_init(struct fuse_mount *fm) if (IS_ENABLED(CONFIG_FUSE_PASSTHROUGH)) flags |= FUSE_PASSTHROUGH; + /* + * This is just an information flag for fuse server. No need to check + * the reply - server is either sending IORING_OP_URING_CMD or not. + */ + if (fuse_uring_enabled()) + flags |= FUSE_OVER_IO_URING; + ia->in.flags = flags; ia->in.flags2 = flags >> 32; diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h index f1e99458e29e4fdce5273bc3def242342f207ebd..6d39077edf8cde4fa77130efcec16323839a676c 100644 --- a/include/uapi/linux/fuse.h +++ b/include/uapi/linux/fuse.h @@ -220,6 +220,14 @@ * * 7.41 * - add FUSE_ALLOW_IDMAP + * 7.42 + * - Add FUSE_OVER_IO_URING and all other io-uring related flags and data + * structures: + * - fuse_uring_ent_in_out + * - fuse_uring_req_header + * - fuse_uring_cmd_req + * - FUSE_URING_IN_OUT_HEADER_SZ + * - FUSE_URING_OP_IN_OUT_SZ */ #ifndef _LINUX_FUSE_H @@ -425,6 +433,7 @@ struct fuse_file_lock { * FUSE_HAS_RESEND: kernel supports resending pending requests, and the high bit * of the request ID indicates resend requests * FUSE_ALLOW_IDMAP: allow creation of idmapped mounts + * FUSE_OVER_IO_URING: Indicate that Client supports io-uring */ #define FUSE_ASYNC_READ (1 << 0) #define FUSE_POSIX_LOCKS (1 << 1) @@ -471,6 +480,7 @@ struct fuse_file_lock { /* Obsolete alias for FUSE_DIRECT_IO_ALLOW_MMAP */ #define FUSE_DIRECT_IO_RELAX FUSE_DIRECT_IO_ALLOW_MMAP #define FUSE_ALLOW_IDMAP (1ULL << 40) +#define FUSE_OVER_IO_URING (1ULL << 41) /** * CUSE INIT request/reply flags @@ -1206,4 +1216,61 @@ struct fuse_supp_groups { uint32_t groups[]; }; +/** + * Size of the ring buffer header + */ +#define FUSE_URING_IN_OUT_HEADER_SZ 128 +#define FUSE_URING_OP_IN_OUT_SZ 128 + +struct fuse_uring_ent_in_out { + uint64_t flags; + + /* size of use payload buffer */ + uint32_t payload_sz; + uint32_t padding; + + uint8_t reserved[30]; +}; + +/** + * This structure mapped onto the + */ +struct fuse_uring_req_header { + /* struct fuse_in / struct fuse_out */ + char in_out[FUSE_URING_IN_OUT_HEADER_SZ]; + + /* per op code structs */ + char op_in[FUSE_URING_OP_IN_OUT_SZ]; + + /* struct fuse_ring_in_out */ + char ring_ent_in_out[sizeof(struct fuse_uring_ent_in_out)]; +}; + +/** + * sqe commands to the kernel + */ +enum fuse_uring_cmd { + FUSE_URING_REQ_INVALID = 0, + + /* submit sqe to kernel to get a request */ + FUSE_URING_REQ_FETCH = 1, + + /* commit result and fetch next request */ + FUSE_URING_REQ_COMMIT_AND_FETCH = 2, +}; + +/** + * In the 80B command area of the SQE. + */ +struct fuse_uring_cmd_req { + uint64_t flags; + + /* entry identifier */ + uint64_t commit_id; + + /* queue the command is for (queue index) */ + uint16_t qid; + uint8_t padding[6]; +}; + #endif /* _LINUX_FUSE_H */ From patchwork Wed Nov 27 13:40: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: 13887014 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 9EAD11FCFEF; Wed, 27 Nov 2024 13:41:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=209.222.82.58 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732714866; cv=fail; b=XLU9+sXdjbb7RnLIsKSJ1OFtp2a71DcuO8okZ+3mYKmx8DyJKKpmp6Hwwef/EwdhJSJYkXU4eDXxI/yfvDYi2CCGGAjiqLDbyPAT7KUT8pTZgqJYB12ZAkvkJyXy0/wN+3M62fOL8qgQgMsm4IXY0Tba817octLboNZTjF1EbW4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732714866; c=relaxed/simple; bh=6nCe00M/Y2uCOcEBUSArlvpHb6TYuQLIjdmKElKH1AA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Osu/sFLO4gORcPYm1ubYmAlsQvsr2XX3VmI/gBfxH0nbbN3eGMoMG4BIb0xxh7mm+Mrgud21i6D8gcc65EH0Jc1OrIRtNZ+ZmdSuR9G6F6fuve4IxtEggCYkN6ab2V/iu2qvD/Y7K8iI0N+9N4OCMhCvimzFvtgw3iAiAfkqHB8= 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=stMuNVxV; 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="stMuNVxV" Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2040.outbound.protection.outlook.com [104.47.66.40]) by mx-outbound42-26.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 27 Nov 2024 13:40:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=IvgFL98xKvVUZdG6RSfnNjFQtI+Kt7nyiwVpTvZ02Zi+t/EA1tDjL2SBD1sRKyuZbFW/dx4wMBKRhC7MXCZzxbTV3NhtMpZShT6hvX+4Obnih0uAIx6gDlQ5nQEG/HuEOg3cI+PGVDS/PuxWRnyj7OiPFH2KCYp2cNBtqsOKgPt6w3/PfP2je3nBWaEGHyTA4CaZJ+QkM+0zHaeN+5tCv93HoXFGoZTxS43pRl+wWwM8Qq5lUi3Yv78Lzm3A4dwcBe/AtRDzSkIGNLk7UVG8PtxHXO3XyQwRgJM7QPQnyMvjuadhECa1+xpFjHor7+T2p+hG2QrPuBpcbcLcfr2DQA== 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=x7BlkzNG8aHLR53QUwTWM4fzHMjHh2RA6stjJUMt1vU=; b=t5vP5rG/V0kktY0KnGuflrdIwac7PaEOYPIYtuJP4ChIQPgTZW6UNHUT1HxoFZ/VNTVlHFSA9wb8nIyMiTZlbNZ/bvDigIc7ex481evzJ8ccRiNBjS164L+jmY/DBLxkVObn6R387EZW+D22dritO3kJLtshR0FU1LFhZAM1ROxcaXgHntGZyg2+A0/o/XVoZV56JgJhkafrr9kaZrLOBFPu5PYCvkjkYdPqizN2TLM0jz/G4ulG0XqYels9l+K4Pvr7o1F4GMQbjy5mLtNme2UvT9c1PcgwaVQeCNOeaeOuw4Qzcq4yzd8oJMK7bhytXXh8rINzZhRRm1gf+BrWYg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=bsbernd.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=x7BlkzNG8aHLR53QUwTWM4fzHMjHh2RA6stjJUMt1vU=; b=stMuNVxV3sF5KdM9wr0mr0D32oM3crYrHjU2XCDMLWp9WoEY0azWWRbhj5xl0ChXFppg/QW1fKfNYGFnyJkfMKOV48+BmAX2EJv20j+HNDANnEi2Q5kbL1Mtcd+bgs8mwyppjRQChXDaq9fAzHQikKUzhfTRqyuN7096ZPiNrbs= Received: from SJ0PR13CA0170.namprd13.prod.outlook.com (2603:10b6:a03:2c7::25) by SJ0PR19MB4778.namprd19.prod.outlook.com (2603:10b6:a03:2ca::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.13; Wed, 27 Nov 2024 13:40:47 +0000 Received: from MWH0EPF000971E2.namprd02.prod.outlook.com (2603:10b6:a03:2c7:cafe::ce) by SJ0PR13CA0170.outlook.office365.com (2603:10b6:a03:2c7::25) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.12 via Frontend Transport; Wed, 27 Nov 2024 13:40:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by MWH0EPF000971E2.mail.protection.outlook.com (10.167.243.69) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.12 via Frontend Transport; Wed, 27 Nov 2024 13:40:46 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 2598A2D; Wed, 27 Nov 2024 13:40:46 +0000 (UTC) From: Bernd Schubert Date: Wed, 27 Nov 2024 14:40:24 +0100 Subject: [PATCH RFC v7 07/16] fuse: Make fuse_copy non static Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241127-fuse-uring-for-6-10-rfc4-v7-7-934b3a69baca@ddn.com> References: <20241127-fuse-uring-for-6-10-rfc4-v7-0-934b3a69baca@ddn.com> In-Reply-To: <20241127-fuse-uring-for-6-10-rfc4-v7-0-934b3a69baca@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1732714838; l=3662; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=6nCe00M/Y2uCOcEBUSArlvpHb6TYuQLIjdmKElKH1AA=; b=xtT3OFn6dWbl5bVBInOJ5HpG07A4aoVfVt5fTk3y24Li0pxcp1B5Thhh0epFeIOl5lMYI9igF JB6icG1FwxfAOCjTu+LRvFL/i0K8vv3UvmgpUz6vmy9xaKSHeNtHGMx X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000971E2:EE_|SJ0PR19MB4778:EE_ X-MS-Office365-Filtering-Correlation-Id: 4ea8ca2f-c009-44f0-696d-08dd0ee91939 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|376014|7416014|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?SD9kNQzfRznLX6eslqqqOwCTpl1gfXt?= =?utf-8?q?yeWDkEb56WrLmXRZ5wNtVPWZdMJh3ltEilqYdhoqgotokapR0oIzVbk2qHwZ3wRNF?= =?utf-8?q?BHxC3qN5BaZ/Fs08PUKHWsQdBxB4Ii0pZCpv47KzEV/WuuuoeK7hHw2cCkTPMxYl8?= =?utf-8?q?+e60HtXxVvcQwGYcNG7QS9ZtCuqVKn1r7ukDRToV6mOK8LCqrwXfjCoxGpMhAVdhS?= =?utf-8?q?o4N+LPkdfKhk20bPd/ekZfePjRIfOPSoRD+X+8VT/JYjVvJub0oCJ509Wk+GAzt/c?= =?utf-8?q?sGHC2XRrokAAF6944imGKKWXfcI6tsPPkLJcbR1sxXL6DbbxnP/CvGxVneHCB5B3J?= =?utf-8?q?8bg9J9nh6LKpl3ZNZ5a9ZzHmBVutUzJlbWvoheFVCvWg5ViYAvr2tAgt+v5/UU7AW?= =?utf-8?q?81p9VPyHBWSv8zwycWCX5b2RHWDy8ZYaq3rfk4Uum+EaSatN3frnMQAISaXViyJLw?= =?utf-8?q?FFyoJuryV6uQUcIoxjSvnxuhVcxFXihKoPx2S9eQ6Dfr+XMa4SoyRZBzrBKcb3709?= =?utf-8?q?CMpdrjgN9S+qiLVDwsGOIF1fitgcv7jokOFY9Fed6R3bW9JbAusfWVU3rKYrvCHZO?= =?utf-8?q?oZ6nh8jAqlyWhAvTniRbgwNOctGrmNLNDWN4u2HWLBwRBxmtWmH+s/bJm4l0hMKO9?= =?utf-8?q?T2firWKBoIH82aas5Eyqfhx7b5T5kuXkcxXC9vxRcuEIl6iBNp84boA4sHIkUSJdo?= =?utf-8?q?gojt5RRUUBkfNqTCjJNbeGzWbAuQqLkTPn47oo5ph9yQGkQmFnCoEFFQanItjhxla?= =?utf-8?q?WTBI8WpXP5bP+I4iz3+snKvr1uleuAoCxFxlFazTROblmbwe8JNrDD8ua0azxr+X4?= =?utf-8?q?NjHhEJy1GZAwu7f8jl7X2CvP9ua+Ee7rO3lrHe1aMFT4yW6KULZukljlDmvt1yfa5?= =?utf-8?q?I6lpkV+D7pAOgSlQSotRu4eZNXGczI9+3K9NhtwDJk25aXxCVllbH/HgBbgIIcL6R?= =?utf-8?q?hHJ6i00gPXytHKGgzvSdOEpM6hfZ2WEIL6EazFXHpwhGv0O1qQgOLUwLCJEGWLNiE?= =?utf-8?q?c59ASbom9NPglyqseho9LJgHBHOt90RYWhMbJ0OgkZGZIDUSPPxZjdcCyEWQVoSgG?= =?utf-8?q?KRQYoZEamGBAfboadaIx1mNVEa+CEieP3tUGEnJeZwIbIf9sgBj6w693w32q6K8Bf?= =?utf-8?q?FWuDcr98rvdrwzXspjHZ2nSGp0TN0I0eDzWNpeQQOwTU9fZFDcqwoIXImwDjdySv4?= =?utf-8?q?Vv4Voiusj/Leue3LixYyI4NkjAG8UB75AEB0zMXgzj3J1rYLaxnMInJ4m1bCjbhPZ?= =?utf-8?q?RSSSNUaEMxwWEGJvfnaoEipAV0znhO2sTbg6Z2PgcKQVfWmB4jrOVxhuzK123j2jU?= =?utf-8?q?TciyJhgifbXyAo1klFH/Da8LoB49o38GOGySTAf2/EluNa1EwABg2lD8d1CyvrfsT?= =?utf-8?q?tkd+BrSWpyE?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(36860700013)(376014)(7416014)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: shcZWThaRaRbDTD90U+9ozzKOOGfK0tWYAv/612syOqI6EjhE3tOW028j3glQ8+vTnB2GzdSXb7zqcCnQSAJl+8g1aCPG8AVbnRyDMFjkoJGHpunFoSNjn6roH1wsb4cplJMbqpFC+VRLRNVxtuPYvqm6789dTh0s2l6X9J2bvNn7Nk7SEKglmnbz8h9IZlxc6HASnmqy06hFr98KV1vdcLtB5RtNvnp9KmW7SkDdUU0hXJD6UbfWTEnUmqptCRyU/2QGQdB3RpT0Z8j+dFZGjcaGhEPht1KyOVGvgtXWmfuK/b+v0Q4pwLtWlsT6SCrt6iXPWCG1U93aDJCmkPjlnjQ+RgjmMRMCwv9VACMvRvanWgouKs8zQZh4ipzqmM/THZfoPb5xjuBu74RgwOiqC5looKTWGi5cdGgQhTw6h0QNffoqCxMgOffwS3eFt3P3zs6DK2prBkrRLjLLAZael4MjxBurjTv+xF2Tlj0AL7ytWjfgDtadrGZetL/oe6qPuS2/7Fq2lZ74zVC7I8CgKgtN8KT4SUKNwz1v5h6ynZncHvUN2fEqAOnzU/TcHXwF8UHBloTmOFCMB6228ZBET/Km/vtGQzACvpWiaiScFjWiRIngEb4cvnE+iuQozEKBuOoVbMDLD/SH5XvFqUgoQ== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2024 13:40:46.8902 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4ea8ca2f-c009-44f0-696d-08dd0ee91939 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: MWH0EPF000971E2.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR19MB4778 X-BESS-ID: 1732714851-110778-13452-2181-1 X-BESS-VER: 2019.1_20241126.2220 X-BESS-Apparent-Source-IP: 104.47.66.40 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVsamJmZAVgZQ0NDUPNXQ1DIxJc k4zcw42djSLDHRMMXU0twwOTXJzDBVqTYWAN8UqONBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260718 [from cloudscan15-58.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 Move 'struct fuse_copy_state' and fuse_copy_* functions to fuse_dev_i.h to make it available for fuse-uring. 'copy_out_args()' is renamed to 'fuse_copy_out_args'. Signed-off-by: Bernd Schubert --- fs/fuse/dev.c | 30 ++++++++---------------------- fs/fuse/fuse_dev_i.h | 25 +++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 22 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 0770373492ae9ee83c4154fede9dcfd7be9fb33d..94314bb61ea16b1ea4a42a1a4b36fbf5cbf7ef70 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -679,22 +679,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; @@ -1045,9 +1031,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; @@ -1922,8 +1908,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); @@ -2025,7 +2011,7 @@ static ssize_t fuse_dev_do_write(struct fuse_dev *fud, if (oh.error) err = nbytes != sizeof(oh) ? -EINVAL : 0; else - err = copy_out_args(cs, req->args, nbytes); + err = fuse_copy_out_args(cs, req->args, nbytes); fuse_copy_finish(cs); spin_lock(&fpq->lock); diff --git a/fs/fuse/fuse_dev_i.h b/fs/fuse/fuse_dev_i.h index 08a7e88e002773fcd18c25a229c7aa6450831401..21eb1bdb492d04f0a406d25bb8d300b34244dce2 100644 --- a/fs/fuse/fuse_dev_i.h +++ b/fs/fuse/fuse_dev_i.h @@ -12,6 +12,23 @@ #define FUSE_INT_REQ_BIT (1ULL << 0) #define FUSE_REQ_ID_STEP (1ULL << 1) +struct fuse_arg; +struct fuse_args; + +struct fuse_copy_state { + int write; + struct fuse_req *req; + struct iov_iter *iter; + struct pipe_buffer *pipebufs; + struct pipe_buffer *currbuf; + struct pipe_inode_info *pipe; + unsigned long nr_segs; + struct page *pg; + unsigned int len; + unsigned int offset; + unsigned int move_pages:1; +}; + static inline struct fuse_dev *fuse_get_dev(struct file *file) { /* @@ -23,5 +40,13 @@ static inline struct fuse_dev *fuse_get_dev(struct file *file) void fuse_dev_end_requests(struct list_head *head); +void fuse_copy_init(struct fuse_copy_state *cs, int write, + struct iov_iter *iter); +int fuse_copy_args(struct fuse_copy_state *cs, unsigned int numargs, + unsigned int argpages, struct fuse_arg *args, + int zeroing); +int fuse_copy_out_args(struct fuse_copy_state *cs, struct fuse_args *args, + unsigned int nbytes); + #endif From patchwork Wed Nov 27 13:40: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: 13887001 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 C8DB61922F2; Wed, 27 Nov 2024 13:40:56 +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=1732714860; cv=fail; b=D8aRQHc69RrqJVrITJ/jGTrp4YYJSQkAyLsrfNGONgw8oKvalIiCgsJCaT6QEliyqiKNezMqgFAPu/ubInOnakBZ84rmS0QMUbLKpQOvIzMF/R7dQXjPwkRMW0PD1BKqniDofFowLH0LeT6eJ8LrL5m7g+maS+tCNZ6FX/N0Nzc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732714860; c=relaxed/simple; bh=cjaX2yx71YmzsueEF8hwSqP/9RlAZQ9UgtqGdFh+pVQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=AyL1ZjQ1IAanOkBsilZw7tgTgnDJ3Q5qgO+gmjwbkcW8M8S/KZ8ILSzSbLT6ZunghUOvkp/zYxNv6T6WthCutGVnuyuSb6mF9bPseQfU8HpV27HYpGcFXe5V7p3BYbnHz3gY10OMGODZZghXyn3EH5czWhbwfN9rd8KHkBrHkgE= 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=Fto/n9ML; 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="Fto/n9ML" Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2174.outbound.protection.outlook.com [104.47.55.174]) by mx-outbound42-179.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 27 Nov 2024 13:40:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=N184GB6CI1uN9KuuwY/wp+RCgOybQsc0YVIMQx50EiupzUmWKRZG5aunLaI+VOTMgJPY93cc6gnEoUcLrYiSR2B2Jjw+L+bvb6wzfrKcwRN+YBExrmPMc1r0hLdc9O/jY9xaFm83+Ps9axprs3vJZ/ntmwrSYFzXIjWxHCWINqPDGpUTbvCI9+FU5iuJ5TjgnwJhEdkjrXxeZIaIgxqQ8FC1Qwe1izKsvVB/cUkXmBMJKXelvZcx2ukS+P8CsGGoOBBFmJe5wMSUwqhHqF1l4jAlA1cfiXbwVtLxoL6v6IRbxgNJPoINFZ1mnY2NzSZnR5585c1Q31reISI12FbJGQ== 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=jso3avSOXUYm4pkaE2qlAImfboDaTrV4lluhj8yB4rw=; b=Rp52weXimySDKY1gzU/4frSv2zZu0mN2cDSRHar70xb1x6yNtoebZlKpv7TX76ihteuExBcKVSjODGa94aRusHhYOaWC6DCtItgq2ETCXj2ZnA4jiCxGC4McB8doMEiqHUrR0YxG8NAPvchcjHA7aDqBYlGg9PLm15QqkQHG2DLhtBG5RYYrtSCcKftJO+C+PI0Mfl5tM9mruYOyZ9YHnmVKoIjMt7Im3G7B/sDGym+ocBfdU43yPhzy+oCw8OePB3DHGU0Bxz4UVx0KuXbkgyt5oY/DNF52aDmCdDjZgsU+4sZF1QVLI2Zqq6GvcgR5kIemTSYBr2QWQSeTimH+wg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=bsbernd.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jso3avSOXUYm4pkaE2qlAImfboDaTrV4lluhj8yB4rw=; b=Fto/n9MLnr1o81/V1nKQbWfDbRvmdWp9E5CIPty3Z7xrQSdQEclgZszilRgTQcA311ibmf6u8ND4z+cmjagbXNDNuMFnbZzEoQU9AtuDvUMpGUiEShHPOrJ1bhGEERg/SXXHwj1CD42Fk5+mFMtyrpbH5Wfd1LOCABFdGr81GFs= Received: from DM6PR08CA0051.namprd08.prod.outlook.com (2603:10b6:5:1e0::25) by BY3PR19MB4883.namprd19.prod.outlook.com (2603:10b6:a03:36d::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.13; Wed, 27 Nov 2024 13:40:48 +0000 Received: from DS3PEPF000099E1.namprd04.prod.outlook.com (2603:10b6:5:1e0:cafe::47) by DM6PR08CA0051.outlook.office365.com (2603:10b6:5:1e0::25) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.12 via Frontend Transport; Wed, 27 Nov 2024 13:40:48 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by DS3PEPF000099E1.mail.protection.outlook.com (10.167.17.196) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.12 via Frontend Transport; Wed, 27 Nov 2024 13:40:47 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 1D1CD55; Wed, 27 Nov 2024 13:40:47 +0000 (UTC) From: Bernd Schubert Date: Wed, 27 Nov 2024 14:40:25 +0100 Subject: [PATCH RFC v7 08/16] fuse: Add fuse-io-uring handling into fuse_copy Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241127-fuse-uring-for-6-10-rfc4-v7-8-934b3a69baca@ddn.com> References: <20241127-fuse-uring-for-6-10-rfc4-v7-0-934b3a69baca@ddn.com> In-Reply-To: <20241127-fuse-uring-for-6-10-rfc4-v7-0-934b3a69baca@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1732714838; l=1731; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=cjaX2yx71YmzsueEF8hwSqP/9RlAZQ9UgtqGdFh+pVQ=; b=RVitUnNpORwtqn0U0xAfaK06SA8BygOFgltSbmHtl0w+Mdpl96cu8o0wLFdvHChJpwQRHBg9P 8AWl9k/zbOUD7SVRQfsRKiS9sPe8rISgNYKiX3GZMEpuJc6h3en23fs X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099E1:EE_|BY3PR19MB4883:EE_ X-MS-Office365-Filtering-Correlation-Id: ffb1d979-138c-4d34-8a62-08dd0ee919bf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|7416014|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?JvDVuL6JWPVm8cVO7Tcv6dQ8nY07zpV?= =?utf-8?q?Md7lptwDX5pU58b1uvylgIrMgMwTvcOqmPKjBHY5QT5+ZIgBG/+G9TIEMVKo+4czF?= =?utf-8?q?1xClegx4vn3IEDd+dtzn7/KpDDP9sTVmhYoV4ZAPxSPzqZAKf+834fQMj7nefYuxd?= =?utf-8?q?tl6cXqkKhn6PiCGIS2/ocHLzS1dfG6mUyi/ByUtVD23dpOttp5tiB6kIPBwZMZZto?= =?utf-8?q?jjumkNBVscQxvOzVuuOx75gPkGZBVDQMrDmuA9c736TT/0BxWEXqrp++SxtLXrDDh?= =?utf-8?q?inNPdosSi0Kxuy1LY7EgKEKkk3vXhJ1Vw+Q5qvLFHzfMebzbXNkJagqvLBxVqoKK3?= =?utf-8?q?sM4jn3IxdsJli8yMmcLwJbzb/6/7UkJw3lrq1s6ZwQzgeL52ci3ucEcpuu9ZZto6m?= =?utf-8?q?1rDX9mILl6GC5LsVp72C3yx8Oorn58tuep8IWZDj1sDRaOPgVrf2/S5MrtaPXc3pr?= =?utf-8?q?zZWa3pCBU5F8ekBWjoJaKCwiK0Uyd9jskwHH+PcN1KqT8s26Q2psjAK6hrHuNDra2?= =?utf-8?q?JtUUYK+7/MsqeX94EOaYvzvxgEfPz2wAu8APSrmC1mAA8AbHaMjFqznAzwV6yfNpb?= =?utf-8?q?If17oAVWoggtexFHgZ38vA9aKcEDAOKDFP0UKVOWc62ESaMc1xw7PEbFmeEmbyuEs?= =?utf-8?q?DTy+UI6nILz6klXai44lvJSR93Z0LgtXEivUMMKyT1L2o1v/lLZx2x4Xmv8lzqQfd?= =?utf-8?q?D2yqF3iULXmE4bM/fexSeHU6/SS0zurlhoBbaE6xlwRGbOstwQfso1iZOzoJIFptQ?= =?utf-8?q?mdgiwsBk2YO6F8dH5Ud+Ik2DubxHApIzpO2SqzNscoftY0pwGCqdgDo1asgUbE6RR?= =?utf-8?q?zosOnKnXqOtOpRxybseX/8P8lAJzmwKfwxWgYJB7fk8V0HuZ7ebj9DlbvWw1Ck3oH?= =?utf-8?q?qMLTGckKRShkhVnKjc4fO6gknAWQ7RzMBVuASLdJyaRKgUFi9lxz6aw2NMobClw7F?= =?utf-8?q?Y7epKtyecZkIMgPdEhbElO5lbUJ10V1vK4G2DYAfXpoxbX4ja1s06aCtqn7H+xT+O?= =?utf-8?q?QEfFCmlSgol3BIvW/NYSTqPs+RIt6mxje7Udt4qyW+qHqypqVmTLZWFC9QI/5BBr2?= =?utf-8?q?1yWV+sDc2HTPfXVf2lF44gS6NdyHPnLVTaXoDyAur6cw+9GymUXGNKVhr0cP7iNUX?= =?utf-8?q?non1pnWjstYHcN4pyFoOjhuZGqgv5w72pcQlKkvuNQ2b2L6b6+43/oD10qsTQuclT?= =?utf-8?q?vgIiqU7Rj7/oGXVEQB6wugMekHDD7e3p6Awq1YocvWZ+0wolMKv+NdhNiE5b2NRb9?= =?utf-8?q?EVt7pJKvIzRXztgbWEX2cgk4KVQ3Mk8zMlIDlD1DzS1AmfKfQLfAk79jTU7Uh7FkO?= =?utf-8?q?RzRQvo7TZiVlv+EcOrpVQStVxQRIMOLv8sdC4rJEHarsFvfmlD64wcJ8vVCnWtv6/?= =?utf-8?q?QdCH3aUuyYK?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(36860700013)(7416014)(376014)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 8PjmUQ9s8xxq3d/PF3vqO9k8UAnV1uzRqdnrzNBUl4QaQqjQRl/j+O5BHeX/jz/upk+3xtxEzXNjpPU/DybcWc/xkC6ju7CmuylsaDG612WET1ap8i0BysK3HTwt/40AhtxZQQ0B4QkB8xzhoHhA2SBFtnMba1NgLGCbGVbMJIu219hVAjsEXC2NBeBy88HWx8D8INn9heHfO74gYcIaZZ5PDZsXg1fJDfvwsb/9KLz/FimqwFOdP9c44GuAmORr8/TLJnUUjRrjJRsn2PnUP44/oNoGur1ZrM6rFlvu2skDqQFblTltomSDc1VQlUa+BUWg1XuvgmSfgHAc+dCBYnJb7wllGbkMsOHGDar8sS4rNxKXaj/I9LH2lTI8b0TqZGIgs3ga8UxBrYUe3JSeXtVXf8eYRNZay0dvZf+raZ0sleoOTAM+B8KYl1Jhk08+rjR4evQRqF8JsjG8m7Mw9+W08j3VpGAa8I/joDiYX0Uzd2NqWmq51GSOsRyQvvGw8iLYG2Ivm6kxg7Cuin7RQJETT/ZIpGU+M1TDR9tmEQRWnKyQ286Mz10EfaSHXZbSR1LZJmvBjQoZpr5RWLlYwzXIPbe25ieuMs6MX9X39y9T/HjJfCLuvuWVDOVEeABpzlstCR441kp2JIHEg+Z6zw== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2024 13:40:47.7380 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ffb1d979-138c-4d34-8a62-08dd0ee919bf X-MS-Exchange-CrossTenant-Id: 753b6e26-6fd3-43e6-8248-3f1735d59bb4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=753b6e26-6fd3-43e6-8248-3f1735d59bb4;Ip=[50.222.100.11];Helo=[uww-mrp-01.datadirectnet.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF000099E1.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY3PR19MB4883 X-BESS-ID: 1732714851-110931-13381-12308-1 X-BESS-VER: 2019.1_20241126.2220 X-BESS-Apparent-Source-IP: 104.47.55.174 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoZm5iZAVgZQ0Mg00dgk0cw8NS 052cwiKQXIsDBITE5LNk5OMbQwN1aqjQUAHN3bbEEAAAA= X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260718 [from cloudscan13-101.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 Add special fuse-io-uring into the fuse argument copy handler. Signed-off-by: Bernd Schubert --- fs/fuse/dev.c | 12 +++++++++++- fs/fuse/fuse_dev_i.h | 5 +++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 94314bb61ea16b1ea4a42a1a4b36fbf5cbf7ef70..51d9c14a8ede9348661921f5d5a6d837c76f91ee 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -787,6 +787,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; } @@ -1911,7 +1914,14 @@ static struct fuse_req *request_find(struct fuse_pqueue *fpq, u64 unique) int fuse_copy_out_args(struct fuse_copy_state *cs, struct fuse_args *args, unsigned nbytes) { - unsigned reqsize = sizeof(struct fuse_out_header); + + unsigned int reqsize = 0; + + /* + * Uring has all headers separated from args - args is payload only + */ + if (!cs->is_uring) + reqsize = sizeof(struct fuse_out_header); reqsize += fuse_len_args(args->out_numargs, args->out_args); diff --git a/fs/fuse/fuse_dev_i.h b/fs/fuse/fuse_dev_i.h index 21eb1bdb492d04f0a406d25bb8d300b34244dce2..0708730b656b97071de9a5331ef4d51a112c602c 100644 --- a/fs/fuse/fuse_dev_i.h +++ b/fs/fuse/fuse_dev_i.h @@ -27,6 +27,11 @@ struct fuse_copy_state { unsigned int len; unsigned int offset; unsigned int move_pages:1; + unsigned int is_uring:1; + struct { + /* overall offset with the user buffer */ + unsigned int offset; + } ring; }; static inline struct fuse_dev *fuse_get_dev(struct file *file) From patchwork Wed Nov 27 13:40: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: 13887011 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 7D1571FCF45; Wed, 27 Nov 2024 13:40:58 +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=1732714864; cv=fail; b=F4vVMlC5QTSn37j/LHatcDVsFdaS27c6v/FyX39t4tg5H1ikjjaEXjQ3EVRr7zLYNygRfYkzxB8j6MlytRUCNrok2yaf1+KuUmth676GsLj1Oh3vKyG4UboQ+yf6oUnIXANDWegVim/98u3wldWxkEqkfctwvLubqgfkpYzHJwQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732714864; c=relaxed/simple; bh=FP4kaQrpOhGoijBglp0kC3Poxw+CWk9aCgwJwUICPEU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=A9sNhLAjzi70hNzzcnrR0ji4ZKPtNL35FaqQvCoxkw1bVM6b0AT6Xqjk+mb9T4HhHcLEp/MuYtWKVpqIxr1qsXthngXEB7kddhu4oytRvAkHd29SJMlpGX+WAnQ+bC0sA2TVns9iO7rYCb7cqnzKkgPJO425ocwwlTJrZ9HiGpg= 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=A9qcTsJI; 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="A9qcTsJI" Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11lp2168.outbound.protection.outlook.com [104.47.56.168]) by mx-outbound21-113.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 27 Nov 2024 13:40:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lpwRcEncA2b+caKA/WCbBlEbLC2/0dC9Kkz2Ya1FheRTqs23Zj5Pe/vk8iypBv1ZOx3EwhLXVTyaFUDKLwPNUM19zYWC8+7+U/uajblKJ50ganDiE54vUHwVPMgmZgQZFDktFMUMM6s8ifN5p2XseCp6427xuGc7u9hA0NgEscQISRQPf43U6YR9zQt6FKdepLC39WhPHuDKR+Xpx2aF7rKk+SP2bGnyJWKQ0qfiVMrFZvcoy70DigWkXOXMDI49vgoQJX1u6NQR/13r9LxMLU2tBoFnGOsHXMeOhCv6hlVOSqZHGXKhRYrYUhkHySjyz3dbz6H4PODDkZQ3glNpAQ== 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=DflUWVFNG5DdHkfJb4MR5OPuglwmiwARfvyo3IAeyDI=; b=hXBx559NK5lT8WdtJj4WwjCrmiIuTtDuqoVZWNqKOLDGLaE7QmIuk4IcHBw4dgh4xZErziJZfm48mKpH2lXVz6mVvocu5c0Kteqv4CKcG6dFeDgAg71iClKcbg+sPUWvmA2Vy9jVH72rUI/Dm6YmF/6EgwgMwKaJHVHtygYlrpcponEFwcFrc0MgobQA5tJWEj0GLGGnKh80p03A3cN6ueVkdY5Sa7P33aYsTThUK/Hsk7PB0W2NYNZfPmy+a8S24RaoKOINuN6nVUjuTB6OKZT8aMPrLBFWd3EFxdmlChmKCDfHaNs9cCfreUEUnxWsXV4gIJBE+U9IhCXKkZq58A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=bsbernd.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DflUWVFNG5DdHkfJb4MR5OPuglwmiwARfvyo3IAeyDI=; b=A9qcTsJILlnDSlIVZ6tpwiuSbDWWDjlMLNegC4VL5wYNXPGKuptK98QnDW5eNpgvj6mmo8MR9tDctxAbYatK8vQFYKwqwwD+pCdEAs6oYk0iwAoKmVT3eFAh/8C8OtfletfB9MacOhH8ek6SbYUCh9ohfBjWv0WDROABHhmHbtU= Received: from SJ0PR05CA0168.namprd05.prod.outlook.com (2603:10b6:a03:339::23) by SN7PR19MB7817.namprd19.prod.outlook.com (2603:10b6:806:2ee::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8182.21; Wed, 27 Nov 2024 13:40:49 +0000 Received: from MWH0EPF000971E5.namprd02.prod.outlook.com (2603:10b6:a03:339:cafe::60) by SJ0PR05CA0168.outlook.office365.com (2603:10b6:a03:339::23) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.12 via Frontend Transport; Wed, 27 Nov 2024 13:40:49 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by MWH0EPF000971E5.mail.protection.outlook.com (10.167.243.73) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.12 via Frontend Transport; Wed, 27 Nov 2024 13:40:48 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 14E022D; Wed, 27 Nov 2024 13:40:47 +0000 (UTC) From: Bernd Schubert Date: Wed, 27 Nov 2024 14:40:26 +0100 Subject: [PATCH RFC v7 09/16] fuse: {uring} Add uring sqe commit and fetch support Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241127-fuse-uring-for-6-10-rfc4-v7-9-934b3a69baca@ddn.com> References: <20241127-fuse-uring-for-6-10-rfc4-v7-0-934b3a69baca@ddn.com> In-Reply-To: <20241127-fuse-uring-for-6-10-rfc4-v7-0-934b3a69baca@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1732714838; l=18145; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=FP4kaQrpOhGoijBglp0kC3Poxw+CWk9aCgwJwUICPEU=; b=xzG9Qr0v0H9k+Qb8MO0IVwbiY7edd/VZwGPAyAP+bgGqXWpdJ/djMxCec18gxJnIhM8EOPAX/ fDf9t9F15ucBvVF070WE2SAnREQWZFDeuWaKcwpeVMILgcI+pOhZC3+ X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000971E5:EE_|SN7PR19MB7817:EE_ X-MS-Office365-Filtering-Correlation-Id: 02ba7d59-088d-4103-73b2-08dd0ee91a54 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|82310400026|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?q?vRoip32nl/h79RKHYfaGOsaCz/2VJWA?= =?utf-8?q?LnI6wjxFiJKyAIoTRGklpn3ySv4vherSCPlJWwMohMmVUpwSzFjwNGtaAUp83QaCc?= =?utf-8?q?YdUAqJSy/+AfTPTiOHwPGwaXZJBAbjoabujMjrxiyVd7PGqaRk9U3LKZFydlJT/vR?= =?utf-8?q?blh6XfwxIKLYS8JZYWwffu5Cck6aL9iJTwztJNYOkS1qhRnU+gvIaGfFne3+JW1tl?= =?utf-8?q?zwj3p+OnL6t6xcl7+jTYY0yY3qathnAoqLiexASuH7+55NHkXU4ITa4WZUb/aNR1P?= =?utf-8?q?mD0l/hziG2WaHyLJauyJEuwbCkQzyOhjZqLA3bEwRNY2Qd2+NITWb/jqmgZj1eADg?= =?utf-8?q?i8lUnnCk8j9O/zGOhaKPAcFUGZnTxQ3ReXlxJZH/K56DXdCWoVN/BDsGGZip4tL39?= =?utf-8?q?qV9y8WfvxwOX2KFeRepZPO+zTXMf29YINNW2cx1mRHKNIEn1lvJWoyWYDI6yks138?= =?utf-8?q?Zo1j3bnUDH/ufSwEW6lT4xrjCmknTs7j8skSSajNdXYf582+4VCDVQmAkRo27zMKD?= =?utf-8?q?JuRfgWvXdpxJi+f2D8ggp9W+kY1qhKWr2a41WuMhyyAR2nDpY580vaKcu4sQeXVUb?= =?utf-8?q?SrqQOtQ/NFNXTD5Wbgy5CxuELPouGUOzJAGEHkq8X6E37r98C+QZQHCo2aMbslzWu?= =?utf-8?q?KGEGdTJAYY/waciVxH76PrjzSBm6S/FmtfOBeWdOBukRriys0BOBobc7zeculMirs?= =?utf-8?q?MnXMrmyHC3XbOIC7VlD/O/v4HmPUjY3JHiiLfBlcAB4dGhNIJGVHmxuS0Y2FlFQmw?= =?utf-8?q?Ka1OOhhxru8iE9tZJ263T7QRxdJXt0UcsIoBr2UDEs7vR62kKi4bCkekKKf96faQ5?= =?utf-8?q?86yUxVjF9T8p8B/t1EtE/6PfwKQ+mZvfof95adKfFg52j342BYh5KNSrY6z+9eRBh?= =?utf-8?q?mKx7/zp/l6ep7c3ykvoMqQeQ9QHf4IyEofCWSPjRKHhauTKEedOudP+TUSw0Sy5Yt?= =?utf-8?q?6CPm/Yvgnp6oiVr2oTDvnJuWkY4p7Dyi8BZQp9FT9s6LOPGClI6HUPDYsw+3oq35J?= =?utf-8?q?RY8VbQ6gRQBMzYDjW4gW6qqMCUILm66Nvmt0CE9YPJfDFBoN5UWnT3hwaZpNNJE1p?= =?utf-8?q?alSDMh4r6YOHGuYglIgUK5XGmCHlD1s/fRWIJ0bVOguSu9edK7OKMxZ/Lo1aRdNPD?= =?utf-8?q?tx8Lv2+YPagdtx1a05nMybQhYHr+nl3uaNUI0C0pFXELsrr5xLjkdL6EjMyn04VK0?= =?utf-8?q?YcmeMQ/7L13nR0DFxLVbZ4e/YS0tSAY5gj/ptwX+CegruNhSBIck/Jqc1KJGvbu+P?= =?utf-8?q?Hr45ITdrQbOKy8Z+fYcdcONwZrwrqxkh2mKbrbs0iiHCmlvqCzD6N4gNDCXGQrZ/b?= =?utf-8?q?0ZOLbtVNNx1Qc3zxBKDL5drXhXRk9tBTVxXa5TfDo4m+0whwQs8NF8a5b8wqnEgKb?= =?utf-8?q?TwP8ZokHuEa?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(7416014)(82310400026)(1800799024)(36860700013);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: cGsltAR4SrIeGBDIvJtrCrDN6pcyBDL5Own1/rzvSSP5/QHmu9Ihs0w9bhjSvE2TIFQt1WPH8zOv6pLkRQKNy2F5JUvQnn5AdxutRolr+Hw/cXicABeYyH7BChKlShrG+6TC7rNWWK08DMyLzyjT9/w0ovvZVeTFxAsUvfHRMinjb1hjlj123QYlXUMKObvJavnBDdMngMgBWGjwMlyzi+1GicsNKW8cSf5v/ZYQUmESBx5xM0SqCv7TjjKvIeEg5jKsG+MnLp28r8/wfHH6ykJ0tX0tipWY3Lo4JeiT3XcoHDGrZSYBovbsAqAngWRV6mnLOGRjdbBVO+v/WfGzQsWPnBtCB4yKlA+kB5C10XxuVrHF4Hi+H2sJ7Tr3Nb0OA/vin0vQi/CUZpb0nfgAclvhVJw9SZzGvy6NDZFsRHGtgAJ1E11U4de79oUOGHxmCRmWKCp/TZFjVZAgo6IiGtznquoE4ixxx7M9HHN/aign8LcIh15IcSGanL5yBCKpxnfcRk36ChdqODs6uHLMzLLNsAHJym3GE27WC212FawyLb874IAWxGjuJ9juz6MY1QUAnPiRET8Y52oAPQd+BcvgJY7lIfVDimUY6QOB4t+l2T4UGmsL8Qipbgk2cICv0Wyu5ftfb/2jyU87HH83rA== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2024 13:40:48.7452 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 02ba7d59-088d-4103-73b2-08dd0ee91a54 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: MWH0EPF000971E5.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR19MB7817 X-BESS-ID: 1732714852-105489-13355-11895-1 X-BESS-VER: 2019.1_20241126.2220 X-BESS-Apparent-Source-IP: 104.47.56.168 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVobmpgZmQGYGUNTUwjgl1dAsyc Ak0cI42cTUMs3C0sg4Jc3MKNHQNDUtVak2FgDKjgiNQgAAAA== X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260718 [from cloudscan23-53.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 This adds support for fuse request completion through ring SQEs (FUSE_URING_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 | 423 ++++++++++++++++++++++++++++++++++++++++++++++++++ fs/fuse/dev_uring_i.h | 12 ++ fs/fuse/fuse_dev_i.h | 6 + fs/fuse/fuse_i.h | 9 ++ fs/fuse/inode.c | 2 +- 6 files changed, 454 insertions(+), 4 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 51d9c14a8ede9348661921f5d5a6d837c76f91ee..143ce48a1898d911aafbba2b2e734805509169c2 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -221,7 +221,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); } @@ -1899,7 +1899,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; @@ -1983,7 +1983,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 af9c5f116ba1dcf6c01d0359d1a06491c92c32f9..7bb07f5ba436fcb89537f0821f08a7167da52902 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -24,6 +24,19 @@ bool fuse_uring_enabled(void) return enable_uring; } +static void fuse_uring_req_end(struct fuse_ring_ent *ring_ent, bool set_err, + int error) +{ + struct fuse_req *req = ring_ent->fuse_req; + + if (set_err) + req->out.h.error = error; + + clear_bit(FR_SENT, &req->flags); + fuse_request_end(ring_ent->fuse_req); + ring_ent->fuse_req = NULL; +} + static int fuse_ring_ent_unset_userspace(struct fuse_ring_ent *ent) { struct fuse_ring_queue *queue = ent->queue; @@ -54,8 +67,11 @@ void fuse_uring_destruct(struct fuse_conn *fc) continue; WARN_ON(!list_empty(&queue->ent_avail_queue)); + WARN_ON(!list_empty(&queue->ent_w_req_queue)); WARN_ON(!list_empty(&queue->ent_commit_queue)); + WARN_ON(!list_empty(&queue->ent_in_userspace)); + kfree(queue->fpq.processing); kfree(queue); ring->queues[qid] = NULL; } @@ -114,13 +130,21 @@ static struct fuse_ring_queue *fuse_uring_create_queue(struct fuse_ring *ring, { struct fuse_conn *fc = ring->fc; struct fuse_ring_queue *queue; + struct list_head *pq; queue = kzalloc(sizeof(*queue), GFP_KERNEL_ACCOUNT); if (!queue) return ERR_PTR(-ENOMEM); + pq = kcalloc(FUSE_PQ_HASH_SIZE, sizeof(struct list_head), GFP_KERNEL); + if (!pq) { + kfree(queue); + return ERR_PTR(-ENOMEM); + } + spin_lock(&fc->lock); if (ring->queues[qid]) { spin_unlock(&fc->lock); + kfree(queue->fpq.processing); kfree(queue); return ring->queues[qid]; } @@ -131,6 +155,12 @@ 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_commit_queue); + INIT_LIST_HEAD(&queue->ent_w_req_queue); + INIT_LIST_HEAD(&queue->ent_in_userspace); + INIT_LIST_HEAD(&queue->fuse_req_queue); + + queue->fpq.processing = pq; + fuse_pqueue_init(&queue->fpq); WRITE_ONCE(ring->queues[qid], queue); spin_unlock(&fc->lock); @@ -138,6 +168,213 @@ static struct fuse_ring_queue *fuse_uring_create_queue(struct fuse_ring *ring, 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; + + err = -EINVAL; + if (oh->unique == 0) { + /* Not supportd through io-uring yet */ + pr_warn_once("fuse: notify through fuse-io-uring not supported\n"); + goto seterr; + } + + err = -EINVAL; + if (oh->error <= -ERESTARTSYS || oh->error > 0) + goto seterr; + + if (oh->error) { + err = oh->error; + goto err; + } + + err = -ENOENT; + if ((oh->unique & ~FUSE_INT_REQ_BIT) != req->in.h.unique) { + pr_warn_ratelimited("Unexpected seqno mismatch, expected: %llu got %llu\n", + req->in.h.unique, oh->unique & ~FUSE_INT_REQ_BIT); + goto seterr; + } + + /* + * Is it an interrupt reply ID? + * XXX: Not supported through fuse-io-uring yet, it should not even + * find the request - should not happen. + */ + WARN_ON_ONCE(oh->unique & FUSE_INT_REQ_BIT); + + return 0; + +seterr: + oh->error = err; +err: + return err; +} + +static int fuse_uring_copy_from_ring(struct fuse_ring *ring, + struct fuse_req *req, + struct fuse_ring_ent *ent) +{ + struct fuse_copy_state cs; + struct fuse_args *args = req->args; + struct iov_iter iter; + int err, res; + struct fuse_uring_ent_in_out ring_in_out; + + res = copy_from_user(&ring_in_out, &ent->headers->ring_ent_in_out, + sizeof(ring_in_out)); + if (res) + return -EFAULT; + + err = import_ubuf(ITER_SOURCE, ent->payload, 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, ring_in_out.payload_sz); +} + + /* + * Copy data from the req to the ring buffer + */ +static int fuse_uring_copy_to_ring(struct fuse_ring *ring, struct fuse_req *req, + struct fuse_ring_ent *ent) +{ + struct fuse_copy_state cs; + struct fuse_args *args = req->args; + struct fuse_in_arg *in_args = args->in_args; + int num_args = args->in_numargs; + int err, res; + struct iov_iter iter; + struct fuse_uring_ent_in_out ring_in_out = { .flags = 0 }; + + if (num_args == 0) + return 0; + + err = import_ubuf(ITER_DEST, ent->payload, ent->max_arg_len, &iter); + if (err) { + pr_info_ratelimited("fuse: Import of user buffer failed\n"); + return err; + } + + fuse_copy_init(&cs, 1, &iter); + cs.is_uring = 1; + cs.req = req; + + /* + * Expectation is that the first argument is the per op header. + * Some op code have that as zero. + */ + if (args->in_args[0].size > 0) { + res = copy_to_user(&ent->headers->op_in, in_args->value, + in_args->size); + err = res > 0 ? -EFAULT : res; + if (err) { + pr_info_ratelimited("Copying the header failed.\n"); + return err; + } + } + in_args++; + num_args--; + + /* copy the payload */ + err = fuse_copy_args(&cs, num_args, args->in_pages, + (struct fuse_arg *)in_args, 0); + if (err) { + pr_info_ratelimited("%s fuse_copy_args failed\n", __func__); + return err; + } + + ring_in_out.payload_sz = cs.ring.offset; + res = copy_to_user(&ent->headers->ring_ent_in_out, &ring_in_out, + sizeof(ring_in_out)); + err = res > 0 ? -EFAULT : res; + if (err) + return err; + + return 0; +} + +static int +fuse_uring_prepare_send(struct fuse_ring_ent *ring_ent) +{ + struct fuse_ring_queue *queue = ring_ent->queue; + struct fuse_ring *ring = queue->ring; + struct fuse_req *req = ring_ent->fuse_req; + int err = 0, res; + + if (WARN_ON(ring_ent->state != FRRS_FUSE_REQ)) { + pr_err("qid=%d ring-req=%p invalid state %d on send\n", + queue->qid, ring_ent, ring_ent->state); + err = -EIO; + } + + if (err) + return err; + + /* copy the request */ + err = fuse_uring_copy_to_ring(ring, req, ring_ent); + if (unlikely(err)) { + pr_info("Copy to ring failed: %d\n", err); + goto err; + } + + /* copy fuse_in_header */ + res = copy_to_user(&ring_ent->headers->in_out, &req->in.h, + sizeof(req->in.h)); + err = res > 0 ? -EFAULT : res; + if (err) + goto err; + + set_bit(FR_SENT, &req->flags); + return 0; + +err: + fuse_uring_req_end(ring_ent, true, err); + return err; +} + +/* + * Write data to the ring buffer and send the request to userspace, + * userspace will read it + * This is comparable with classical read(/dev/fuse) + */ +static int fuse_uring_send_next_to_ring(struct fuse_ring_ent *ring_ent) +{ + 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; +} + /* * Make a ring entry available for fuse_req assignment */ @@ -148,6 +385,189 @@ static void fuse_uring_ent_avail(struct fuse_ring_ent *ring_ent, ring_ent->state = FRRS_WAIT; } +/* Used to find the request on SQE commit */ +static void fuse_uring_add_to_pq(struct fuse_ring_ent *ring_ent, + struct fuse_req *req) +{ + struct fuse_ring_queue *queue = ring_ent->queue; + struct fuse_pqueue *fpq = &queue->fpq; + unsigned int hash; + + req->ring_entry = ring_ent; + hash = fuse_req_hash(req->in.h.unique); + list_move_tail(&req->list, &fpq->processing[hash]); +} + +/* + * Assign a fuse queue entry to the given entry + */ +static void fuse_uring_add_req_to_ring_ent(struct fuse_ring_ent *ring_ent, + struct fuse_req *req) +{ + struct fuse_ring_queue *queue = ring_ent->queue; + + lockdep_assert_held(&queue->lock); + + if (WARN_ON_ONCE(ring_ent->state != FRRS_WAIT && + ring_ent->state != FRRS_COMMIT)) { + pr_warn("%s qid=%d state=%d\n", __func__, ring_ent->queue->qid, + ring_ent->state); + } + list_del_init(&req->list); + clear_bit(FR_PENDING, &req->flags); + ring_ent->fuse_req = req; + ring_ent->state = FRRS_FUSE_REQ; + list_move(&ring_ent->list, &queue->ent_w_req_queue); + fuse_uring_add_to_pq(ring_ent, req); +} + +/* + * Release the ring entry and fetch the next fuse request if available + * + * @return true if a new request has been fetched + */ +static bool fuse_uring_ent_assign_req(struct fuse_ring_ent *ring_ent) + __must_hold(&queue->lock) +{ + struct fuse_req *req = 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); + } + + return req ? true : false; +} + +/* + * Read data from the ring buffer, which user space has written to + * This is comparible with handling of classical write(/dev/fuse). + * Also make the ring request available again for new fuse requests. + */ +static void fuse_uring_commit(struct fuse_ring_ent *ring_ent, + unsigned int issue_flags) +{ + struct fuse_ring *ring = ring_ent->queue->ring; + struct fuse_conn *fc = ring->fc; + struct fuse_req *req = ring_ent->fuse_req; + ssize_t err = 0; + bool set_err = false; + + err = copy_from_user(&req->out.h, &ring_ent->headers->in_out, + sizeof(req->out.h)); + if (err) { + req->out.h.error = err; + goto out; + } + + err = fuse_uring_out_header_has_err(&req->out.h, req, fc); + if (err) { + /* req->out.h.error already set */ + goto out; + } + + err = fuse_uring_copy_from_ring(ring, req, ring_ent); + if (err) + set_err = true; + +out: + fuse_uring_req_end(ring_ent, set_err, err); +} + +/* + * Get the next fuse req and send it + */ +static void fuse_uring_next_fuse_req(struct fuse_ring_ent *ring_ent, + struct fuse_ring_queue *queue) +{ + int has_next, err; + int prev_state = ring_ent->state; + + do { + spin_lock(&queue->lock); + has_next = fuse_uring_ent_assign_req(ring_ent); + if (!has_next) { + fuse_uring_ent_avail(ring_ent, queue); + spin_unlock(&queue->lock); + break; /* no request left */ + } + spin_unlock(&queue->lock); + + err = fuse_uring_send_next_to_ring(ring_ent); + if (err) + ring_ent->state = prev_state; + } while (err); +} + +/* FUSE_URING_REQ_COMMIT_AND_FETCH handler */ +static int fuse_uring_commit_fetch(struct io_uring_cmd *cmd, int issue_flags, + struct fuse_conn *fc) +{ + const struct fuse_uring_cmd_req *cmd_req = io_uring_sqe_cmd(cmd->sqe); + struct fuse_ring_ent *ring_ent; + int err; + struct fuse_ring *ring = fc->ring; + struct fuse_ring_queue *queue; + uint64_t commit_id = cmd_req->commit_id; + struct fuse_pqueue fpq; + struct fuse_req *req; + + err = -ENOTCONN; + if (!ring) + return err; + + queue = ring->queues[cmd_req->qid]; + if (!queue) + return err; + fpq = queue->fpq; + + spin_lock(&queue->lock); + /* Find a request based on the unique ID of the fuse request + * This should get revised, as it needs a hash calculation and list + * search. And full struct fuse_pqueue is needed (memory overhead). + * As well as the link from req to ring_ent. + */ + req = fuse_request_find(&fpq, commit_id); + err = -ENOENT; + if (!req) { + pr_info("qid=%d commit_id %llu not found\n", queue->qid, + commit_id); + spin_unlock(&queue->lock); + return err; + } + list_del_init(&req->list); + ring_ent = req->ring_entry; + req->ring_entry = NULL; + + err = fuse_ring_ent_unset_userspace(ring_ent); + if (err != 0) { + pr_info_ratelimited("qid=%d commit_id %llu state %d", + queue->qid, commit_id, ring_ent->state); + spin_unlock(&queue->lock); + return err; + } + + ring_ent->cmd = cmd; + spin_unlock(&queue->lock); + + /* without the queue lock, as other locks are taken */ + fuse_uring_commit(ring_ent, issue_flags); + + /* + * Fetching the next request is absolutely required as queued + * fuse requests would otherwise not get processed - committing + * and fetching is done in one step vs legacy fuse, which has separated + * read (fetch request) and write (commit result). + */ + fuse_uring_next_fuse_req(ring_ent, queue); + return 0; +} + /* * fuse_uring_req_fetch command handling */ @@ -310,6 +730,9 @@ int fuse_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags) return err; } break; + case FUSE_URING_REQ_COMMIT_AND_FETCH: + err = fuse_uring_commit_fetch(cmd, issue_flags, fc); + break; default: return -EINVAL; } diff --git a/fs/fuse/dev_uring_i.h b/fs/fuse/dev_uring_i.h index 75c644cc0b2bb3721b08f8695964815d53f46e92..b2722828bd20dce5f5bd7884ba87861fb6e0d97b 100644 --- a/fs/fuse/dev_uring_i.h +++ b/fs/fuse/dev_uring_i.h @@ -20,6 +20,9 @@ enum fuse_ring_req_state { /* The ring entry is waiting for new fuse requests */ FRRS_WAIT, + /* The ring entry got assigned a fuse req */ + FRRS_FUSE_REQ, + /* The ring entry is in or on the way to user space */ FRRS_USERSPACE, }; @@ -72,7 +75,16 @@ struct fuse_ring_queue { * entries in the process of being committed or in the process * to be send to userspace */ + struct list_head ent_w_req_queue; struct list_head ent_commit_queue; + + /* entries in userspace */ + struct list_head ent_in_userspace; + + /* fuse requests waiting for an entry slot */ + struct list_head fuse_req_queue; + + struct fuse_pqueue fpq; }; /** diff --git a/fs/fuse/fuse_dev_i.h b/fs/fuse/fuse_dev_i.h index 0708730b656b97071de9a5331ef4d51a112c602c..d7bf72dabd84c3896d1447380649e2f4d20b0643 100644 --- a/fs/fuse/fuse_dev_i.h +++ b/fs/fuse/fuse_dev_i.h @@ -7,6 +7,7 @@ #define _FS_FUSE_DEV_I_H #include +#include /* Ordinary requests have even IDs, while interrupts IDs are odd */ #define FUSE_INT_REQ_BIT (1ULL << 0) @@ -14,6 +15,8 @@ struct fuse_arg; struct fuse_args; +struct fuse_pqueue; +struct fuse_req; struct fuse_copy_state { int write; @@ -43,6 +46,9 @@ static inline struct fuse_dev *fuse_get_dev(struct file *file) return READ_ONCE(file->private_data); } +unsigned int fuse_req_hash(u64 unique); +struct fuse_req *fuse_request_find(struct fuse_pqueue *fpq, u64 unique); + void fuse_dev_end_requests(struct list_head *head); void fuse_copy_init(struct fuse_copy_state *cs, int write, diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index a21256ec4c3b4bd7c67eae2d03b68d87dcc8234b..dd628996bbd45b375ca36694067f7be3e58698fa 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; @@ -1221,6 +1225,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 76267c79e920204175e5713853de8214c5555d46..2943d25bff9a96fde8c3b51ea8fb02eedd3e6004 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -906,7 +906,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 Nov 27 13:40: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: 13887008 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 EF56B1FCF66; Wed, 27 Nov 2024 13:40:59 +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=1732714863; cv=fail; b=NByMyI7KtNRRGDCk1ETv6xjuTiPeHAXnvRr1M6dpi+pddecqN1kyKSev8z1QV3GaxiADhC+JEeRfop4eDOosYLKyy7vaGX2MhgeVnd4YNOeD84Qe8pOx6I4SCEvGYipJ87MyidnjhGcxpzCLAmhA9ljGWIAt3EbhLYhI9p3SZDg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732714863; c=relaxed/simple; bh=Hdi4JQx9cZhfAyOVZa1v58hu1bYTNfj8l3d1uVWb7Js=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ej8oz2LaoXgw6g/lnerDLnvIzAqVwdyj8TMZIyF0fbtYSCINrFRrz8cbOm5nwJwl/jv1UJwQqiw9dy+s+id/dDTukqZOQY2FgjVuXc0/A/4IAu950Te7Li24SaO2bNyUNV/jnV+VVq0u2dlGOKZYNTS2NdnrB8eKkZPhdMHwCOI= 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=ylcXZ72/; 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="ylcXZ72/" Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2041.outbound.protection.outlook.com [104.47.70.41]) by mx-outbound45-240.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 27 Nov 2024 13:40:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tFQPpPmcYd4KAtpEBlawa9xpdiV72ATUGl0FCfNpPRBcbEiWaDWjsq7sjJEnXoHUuK3/kjU7n1nMIhPacS1bLTSZnVa/hwYkrJNA7qovEbEBHzuTEnhDn1ewe+TKBZZqVHo7RBYsem547tBM/F/KM16+nDRPVXloNAq+5IqyCrngtbe/SAUYzb/aQ+DbJ8uro/W1f52W70bzkD5mMVyQplYRDGmHEUH0Y4M9m4T006rNN28Y8Wuy9I3vAZwFfmd8NGOHUvsWFnX0h2HENCX7DoFStTujeGUkkm9LoiC63/8OMc65BsQ+TMTT5fG+ItMzqJskK/UIyt+nhtY2HD9R5A== 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=Ts7qj2oHeGmEh3ZrZY9pB1Tnvu8iQGgjUn3TQhzn69M=; b=JxqOhSVXL9RzEE765MkNIOLF3hjlGNiWoDbnxrgKtLNu6eqKv67fMFhBgUUQWEZHesl1RGkfra/+6KCKubf3n6WOJ4xEWQegK0l/qOq+xPJnCf9fW0ai+GAk/zEYzWp7Mdiv4W5OdkOOo2mqE9qVpe3QaNRwu7aamYpcEBWEGf71+gQgsLSlp+934l4qFGUa2mr7iKjs3aM03Io9tLjd3a4nSmVpmZ3LevVFr3LDzftiNooDXM3VsCNuwcpbsVE6owUYT4rAgJLouAxwVKOA7Rbg+9gFxPfT3w8pOT0aPJTNf9HZu3HnBByuNX2snUwbqNaLhoQhMQ2MYwTOqP512w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=bsbernd.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ts7qj2oHeGmEh3ZrZY9pB1Tnvu8iQGgjUn3TQhzn69M=; b=ylcXZ72/FP7QN284idxfwimuE4cwqsikkXHOw+UO9pYSA5QucU/4p3tx8vw/lec9OdoreJdhjrNsnlyuODuVirOGVXyeH3NlvBoPlbhWHlwkmIze/1Q0ejMFSpzKuvPOWC1ZfVm0+QK992UpRLeexW92CHkxKAEgssUekjvKzR4= Received: from CH3P220CA0014.NAMP220.PROD.OUTLOOK.COM (2603:10b6:610:1e8::16) by MN0PR19MB5684.namprd19.prod.outlook.com (2603:10b6:208:373::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8182.20; Wed, 27 Nov 2024 13:40:50 +0000 Received: from CH1PEPF0000AD79.namprd04.prod.outlook.com (2603:10b6:610:1e8:cafe::19) by CH3P220CA0014.outlook.office365.com (2603:10b6:610:1e8::16) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.12 via Frontend Transport; Wed, 27 Nov 2024 13:40:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by CH1PEPF0000AD79.mail.protection.outlook.com (10.167.244.57) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.12 via Frontend Transport; Wed, 27 Nov 2024 13:40:49 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 0CFCC32; Wed, 27 Nov 2024 13:40:48 +0000 (UTC) From: Bernd Schubert Date: Wed, 27 Nov 2024 14:40:27 +0100 Subject: [PATCH RFC v7 10/16] fuse: {uring} Handle teardown of ring entries Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241127-fuse-uring-for-6-10-rfc4-v7-10-934b3a69baca@ddn.com> References: <20241127-fuse-uring-for-6-10-rfc4-v7-0-934b3a69baca@ddn.com> In-Reply-To: <20241127-fuse-uring-for-6-10-rfc4-v7-0-934b3a69baca@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1732714838; l=11593; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=Hdi4JQx9cZhfAyOVZa1v58hu1bYTNfj8l3d1uVWb7Js=; b=3r6PO5C3e1gDcBjZ385ALWjzo2Wx7clSJ8nIpgFS49kLtz4eIwz/8Ru5xK67zK339xRlRaolc q7dkUpEBlx3AFr3YmAe3wfE3rDsEFtS6WjpSNijpHArBMzU4t050Ghu X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH1PEPF0000AD79:EE_|MN0PR19MB5684:EE_ X-MS-Office365-Filtering-Correlation-Id: 07a1d0ed-3e28-4f8f-3cd3-08dd0ee91b01 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|376014|7416014|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?yICU0Yq5VSXHyY+aT5hbuTQGF8YUazJ?= =?utf-8?q?gokWuwvC+y1HJsOeG7UQOr8uJhuKkMW0Gb/g+4fHZFFd0XrueIobmwR2bJFuguXpB?= =?utf-8?q?sxLD8Ap6UqL28WQAeGfLlmkwPXM2bLmCvLiIe5t1NRx4zFOwpUf5Q8NAg3sePXWYY?= =?utf-8?q?AZJNtob67aPw3Lz9pAD69WXXnChSgjnuMpnV8eG9d8HYQxIRzKpZfUncFsF/hFnVY?= =?utf-8?q?lL6Czi72cybGiJVDsB7D/+tHa6jDw5YUAAI4oGPSFJc6E/ji9d3P7zA7aU4fFDo29?= =?utf-8?q?CwS5b7QoZPwogQ0hRsxqy53whQRgxMMm1gEhfYdwr1LEoAKWYE5CUn26MEgg1jy51?= =?utf-8?q?W9aNZrxP69Opg3R8o33KT41dELlY0FaTVqaPl/L72JAdwdCI/Au6W/7zemuT5MwnI?= =?utf-8?q?YnvhJiXVndIKh26Ec0VW2jw+DbPXyw6PYDEPsbGZovEuHMwbaSKChAdDbho5dvOTA?= =?utf-8?q?nOLpEMH0+KJii+on1n9ejuL8ZOACf6BgZXGpA5GmP08gHIw0E47AevL8HnHncUUrk?= =?utf-8?q?ckAeNi3hdN6sS1sc7zJZPNdvOD/Egpk9L+Ipp6EHLNL58OiSw6qLjxBI6+8sSbgYb?= =?utf-8?q?vBKz3X3F8Kg+mhR4muFsEvE4ZmH5WTqkq6yZUgl31cbQX9OxjOT8fpyfsG0BgS7g9?= =?utf-8?q?nTpNWkwWD2LfIVXfR2Gl2nqwknnrufvkyOo89KlHBoGoJtuOot2B7E40uQe52X2ok?= =?utf-8?q?EmgCOEFM8WSor/0c6M1wOo+91MobWxUX51sFna1+brECIHADHpaqw+so2yrX21DV/?= =?utf-8?q?jW8Y92B73njoJCP41/awKZd7ArSBTA2Stcvinx9dMEZ1HzHSi2ydrnln5aFaUJfga?= =?utf-8?q?pCsSx465krd8xnrWfjjwKNLlAZwEOg/jLtMpEEi3XHG1Ubt/x9eVdMGu/gQDx357t?= =?utf-8?q?N/ArXe+e2KxHZGqrrTKAdIQpUOAc1HJrFpn4NDYRvNw64Qo20p5mWm3NKsoujBZdc?= =?utf-8?q?lcrD+0Wz+GnxowTOX+Q0zGTLv0y4/2uTaecb6r8NdP3Up8qYB5SyFgqSKhWWRKfu2?= =?utf-8?q?qpnlhfgGrs4wdouCXdIMUJSZ5doyZ51DNZ0b//0FbOadgiW/xrbSxubu8WwSClBKd?= =?utf-8?q?gu+RAoLpMlJu7ZUgiTHluC5JWG/eVkW+UGINk9Gus4FpCYXgDz1m4/X1MNbGWn4nH?= =?utf-8?q?wcpFCQ+VQv4YFjYRpQtPgNy4d7NlyGgPZraRMhyHRhwFjD9ZewkijMZ2vzaZFtVun?= =?utf-8?q?qSN9+sekn2nBrJdpV+rtGe2xIBsyBgwmf0ifnjBERJpyPIjzeUrLdvb8ZIhYv/84Y?= =?utf-8?q?KTLDkL53uIDnXsaAJsr3GT6zHLP5Zh31LAy47vJeBIpoQt3WJF3GxyMNg3lzQOo+b?= =?utf-8?q?alOmE8GdSAecqH9CxzBTWnamDKxJ0HdVab+P6+V6f9px4BuPkomGLtkJ8WsBa70j9?= =?utf-8?q?e93MuVuOzmd?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(36860700013)(376014)(7416014)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: zWOMpMP31rw52nekfKj00JLeUGBXhmBQCirLBD1Gh/MWd2q4fmyV6nbc6L+DLYIcvonInG5b2qzXmFAOAQwjLUKPvNi0m1Cs6sK6KQf0s0OuSs5+N8qw3GXMAaubEMjsHeOT74UU7TMS6Vo/lRsIszr2Y4ofnBLmYuV6OPNgR5g7liHGyIpRNzDpBUt1yQwnoycr0AW7Y0OuhRhgG7h0+bsm+hMtkkKTjiXkN8zbJYwXFgk4rbzehMM12rwneBPymz8nMuO537UjEfmAQLqqlZHldII1jaN1G7oXhczJaLKszIgaIOkCIe4/hY1f+tB/Hyof9YEQX2pp3o/xRZVAFxrG4zdNh4B5TcRVfOllegyrY/01L7jeiszCuEf7L3Dlwuwj1FfZXBIpL6tY/uTr79aF0egYqQpt3Z3+TqJJaSQof40NhTkJ/BfTV0EKajlWkRQUp57DdchqOPPo1MiNeOkEhA8Edn4ReVOh4B/qqI0ZTZkczUiUoqPs1NV2PNQUP9f63/iiYbH2QakhR45yZLmZyHtxqR5aIYctUYAK4K3dMjVQi3NtApTf7MBDyA1HcMdjyXV2EOOJf1VS2oaBUtHi1aRLJLPron0jS0XUdmQn79Bo+Z7+Mx4ahZzjiZGt5W6Ke6dYbH5PVobIPyWRug== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2024 13:40:49.7994 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 07a1d0ed-3e28-4f8f-3cd3-08dd0ee91b01 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: CH1PEPF0000AD79.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR19MB5684 X-BESS-ID: 1732714854-111760-13381-2159-1 X-BESS-VER: 2019.1_20241126.2220 X-BESS-Apparent-Source-IP: 104.47.70.41 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoaGhhYWQGYGUNTQxDzJNDXZ3M LI2CTJxCAtzcTYLNnc0DLV3NgkJdE4Uak2FgDFLVvsQgAAAA== X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260718 [from cloudscan15-69.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 On teardown struct file_operations::uring_cmd requests need to be completed by calling io_uring_cmd_done(). Not completing all ring entries would result in busy io-uring tasks giving warning messages in intervals and unreleased struct file. Additionally the fuse connection and with that the ring can only get released when all io-uring commands are completed. Completion is done with ring entries that are a) in waiting state for new fuse requests - io_uring_cmd_done is needed b) already in userspace - io_uring_cmd_done through teardown is not needed, the request can just get released. If fuse server is still active and commits such a ring entry, fuse_uring_cmd() already checks if the connection is active and then complete the io-uring itself with -ENOTCONN. I.e. special handling is not needed. This scheme is basically represented by the ring entry state FRRS_WAIT and FRRS_USERSPACE. Entries in state: - FRRS_INIT: No action needed, do not contribute to ring->queue_refs yet - All other states: Are currently processed by other tasks, async teardown is needed and it has to wait for the two states above. It could be also solved without an async teardown task, but would require additional if conditions in hot code paths. Also in my personal opinion the code looks cleaner with async teardown. Signed-off-by: Bernd Schubert --- fs/fuse/dev.c | 8 ++ fs/fuse/dev_uring.c | 206 ++++++++++++++++++++++++++++++++++++++++++++++++++ fs/fuse/dev_uring_i.h | 51 +++++++++++++ 3 files changed, 265 insertions(+) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 143ce48a1898d911aafbba2b2e734805509169c2..ed85a5f2d6c360b8401b174bc97cc135d87e90d9 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -2280,6 +2280,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); } @@ -2291,6 +2297,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 7bb07f5ba436fcb89537f0821f08a7167da52902..b5bb78b5f5902c8b87f3e196baaa05640380046d 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -52,6 +52,37 @@ static int fuse_ring_ent_unset_userspace(struct fuse_ring_ent *ent) return 0; } +/* Abort all list queued request on the given ring queue */ +static void fuse_uring_abort_end_queue_requests(struct fuse_ring_queue *queue) +{ + struct fuse_req *req; + LIST_HEAD(req_list); + + spin_lock(&queue->lock); + list_for_each_entry(req, &queue->fuse_req_queue, list) + clear_bit(FR_PENDING, &req->flags); + list_splice_init(&queue->fuse_req_queue, &req_list); + spin_unlock(&queue->lock); + + /* must not hold queue lock to avoid order issues with fi->lock */ + fuse_dev_end_requests(&req_list); +} + +void fuse_uring_abort_end_requests(struct fuse_ring *ring) +{ + int qid; + struct fuse_ring_queue *queue; + + for (qid = 0; qid < ring->nr_queues; qid++) { + queue = READ_ONCE(ring->queues[qid]); + if (!queue) + continue; + + queue->stopped = true; + fuse_uring_abort_end_queue_requests(queue); + } +} + void fuse_uring_destruct(struct fuse_conn *fc) { struct fuse_ring *ring = fc->ring; @@ -111,9 +142,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; @@ -175,6 +209,174 @@ fuse_uring_async_send_to_ring(struct io_uring_cmd *cmd, io_uring_cmd_done(cmd, 0, 0, issue_flags); } +static void fuse_uring_stop_fuse_req_end(struct fuse_ring_ent *ent) +{ + struct fuse_req *req = ent->fuse_req; + + /* remove entry from fuse_pqueue->processing */ + list_del_init(&req->list); + ent->fuse_req = NULL; + clear_bit(FR_SENT, &req->flags); + req->out.h.error = -ECONNABORTED; + fuse_request_end(req); +} + +/* + * Release a request/entry on connection tear down + */ +static void fuse_uring_entry_teardown(struct fuse_ring_ent *ent, + bool need_cmd_done) +{ + /* + * fuse_request_end() might take other locks like fi->lock and + * can lead to lock ordering issues + */ + lockdep_assert_not_held(&ent->queue->lock); + + if (need_cmd_done) + io_uring_cmd_done(ent->cmd, -ENOTCONN, 0, + IO_URING_F_UNLOCKED); + + if (ent->fuse_req) + fuse_uring_stop_fuse_req_end(ent); + + list_del_init(&ent->list); + kfree(ent); +} + +static void fuse_uring_stop_list_entries(struct list_head *head, + struct fuse_ring_queue *queue, + enum fuse_ring_req_state exp_state) +{ + struct fuse_ring *ring = queue->ring; + struct fuse_ring_ent *ent, *next; + ssize_t queue_refs = SSIZE_MAX; + LIST_HEAD(to_teardown); + + spin_lock(&queue->lock); + list_for_each_entry_safe(ent, next, head, list) { + if (ent->state != exp_state) { + pr_warn("entry teardown qid=%d state=%d expected=%d", + queue->qid, ent->state, exp_state); + continue; + } + + list_move(&ent->list, &to_teardown); + } + spin_unlock(&queue->lock); + + /* no queue lock to avoid lock order issues */ + list_for_each_entry_safe(ent, next, &to_teardown, list) { + bool need_cmd_done = ent->state != FRRS_USERSPACE; + + fuse_uring_entry_teardown(ent, need_cmd_done); + queue_refs = atomic_dec_return(&ring->queue_refs); + + WARN_ON_ONCE(queue_refs < 0); + } +} + +static void fuse_uring_teardown_entries(struct fuse_ring_queue *queue) +{ + fuse_uring_stop_list_entries(&queue->ent_in_userspace, queue, + FRRS_USERSPACE); + fuse_uring_stop_list_entries(&queue->ent_avail_queue, queue, FRRS_WAIT); +} + +/* + * Log state debug info + */ +static void fuse_uring_log_ent_state(struct fuse_ring *ring) +{ + int qid; + struct fuse_ring_ent *ent; + + for (qid = 0; qid < ring->nr_queues; qid++) { + struct fuse_ring_queue *queue = ring->queues[qid]; + + if (!queue) + continue; + + spin_lock(&queue->lock); + /* + * Log entries from the intermediate queue, the other queues + * should be empty + */ + list_for_each_entry(ent, &queue->ent_w_req_queue, list) { + pr_info(" ent-req-queue ring=%p qid=%d ent=%p state=%d\n", + ring, qid, ent, ent->state); + } + list_for_each_entry(ent, &queue->ent_commit_queue, list) { + pr_info(" ent-req-queue ring=%p qid=%d ent=%p state=%d\n", + ring, qid, ent, ent->state); + } + spin_unlock(&queue->lock); + } + ring->stop_debug_log = 1; +} + +static void fuse_uring_async_stop_queues(struct work_struct *work) +{ + int qid; + struct fuse_ring *ring = + container_of(work, struct fuse_ring, async_teardown_work.work); + + /* XXX code dup */ + for (qid = 0; qid < ring->nr_queues; qid++) { + struct fuse_ring_queue *queue = READ_ONCE(ring->queues[qid]); + + if (!queue) + continue; + + fuse_uring_teardown_entries(queue); + } + + /* + * Some ring entries are might be in the middle of IO operations, + * i.e. in process to get handled by file_operations::uring_cmd + * or on the way to userspace - we could handle that with conditions in + * run time code, but easier/cleaner to have an async tear down handler + * If there are still queue references left + */ + if (atomic_read(&ring->queue_refs) > 0) { + if (time_after(jiffies, + ring->teardown_time + FUSE_URING_TEARDOWN_TIMEOUT)) + fuse_uring_log_ent_state(ring); + + schedule_delayed_work(&ring->async_teardown_work, + FUSE_URING_TEARDOWN_INTERVAL); + } else { + wake_up_all(&ring->stop_waitq); + } +} + +/* + * Stop the ring queues + */ +void fuse_uring_stop_queues(struct fuse_ring *ring) +{ + int qid; + + for (qid = 0; qid < ring->nr_queues; qid++) { + struct fuse_ring_queue *queue = READ_ONCE(ring->queues[qid]); + + if (!queue) + continue; + + fuse_uring_teardown_entries(queue); + } + + if (atomic_read(&ring->queue_refs) > 0) { + ring->teardown_time = jiffies; + INIT_DELAYED_WORK(&ring->async_teardown_work, + fuse_uring_async_stop_queues); + schedule_delayed_work(&ring->async_teardown_work, + FUSE_URING_TEARDOWN_INTERVAL); + } else { + wake_up_all(&ring->stop_waitq); + } +} + /* * Checks for errors and stores it into the request */ @@ -526,6 +728,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 @@ -683,6 +888,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; diff --git a/fs/fuse/dev_uring_i.h b/fs/fuse/dev_uring_i.h index b2722828bd20dce5f5bd7884ba87861fb6e0d97b..52259714ffc59a38b21f834ae5e317fe818863dc 100644 --- a/fs/fuse/dev_uring_i.h +++ b/fs/fuse/dev_uring_i.h @@ -11,6 +11,9 @@ #ifdef CONFIG_FUSE_IO_URING +#define FUSE_URING_TEARDOWN_TIMEOUT (5 * HZ) +#define FUSE_URING_TEARDOWN_INTERVAL (HZ/20) + enum fuse_ring_req_state { FRRS_INVALID = 0, @@ -85,6 +88,8 @@ struct fuse_ring_queue { struct list_head fuse_req_queue; struct fuse_pqueue fpq; + + bool stopped; }; /** @@ -99,12 +104,51 @@ 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; }; bool fuse_uring_enabled(void); void fuse_uring_destruct(struct fuse_conn *fc); +void fuse_uring_stop_queues(struct fuse_ring *ring); +void fuse_uring_abort_end_requests(struct fuse_ring *ring); int fuse_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags); +static inline void fuse_uring_abort(struct fuse_conn *fc) +{ + struct fuse_ring *ring = fc->ring; + + if (ring == NULL) + return; + + if (atomic_read(&ring->queue_refs) > 0) { + fuse_uring_abort_end_requests(ring); + fuse_uring_stop_queues(ring); + } +} + +static inline void fuse_uring_wait_stopped_queues(struct fuse_conn *fc) +{ + struct fuse_ring *ring = fc->ring; + + if (ring) + wait_event(ring->stop_waitq, + atomic_read(&ring->queue_refs) == 0); +} + #else /* CONFIG_FUSE_IO_URING */ struct fuse_ring; @@ -122,6 +166,13 @@ static inline bool fuse_uring_enabled(void) return false; } +static inline void fuse_uring_abort(struct fuse_conn *fc) +{ +} + +static inline void fuse_uring_wait_stopped_queues(struct fuse_conn *fc) +{ +} #endif /* CONFIG_FUSE_IO_URING */ #endif /* _FS_FUSE_DEV_URING_I_H */ From patchwork Wed Nov 27 13:40:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13887009 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 613211FCF77; Wed, 27 Nov 2024 13:41:00 +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=1732714864; cv=fail; b=qn7yoBjhqg6e7bThg0vWBn6TA9+QaHDJeYyhBXmKH7+a21MzsxmJkKkvqgIc5a9/5TkTSuCHX8mO8LJ5Ey3Q1Rx/7++TFMUB0iXNlq7dfTKimw1PjqsZuI6aLL8KVCaM0QR3NAUgV0CML8l/3hs8j6DpXfTDg6shm8cA50VonPQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732714864; c=relaxed/simple; bh=dGbzULYkqOY3NK86k6Rinuh/+I8xRP4zoFWvH/ef4YA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=trnt+Mk0yCfSctJP4mcXo73j31kF+uvBkBCCNwtyz3NWi/PVzOlJDemaxazZVvCPAghqowo7dMU5ycs+2abgzl34posiPOp00MObg11clM67h/tDjglz0P8qDB19R7fFj8KtnEOAJ86X6gn4zisjGOCEfaspBMq4TQ8nNMXj/yo= 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=YM2j8pde; 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="YM2j8pde" Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2042.outbound.protection.outlook.com [104.47.66.42]) by mx-outbound9-173.us-east-2a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 27 Nov 2024 13:40:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Fded+kwjapyS1NkAt9br4kcAnZFyewhx7m7u6UP199VjzG9SwObMSa/hbXcCW1Ve+nrjPEwVsVE17QkS8ObGGHr0vmA6CkHyh0gJTkg/BQYkDkU6zStHWOvLeIAnV5fnaWgGvbp0p8QplhjyLwB+Pk+QUbmrzO8mh0IxY12j7zILvEV7d9NOJgfEOVJ2K3qprxCyM4oJ0AT5GJAYyUTQoWAMui5ZRXJzPcuJSw6JMyru+lR2fWjpSBn/qF391AR2pyzkp4bkrynwDq9RP0wxdl6FedDSRUCjdnzsM+ADe+TW1qyyBKlJHl2gYulJRXljpEOUXd7lZCGxbUJb/JrR5Q== 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=u9NIVFwmQYGwLNqCJ0zYiwK+OdfgBdC/041D4/2Yym8=; b=AziGBhD85018dCZ7ksUDe9Kh4EqXx3nnTxv8IEupNDoq92x2g7qGMLeAUWrNz3MCoTZ0wo58UzZBZzlRorkJBl3sDwjmK1EoZN7Ke4PehiDE5kgoY+1Fz5F5YSQlpMcDXTclDZCCE0wgIqhMD9L8HsgQMMkUHxp5/9JqWOhD3KCDynfM9HOVrAZjOcayYFWR5x+WHPa/OEezKkLV+4Lj/KGXnwJbD5YDGoQsVJ30pIhnIErRlC2N8tMnVRHQYn1cfxP/1i7wyE4v18pUO+tzOPLtFzMCFC6o58lm2MkoENvrGsIlJNAjlZQtOuy2IgVjor5OngdtuEnpRbQNYvYIiQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=bsbernd.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=u9NIVFwmQYGwLNqCJ0zYiwK+OdfgBdC/041D4/2Yym8=; b=YM2j8pdevtbiCg95Z6j2Fv6fxTonuguoCB7QZUysdaaSW0sU9UTlobSVKpGcJ9XlRDjapwuyIUYXF6ihs5v1mzs0Dwwcv7R0/hL+byeX9XRt0HWgYcdw0rzBZaN/UrsWvoy64KXmPs83fd2VrkfNh9kRLOxcbpYm0TeWUa0N11A= Received: from CH3P220CA0015.NAMP220.PROD.OUTLOOK.COM (2603:10b6:610:1e8::8) by DM4PR19MB6558.namprd19.prod.outlook.com (2603:10b6:8:bc::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.13; Wed, 27 Nov 2024 13:40:51 +0000 Received: from CH3PEPF00000011.namprd21.prod.outlook.com (2603:10b6:610:1e8:cafe::f9) by CH3P220CA0015.outlook.office365.com (2603:10b6:610:1e8::8) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.12 via Frontend Transport; Wed, 27 Nov 2024 13:40:51 +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 CH3PEPF00000011.mail.protection.outlook.com (10.167.244.116) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.0 via Frontend Transport; Wed, 27 Nov 2024 13:40:50 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 04C412D; Wed, 27 Nov 2024 13:40:49 +0000 (UTC) From: Bernd Schubert Date: Wed, 27 Nov 2024 14:40:28 +0100 Subject: [PATCH RFC v7 11/16] fuse: {uring} Allow to queue fg requests through io-uring Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241127-fuse-uring-for-6-10-rfc4-v7-11-934b3a69baca@ddn.com> References: <20241127-fuse-uring-for-6-10-rfc4-v7-0-934b3a69baca@ddn.com> In-Reply-To: <20241127-fuse-uring-for-6-10-rfc4-v7-0-934b3a69baca@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1732714838; l=8245; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=dGbzULYkqOY3NK86k6Rinuh/+I8xRP4zoFWvH/ef4YA=; b=iI8pNMYi7gpIM7QIHwmQL0fq64gNMEtOVFMvVvwVwUanx1DOiL5lKeRbt3oCULuqHxVDYZLx1 /CggSxQGJhsB3jjExYe2emlcSrsU/7gyacxE/sTSvg+C3z6rkIdFsA7 X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PEPF00000011:EE_|DM4PR19MB6558:EE_ X-MS-Office365-Filtering-Correlation-Id: 744e52bb-44ca-4014-c232-08dd0ee91b9b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?hsvQVPqEQNX/OsStg5V0QW1j+QkuBQF?= =?utf-8?q?QF+mIuYeug0tjh2ylCU6M5LK6Pqp4jmcxQhD6/hNaGHvqY6gLAx1KfPk6rD7sBMDk?= =?utf-8?q?EefeQDl2dlTvLwxzxsqq3xqAcoCoEgeY3vWA3mq4+bcUNklR2/zNT0v1IUxOGblbe?= =?utf-8?q?FXBoKPZWkzPSxk1VX9++ZYDwZTblXOnWlJP/+YVLJiCfxTbS76ii61rQvrP86ANf5?= =?utf-8?q?gpFD26JbzfOINPS62THxfoYIKmV5x1o4A5i7Amny9f9nPIsLqK4VFIPk9IKBRsr33?= =?utf-8?q?VUrssWI9NyRCd520I6d6CrxccGHpL8K+WKyf9Ca5BcnrCmwKcf/iR6q/owKRw8Jcp?= =?utf-8?q?rbJkVw1FLwGAszpCoVE5WRwY611oTWgffs+0D78UxnuAcSCkiWMEW7lKomfkfRhRa?= =?utf-8?q?VUbMSyO79b5IBac36BzwaYKyunPPpugpuFJCmr/5I9/iMKS+sVJzEtNW9gJdnk4TR?= =?utf-8?q?y4jalp6kzSS7nFc1UgZU9Oagq3zYlLcrrj0Bdq3724dVWurW9aIxIOqNdeIszbMt2?= =?utf-8?q?g+efb3MHVvoZ0ucop5/7a6voGuUkmIHQr5OOnKM9Ud8SeR2BTafzKoYXHKv3Fixh1?= =?utf-8?q?BkMmRhxRf95xZFSFYnnyzAXN64+850IiEi5BIuISqanwfiLIgODg8/4m0PmR60PvE?= =?utf-8?q?u3N0s2c7Uy0Pq1KxYm8E5kXnNEIqbOul9I9kadjG6t+PRoPZP2x2Q8jlJQwNOMfhy?= =?utf-8?q?d8kvNN71yFcpo3KTo+FMGpEBP7HGw8WOH3YirLx0luABQGt+E8DSAFCF2/re3phZs?= =?utf-8?q?/podDR9ns6zwEyYdHCRAES3DHl6GF3hPP5mXdyRvXXXbloqPynhpt5mi26hJrpae+?= =?utf-8?q?ZohemwEiP530Cygu+HMl5vf2aV5FZFfHuD1ym8E6Qsr89tdzqT5uugHXjQDcNg0WM?= =?utf-8?q?f3ROb8q7pQWQDWkQJjHJs4lAe/jOfmjTblPduLVG/LJiWtzPRGLILZGCJ/49ps0iK?= =?utf-8?q?EBqpk//xge+bMWZ0ujk6GpMnjmLPiA+a2FN1eQVkLxElJyI4m/jyTvt6TULOdqa9N?= =?utf-8?q?tYKoQGXjCKqRUPeLCBTjUB30gLFR9Ieql1SooaHbh+eU7U/A7ExtCrWNH8umu5n/7?= =?utf-8?q?JxwWW5dgmCUDrxepadSQj2ycsufY1zHyiHrqDipZdPE+Z1zZBpBlj3HQcQ/D1hyc+?= =?utf-8?q?FeqzSnbNTRD6kMUQFkJrEvTgkuKj99jDyLZaDrqGuSrjdLOk/epskDeSsuw1N0VDY?= =?utf-8?q?7ur6t9kZ8ZyS24lgXDZstOvc8Cf+3g+qLVRM7hiiCFZn0GvAe58WO1WdaffEZQGUw?= =?utf-8?q?VhAqJBSfKaA3MqXGIs1aCXCTGu8lJGRiMXbDQzE9brOHq4VbNBVuy5C4n+PsN8AL4?= =?utf-8?q?Ju5t5kTEQDlEcKqJYjuboaSwtUS/pr1GiSZnwv5VH+4y4I4OsNBLR4nr4+yjQqLBp?= =?utf-8?q?BQKqu+8OVC4?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(7416014)(36860700013)(1800799024)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Vo8rzA8gMIc1fp6NoQINxML81SvjasR9vHSM2JQNMpdcXG25X/oh6ybsS+OqnfCP1b0b8Aq52BM3IcU0bfS6bHT0SoPMIIM3ArsGoLjoUByBCBiq01BDxqpZOyljwE4/sZXiHl+uodcVe7oyyUFTPORLRccZxDyad8OE3UFNmFcnnytH88pI5FnaHPEvz3lOaJUMFmttc4FrvUJfXFjWG5cWmswVs/5J7+BPuyIgyOzj6q+v24Lmm3FV6YrtbFuS9D08Cqx3AYH+nyYBVF+r4kn4UkBXs7cIvcnyUh7oVll51uZ2+mEf1e5biqRh5jRtCW8/ACc5qPNZaLawKhLnjIVgK8t/J3M/MjrOoT/twz8rZ9AxXcuT9vY/qkt6jcgWP3t4w07WgirI7h68qaIfuQr8+pAWmkljfetWJ+WzysX/gDGonVpQWRz/XCMRgZPIJE1DBEw+fmRgbSS9nvvM+3anjzeIKc3EomXmJF5GeoPnumRHnB7nysW7MYtxArd0p87yTUW1EJvDiFYz59ttgvZQgFx7b7ITG/mutp0FIGl6ruKa/oH6pqx0RKpIN+ZKjIB/fNa86yiDVVeUpu87SogLmoIoegVWY8/HyO60VW34e7PTSAQLsO6xg2jQ+wGUPARV+uOTwgSpSvBy4y/9ow== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2024 13:40:50.7339 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 744e52bb-44ca-4014-c232-08dd0ee91b9b 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: CH3PEPF00000011.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR19MB6558 X-BESS-ID: 1732714855-102477-13345-4658-1 X-BESS-VER: 2019.1_20241126.2220 X-BESS-Apparent-Source-IP: 104.47.66.42 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVuaWZgZAVgZQMNUg2TTJPNHSNN XYLMnU0sLSwjAxKTHN3MzY0tTIyDxNqTYWAKYLWcpBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260718 [from cloudscan8-156.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 This prepares queueing and sending foreground requests through io-uring. Signed-off-by: Bernd Schubert --- fs/fuse/dev.c | 5 +- fs/fuse/dev_uring.c | 159 ++++++++++++++++++++++++++++++++++++++++++++++++++ fs/fuse/dev_uring_i.h | 8 +++ fs/fuse/fuse_dev_i.h | 5 ++ 4 files changed, 175 insertions(+), 2 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index ed85a5f2d6c360b8401b174bc97cc135d87e90d9..c53deb690cc9c7958741cd144fcad166b5721e11 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -237,7 +237,8 @@ __releases(fiq->lock) spin_unlock(&fiq->lock); } -static void fuse_dev_queue_forget(struct fuse_iqueue *fiq, struct fuse_forget_link *forget) +void fuse_dev_queue_forget(struct fuse_iqueue *fiq, + struct fuse_forget_link *forget) { spin_lock(&fiq->lock); if (fiq->connected) { @@ -250,7 +251,7 @@ static void fuse_dev_queue_forget(struct fuse_iqueue *fiq, struct fuse_forget_li } } -static void fuse_dev_queue_interrupt(struct fuse_iqueue *fiq, struct fuse_req *req) +void fuse_dev_queue_interrupt(struct fuse_iqueue *fiq, struct fuse_req *req) { spin_lock(&fiq->lock); if (list_empty(&req->intr_entry)) { diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index b5bb78b5f5902c8b87f3e196baaa05640380046d..b1c56ccf828ec2d4cd921906fb42901fefcc6cc5 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -24,6 +24,12 @@ bool fuse_uring_enabled(void) return enable_uring; } +struct fuse_uring_cmd_pdu { + struct fuse_ring_ent *ring_ent; +}; + +const struct fuse_iqueue_ops fuse_io_uring_ops; + static void fuse_uring_req_end(struct fuse_ring_ent *ring_ent, bool set_err, int error) { @@ -773,6 +779,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 */ @@ -781,11 +812,23 @@ 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; + struct fuse_conn *fc = ring->fc; + struct fuse_iqueue *fiq = &fc->iq; 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); + fiq->ops = &fuse_io_uring_ops; + } + } } /* @@ -945,3 +988,119 @@ 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. + */ +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); +} + +static struct fuse_ring_queue *fuse_uring_task_to_queue(struct fuse_ring *ring) +{ + unsigned int qid; + struct fuse_ring_queue *queue; + + qid = task_cpu(current); + + if (WARN_ONCE(qid >= ring->nr_queues, + "Core number (%u) exceeds nr ueues (%zu)\n", qid, + ring->nr_queues)) + qid = 0; + + queue = ring->queues[qid]; + if (WARN_ONCE(!queue, "Missing queue for qid %d\n", qid)) + return NULL; + + return queue; +} + +/* queue a fuse request and send it if a ring entry is available */ +void fuse_uring_queue_fuse_req(struct fuse_iqueue *fiq, struct fuse_req *req) +{ + struct fuse_conn *fc = req->fm->fc; + struct fuse_ring *ring = fc->ring; + struct fuse_ring_queue *queue; + struct fuse_ring_ent *ring_ent = NULL; + int err; + + err = -EINVAL; + queue = fuse_uring_task_to_queue(ring); + if (!queue) + goto err; + + if (req->in.h.opcode != FUSE_NOTIFY_REPLY) + req->in.h.unique = fuse_get_unique(fiq); + spin_lock(&queue->lock); + err = -ENOTCONN; + if (unlikely(queue->stopped)) + goto err_unlock; + + if (!list_empty(&queue->ent_avail_queue)) { + ring_ent = list_first_entry(&queue->ent_avail_queue, + struct fuse_ring_ent, list); + + fuse_uring_add_req_to_ring_ent(ring_ent, req); + } else { + list_add_tail(&req->list, &queue->fuse_req_queue); + } + spin_unlock(&queue->lock); + + if (ring_ent) { + struct io_uring_cmd *cmd = ring_ent->cmd; + struct fuse_uring_cmd_pdu *pdu = + (struct fuse_uring_cmd_pdu *)cmd->pdu; + + err = -EIO; + if (WARN_ON_ONCE(ring_ent->state != FRRS_FUSE_REQ)) + goto err; + + pdu->ring_ent = ring_ent; + io_uring_cmd_complete_in_task(cmd, fuse_uring_send_req_in_task); + } + + return; + +err_unlock: + spin_unlock(&queue->lock); +err: + req->out.h.error = err; + clear_bit(FR_PENDING, &req->flags); + fuse_request_end(req); +} + +const struct fuse_iqueue_ops fuse_io_uring_ops = { + /* should be send over io-uring as enhancement */ + .send_forget = fuse_dev_queue_forget, + + /* + * could be send over io-uring, but interrupts should be rare, + * no need to make the code complex + */ + .send_interrupt = fuse_dev_queue_interrupt, + .send_req = fuse_uring_queue_fuse_req, +}; diff --git a/fs/fuse/dev_uring_i.h b/fs/fuse/dev_uring_i.h index 52259714ffc59a38b21f834ae5e317fe818863dc..19867d27894f9d985e224111ea586c82b4b4cfe8 100644 --- a/fs/fuse/dev_uring_i.h +++ b/fs/fuse/dev_uring_i.h @@ -119,6 +119,8 @@ struct fuse_ring { unsigned long teardown_time; atomic_t queue_refs; + + bool ready; }; bool fuse_uring_enabled(void); @@ -126,6 +128,7 @@ void fuse_uring_destruct(struct fuse_conn *fc); void fuse_uring_stop_queues(struct fuse_ring *ring); void fuse_uring_abort_end_requests(struct fuse_ring *ring); int fuse_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags); +void fuse_uring_queue_fuse_req(struct fuse_iqueue *fiq, struct fuse_req *req); static inline void fuse_uring_abort(struct fuse_conn *fc) { @@ -149,6 +152,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; diff --git a/fs/fuse/fuse_dev_i.h b/fs/fuse/fuse_dev_i.h index d7bf72dabd84c3896d1447380649e2f4d20b0643..1d1c1e9848fba8dae46651e28809f73e165e74fe 100644 --- a/fs/fuse/fuse_dev_i.h +++ b/fs/fuse/fuse_dev_i.h @@ -17,6 +17,8 @@ struct fuse_arg; struct fuse_args; struct fuse_pqueue; struct fuse_req; +struct fuse_iqueue; +struct fuse_forget_link; struct fuse_copy_state { int write; @@ -58,6 +60,9 @@ int fuse_copy_args(struct fuse_copy_state *cs, unsigned int numargs, int zeroing); int fuse_copy_out_args(struct fuse_copy_state *cs, struct fuse_args *args, unsigned int nbytes); +void fuse_dev_queue_forget(struct fuse_iqueue *fiq, + struct fuse_forget_link *forget); +void fuse_dev_queue_interrupt(struct fuse_iqueue *fiq, struct fuse_req *req); #endif From patchwork Wed Nov 27 13:40:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13887010 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 CE48F1FCF7D; Wed, 27 Nov 2024 13:41:00 +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=1732714864; cv=fail; b=i9oTj3WgA/gmvDAQ4xpx76tFDnqjwlXpOC1Ttnnhi+Zk81DcdYoH/GXW5Pn3BZpUIy+3ENp3rjHr4Y3vHqbMNtJaAVioCJtJd8C4QOZrqWHpnJDjZLbKwXapLl4gpHj2JiyvIXfQzLSj6eR2xK20cYfm+3IEhbQoox7wdCzQjsk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732714864; c=relaxed/simple; bh=3Ia8xa5+ywUtWGfJ9AvgzAZm2DIv2wptA9eSVkWhG3Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qLnvm3i8zB937MhfM6LHVsdbaaROnU5+6g5Hia9ZTZG8NufnD9aGMLIPlJpDA5polfFMoXJZrIyk7ICzCW/QYYTipMMbS6SGghKEHwlwDFivQ3pTPgPRN9k+kJ0xaPIzV7alQqg92+UMc+xjc3aDPnUwC/b0ZlUfyZBFdfGwuSw= 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=jYpGBC2h; 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="jYpGBC2h" Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11lp2172.outbound.protection.outlook.com [104.47.56.172]) by mx-outbound45-240.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 27 Nov 2024 13:40:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=aWsg/qocMbjmCdex3TzayiLXvVbwgksWx0u6rG1/Df4o65HUZG/qMEOPZfidKUQ6rAGGpMGEn04abnZGCNYlG0yCeKve1T7gprb4T2tMDRDkGkKQtS4U9DsReaMjkQfZqKCKHhzl8RWMVJIutWCXuEUVZ4XEJuJ0DECTI9opR3sFk+9MyiHNT8L3LTih6FPcyXia+1Itb8X6LtOR41iWsP7m5jj3gm5mvBr6QivTlR6LkaTCLvDhkuRNqXk3z0DAZfiihWYoz+Y9a+8HkPrs2h4hHcSErBb4/tLZp1LAIyX7DWNsgZuf+vtjzrE6kvepv8IkBHspxGbEaFlzwUvCZA== 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=PjqHMWBVy9lkVcUFq6CqXAMFXmbXRRATa7kT67dvY00=; b=o3UJxnPVPfQyp5H36MdIkuH6ykEBT8p0800tn3zr7bESqpbh4b2BsOo2T1iJGiDHtTkXr+T/BbdTkx+R/eryATmGJ6WTo5xHzNGH9CtmSQNNWYSHxBuJj0BeuU0Sm4AH0/BHqwVfj/K2wp5yZja43nkgc7HOHfSyAU7BpwBlemq/1RuqIUH4Sc5ziBgkp1zF1627lMew8TwgQM2sqsphM8w2nUPLJ4+a9HVNliQ9etycjRGQhdt7dS9H24aHHBkV+u5rh6qgAbSRdaASJipxQoYDrHGY+yC++59MCgULC8bMmiEQTABWcWUu6Ds74zth1kh8yhnlIrbo15xfzBkdwQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=bsbernd.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PjqHMWBVy9lkVcUFq6CqXAMFXmbXRRATa7kT67dvY00=; b=jYpGBC2h2Ybv87MgQA0Fq3t/igYycl1gR+Lj12C3oH4u6IceiRLsuBpCIO4RVoZtcXZv1Xd0TnylO+ByXsXXb+0dCENVaDQUZELwe7uxXMclig6EHlo/YFu4nZW38V5ER+RBIvdQmn7xE1svLCqY+0SeQQnpfeJuoRccB9HQ/fI= Received: from DM6PR21CA0023.namprd21.prod.outlook.com (2603:10b6:5:174::33) by MN2PR19MB4063.namprd19.prod.outlook.com (2603:10b6:208:1e3::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.13; Wed, 27 Nov 2024 13:40:52 +0000 Received: from DS3PEPF000099DB.namprd04.prod.outlook.com (2603:10b6:5:174:cafe::31) by DM6PR21CA0023.outlook.office365.com (2603:10b6:5:174::33) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.2 via Frontend Transport; Wed, 27 Nov 2024 13:40:52 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by DS3PEPF000099DB.mail.protection.outlook.com (10.167.17.197) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.12 via Frontend Transport; Wed, 27 Nov 2024 13:40:51 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id F1DE832; Wed, 27 Nov 2024 13:40:50 +0000 (UTC) From: Bernd Schubert Date: Wed, 27 Nov 2024 14:40:29 +0100 Subject: [PATCH RFC v7 12/16] fuse: {uring} Allow to queue bg requests through io-uring Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241127-fuse-uring-for-6-10-rfc4-v7-12-934b3a69baca@ddn.com> References: <20241127-fuse-uring-for-6-10-rfc4-v7-0-934b3a69baca@ddn.com> In-Reply-To: <20241127-fuse-uring-for-6-10-rfc4-v7-0-934b3a69baca@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1732714838; l=7176; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=3Ia8xa5+ywUtWGfJ9AvgzAZm2DIv2wptA9eSVkWhG3Y=; b=QoFrxUzH/+0CTxXK8i1gHFNB/lqLLckITw2NyaTc1sSde3M8h/mBQYqiqRa8j7AQXag4afS5C R5F8Z1DuE+yB5oMGJosITuSzZRTjrj+keoIhqAlJF7TfBqXUfQGF67k X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099DB:EE_|MN2PR19MB4063:EE_ X-MS-Office365-Filtering-Correlation-Id: a6c4faf5-cb1b-4af9-dc53-08dd0ee91c21 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|7416014|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?UV7DyD0mkgz4iFEJ9f0RQMMs8qTAwm9?= =?utf-8?q?3A0rogpthGvVoj1yzM0fvmVDYn+opSUuigztENVn6mo3Ka4de2PArr8g2VRuQ9kvi?= =?utf-8?q?QeWQuVicjv+Dpz3tBNANtBuCjsb7hbvD1nthlIWWZjrrYQ5T5cE51G0g34goTPpEI?= =?utf-8?q?rf9GDsbE+5jLoiWeFe2h62pDo6XvHe0dV0iSXDbYz1oNCDJfaLsSDv0R3AP6ditwY?= =?utf-8?q?ykjaW97kJaLfUz+rgCtxbZhQl28p6rlZJ4oOTDuP6J0m7vQNO3bH6jUlheJJV67bO?= =?utf-8?q?OxVxek63yhaOMPAj76IdeLC96NZgZzYhk1XVFNFKbsR2xfqbChChYO4wUzEPK51Fa?= =?utf-8?q?TUh+32qKX/mV+nHCYSVMItdvS0OlD2FCnGmjDmgVPWqzF/jdBdcVJoVSNAigh+2Qf?= =?utf-8?q?6l4bGnmzK5YzFfWcluJVRuxoSR+8+2EYgHHHeuX/xKXlSzrYoIduDId1XyliMGkxC?= =?utf-8?q?8Zc2J6FLDhNJ2tRBbRoZqWga3V7jpb7/7IEvsrXqBs3cB37QH0qBvSRzrV17aHwlE?= =?utf-8?q?YZxCZDwnWhFMQrrPToDjzyQKD2lRTrCydpvfw4HsyE+x5JziVkzvVNN0RroviSjPp?= =?utf-8?q?V7RtkBzTp7/D+iEKh8738OjvHGcoUZY/XG1OTBwV/OYGquZu8VYnZIcdSfk7upcje?= =?utf-8?q?fE4d6dtyHTH9K8kbi1wZUxTF+NE7ocF6eOMq/8MaVeIW+Swm1FXPlkILhzokW5dz7?= =?utf-8?q?S9qAJUkxn5iRjiQkcsFZRiX3ohxKcIHBAajEEiiUo5aVt4CU0xwPmNPXTcD9TZfZc?= =?utf-8?q?DO6ORA3Pj5+bngjzXe1RkSqi//FhUyS1/LKnfD4YFmIj0FdIlURWF4Rqp5NU0lgjU?= =?utf-8?q?tCe3K3C/MtD0SA/R14FBFy4jA8JSo1ewRa986FQHC6KQjwRgj9VlUwQsoGNn7nYp5?= =?utf-8?q?tC4PjM0yoeJrvuO1VxJhP5Z13me0aJ9FaADNEGlPFpy1ey0nvaFxTRI7qqu6C71vd?= =?utf-8?q?jWeIITbbt3FCyv0u4I7D8tPvxz6EisREJnFnSXX8Sbf+K/D8pDVMW3wYgVG4nBAP+?= =?utf-8?q?0Qz00dTT5e2kZSZpZT8s3nDCaA7jNlEqWqXrMbydYrdmSCChBlj8WoWjd8hXTVVUy?= =?utf-8?q?gQrai2qTos3t/0oC+RtYA4+RmRzbXzSnUOn4FV/5ocys9a0j5kxmvA7QLNNAHSEtR?= =?utf-8?q?XMReWF4XI6TFufdGlhsdt6i8d8hSrEGw5Yejwpk8s/MOzlUIhFCKRQykA2fRf7Zq6?= =?utf-8?q?desue1a7Gb/k7bjIZvlmvQ8XMPxUR7F6NnYSZQrY5ov/JlDcz6xH8x7l84veMRiv2?= =?utf-8?q?tVJBWDgZlm4Bu01fcHmvTTepYcbEFCecAzVRYLhZwbh2IX6K3v64LuwgAdEYLrqfw?= =?utf-8?q?Eo9S8uDLDQ/AD6vrDl3wvg6bJBo8VU2Xbwc0LMowtVSSA+wRGkATL/sJgK+9/W1d9?= =?utf-8?q?ZlP2XUV2hR+?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(36860700013)(7416014)(376014)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: PhmGyNo4jLKglFw7HwpkSpza4O1Z4wii9CF+dVi24ZIkSTdmoHaNKArBk1ebjdsAg7qr4RjBrr11Stj5rGjqTN3CaY23blmeCgIUI61UVyAE7Y3K24luImOrqDGtGq58/FwrBmQ4DE/Nafb2219v/BxLKHhDhr/NH7bm9krlf9OfVzDglgweLhvUytJx/1clw7YD4tLn8Ge/gzp5cZ/ur+9DBci9n5UjgiV4NpfCTTLsGRlIVXm857zfDgKc9HLQskTjek0wkltotsVtgnbbcryz7Uvn5MNghjbxiC4OFRh8IlK+0pIkpsagVgAFPleL2FhSdeVB/pn4EakIFD69QN7PcEgvqUphNq2KPIZTEGWind30p/b81ZZhUH3QXxm2Nrmb60HDH753wnWBqQLcNBLRFXHfvl7porVE65KZONllXAA89Y6ez1BSwnesCnR2EO7tYkSE0Tbh7vkhYgbYANnLu+w1ge1FM0GFCLsc8coI+YNITkK/Hgc3D58ggOmQgfUD1P3UP0/lWe+6TnE6+peOXzDumUD1SDoG1HIdHxHMviLqIqE0doequ7GauW31oTHjy/Wjnl9njcny7LsIzwY84Q5HiRQeF3oiVgvSh2tKaiAa72UAnrE4tB8s92+SQOUF98WjTUGAvzGvI2XB7w== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2024 13:40:51.7378 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a6c4faf5-cb1b-4af9-dc53-08dd0ee91c21 X-MS-Exchange-CrossTenant-Id: 753b6e26-6fd3-43e6-8248-3f1735d59bb4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=753b6e26-6fd3-43e6-8248-3f1735d59bb4;Ip=[50.222.100.11];Helo=[uww-mrp-01.datadirectnet.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF000099DB.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR19MB4063 X-BESS-ID: 1732714855-111760-13393-2161-1 X-BESS-VER: 2019.1_20241126.2220 X-BESS-Apparent-Source-IP: 104.47.56.172 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVmaWJhZAVgZQ0MwgxSjRIMXCxC DJONk80dgkKTHN0tjIJNXIxCTFwDhJqTYWANPsxStBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260718 [from cloudscan8-83.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 This prepares queueing and sending background requests through io-uring. Signed-off-by: Bernd Schubert --- fs/fuse/dev.c | 26 ++++++++++++- fs/fuse/dev_uring.c | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++ fs/fuse/dev_uring_i.h | 6 +++ 3 files changed, 134 insertions(+), 1 deletion(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index c53deb690cc9c7958741cd144fcad166b5721e11..5134bd158ce0d24f77a4b622b87ccb83b8c92f3f 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -568,7 +568,25 @@ ssize_t __fuse_simple_request(struct mnt_idmap *idmap, return ret; } -static bool fuse_request_queue_background(struct fuse_req *req) +#ifdef CONFIG_FUSE_IO_URING +static bool fuse_request_queue_background_uring(struct fuse_conn *fc, + struct fuse_req *req) +{ + struct fuse_iqueue *fiq = &fc->iq; + + req->in.h.unique = fuse_get_unique(fiq); + req->in.h.len = sizeof(struct fuse_in_header) + + fuse_len_args(req->args->in_numargs, + (struct fuse_arg *) req->args->in_args); + + return fuse_uring_queue_bq_req(req); +} +#endif + +/* + * @return true if queued + */ +static int fuse_request_queue_background(struct fuse_req *req) { struct fuse_mount *fm = req->fm; struct fuse_conn *fc = fm->fc; @@ -580,6 +598,12 @@ static bool fuse_request_queue_background(struct fuse_req *req) atomic_inc(&fc->num_waiting); } __set_bit(FR_ISREPLY, &req->flags); + +#ifdef CONFIG_FUSE_IO_URING + if (fuse_uring_ready(fc)) + return fuse_request_queue_background_uring(fc, req); +#endif + spin_lock(&fc->bg_lock); if (likely(fc->connected)) { fc->num_background++; diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index b1c56ccf828ec2d4cd921906fb42901fefcc6cc5..66addb5d00c36d84a0d8d1f470f5ae10d8ee3f6f 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -30,10 +30,52 @@ struct fuse_uring_cmd_pdu { const struct fuse_iqueue_ops fuse_io_uring_ops; +static void fuse_uring_flush_bg(struct fuse_ring_queue *queue) +{ + struct fuse_ring *ring = queue->ring; + struct fuse_conn *fc = ring->fc; + + lockdep_assert_held(&queue->lock); + lockdep_assert_held(&fc->bg_lock); + + /* + * Allow one bg request per queue, ignoring global fc limits. + * This prevents a single queue from consuming all resources and + * eliminates the need for remote queue wake-ups when global + * limits are met but this queue has no more waiting requests. + */ + while ((fc->active_background < fc->max_background || + !queue->active_background) && + (!list_empty(&queue->fuse_req_bg_queue))) { + struct fuse_req *req; + + req = list_first_entry(&queue->fuse_req_bg_queue, + struct fuse_req, list); + fc->active_background++; + queue->active_background++; + + list_move_tail(&req->list, &queue->fuse_req_queue); + } +} + static void fuse_uring_req_end(struct fuse_ring_ent *ring_ent, bool set_err, int error) { + struct fuse_ring_queue *queue = ring_ent->queue; struct fuse_req *req = ring_ent->fuse_req; + struct fuse_ring *ring = queue->ring; + struct fuse_conn *fc = ring->fc; + + lockdep_assert_not_held(&queue->lock); + spin_lock(&queue->lock); + if (test_bit(FR_BACKGROUND, &req->flags)) { + queue->active_background--; + spin_lock(&fc->bg_lock); + fuse_uring_flush_bg(queue); + spin_unlock(&fc->bg_lock); + } + + spin_unlock(&queue->lock); if (set_err) req->out.h.error = error; @@ -78,6 +120,7 @@ void fuse_uring_abort_end_requests(struct fuse_ring *ring) { int qid; struct fuse_ring_queue *queue; + struct fuse_conn *fc = ring->fc; for (qid = 0; qid < ring->nr_queues; qid++) { queue = READ_ONCE(ring->queues[qid]); @@ -85,6 +128,13 @@ void fuse_uring_abort_end_requests(struct fuse_ring *ring) continue; queue->stopped = true; + + WARN_ON_ONCE(ring->fc->max_background != UINT_MAX); + spin_lock(&queue->lock); + spin_lock(&fc->bg_lock); + fuse_uring_flush_bg(queue); + spin_unlock(&fc->bg_lock); + spin_unlock(&queue->lock); fuse_uring_abort_end_queue_requests(queue); } } @@ -198,6 +248,7 @@ static struct fuse_ring_queue *fuse_uring_create_queue(struct fuse_ring *ring, INIT_LIST_HEAD(&queue->ent_w_req_queue); INIT_LIST_HEAD(&queue->ent_in_userspace); INIT_LIST_HEAD(&queue->fuse_req_queue); + INIT_LIST_HEAD(&queue->fuse_req_bg_queue); queue->fpq.processing = pq; fuse_pqueue_init(&queue->fpq); @@ -1093,6 +1144,58 @@ void fuse_uring_queue_fuse_req(struct fuse_iqueue *fiq, struct fuse_req *req) fuse_request_end(req); } +bool fuse_uring_queue_bq_req(struct fuse_req *req) +{ + struct fuse_conn *fc = req->fm->fc; + struct fuse_ring *ring = fc->ring; + struct fuse_ring_queue *queue; + struct fuse_ring_ent *ring_ent = NULL; + + queue = fuse_uring_task_to_queue(ring); + if (!queue) + return false; + + spin_lock(&queue->lock); + if (unlikely(queue->stopped)) { + spin_unlock(&queue->lock); + return false; + } + + list_add_tail(&req->list, &queue->fuse_req_bg_queue); + + if (!list_empty(&queue->ent_avail_queue)) + ring_ent = list_first_entry(&queue->ent_avail_queue, + struct fuse_ring_ent, list); + + spin_lock(&fc->bg_lock); + fc->num_background++; + if (fc->num_background == fc->max_background) + fc->blocked = 1; + fuse_uring_flush_bg(queue); + spin_unlock(&fc->bg_lock); + + /* + * Due to bg_queue flush limits there might be other bg requests + * in the queue that need to be handled first. Or no further req + * might be available. + */ + req = list_first_entry_or_null(&queue->fuse_req_queue, struct fuse_req, + list); + if (ring_ent && req) { + struct io_uring_cmd *cmd = ring_ent->cmd; + struct fuse_uring_cmd_pdu *pdu = + (struct fuse_uring_cmd_pdu *)cmd->pdu; + + fuse_uring_add_req_to_ring_ent(ring_ent, req); + + pdu->ring_ent = ring_ent; + io_uring_cmd_complete_in_task(cmd, fuse_uring_send_req_in_task); + } + spin_unlock(&queue->lock); + + return true; +} + const struct fuse_iqueue_ops fuse_io_uring_ops = { /* should be send over io-uring as enhancement */ .send_forget = fuse_dev_queue_forget, diff --git a/fs/fuse/dev_uring_i.h b/fs/fuse/dev_uring_i.h index 19867d27894f9d985e224111ea586c82b4b4cfe8..0826fb1c03e2e38dedad56552ea09461965e248f 100644 --- a/fs/fuse/dev_uring_i.h +++ b/fs/fuse/dev_uring_i.h @@ -87,8 +87,13 @@ struct fuse_ring_queue { /* fuse requests waiting for an entry slot */ struct list_head fuse_req_queue; + /* background fuse requests */ + struct list_head fuse_req_bg_queue; + struct fuse_pqueue fpq; + unsigned int active_background; + bool stopped; }; @@ -129,6 +134,7 @@ void fuse_uring_stop_queues(struct fuse_ring *ring); void fuse_uring_abort_end_requests(struct fuse_ring *ring); int fuse_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags); void fuse_uring_queue_fuse_req(struct fuse_iqueue *fiq, struct fuse_req *req); +bool fuse_uring_queue_bq_req(struct fuse_req *req); static inline void fuse_uring_abort(struct fuse_conn *fc) { From patchwork Wed Nov 27 13:40:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13887017 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 815E61FE454; Wed, 27 Nov 2024 13:41:07 +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=1732714871; cv=fail; b=gd3yqcHQVswzhUm9QnQ044gQ2WikyH6mbrKxiu14ehk1ld4jBLVVhgQg9wZ7ZjwMX3wzw0gvGEkrU9MVYjs8ByKswPm/uQQdXweOoWjnUU4nR15MC/3daLF5IQSlE+12w5XTHAfHWijZC4JLYt/TzL+7qXnyBuyQk5jd3684Fw4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732714871; c=relaxed/simple; bh=9PzkB61bj/XR2Z+Wxlq+/t+fdgKvUzyQ0tG8Huxq6vA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mIfyymTX+Nx3zenAQLvI1SMC4wtJBoH8OsCcaKIR5Kzbwhq7RVYMyUSoDpGQTGgGNElaWNsbMmMQtycHkEgzV/JTsDTO8CVF1v6ht0c1IzWTjFwnlw7W4QFMhu7q7+fNy6OpHdyx3YqTDDcdefthEm/gvODzizcEO2nvdbbeA9c= 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=k/+4Rpa/; 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="k/+4Rpa/" Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2044.outbound.protection.outlook.com [104.47.55.44]) by mx-outbound45-131.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 27 Nov 2024 13:40:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AV+93w9NdBul7FfsGw84fsb/wtyQPusHDPVzcOrFRf5TUi2EfNdLuaflziyZ4NCt9Z66eedNI5NUX5yqaALjxCBKUc+kyi/nz1xhn0d7YB7N8kCZmUY/mzsau/5eHygohug1PXvcLNY6X5kLc6SNea7wcal1taO4SXsATStML3QAhSl6FtmJ5dceHdZ8GpxSDdqUgxyF+kjqEME/IfkPJcMwwlubYbBAV4+D2B1Hn+pkEd2Z4OsRG42fODcn7Hte1Gq7EhSdsWuEzz1Q+BkMQVRj9ZNH4yENOPgg9BQTg5uKiPbCtFL5nhfADLhAjKRQ0MuQqTWRMXthyBezn8eh9Q== 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=+K6grFXYQFUPscAqxdj4dBIZiGWdtyrh7ixfQODKKbA=; b=xQSANleaMaw8KRRdHpXK53wRV8/2dx8arO9xKdutAEnmiwsm4/pyMWpWxqwpoR+m+t3oJoptP1lX+Uda50FYruX7JxM42cccv/pWmN++655JJddkyBmsKyON7rtMNRG2kRScS0YVEXY7tFJrokDjICsDO8Ms5jWcM5inn+wPnRPZPVZtGxOVWzBXj42oKHkWzjb0i845LxFa+xGbWpw5chQhx3aFLuy6WzZf0YP6Zd+MG+H3Tn9mAja1v0Tzbu3q5RUaL4wQV8v3YNGloGAkxFBDH4oE77IZ1vHZ5V1g21Futav6j4a48MDlj1u22ZzKOVI2uw0Zl0V8fofYgdrSEg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=bsbernd.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+K6grFXYQFUPscAqxdj4dBIZiGWdtyrh7ixfQODKKbA=; b=k/+4Rpa/nCnoi9MJJpK49V33IuB9JXDuJeUiGtkp7XTrZdQH9Y63cYHzdvyQoKwrsOWNb13RxafJ7PDlg562ktjCVHHcQ6ApFmA1EmXJMj0hqC6rRTL7AdffoFezuOQ7wcRP2FkTcDvmoAr+0/HECGQx4mEOPnxjT9oHHD4IA7M= Received: from CH2PR14CA0059.namprd14.prod.outlook.com (2603:10b6:610:56::39) by BLAPR19MB4289.namprd19.prod.outlook.com (2603:10b6:208:27a::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8182.21; Wed, 27 Nov 2024 13:40:53 +0000 Received: from CH3PEPF00000018.namprd21.prod.outlook.com (2603:10b6:610:56:cafe::80) by CH2PR14CA0059.outlook.office365.com (2603:10b6:610:56::39) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.12 via Frontend Transport; Wed, 27 Nov 2024 13:40:53 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by CH3PEPF00000018.mail.protection.outlook.com (10.167.244.123) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.0 via Frontend Transport; Wed, 27 Nov 2024 13:40:52 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id E95F62D; Wed, 27 Nov 2024 13:40:51 +0000 (UTC) From: Bernd Schubert Date: Wed, 27 Nov 2024 14:40:30 +0100 Subject: [PATCH RFC v7 13/16] io_uring/cmd: let cmds to know about dying task Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241127-fuse-uring-for-6-10-rfc4-v7-13-934b3a69baca@ddn.com> References: <20241127-fuse-uring-for-6-10-rfc4-v7-0-934b3a69baca@ddn.com> In-Reply-To: <20241127-fuse-uring-for-6-10-rfc4-v7-0-934b3a69baca@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1732714838; l=1916; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=DJ3dd+IL74OJQCvDusXpPNgQqk5rs1+4ays6c3lVSGQ=; b=BwV290uqXxlbs6b8SA4yNxILekT+PsQg02svrXRhPnZzkym53RmUhI+yfOZAQXEL5lX0mpyFl zRVzxqbcLlJCh1BkxBzHOkOTv2+Rn03Me79g9JjqD6nhRKpUe/pQVlK X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PEPF00000018:EE_|BLAPR19MB4289:EE_ X-MS-Office365-Filtering-Correlation-Id: f7b4b2b7-cf7b-4006-67bd-08dd0ee91cb8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|82310400026|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: =?utf-8?q?7A73llGX2YJtHTofeN+2JBptBM02ZVF?= =?utf-8?q?UoxB0mo3QDkaO5m5myoGNXCwKmB64OO4f8OTqMbylKIrFVNurzbJGCHYw+1fdGAzj?= =?utf-8?q?XXLVje8nxW93f2Izm04GfKRrDrzsk6DL37+xw9pUTl2SXrT+e27WbmilaoTYkXyDz?= =?utf-8?q?t8rVjbyIqMoj8iGkCdsgAYK2fjfvEp5BbWRTgAyT5oPEh1LgYuV7caNb0jZqsjn/C?= =?utf-8?q?F9SzZ4ve4M5Pvro6ijDdg3qxEQiAl6f9e7d6DYrpz/5bGgRlHrsZXSBT7DbNksc3i?= =?utf-8?q?VHAxkfxml3X2ZhKUufUNEVW/UbxpeZXHXEdQVkP8X7YtxAk7cLZ9NvMPDxjPSmSUH?= =?utf-8?q?geqFQ9d+HSfkmljCG89sAmry2BUv+eH67KsvLPfUbqd8sxP2ZTASHdRkC13B+o5HM?= =?utf-8?q?KLXRzkV+ZpygcydzyK18BBKmTyM6YtbMTc6sZFAo541fBXFFOdwj0GeMEKpRXTVgl?= =?utf-8?q?D2A5L35kOmD/ZzC6/X9Xnpp1kyECZ+dw8BR5kTPLl0nB+ONgLd9xpywwV2u1nd1kn?= =?utf-8?q?HIq+vbe5oYXkZzdEv3DSrhqERft2UAo4PSedc/+zZheGJzAsk+omTQc+V2lu+50J7?= =?utf-8?q?xQAjVtIOxUrwRsGiWJo8Rfmp62Dx7q1ez2qasC/R6MgS8vgAsuZpAeCMVgEuO6ZO0?= =?utf-8?q?t+BsFmmH3N3ZfBFeAeGMB1mf+GQhwUhytalTajpnjGi3TUFxbw829wbXQ/eQMxOEw?= =?utf-8?q?6lI4r4n7/GQ7RmFir5ewRbauK+zr4Uedkz+spPwQkjeaJH5zCt3IMSPYk/LMazgQN?= =?utf-8?q?6ARTGMKORNOcDZh+WsXMivIPYa49gsryPqEw4oEmpHLqC+/Ybs+KEQem8T57IpVhI?= =?utf-8?q?9rmXBWgiekZXLvOhzNOS6tIVYTLnWTTJ9tPhDzsIhTJyjc4MpHA/sx3tlP7tHL7Jk?= =?utf-8?q?iC9/JxT47CddxNgxEb+gpSAwFAjmEb5EebmVRFYflodu/6PIXrywpQkrXxLU0oFWv?= =?utf-8?q?+gZYReCGdXCAvXKUnR4OM7Zuzxa9rWjjGlo7SJMqG+liGL+IgjBSpygA7N7TifPHp?= =?utf-8?q?Ws7a1xkF4v/VkucRfo8T6dn3l4yL11nZvuTVC4x+WqIFLr+dy7Tg91GvjOM8qjGGM?= =?utf-8?q?pPlehjdqy+XGHljFzyPDw3T42+fY5/RflM6faLp1fNPEk8TT72FwpnNMyWDYXnc3g?= =?utf-8?q?lVIyEvIjzFoHsJiH5LOOY2myAvPUTL/bbzCSdOi4XXgCglw//FaeGUDS6VdYpnCV2?= =?utf-8?q?aTc5//cUyaGg7IysoZtiT6xVRlMSb1+kPz5mIXlWuuQlcWzZAGM6147j9rq5bkFuz?= =?utf-8?q?xzbpC4tazgyJY0MMDEASsvFXS/NMiBmlHEDyq+P9tIIOYAuSz/y0SN7ddqamJPFIW?= =?utf-8?q?wT/HMoLKVrGFpBLdMuTtlHHaNfdd0DSuFQUCBFfdxv+OFA4yz3pwF/PLx5hojAo0M?= =?utf-8?q?+OC/dezOLLv?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(7416014)(376014)(82310400026)(36860700013)(1800799024);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: +eaAJcXa96i9ol6b9mbclcOtrDPGVdY8XTdwLcEJF6gnab8AE3pYG1VOCuykKgNSPlWhj4ygVu+xdsxcm6SXfnB8WHRvTnwMmZFuvT30WHxlnF3yuCKp2/wl12t8h/wlYyTdlR2mq3IJTwAlQV/AmmWHEs7F4Y7ckUEOuxirzsAs6ilbv7n1bFzD68Ktv1PXr9ITLplDZkvI+TVKQZboh/Ee2qVfLLGlYiTpgQBewAlUrTW/nMHmC/PPsQLldL2lgWyZvceemoSbYc414w2sTtn6v8I+nvXzAUNGDqhXy09Tx2zb4EMoRtTqG2Q+XF2axF3ai0i+NXGTUCzv7RkmIEPYsWT3L8D0wQldTPft7q3SkuVqMFfI/9VFtVQlC11ZxwmFjKJigb5B3WDjLH76dZ3bpoOfjTCVop43DC/eEkgV2XL98OEgTytmaYBMUp9piMC+coFPVmX7LCfOoz6v51FLyv2UcLSAY0UodTcA5wQ1XGh5CKGS0YPMVNNnWqWm22hdnJB9yeUTrK2XWP6thdHszIab5DcJVMj3eA+K5Kf5KIxjvBscL0dEts0le8q65TQ8mfYziy3+zq6NlEayVI6EA1rY9NgqOfoaTkiPmlrNEjR2l5tBX3Z8Y0wZlQwzsEyMZhIqCfHzYJyi93B9lQ== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2024 13:40:52.7400 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f7b4b2b7-cf7b-4006-67bd-08dd0ee91cb8 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: CH3PEPF00000018.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR19MB4289 X-BESS-ID: 1732714856-111651-13407-2136-1 X-BESS-VER: 2019.1_20241126.2220 X-BESS-Apparent-Source-IP: 104.47.55.44 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoaWhuZAVgZQ0MwozdzMNCnROM 0s1dDI3NLEIM3SIsUg1cQ8ycQs0SRZqTYWAP8mqz9BAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260718 [from cloudscan12-175.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 From: Pavel Begunkov When the taks that submitted a request is dying, a task work for that request might get run by a kernel thread or even worse by a half dismantled task. We can't just cancel the task work without running the callback as the cmd might need to do some clean up, so pass a flag instead. If set, it's not safe to access any task resources and the callback is expected to cancel the cmd ASAP. Signed-off-by: Pavel Begunkov --- 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 4b9ba523978d203ae23fb4ec9622d6e4e35a5e36..2ee5dc105b58ab48aef347a845509367a8241b9b 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 39c3c816ec7882b9aa26cd45df6ade531379e40f..38b6ccb4e55a1e85d204263272a280d3272557a4 100644 --- a/io_uring/uring_cmd.c +++ b/io_uring/uring_cmd.c @@ -119,9 +119,13 @@ EXPORT_SYMBOL_GPL(io_uring_cmd_mark_cancelable); static void io_uring_cmd_work(struct io_kiocb *req, struct io_tw_state *ts) { struct io_uring_cmd *ioucmd = io_kiocb_to_cmd(req, struct io_uring_cmd); + unsigned int flags = IO_URING_F_COMPLETE_DEFER; + + if (req->task->flags & PF_EXITING) + flags |= IO_URING_F_TASK_DEAD; /* task_work executor checks the deffered list completion */ - ioucmd->task_work_cb(ioucmd, IO_URING_F_COMPLETE_DEFER); + ioucmd->task_work_cb(ioucmd, flags); } void __io_uring_cmd_do_in_task(struct io_uring_cmd *ioucmd, From patchwork Wed Nov 27 13:40:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13887013 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 807021FCFCC; Wed, 27 Nov 2024 13:41:01 +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=1732714865; cv=fail; b=gK6dhKiA1NO+fE+bt5644Cp/xJnVlMPG89sVFLCS7E2NiyGJ1CydyA2oHOoX2Uopp/tCUDg0rYFqmgw9+VXnJh9IhNNZlEHXpePbKhxQBJPhQZCLuruc7DK+0elOHCWnaQ8QcntPjWySCnTUxePBJVMxmDnZJFD+BYUnbNFmnhU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732714865; c=relaxed/simple; bh=0lzjX4/7JNaE+LdkRqg0ZnQVuZyH8t1LjuQhvpCVxF4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tKlF8aOEAOrVtoHb8vgkCndkxpFXD449M/LACfLcv/7bhCpGSk5j/ooH26b6/3yuVfj83t26t98T3tfjAYfneZTgfNnkg3jIfd5OoRyoVj2N8Phpa4WUJ9AIGVQlVGVrJMlAviUPq9Qlg563hErOcsfiYAf54cCyHZQCZjiJ3FA= 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=1p5uREsv; 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="1p5uREsv" Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2170.outbound.protection.outlook.com [104.47.59.170]) by mx-outbound14-13.us-east-2a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 27 Nov 2024 13:40:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yOLNIwyaocoC53j1/PsAu7k+eMx77Hhk+cRnTZrzTq0mXHWK8HqOSRHK9syQ30F767wGOO/mG7231bYgwtvGy2agu43KoiS7Z8nBFvHNb4xfVbR/XjA7ZWNNd1BYrROtK9wQSDK8fvzvM4ymNEos1dK9bWQiC6IO+5erwik+M3m4iJu0duBWuy5conXWOKde1cxwKLXJHjb/b/67hzO1iT42RqlgX9diCJFK4qDB22WeM5lut05kdiCCcWYT3pYH061oawB3DWPCCD4a8XA7/nSrCW6szg0Xpv9ZTmpgH0FuOkPClLVl4pZvE7xNz7qnPkuUJVR3ZHt/3fzWoviIkQ== 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=09hcynU61oTWlT8A9fGNN0G6i5QxrdJeCbrCrG4GLKk=; b=w/5Crs9vSLBw0d/zqGQtD8OFCcI5s9BBQn56lqHrz7sCyfvd+BFZbBVnhcR1j/CHOgHm2dTLGMUJ8bKwYyNTLL58msTqGSOfIkRvbcf9tJXZ2DXqPzMMT98tZ543jatybZhCWbhBmZgdANVVJv0Mc2gugiaLnlFKEjD9Cbylub00LciDB6t4SuE5fbm4V8N8WvaGT/aRq0ImfDHA0AoeaEWO/lAfDZzFnGrQPLMTUr1rYKa5BBYtTRPLJY4dX4wyrmTTws7smXASWw2E1b575xzYDc+s7JUiIZ3btmX2cpug672q63eZWYLFTb57bL8qsY8R2L2zWs0E8gQPAvakbA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=bsbernd.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=09hcynU61oTWlT8A9fGNN0G6i5QxrdJeCbrCrG4GLKk=; b=1p5uREsvrgTmt6O45YtzoBGZ+F+7YX/ebqgUEAdlHAjxfJzumWPt4+1/pXAN7ACNAEq0PKTZOWc+WdvzJFVog1F3hMfkhcCm4DqeDOuiAr2i8EhuLbN/Z+Bfr8Xx78pGTv9f9cKTb42+MXWg5v6LpbPymCIYUtqDX7BE2M7Qhbk= Received: from CH0PR03CA0251.namprd03.prod.outlook.com (2603:10b6:610:e5::16) by CY8PR19MB6987.namprd19.prod.outlook.com (2603:10b6:930:5c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.13; Wed, 27 Nov 2024 13:40:54 +0000 Received: from CH3PEPF00000013.namprd21.prod.outlook.com (2603:10b6:610:e5:cafe::ae) by CH0PR03CA0251.outlook.office365.com (2603:10b6:610:e5::16) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8182.21 via Frontend Transport; Wed, 27 Nov 2024 13:40:53 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by CH3PEPF00000013.mail.protection.outlook.com (10.167.244.118) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.0 via Frontend Transport; Wed, 27 Nov 2024 13:40:53 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id E131D32; Wed, 27 Nov 2024 13:40:52 +0000 (UTC) From: Bernd Schubert Date: Wed, 27 Nov 2024 14:40:31 +0100 Subject: [PATCH RFC v7 14/16] fuse: {uring} Handle IO_URING_F_TASK_DEAD Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241127-fuse-uring-for-6-10-rfc4-v7-14-934b3a69baca@ddn.com> References: <20241127-fuse-uring-for-6-10-rfc4-v7-0-934b3a69baca@ddn.com> In-Reply-To: <20241127-fuse-uring-for-6-10-rfc4-v7-0-934b3a69baca@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1732714838; l=1124; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=0lzjX4/7JNaE+LdkRqg0ZnQVuZyH8t1LjuQhvpCVxF4=; b=p8UC7auYob1Zdxd+w41lDdIpSKMOHpDDn2MT7N633Of4s14XOiPUGNJXw8qWc/1Mcirk6Xp8f fMP3w0SgueDD6BzeGVnU9DF70funlQUGbmg9ESpuUw1TWbP3g2dnDZY X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PEPF00000013:EE_|CY8PR19MB6987:EE_ X-MS-Office365-Filtering-Correlation-Id: a4685903-1e51-46c7-f72c-08dd0ee91d45 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|82310400026|36860700013|376014|7416014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?3JyhFTj3I03M7y2ObQvvEe1n6icQ4Is?= =?utf-8?q?4nPQf367wFlrmdyx4u90xxUxpSbsPvvJC/fva3WmQEYyfXMnbvNvh2E/5O/CyqSgX?= =?utf-8?q?a9NK2xpVyPIzimUJ9gVNl5CEDkvWGZhrA9XLMo/AfOY0tv3zviOXsnzP4YaescBEo?= =?utf-8?q?J6ECkqBJempI7NdMeFiXrBfgqMIt95K+DbEU03klZwFCIX44dJ0kiBYifSfeTqQBZ?= =?utf-8?q?WoGhaktZQbjstIXz4ErCXgr514C66hxm61E2Mkxgfh5t7E9sqn2H2jfBkCSMf5jGF?= =?utf-8?q?vsDJee1UV0uplQF6HnrjZ+qVEh4JBoXp7fQWSIuQ+meIqI+KJSAJQ85tZf5r8U0t+?= =?utf-8?q?CHR2+o9sGjHQdskDtM8EZMxEJIO8Du430NZUxQ1O3vrVEmmSh1SvOO/oLZ0KjUYJ0?= =?utf-8?q?OYNfwwX284HiQ3BmRcyz7/3ZKdtEU3eoTnHMxyECoKZHKz/qTK0jIBqYJVt9EsZgq?= =?utf-8?q?887W/QVwLgIuuomTZ+xex1TlzRxs79ybJhOryt8OzBYfYcTR4B8sWbLyo6tuearfi?= =?utf-8?q?GaeXnrYvSL087HbkX5SCbX7aMvvOVdm85iCzxlrQPWRKcIF6Wmh8zSUNiQ7Td8zmn?= =?utf-8?q?10yX5EbsmT2bCRjQEWFfSyGfMtxDIb+EnUz1550LsRDJPzpgDjjWDJM3dDUgCQQn/?= =?utf-8?q?XY0gpJZSIZsaAQ/ok1YJFyLMMXC+FM4P3gWdu+W2WeJykomkF7LraIoacdZYug7N5?= =?utf-8?q?lIHh5CQWt3+ODo3dGUdy1BZEm0qIBRFnAbXvLz4OU6BUwl/lP2rrzsWwEargwmq8Y?= =?utf-8?q?dtuILhnVzpc5oJYhYs4UgadNfsvrC/WriD0HE9BhFzyegKUx8zoM7lT0D197aEmmW?= =?utf-8?q?get7GRJK90Y+Bwuj5HSbDqJBbryKONH7aB/eDn6ElMDyoVXYOKjPMjiODnThQaxSL?= =?utf-8?q?E2WshZo7ddPRpa7surh/ikE4nOWatMhd1lNT1FBt1U8EofhqyxixguFRhiQ1J4exb?= =?utf-8?q?jnpCsVqqq9YYUAQVgiH2O0vRjiLf0f2ggGhC7B1kM0RydOAaBZP/qJrm5d9WyvfeN?= =?utf-8?q?sEDwKdlY7St2a5E3ohkUFRS+iSxcTQRrXW7h9wr+xzbPfeuIM6aXyW84tHJEvqFVs?= =?utf-8?q?UiSeCv2AX3veVSf/nsF9Uy3UW8W1jDi9yQyNVXSIVy9rQ8wXuS3bB1qwlopxd3q0e?= =?utf-8?q?ypwobUhLHNnCmd5WovrYfy0YPPSp3WpIpDPVl23vmTlLQG+2anIaggxvmoZBgq74h?= =?utf-8?q?uctrmeZnQ43BqYziVtdctsPLRYcoRFvazHc7jkR8GbVhyYXYYuK8bQhSjBkw5bLU2?= =?utf-8?q?pbxiZFjCcNrNcO/RdcGI90Ingqf6c5RG+HX/ktnRhS3ef7uCDWImGffqCYGUZwYXJ?= =?utf-8?q?xVLhcDloDhyyb3bjG9aj51C3c8mgZ/JKcyk56iROIXfhT3GC8dcnySKgKawSt6oVo?= =?utf-8?q?IjGzc7rEyZ2?= 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)(7416014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: XwrpNgSwfPSYv1EpgxmiFbVkgRnFe17a1FuTscUf1xIhx914ows2kIzn8HwBVJ5yfv3icxwH0bimH4PoTaIY7GYyLp8pxh5Ejxe+nyo33eqtdqSbAaZcyxjanDBe5xW4CObiHfgzlnQf9QZYOYE+Aw4y0PCjl0EhhrvOwQYFEcRrfzVqt0ita+BNFbX30GFtYznnPHNPxtZcCZCtw9PLK1BRx2RwL3LgQ2QJBL9+pgfFXFekG4cbWvSTazuFCVxmQt2gQ1bfJ+3rYomNuevKboOlttWa9fQ285YAn/WB2zHML6yqN87IiuCixBaXB/TG+GMZnfks7wfs7OwC+NgCFhdRiTYqXA07Emi0zSX2VmBC6ImROe4gwND3O/puXqmVqFs+wJAAQiOeTf36UvodVCCLceI1ZD3S4Pgx0zvU6AV3UTLVV4uzdnDWecvDFveIEHvdvC+hdB5u6AySoGnbpawekJngMBNwGIySgKfv7kv/ylJ5S/ljGTNmfozQwIv3RaiCnvL4AmQ13aPVPCMZ3bnFYcoCVtTKe81iSnAngLE9SHVYueaAGvhx48baW+PJXbSwPyrmvjpID9pV2KGj3FSOLwJRthlR3thOfuaFlgbevbZQu3WI5Q7JpgnyAW+2qAVbfEFtBRxspLkcMX0ycQ== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2024 13:40:53.6834 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a4685903-1e51-46c7-f72c-08dd0ee91d45 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: CH3PEPF00000013.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR19MB6987 X-BESS-ID: 1732714856-103597-13475-2202-1 X-BESS-VER: 2019.1_20241126.2220 X-BESS-Apparent-Source-IP: 104.47.59.170 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoYGFqZAVgZQ0CzFPCUxNckgJc 3SMM080dTAONHU2DLV0NjY1MLcNNlIqTYWANaAcZhBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260718 [from cloudscan14-190.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 The ring task is terminating, it not safe to still access its resources. Also no need for further actions. Signed-off-by: Bernd Schubert --- fs/fuse/dev_uring.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index 66addb5d00c36d84a0d8d1f470f5ae10d8ee3f6f..94dc3f56d4ab604eb4b87d3b9731567e3a214b0a 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -1056,16 +1056,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 Nov 27 13:40:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13887016 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 9ABC61FDE02; Wed, 27 Nov 2024 13:41:03 +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=1732714867; cv=fail; b=DmZABShw0L1vxsCnj+7HQJScO91qke7kY4/9/3iaucJSDzoffZnXAy8tzDWWpB5XRwnwrj/UkaCsGzfg/Z+E43JszeIsXXsXBEPvjXXB3xpKEM1KCsO9jLfGF4rXJRUlwonYOzOE1NotfRED1YSjtWytTj2J8dg8tDWBINCfIrY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732714867; c=relaxed/simple; bh=U0rOiOpbEi0wwx1eGkRe+gsNPTVSxtP4ER7cQV8xVR0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=aY//IahNET9ap/Ryc8hwiRkcd6rOr46CMQDzmtVuy5ydOSu+qHzm1Rgjr795IZwZ5J+jRHXNA1n/liBYBHjmiNKSIi/fJiCTdYiPPdEjvbyYuJhCaao2exvb6/QlRrIz7ugjRyMSE/3JOaHjPovrlzQ31Nzk7HtDJIp+a9MZ4LY= 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=1sddP6XI; 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="1sddP6XI" Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2169.outbound.protection.outlook.com [104.47.55.169]) by mx-outbound41-168.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 27 Nov 2024 13:40:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=q4TLABV+FYA8UooddxM4Ja9r1EV6Le1j36PYlv9XX2Fvs7AYDXccZiwBDOTtElhcVLfiN/hISrsxacCcLygOP5s1rNfXYNRsrCilds+svGPvm6TplGRduH3viaWFzyU4+HJbfvEEZkjLOrinm9gNs6fDrQr28oXfa9GqsZ9wE65gCsjwDDX2/INRxVq4dWhY5r6vzklS6QCY0OQqH6OPABt2J4y9S3DP97vwvrQT5cdyxXiq/TtmaqO1xdF4jdEEBW4C8MaTGo13AWMcyBEGyy1n3ar8Mx0V/BNG2avmqL+hNv1zTw8qpnDOuK3thFXkJj9VLR5dTZyaQ7oefe7vWw== 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=PQbxxKacmAonMd5Qo/sy8APS/T3tU1DF7yb6bfGdkPI=; b=Y+P8RwamyR0O0sPZLFPmcLrgccVph7VfzAzUCIxR5UFVE+D7JtE3zPD+LHfc5PF6WhE0diWgt6fW1+BmVbNy4i8lXpzq8IIXO9WhJRkzO7RKf3I7PxcTQREPzmzMqf2sYHCWFpYZBx3hPcjg/Yag6kCCVYczQui+ayuHVfinyzDYs9fPssgoS6SsCYR0iH7wJW//M3/66CgSmif6h4kuY2eZDsVsJD+acMkpX4vIVaR4vc5/SAsEDkGp72SteYZxUNZbud3CPsTK56TJn9FfD4t9170rMm36mOptBbQtzC/W7EgzmZQjm+PNMmQi48FZ0XwQXqGJalINU+5cHOFbzA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=bsbernd.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PQbxxKacmAonMd5Qo/sy8APS/T3tU1DF7yb6bfGdkPI=; b=1sddP6XIRDyFVjN3cgh8DTAkyJ4DNqantP7EchU4NvvA53jDqdzMKpHp8gNjUhucKlgVK4yH2Wkq7ReGkZ8Lr83/F3iiR7y3JuyHNm1yD75uMDmgN22ICfb8WJdiOVKnz3TTtIVxs30zmZqvnLPDVC1rEZbzbOqGmihxKvn2Chg= Received: from SA1P222CA0143.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:3c2::19) by SA1PR19MB7087.namprd19.prod.outlook.com (2603:10b6:806:2b8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8182.20; Wed, 27 Nov 2024 13:40:54 +0000 Received: from SN1PEPF0002636D.namprd02.prod.outlook.com (2603:10b6:806:3c2:cafe::b0) by SA1P222CA0143.outlook.office365.com (2603:10b6:806:3c2::19) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.12 via Frontend Transport; Wed, 27 Nov 2024 13:40:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by SN1PEPF0002636D.mail.protection.outlook.com (10.167.241.138) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.12 via Frontend Transport; Wed, 27 Nov 2024 13:40:54 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id D91BD2D; Wed, 27 Nov 2024 13:40:53 +0000 (UTC) From: Bernd Schubert Date: Wed, 27 Nov 2024 14:40:32 +0100 Subject: [PATCH RFC v7 15/16] fuse: {io-uring} Prevent mount point hang on fuse-server termination Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241127-fuse-uring-for-6-10-rfc4-v7-15-934b3a69baca@ddn.com> References: <20241127-fuse-uring-for-6-10-rfc4-v7-0-934b3a69baca@ddn.com> In-Reply-To: <20241127-fuse-uring-for-6-10-rfc4-v7-0-934b3a69baca@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1732714838; l=9835; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=U0rOiOpbEi0wwx1eGkRe+gsNPTVSxtP4ER7cQV8xVR0=; b=1lUu1tvxyj64PPeU5AGGWBimSyjEyOQxN9yS/kiIX+vduO1OG1/H2sjYYLa3JVjP1HFo77rPg m0lDo8l/wzEBd5fVxJ5bMi4JF5UD/p+Hao58I1sk94oHUUkstp+0NJc X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002636D:EE_|SA1PR19MB7087:EE_ X-MS-Office365-Filtering-Correlation-Id: 0ff30fcb-c93a-4f7f-575a-08dd0ee91dd5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|82310400026|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: =?utf-8?q?xUEDNGTY8yvZtAkptlmEADlz2YXz85X?= =?utf-8?q?uwraOLrWsQ6DVc055+EFFYIXF+ne3bAKwc62HEZv8Mr+Jy/hZZE3ohl9vjkqgFS5O?= =?utf-8?q?s6qbQMiaPdcAl72f5BSmc1tDxwl7ovKL+d+LRf8SUZ7eKi5BfvAeJvO9OINEpHCAA?= =?utf-8?q?eRZRwEgnDqMPONuicfq/pP8dZ2fBBtGSLYZqyp4daqt6rKQyXu8bejIjvxgw2EARj?= =?utf-8?q?xc3pnaPCkafY9dOIeJiGEp3+37zk29iFBee4ZRNZWlbevoLRweibTduMiBQCaNh3Z?= =?utf-8?q?UFG62Wp7+pQJepK+BsusMNNYlwbMX/cbhKz+ZWal8gN8tY8xbi7+y1QgK9gNbNY4i?= =?utf-8?q?p5wo65A4YOOm8FhgElBhHULitLyPmIXwz+0SiMlHCDEXIzWdcaXN07WqQbNtgiVTF?= =?utf-8?q?VzbCXAGEBxLRMfiwFyQ/pKiPtlp4zrUq8kMphQXUMlhMSJuRvPIJQ0Rqv2qMSl/1x?= =?utf-8?q?or1VmUwN2yrUBcKY0Y9tandsfEPO9G0DsC5n8TbgGMaBA5KBRHQcDHRfCGllTQEVi?= =?utf-8?q?WP42DHKP/gwMA8xTbGalAd2EgBl/KQObF2yszeLIDaBvREp7+KAjOr24xbdMygRy3?= =?utf-8?q?oZ6GTVJiQpHaK2GC0dMg+P7eBO/y6dypR949qeta5a/Q962WPH6A4b8seg9HuIAtf?= =?utf-8?q?2I5Pe03Y9FAvZSEubf00zDhVogshrzbfXYBeXjDaFhO1jKAGfFrPYYhlB0gDp8yH0?= =?utf-8?q?E+q/KxUB5PMv+sAMlQ9MjEz117wned9hnCyHmV8LuzVEHWNMMDY3Jy3i4JRLhqMHE?= =?utf-8?q?PSKPFWzeZeZUVqDbxE+hm8I2LXkvBo/o+7vuQ/qH0Wg9P5MZL5zyPb9+h/Ck9fX8b?= =?utf-8?q?JfCtm4IcaU/DQHYZ9JqMnMPcny2+wVbvcuN6PFmOD5MUv8gufqnpF/XgQyXZ3u5Et?= =?utf-8?q?ewcfy9AGV15lihnsZDzAGRgqc+gL1AxkGkVksWL/mPD75/NiTL6euSdEgZ5DO0Ujc?= =?utf-8?q?V1QhOqBvJihALyOSAGKP7ahyLJuLa0gYuf3guISCKDZI5V98SUy9QYgbFrFD9/gu4?= =?utf-8?q?jQs1bOeouwQsoJByDcL71dLwZ22gztvOdM27sT/ut+Bu1VHzYi3izsJ/OzKX25gUQ?= =?utf-8?q?6Ff/+kHyk1sFbqUL6LEdDHVaD8G+InRjihP+NGB1Q7oUnlq/V5pxmjAv6goziTyuk?= =?utf-8?q?+ybSb25OKCVaFstVIpHnStnqv0P7PJQvLxDWKEu0j5QzUXyJFZoc6fQGlUffBvyDa?= =?utf-8?q?CpC/hgXlY6NsibDJQglZJaLRaOVKrpDsiSOQK71Jae4pJl7RJc57C0HJUSbEuqp9U?= =?utf-8?q?0WAz3n2uSmW1hUtSQYh0IwZmgxp3BP+cpubmqUuNBrf54OqxdJQUumMxO7GWXyOn7?= =?utf-8?q?SLuBiFQZc/+i0tLoioqIn5Wrh7lrET0xkXVleumYm+/JUWUNCkRpJOzVOiQ28iVpX?= =?utf-8?q?hdwjWDCFROa?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(7416014)(376014)(82310400026)(36860700013)(1800799024);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: agjcKNmk/regw4zQRhz4wsWbLste5JPJQpbc0Mxu/YB3dOSpLsJvxUdQTSRnIntzhYWXBH3t6TuHdyKyw2PNC/T/bz3NTTiyG7Etm5UB/y+Z/Tzi+FEjZhCcKY1oRXADuqPT2Uo22vSDkOMOXqhaSvgq7T99WitUT5crsvLd472A7nCcy0aCVR+SxN/uYeRIMPnopd+UxlrRgDutbxZtixGo4rvkPdxqtgvSyKrXnjQPMM6wyGyZWhaNX8RFMc1XAvM75QWi3mlyyLYbPaIIRbtTIof9c4L6DsZBPUKHd7KuNsjooGkXOMGnWyT7sBkJvU3DiQBousnev+RNh9Wmyc2umfK1ssrno19Ap3+c595StbLWR1MybYiGqhsrlH5HGTt5bP5Dww1mOSY2iyP01mkb5EpGeQQWlucjzbTIlLAofIPHkvI1c0XJKxVacYt4Ptjp99rM1cxqsGHL5A+8aJTsddDgoRyxZF5s95TlEJkjV5W5/KBk2ps3FUj9+YNvnGzE+KUUftCgiZ5mwjWpxQvzlgJ6N2l5qRL2dLuVMIjiv79qZGqiY9ui+B0eSrB1eAm4JnvOln/yL3YC6IWsrmayo9zRp/lruXqZBx8WB8wVYlj0+47nuysUjFxHqE8bQ8SgdlUY3k8lj73+medlKQ== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2024 13:40:54.6230 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0ff30fcb-c93a-4f7f-575a-08dd0ee91dd5 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: SN1PEPF0002636D.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR19MB7087 X-BESS-ID: 1732714857-110664-13393-2147-1 X-BESS-VER: 2019.1_20241126.2220 X-BESS-Apparent-Source-IP: 104.47.55.169 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVpamJgZAVgZQ0MwkJcXAOC3ZPM 3UwtQ8MTXR0iA1JTk10TA1Kckw0dBAqTYWAPlXP/NBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260718 [from cloudscan19-165.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 When the fuse-server terminates while the fuse-client or kernel still has queued URING_CMDs, these commands retain references to the struct file used by the fuse connection. This prevents fuse_dev_release() from being invoked, resulting in a hung mount point. This patch addresses the issue by making queued URING_CMDs cancelable, allowing fuse_dev_release() to proceed as expected and preventing the mount point from hanging. Signed-off-by: Bernd Schubert --- fs/fuse/dev_uring.c | 109 ++++++++++++++++++++++++++++++++++++++------------ fs/fuse/dev_uring_i.h | 12 ++++++ 2 files changed, 95 insertions(+), 26 deletions(-) diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index 94dc3f56d4ab604eb4b87d3b9731567e3a214b0a..fe24e31bbfecec526f88bc5b82b0aa132357c1cc 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -26,6 +26,7 @@ bool fuse_uring_enabled(void) struct fuse_uring_cmd_pdu { struct fuse_ring_ent *ring_ent; + struct fuse_ring_queue *queue; }; const struct fuse_iqueue_ops fuse_io_uring_ops; @@ -221,6 +222,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; + struct fuse_ring_ent *ent, *next; queue = kzalloc(sizeof(*queue), GFP_KERNEL_ACCOUNT); if (!queue) @@ -249,6 +251,12 @@ static struct fuse_ring_queue *fuse_uring_create_queue(struct fuse_ring *ring, INIT_LIST_HEAD(&queue->ent_in_userspace); INIT_LIST_HEAD(&queue->fuse_req_queue); INIT_LIST_HEAD(&queue->fuse_req_bg_queue); + INIT_LIST_HEAD(&queue->ent_released); + + list_for_each_entry_safe(ent, next, &queue->ent_released, list) { + list_del_init(&ent->list); + kfree(ent); + } queue->fpq.processing = pq; fuse_pqueue_init(&queue->fpq); @@ -281,24 +289,27 @@ static void fuse_uring_stop_fuse_req_end(struct fuse_ring_ent *ent) /* * Release a request/entry on connection tear down */ -static void fuse_uring_entry_teardown(struct fuse_ring_ent *ent, - bool need_cmd_done) +static void fuse_uring_entry_teardown(struct fuse_ring_ent *ent) { - /* - * fuse_request_end() might take other locks like fi->lock and - * can lead to lock ordering issues - */ - lockdep_assert_not_held(&ent->queue->lock); + struct fuse_ring_queue *queue = ent->queue; - if (need_cmd_done) + if (ent->need_cmd_done) io_uring_cmd_done(ent->cmd, -ENOTCONN, 0, IO_URING_F_UNLOCKED); if (ent->fuse_req) fuse_uring_stop_fuse_req_end(ent); - list_del_init(&ent->list); - kfree(ent); + /* + * The entry must not be freed immediately, due to access of direct + * pointer access of entries through IO_URING_F_CANCEL - there is a risk + * of race between daemon termination (which triggers IO_URING_F_CANCEL + * and accesses entries without checking the list state first + */ + spin_lock(&queue->lock); + list_move(&ent->list, &queue->ent_released); + ent->state = FRRS_RELEASED; + spin_unlock(&queue->lock); } static void fuse_uring_stop_list_entries(struct list_head *head, @@ -318,15 +329,15 @@ static void fuse_uring_stop_list_entries(struct list_head *head, continue; } + ent->need_cmd_done = ent->state != FRRS_USERSPACE; + ent->state = FRRS_TEARDOWN; list_move(&ent->list, &to_teardown); } spin_unlock(&queue->lock); /* no queue lock to avoid lock order issues */ list_for_each_entry_safe(ent, next, &to_teardown, list) { - bool need_cmd_done = ent->state != FRRS_USERSPACE; - - fuse_uring_entry_teardown(ent, need_cmd_done); + fuse_uring_entry_teardown(ent); queue_refs = atomic_dec_return(&ring->queue_refs); WARN_ON_ONCE(queue_refs < 0); @@ -434,6 +445,49 @@ void fuse_uring_stop_queues(struct fuse_ring *ring) } } +/* + * Handle IO_URING_F_CANCEL, typically should come on daemon termination + */ +static void fuse_uring_cancel(struct io_uring_cmd *cmd, + unsigned int issue_flags, struct fuse_conn *fc) +{ + struct fuse_uring_cmd_pdu *pdu = (struct fuse_uring_cmd_pdu *)cmd->pdu; + struct fuse_ring_queue *queue = pdu->queue; + struct fuse_ring_ent *ent = pdu->ring_ent; + bool need_cmd_done = false; + + /* + * direct access on ent - it must not be destructed as long as + * IO_URING_F_CANCEL might come up + */ + spin_lock(&queue->lock); + if (ent->state == FRRS_WAIT) { + ent->state = FRRS_USERSPACE; + list_move(&ent->list, &queue->ent_in_userspace); + need_cmd_done = true; + } + spin_unlock(&queue->lock); + + if (need_cmd_done) + io_uring_cmd_done(cmd, -ENOTCONN, 0, issue_flags); + + /* + * 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 */ @@ -638,8 +692,10 @@ static int fuse_uring_send_next_to_ring(struct fuse_ring_ent *ring_ent) * Make a ring entry available for fuse_req assignment */ static void fuse_uring_ent_avail(struct fuse_ring_ent *ring_ent, - struct fuse_ring_queue *queue) + struct fuse_ring_queue *queue, + unsigned int issue_flags) { + fuse_uring_prepare_cancel(ring_ent->cmd, issue_flags, ring_ent); list_move(&ring_ent->list, &queue->ent_avail_queue); ring_ent->state = FRRS_WAIT; } @@ -742,7 +798,8 @@ static void fuse_uring_commit(struct fuse_ring_ent *ring_ent, * Get the next fuse req and send it */ static void fuse_uring_next_fuse_req(struct fuse_ring_ent *ring_ent, - struct fuse_ring_queue *queue) + struct fuse_ring_queue *queue, + unsigned int issue_flags) { int has_next, err; int prev_state = ring_ent->state; @@ -751,7 +808,7 @@ static void fuse_uring_next_fuse_req(struct fuse_ring_ent *ring_ent, spin_lock(&queue->lock); has_next = fuse_uring_ent_assign_req(ring_ent); if (!has_next) { - fuse_uring_ent_avail(ring_ent, queue); + fuse_uring_ent_avail(ring_ent, queue, issue_flags); spin_unlock(&queue->lock); break; /* no request left */ } @@ -826,7 +883,7 @@ static int fuse_uring_commit_fetch(struct io_uring_cmd *cmd, int issue_flags, * and fetching is done in one step vs legacy fuse, which has separated * read (fetch request) and write (commit result). */ - fuse_uring_next_fuse_req(ring_ent, queue); + fuse_uring_next_fuse_req(ring_ent, queue, issue_flags); return 0; } @@ -868,7 +925,7 @@ static void _fuse_uring_fetch(struct fuse_ring_ent *ring_ent, struct fuse_iqueue *fiq = &fc->iq; spin_lock(&queue->lock); - fuse_uring_ent_avail(ring_ent, queue); + fuse_uring_ent_avail(ring_ent, queue, issue_flags); ring_ent->cmd = cmd; spin_unlock(&queue->lock); @@ -1022,6 +1079,11 @@ int fuse_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags) if (!fc->connected || fc->aborted) return fc->aborted ? -ECONNABORTED : -ENOTCONN; + 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); @@ -1074,7 +1136,7 @@ fuse_uring_send_req_in_task(struct io_uring_cmd *cmd, return; err: - fuse_uring_next_fuse_req(ring_ent, queue); + fuse_uring_next_fuse_req(ring_ent, queue, issue_flags); } static struct fuse_ring_queue *fuse_uring_task_to_queue(struct fuse_ring *ring) @@ -1129,14 +1191,11 @@ void fuse_uring_queue_fuse_req(struct fuse_iqueue *fiq, struct fuse_req *req) if (ring_ent) { struct io_uring_cmd *cmd = ring_ent->cmd; - struct fuse_uring_cmd_pdu *pdu = - (struct fuse_uring_cmd_pdu *)cmd->pdu; - err = -EIO; if (WARN_ON_ONCE(ring_ent->state != FRRS_FUSE_REQ)) goto err; - pdu->ring_ent = ring_ent; + /* pdu already set by preparing IO_URING_F_CANCEL */ io_uring_cmd_complete_in_task(cmd, fuse_uring_send_req_in_task); } @@ -1189,12 +1248,10 @@ bool fuse_uring_queue_bq_req(struct fuse_req *req) list); if (ring_ent && req) { struct io_uring_cmd *cmd = ring_ent->cmd; - struct fuse_uring_cmd_pdu *pdu = - (struct fuse_uring_cmd_pdu *)cmd->pdu; fuse_uring_add_req_to_ring_ent(ring_ent, req); - pdu->ring_ent = ring_ent; + /* pdu already set by preparing IO_URING_F_CANCEL */ io_uring_cmd_complete_in_task(cmd, fuse_uring_send_req_in_task); } spin_unlock(&queue->lock); diff --git a/fs/fuse/dev_uring_i.h b/fs/fuse/dev_uring_i.h index 0826fb1c03e2e38dedad56552ea09461965e248f..df541247f07e413923b13b6bf203f301e8c1710a 100644 --- a/fs/fuse/dev_uring_i.h +++ b/fs/fuse/dev_uring_i.h @@ -28,6 +28,12 @@ enum fuse_ring_req_state { /* The ring entry is in or on the way to user space */ FRRS_USERSPACE, + + /* The ring entry is in teardown */ + FRRS_TEARDOWN, + + /* The ring entry is released, but not freed yet */ + FRRS_RELEASED, }; /** A fuse ring entry, part of the ring queue */ @@ -52,6 +58,9 @@ struct fuse_ring_ent { */ unsigned int state; + /* The entry needs io_uring_cmd_done for teardown */ + unsigned int need_cmd_done; + struct fuse_req *fuse_req; }; @@ -84,6 +93,9 @@ struct fuse_ring_queue { /* entries in userspace */ struct list_head ent_in_userspace; + /* entries that are released */ + struct list_head ent_released; + /* fuse requests waiting for an entry slot */ struct list_head fuse_req_queue; From patchwork Wed Nov 27 13:40:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13887015 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 A09161FDE06; Wed, 27 Nov 2024 13:41:03 +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=1732714867; cv=fail; b=j50zC0R4wwIlpY1WnaN6kbndBiMWZdcQMmCDMOMQMYOi4BjuaV1l10UmfqFmVSQYVURS2uWGkbXt6bMnb11qFm55T5dGNJ3dSZZLIgwk8CPfPqffPs51u+FTICcpKxqn3W8H1hMAWrmsRD/bkpVGgXph7tWfMQliAXJQPFTrORk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732714867; c=relaxed/simple; bh=XFkl+WqqLAjH6uZixQ2rg5NnynNvDs2uyYFQqVLociU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=feOQsxZ/m/5H7CjhDdraMamWjdquiKcBUzagwdqkOKxoPMzHvdwpL24uF1yE8WU2lXKUXlBdTVE8FEl8Mr35MQqEt14/jDtuUI9MAx7LES0JSmUzpxdPse3XvXk6XSwi22SpQxRHNfTkYQQxaSqF5OGwYnTiP5hA/tLSKUA/JzY= 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=azuh3GJN; 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="azuh3GJN" Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2043.outbound.protection.outlook.com [104.47.70.43]) by mx-outbound-ea15-210.us-east-2a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 27 Nov 2024 13:40:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=u1ZP5SLd4wYtt7gmBUp30KIkeqfOMovMnUWR5y15c5hjq3KtKmCBorSEoPf9GoCTlFLc9aXivGplTOq8LKfmXCiQKk0ox9MVy+n9FXhzo/tn+ENIYVDOiyOxyWn1Zf/2zBpvJ5ju0/Gt+A+TxqtuKXQetpeudvFFQ3crmdu7gnBuzVQoN+PpPHs9rrNlI1aOWrkncSALaPBxjvC0ux96uZ4/XDwWLYtk80su4UvgmbMTSvQ9RaiZUuPcNAaLgo1AqFONwY1MmCiIGMxcYsyd+RfAGe1TMMOFi0SHqOuB0phmM0Qy87pA/qLRQXwQTNR9pkyPrM43/8J6JrtcOkVlWQ== 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=b4VLP1XaRYFNFwbgS1qN7TjUIiDTirnRrvGk/dJeL6s=; b=QMZCD+UoBUAiH5h9XLILR3N7sXoUP4flxsTxOC3+uKnKar/9sk/CeZ9o4sJNUIoe7mN7pGEyajGR6So1/OycUYb+BRuyJFIXoGAYDtXnEAHdvgqXW7Ed16VcgM/gdTjXnoBydWSVVgXvpas+L2jPDkjow++D4gsQAYBzYQhPSXqnj05hJbf3s9wqr+5gSM1YoB3Wu75HJIg1Tr59A8GWIjMJbZ+gzSyWwclPnup4t/rvVKwtFbK+YN8m/gNq2nFC0V+bbK2V/vAeBOEXJlk3m/aWLbuhMkUyrSU4BfFnqjBhvuKfnCxhjfFeml614AfBNZB64MDpnA0eerG+eswnCQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=bsbernd.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=b4VLP1XaRYFNFwbgS1qN7TjUIiDTirnRrvGk/dJeL6s=; b=azuh3GJNGshEw4uPL0M04JV1dDbFaBMC/AQREytGLphcNBoHBN5JQPG3zD1e0ZI/peiBtFTVllDVcy+jiImGSr6UEOWFLuicolse44+nHzWvAb7WpXe3esNkLzZbFsd6Z2QqAjJPX896dLsy2sc01nJwcS0lqm8v2hTSvVYCoEY= Received: from MN2PR18CA0010.namprd18.prod.outlook.com (2603:10b6:208:23c::15) by CO6PR19MB5404.namprd19.prod.outlook.com (2603:10b6:303:14b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8182.19; Wed, 27 Nov 2024 13:40:56 +0000 Received: from BN2PEPF00004FC0.namprd04.prod.outlook.com (2603:10b6:208:23c:cafe::39) by MN2PR18CA0010.outlook.office365.com (2603:10b6:208:23c::15) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.13 via Frontend Transport; Wed, 27 Nov 2024 13:40:56 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by BN2PEPF00004FC0.mail.protection.outlook.com (10.167.243.186) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.12 via Frontend Transport; Wed, 27 Nov 2024 13:40:56 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id D268E32; Wed, 27 Nov 2024 13:40:54 +0000 (UTC) From: Bernd Schubert Date: Wed, 27 Nov 2024 14:40:33 +0100 Subject: [PATCH RFC v7 16/16] fuse: enable fuse-over-io-uring Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241127-fuse-uring-for-6-10-rfc4-v7-16-934b3a69baca@ddn.com> References: <20241127-fuse-uring-for-6-10-rfc4-v7-0-934b3a69baca@ddn.com> In-Reply-To: <20241127-fuse-uring-for-6-10-rfc4-v7-0-934b3a69baca@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1732714838; l=792; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=XFkl+WqqLAjH6uZixQ2rg5NnynNvDs2uyYFQqVLociU=; b=s2XOCt1BmL9fC9ZzO1CL+uPFRZqtCFmjugLG5zxAzmiEoSr6ihs8aXhX37+ExQdTIHFiSyYsA 8Zo5t9FORoJD5em4IFRmnIgAhiVFNQE728rXGRWRTkAwHBNqUzKtVGP X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF00004FC0:EE_|CO6PR19MB5404:EE_ X-MS-Office365-Filtering-Correlation-Id: 84763ebc-f8c4-49f2-114d-08dd0ee91eb3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|82310400026|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: =?utf-8?q?GFIMDMuw/veG0kHKF833nyOoBnJhgH0?= =?utf-8?q?k+xI7rgs2O7cr2HogAceZrf1yWrrAig/OetQfIbijKvBFOU8Umkf8kLXVZczcTR7e?= =?utf-8?q?w/J05Darn4PocTEFaobI+j9caeNxaKAuWYO+pVvosnqdR5LpktDyTaLuXoQcAij6z?= =?utf-8?q?fpcyskaECNsF68iLw5M4wzLgCMSO6+YNjpA49EBaqXZyi+c+QTVlESgGE7M1Afr8o?= =?utf-8?q?aiDBg3Y62nPAmTBPMnOD4+4zQTIK51868XW1pUe5sLPJ3TfhJD3OKxN6w8bqnazIV?= =?utf-8?q?eq5LOFheRdukAe/MXQZ+fUg3aqJ2Uege3zbaCD7I5OEcG4BGZA87D1G/MiKbCRKTK?= =?utf-8?q?9Ng5AA2hdjHbfZmw/HYV4TKgXN9u1nXfp8cmGhvWocdlEBwSHkTkG9uwP2+7mt7P5?= =?utf-8?q?0aynpZTP9qpOgdLRybg3UtisIsysVPBLvBJTptPmW+SAi/g7gODqtI67m1OF2bhA4?= =?utf-8?q?0sm9cjYXTjbDSRLXjovAbhkynI3NnJ/d8rMsaVL+azGdRcgjTK83BM4JyQ9qnUi0M?= =?utf-8?q?iXsNCpBm+OvG4DAU0j8PzoOPYKiXhmXoy0KxuabhnYauFTdBBPu/vs+/n0DHRbvNT?= =?utf-8?q?QK1XRWcTgl7PRsPbMYKo2cO+u+72GwvdAlhlXpsU45E3V8KwMihKVqdYsC7IRsdyu?= =?utf-8?q?qvqCunYayZUYqwqelLzNB+IBTSm+I/P1V0Mw8ImYbHr1kJT1VJuRDRBJaDU3OBbee?= =?utf-8?q?6eR1oJUPzfpkom7U3dXc03chn8i9zjeIY1eSwE1dPm+Y4y3fQ7ImixLtxbyTtWCas?= =?utf-8?q?N0xlVFrmhaPF9tpydeaV1iNp1QaQT+x/9k6BzQBJE+fsFcXCgjMe3J1lDgSbSGaH8?= =?utf-8?q?bLNy9pTywPX4vRG8SmMpeNuSHzKP7MrvoXELSwEnT7lnFMBqqIdfKiQmJBSYUTrMp?= =?utf-8?q?ckwoL4FCo42OVVOjFZ98qsxbDbrXER7WEPDdVCCF54eGuzFXqJDdDVPuaPiZGMm4g?= =?utf-8?q?vUeUwy8MU0XyHHsVh+cq0lZ57giOAu9k/8ic41uCZuv9DQZDHwcX1LWm5KxtB6shs?= =?utf-8?q?0nQ8PXly9AzcOaCEO2MKVzqf+85Prj/p/ffiGDJRR/Atjce1wNOZR6FCIB2Am61A0?= =?utf-8?q?Nq0ytjTgnXXGqDHGRf0irRx+kXykGu3OyBMksrhOx4ct3z4Sf3iTdTfxJ5YzuaL4f?= =?utf-8?q?pZAhvyJf0PViio2fzpAriyqN7lzGtVal7Y/fOCAT9KsYwfXU95wkPNdCvSyEMR6ZM?= =?utf-8?q?Qa3cDqxkGrnDOXTh71dncCKNkqUCoM+T2lLqf621meXEsDdxiP44lkOjiUPwGcS4/?= =?utf-8?q?UDRt1mDU3Vvb40vBQDtEsu/kyCwjOQ32mcXXh8SVDpNx+oTR9TEVQ2IjNC8dnJrBr?= =?utf-8?q?Q2UaMBJu1U/yZLi29sqXvmc8IvmFQi9CkHR/5CrNbw1Ys3+1ve5ZSg85c6I46iqW1?= =?utf-8?q?hjo9Yi6hWJD?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(7416014)(376014)(82310400026)(36860700013)(1800799024);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Mw1rF3RJaQ6EQ62X6F4f/QIy0MI2oKhdEWhHPQKgRAzM1EK094chgIzRSginsFRQu+GYbsKxMVrCIzmjQdT6xhxHtPv1r0+6+6P3xqXQvj0ts4XMgGpLUe+s1TfahhlWPMqaNgT5XQ6fJ++Dgq053DXcdXZWtReNA0OwERkeBlNTVgnoGuuYkm5ZiWdrMl06J3mV8LQocPd+sIMfhdz+7noz4EGXYD/hsfmrGaOLsVdlOz+SmVJlSy+dtQJFAoZS2lXWBNeyLxvrmOGmiyj2oIy1g36b7CPkhjFYnkCSizivLYBg1dbDnr+9q8NtoM+YYLWJ32KvyXzGPQk4v7rMjWcfO/xKOp2+yOviQOIU1voVxFclOwlFz/0eSlLTTV51/4yjFCifHwF9l2OGKF0/k/PPoVpYLBNovUTHZODe5bZ62ZexOvzmMEa4j6ugsNgteHiiwT2J+kI7eYGAEGf7vcTlqw4DPz/X9zywnbcqBshYqVuqsJBrSpt/s3bhdvO0K59c3jHLsZp1QZYGXlNyljTiKi3KQni07dumBcmjdE7fLUehjVNimk8mKFT7ryG6RvDQjEyquyJSE1dQW6lXCRAF/ysemO6h9k84cEB6rdJEaCO1B2+8eqEPOeYuvRlHHovubibJ3H9Fbnqr4BzqtA== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2024 13:40:56.0292 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 84763ebc-f8c4-49f2-114d-08dd0ee91eb3 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: BN2PEPF00004FC0.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR19MB5404 X-BESS-ID: 1732714858-104050-2072-13680-1 X-BESS-VER: 2019.3_20241126.2120 X-BESS-Apparent-Source-IP: 104.47.70.43 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVuZmFkBGBlDMyDLJ3DjF1DzJ0i QxyTw1zdI8NTE5OdEs0cw00SzNNEWpNhYAW8SOqUAAAAA= X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260718 [from cloudscan19-166.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 All required parts are handled now, fuse-io-uring can be enabled. Signed-off-by: Bernd Schubert --- fs/fuse/dev_uring.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index fe24e31bbfecec526f88bc5b82b0aa132357c1cc..0039be997ededd29b094d84001958de3de91fe5a 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -1060,9 +1060,6 @@ int fuse_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags) u32 cmd_op = cmd->cmd_op; int err; - /* Disabled for now, especially as teardown is not implemented yet */ - pr_info_ratelimited("fuse-io-uring is not enabled yet\n"); - return -EOPNOTSUPP; if (!enable_uring) { pr_info_ratelimited("fuse-io-uring is disabled\n");