From patchwork Tue Mar 25 17:29:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 14029306 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 A70062627F9 for ; Tue, 25 Mar 2025 17:30:00 +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=1742923812; cv=fail; b=Fvoaix7Zago7VddqHj3sYWB/lb3860/mHMYY6875iNJprDMYqnSHDMi0HBAAwymIKu5fZPse21ipP+jCslFgZzGqlU6UIdGNsEe5JWRSAqMYh6PfRGob5xbI3qdUWq3QmqNyeBHIVjP0hSBGhEW75XPqwdPbBpsdRcMefIIDSqo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742923812; c=relaxed/simple; bh=kvCsFRDbEHAu0kI0NbiIbsR+6aYgpBGxf1KRCGoiJ88=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=jxDsh13ne+Fno1qDRSPyCXUgrcYOELli3fushrZuViQ2b+6x5PHov96B652itQKO8Umt4L8iZCWhLMEbnT70PhiIIg4K2GV5ra33r8/Z26vE6xpH1FE+bQou/kKQHwAXoxiIfoe5dyvn4qNqLMyHY0/SCiEYKTdO6dFPMa+hV44= 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=JTZCAIoG; 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="JTZCAIoG" Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2041.outbound.protection.outlook.com [104.47.70.41]) by mx-outbound11-18.us-east-2a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 25 Mar 2025 17:29:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=r39ke8YTULUkfGySzL66nD1HaK9ZVzokn7vNKIV+epyStjwCpjFvK6igvOxQ0DFdk0xQ8OzfOY+uQvESZIbzyQ3Yegh2xcpoS0+P3ht/UvkEsgiJ0bDp5H4Gg95gEoIvu3GOKN5V0ojGVEx3r9yElK6vKCIoq+oxnvtjPZmzRnAmInX1T5uEJtBlIoa9faURMPGHuqUkfjOpI2Fw7JTkTnkrFd/TgKC7dvteAmNckWUzb6YNQD98Qf1mX5zTQYBtcZKWmBRf0Re1VqAgYzEmVRGCmW8ICGjKfAKx/5SXiUZIFDZ0T6BD1Yp4hhUC/N/o/RB47ReYgTvAVaMEHD9g2g== 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=kjlJoUOPxfx5PNiga6Y2h5lABFn1hYVfOQBa6pvd6GE=; b=V+sf/8z1By62/NK2I2eFdR/Nh9/rA/yWAbDE0zUxOSBnZaEXl7e/Jk8ElKcbxhH4fpHi41IUhi4jz1rgm+KV6YT+ht1wnB6cdqTP+iCF3Ru54AE/kPuDV3avAHCWpX7NyejQ70RaLJaEBucOhABM3a/OrasPbbRi4GdaSvs0OuVcXuWN4Cchz0cZVoSVSpbfzDHjlN7KEM1ZNRTcFs0R949ie9XIVgbr1DY9dWx45Kx4LE6SKBNWY6VTqW1jtflMfmUF3dyCKtJcekD94K4Ummgbdvtje1CmRioS3LanbF/rxSexlLMjbODrc7jkBhfMz6NebmNuC2CMo3ennMsmEw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=ddn.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kjlJoUOPxfx5PNiga6Y2h5lABFn1hYVfOQBa6pvd6GE=; b=JTZCAIoGTY611hkO9slBi+0OVaFjuXhEv9xzo2RMRTNiEilxV7BeNP6k2IUzyMeeEqUHN+CMF7tMR34q0I4QS8mO6PEvsW4roZ/fr6vIvbd8GtKCjPF9XrX33U/964kCvwD/bX0jo9xzhOMwJYjllI2zVccwaxOfuwyfg5Pfc9o= Received: from CH2PR18CA0049.namprd18.prod.outlook.com (2603:10b6:610:55::29) by MW5PR19MB5554.namprd19.prod.outlook.com (2603:10b6:303:193::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8534.42; Tue, 25 Mar 2025 17:29:39 +0000 Received: from CH2PEPF0000013D.namprd02.prod.outlook.com (2603:10b6:610:55:cafe::2e) by CH2PR18CA0049.outlook.office365.com (2603:10b6:610:55::29) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8534.43 via Frontend Transport; Tue, 25 Mar 2025 17:29:38 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by CH2PEPF0000013D.mail.protection.outlook.com (10.167.244.69) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8534.20 via Frontend Transport; Tue, 25 Mar 2025 17:29:38 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 8E1EE4A; Tue, 25 Mar 2025 17:29:37 +0000 (UTC) From: Bernd Schubert Date: Tue, 25 Mar 2025 18:29:31 +0100 Subject: [PATCH v2] fuse: {io-uring} Fix a possible req cancellation race Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250325-fr_pending-race-v2-1-487945a6c197@ddn.com> X-B4-Tracking: v=1; b=H4sIAPrn4mcC/x3MQQqAIBBA0avErBN0pKiuEhGio83GYoQIpLsnL d/i/wqFhKnA0lUQurnwmRuw78AfLidSHJoBNQ4azaSi7BflwDkpcZ6UJTtiRIzWzNCqSyjy8x/ X7X0/3VL1wmEAAAA= X-Change-ID: 20250218-fr_pending-race-3e362f22f319 To: Miklos Szeredi , Luis Henriques Cc: Joanne Koong , Jeff Layton , linux-fsdevel@vger.kernel.org, Miklos Szeredi , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1742923777; l=7320; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=kvCsFRDbEHAu0kI0NbiIbsR+6aYgpBGxf1KRCGoiJ88=; b=poZlBkeZfV8Za2tVsmtG7lGYrv/n0sxS045iX4kZ+OgJJzzo5j1svVDRMoaRmYd++WAphb5/x Tk0Ab6im6t4DRvAc6pnLmtF0/m3PN9/+uxt0vo3Ld4iMH59UEP4ipR+ X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PEPF0000013D:EE_|MW5PR19MB5554:EE_ X-MS-Office365-Filtering-Correlation-Id: c1f4b704-de63-4a3b-3113-08dd6bc29eb7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|376014|36860700013|7053199007; X-Microsoft-Antispam-Message-Info: =?utf-8?q?Cm3HdTF1GAqNlVs3Yq9vmdWoPEw0cVV?= =?utf-8?q?n2d1631Shr7fftDVGiwDP/kjRldaMRywEAh7BgiPBT4pdUSickqhgKyWsxCFb6Tyl?= =?utf-8?q?Fu+R2a8BJuQoTviNF4seA5iYOvS3U0vXqM1s7DbIJZKstYrcvRe/+12QVWGqOj70n?= =?utf-8?q?fZry5EZvfO+FlOkChoUIn/p+NudK3S14q4f9qB4eBR0rliBrzYVCqwFkaTSIaT2f5?= =?utf-8?q?Ct8J5SHfru+Br8bYewychX41vGi16jtyfzwh5RZ2KMS6+TV0ZAY4SdUWAElPmYyDT?= =?utf-8?q?OdU2iqEEUMdX2QcCOd8vCvewkTDCB3bg+BRhJvi04e+3+Ilw+tA+D6SHOUZFx7c1X?= =?utf-8?q?VBO+30RS/GePJ/9IP6RKxxTEZRo1UK8yyBKpuFOI4jEbjn2qeKCVtCTfCsN8M2IOc?= =?utf-8?q?GNpLzXTRQS/KsvflYEB0QVDRfN4r8xOAzdiWsSWFfoKT0bgbpkzRHCDAug028vYzM?= =?utf-8?q?tAELNJuF1tIZcsfTXG+wTH9fOGpZHEPaeU1Ifm4ZLkxD9Mbn5pQwOWW4hCDKoz9VQ?= =?utf-8?q?L/jVakQ4Z1k/mItUXklNkfSz/oON4S6k4gWLAfkKhNfQFYrBgUUtRWHLiOa5cv0Bm?= =?utf-8?q?zT+Vxa83gMW5P3WRD+qP4rYDxoTxAhkVGqJiV8Aop8/GH/kdP1U9Wl/WhHSYGJDEU?= =?utf-8?q?t6FBk+QL1t5hTsT03RcA8yiDleV3uUw1zqVOXT/R3k2QHVMD7T+lR9apumDTwwiel?= =?utf-8?q?tkdqxxZTrK7+xeN3WYdooqGnQ8Q3peLgxbLFkZLvC48cQgEQIoMAoFtZUqVww8LzV?= =?utf-8?q?kTSv1aNEDQqSfsL/eR5IVc5VIkHXrN9Ef4nH2zxsEHcNdhsVgjCixDXjL09/SVEyV?= =?utf-8?q?OMKrXrtgQpUudzFUrV+1xkYDev0gLDFJyBQS1oLW5s1Zi0alDbp5mHQehAZxkAzgq?= =?utf-8?q?/WjwLAhw8QmF3kL6PwB1t9JxoQ5C+G3LRu0zZm1XdOcgki4LuGr1Sbhptg9W1xnF2?= =?utf-8?q?5k/B6TkTg44kfsyPuZf7N0c549rkjC+Y2b6Y+VO5GpmzkW0TSzi2BgYhv5mRraEOo?= =?utf-8?q?+z00UGxYMpsLKfcPKItI1fz8o6puvVjdh2zeDponDFMBDCMgmms4/K83XVbppIGME?= =?utf-8?q?TaG+ZFNmN8GN35kp1xIbqKvTt6Xw2yTyN3Opn0l9fN5lsDN5UyVeB8+ZW78n0Dr/W?= =?utf-8?q?uzquCsrv3YoU91QoTV4PV7hAO3JXSFKl9UxggOsYcT9al2CUbGRtqdrdHAP+EBj7H?= =?utf-8?q?k5cpgAA1tJ2SDRYEMSoCpTTwkIKHlBlnsI1or3qMMlAmRwhaSwA+xtYetrMFtAQaD?= =?utf-8?q?Ga0p4flo9LYLYKJ1VAF1ZBybU2jMMsbv0mK5wjLFiR1vuXkruYR5Odnoci24LUMkg?= =?utf-8?q?Gghn3nywEl99joL3ZWd7WWVRpzTPMvD9jgNhw+n0ztt6MymqgWy5kTEdzt8PvQF5H?= =?utf-8?q?186iMmmekZnsuOEBI+sRguXBbxavnpxCa2vTtDhNYRkB8luvHQdBhY=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(1800799024)(376014)(36860700013)(7053199007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 0AUtboAXAQQCSpmEBMBKGrC7hykRN80WPb629vEih8qqNqeg/FedfDgfeSWqMZL1ekhmPiuJjjlyupzFNH1KyRCfgVjllo417/TyBSgzw8h/+iPUumZDFNa98Zc1JbNcDWb6OPIHfosjSGclFR7g+UQdQ0XB3wlsKgGu5JFy4fAjYl3FsxFYcekItfWEuj6r5gDmKR/ZIsXxqqIepeQbiGsz9qPLaMxHR2aJdHkUyUb+MSabaWJ+TpTTl8iPEAuaj6OdvcVSUymg7r3E8Dg5kTgCeDv9W1IJ0hXk7phRENu8GVhaF36Xybc1pLcgwIKvlxX4uNJWljKOYOesDYXsZxA005NXgW2IJXGcIndg42i9eNTLhny6sHk8QOSMF5zkn7j0D2WPFvlMPYHucRjAN8p0vXQ+/H2sJY2lGbpwD+iaQ8s3/FhoQJGL7+wIkK3oBeABnUFGasaOiNR0qRMIlate/1b6HldKvoBVDVSYfShBNUBDM30NYByw7rp8KXd5u3dCz5aDEhKyy2t6OtsmXGrk8tm/dt5fXCYQiw1WUQmQautTUW6dUMjgR9JpwA3rXYVFpvcc2qwLRjc1IHTMEhEAXlAi7Igjwm3cmQlJLtgr4HkKUIER7q8z9E94d4y/MeQHlUJBw/3cGvjXcsCdog== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Mar 2025 17:29:38.5080 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c1f4b704-de63-4a3b-3113-08dd6bc29eb7 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: CH2PEPF0000013D.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW5PR19MB5554 X-BESS-ID: 1742923782-102834-8473-9928-1 X-BESS-VER: 2019.1_20250319.1753 X-BESS-Apparent-Source-IP: 104.47.70.41 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVuYGluZAVgZQ0DzJNMkw0cLMMi 3NzDQ1zSLRyNwkOck8ydgkMdHI2NRcqTYWAMk6XNlBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.263412 [from cloudscan22-57.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 task-A (application) might be in request_wait_answer and try to remove the request when it has FR_PENDING set. task-B (a fuse-server io-uring task) might handle this request with FUSE_IO_URING_CMD_COMMIT_AND_FETCH, when fetching the next request and accessed the req from the pending list in fuse_uring_ent_assign_req(). That code path was not protected by fiq->lock and so might race with task-A. For scaling reasons we better don't use fiq->lock, but add a handler to remove canceled requests from the queue. This also removes usage of fiq->lock from fuse_uring_add_req_to_ring_ent() altogether, as it was there just to protect against this race and incomplete. Also added is a comment why FR_PENDING is not cleared. Fixes: c090c8abae4b ("fuse: Add io-uring sqe commit and fetch support") Reported-by: Joanne Koong Closes: https://lore.kernel.org/all/CAJnrk1ZgHNb78dz-yfNTpxmW7wtT88A=m-zF0ZoLXKLUHRjNTw@mail.gmail.com/ Signed-off-by: Bernd Schubert Reviewed-by: Joanne Koong --- Changes in v2: - Removed patch 1 that unset FR_PENDING - Added a comment as part of this patch why FR_PENDING is not cleared - Replaced function pointer by direct call of fuse_remove_pending_req --- fs/fuse/dev.c | 34 +++++++++++++++++++++++++--------- fs/fuse/dev_uring.c | 15 +++++++++++---- fs/fuse/dev_uring_i.h | 6 ++++++ fs/fuse/fuse_dev_i.h | 1 + fs/fuse/fuse_i.h | 3 +++ 5 files changed, 46 insertions(+), 13 deletions(-) --- base-commit: 81e4f8d68c66da301bb881862735bd74c6241a19 change-id: 20250218-fr_pending-race-3e362f22f319 Best regards, diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 2c3a4d09e500f98232d5d9412a012235af6bec2e..2645cd8accfd081c518d3e22127e899ad5a09127 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -407,6 +407,24 @@ static int queue_interrupt(struct fuse_req *req) return 0; } +bool fuse_remove_pending_req(struct fuse_req *req, spinlock_t *lock) +{ + spin_lock(lock); + if (test_bit(FR_PENDING, &req->flags)) { + /* + * FR_PENDING does not get cleared as the request will end + * up in destruction anyway. + */ + list_del(&req->list); + spin_unlock(lock); + __fuse_put_request(req); + req->out.h.error = -EINTR; + return true; + } + spin_unlock(lock); + return false; +} + static void request_wait_answer(struct fuse_req *req) { struct fuse_conn *fc = req->fm->fc; @@ -428,22 +446,20 @@ static void request_wait_answer(struct fuse_req *req) } if (!test_bit(FR_FORCE, &req->flags)) { + bool removed; + /* Only fatal signals may interrupt this */ err = wait_event_killable(req->waitq, test_bit(FR_FINISHED, &req->flags)); if (!err) return; - spin_lock(&fiq->lock); - /* Request is not yet in userspace, bail out */ - if (test_bit(FR_PENDING, &req->flags)) { - list_del(&req->list); - spin_unlock(&fiq->lock); - __fuse_put_request(req); - req->out.h.error = -EINTR; + if (test_bit(FR_URING, &req->flags)) + removed = fuse_uring_remove_pending_req(req); + else + removed = fuse_remove_pending_req(req, &fiq->lock); + if (removed) return; - } - spin_unlock(&fiq->lock); } /* diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index ebd2931b4f2acac461091b6b1f1176cde759e2d1..add7273c8dc4a23a23e50b879db470fc06bd3d20 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -726,8 +726,6 @@ static void fuse_uring_add_req_to_ring_ent(struct fuse_ring_ent *ent, struct fuse_req *req) { struct fuse_ring_queue *queue = ent->queue; - struct fuse_conn *fc = req->fm->fc; - struct fuse_iqueue *fiq = &fc->iq; lockdep_assert_held(&queue->lock); @@ -737,9 +735,7 @@ static void fuse_uring_add_req_to_ring_ent(struct fuse_ring_ent *ent, ent->state); } - spin_lock(&fiq->lock); clear_bit(FR_PENDING, &req->flags); - spin_unlock(&fiq->lock); ent->fuse_req = req; ent->state = FRRS_FUSE_REQ; list_move(&ent->list, &queue->ent_w_req_queue); @@ -1238,6 +1234,8 @@ void fuse_uring_queue_fuse_req(struct fuse_iqueue *fiq, struct fuse_req *req) if (unlikely(queue->stopped)) goto err_unlock; + set_bit(FR_URING, &req->flags); + req->ring_queue = queue; ent = list_first_entry_or_null(&queue->ent_avail_queue, struct fuse_ring_ent, list); if (ent) @@ -1276,6 +1274,8 @@ bool fuse_uring_queue_bq_req(struct fuse_req *req) return false; } + set_bit(FR_URING, &req->flags); + req->ring_queue = queue; list_add_tail(&req->list, &queue->fuse_req_bg_queue); ent = list_first_entry_or_null(&queue->ent_avail_queue, @@ -1306,6 +1306,13 @@ bool fuse_uring_queue_bq_req(struct fuse_req *req) return true; } +bool fuse_uring_remove_pending_req(struct fuse_req *req) +{ + struct fuse_ring_queue *queue = req->ring_queue; + + return fuse_remove_pending_req(req, &queue->lock); +} + static const struct fuse_iqueue_ops fuse_io_uring_ops = { /* should be send over io-uring as enhancement */ .send_forget = fuse_dev_queue_forget, diff --git a/fs/fuse/dev_uring_i.h b/fs/fuse/dev_uring_i.h index 2102b3d0c1aed1105e9c1200c91e1cb497b9a597..e5b39a92b7ca0e371512e8071f15c89bb30caf59 100644 --- a/fs/fuse/dev_uring_i.h +++ b/fs/fuse/dev_uring_i.h @@ -142,6 +142,7 @@ 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); +bool fuse_uring_remove_pending_req(struct fuse_req *req); static inline void fuse_uring_abort(struct fuse_conn *fc) { @@ -200,6 +201,11 @@ static inline bool fuse_uring_ready(struct fuse_conn *fc) return false; } +static inline bool fuse_uring_remove_pending_req(struct fuse_req *req) +{ + return false; +} + #endif /* CONFIG_FUSE_IO_URING */ #endif /* _FS_FUSE_DEV_URING_I_H */ diff --git a/fs/fuse/fuse_dev_i.h b/fs/fuse/fuse_dev_i.h index 3b2bfe1248d3573abe3b144a6d4bf6a502f56a40..2481da3388c5feec944143bfabb8d430a447d322 100644 --- a/fs/fuse/fuse_dev_i.h +++ b/fs/fuse/fuse_dev_i.h @@ -61,6 +61,7 @@ int fuse_copy_out_args(struct fuse_copy_state *cs, struct fuse_args *args, 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); +bool fuse_remove_pending_req(struct fuse_req *req, spinlock_t *lock); #endif diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index fee96fe7887b30cd57b8a6bbda11447a228cf446..2086dac7243ba82e1ce6762e2d1406014566aaaa 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -378,6 +378,7 @@ struct fuse_io_priv { * FR_FINISHED: request is finished * FR_PRIVATE: request is on private list * FR_ASYNC: request is asynchronous + * FR_URING: request is handled through fuse-io-uring */ enum fuse_req_flag { FR_ISREPLY, @@ -392,6 +393,7 @@ enum fuse_req_flag { FR_FINISHED, FR_PRIVATE, FR_ASYNC, + FR_URING, }; /** @@ -441,6 +443,7 @@ struct fuse_req { #ifdef CONFIG_FUSE_IO_URING void *ring_entry; + void *ring_queue; #endif };