From patchwork Sat Jan 25 17:43:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13950476 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 E01457405A for ; Sat, 25 Jan 2025 17:44:17 +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=1737827066; cv=fail; b=aDkpnsiQ0lrlTngBhE248HdC9V27U0oROzakG7TjmxMUR1ywlCtcDs61NoV2Zf0gKNYg4mlGZBnHdQow+ta7AnWNpCad3mb7F0hPfS9YPCEtlSmsrrfActY7AF7FXyy+0FGioZYC4UqPw2ri2MGw2HjTGmabLN2tGEEkfYf03wo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737827066; c=relaxed/simple; bh=9pIH8SQN7l30Y0x3YkGM4lsHwYA/oWC7Cwq+mNoGsO4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DCsok5IiPwM44FXKzwJfbrygAWi7oUGH7uKqkS/bf42j4IE4ybPim0mJ94P0teq2w7VlE2RpD2G/mAutwIIo3w9kBFPyMZ3MYT9uTilhTwTzeln2kgYsX+nNfG01b/G0r6umGCFFG8Uu57i7+RX+FoYnsQ2zx3mfx0FOn1PawGs= 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=mygVivVQ; 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="mygVivVQ" Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2040.outbound.protection.outlook.com [104.47.56.40]) by mx-outbound8-214.us-east-2a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 25 Jan 2025 17:44:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=IWlKJ8eRFfzOjE4iWjGXK1D51WiEQLToHsCpzULQuZ2K4AgJips5qRc3I0UxPrRBnfYfK75N9C4+Y/NACuSMLqHjO6atO5mDAVYu684X9OYIe1fpSRguMwnUF+pwkf9g0nPJjH/grCet8QzYyNeV4inSvButzctdAgiEM94oPXIkCSDF+4j+8/2vwGAuBmu2ZqEZyZ82VuGpXUwT20wFFlLl6shdsGBXuM4FuONz798ZOYwj9X4RVfT7rZPcsU0/R2sAWqgmK6GYBaLmn8giIhkI1XFDmt2UabAJIPUybxgUQpwFGHPlmnns8yFCfEUQ2w1dhyEpQ3POEDaRFmodFg== 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=wsrWFwwxmuB4lEDyyGIfS9yT4/clx/pPsew7D+uWJZ8=; b=eeIjQJzACQjF3mS0FLXGoFk7ylEghvDAuthY+dnu9RzoG2PzcJikWxZLugvq7u/DZ9XZH/SwbuMprhQah2EAxDVz+Rsx1GWhFwnWwlj/66xaMGOmP6nKvl4F2E4RburYsGJ6ol0/9vdU82HbnicXU/OuwVVI6MIMPx+fXHnIn0uNUtqxCk2s5nTpPOLmeXA47CTmwNuivaEvtt7ZJf1quWYt11VbTqZCawxgrzmdIRdfS1rzWiES8FTDADbENXPpeDRMYVvOoQwChpME4maW5XWe+4bNc4JTRv7zAatJlVAyAjc8z5NU9W1VV2ZqEddm53NhJ1m3N3+l+K36Fqrz4Q== 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=wsrWFwwxmuB4lEDyyGIfS9yT4/clx/pPsew7D+uWJZ8=; b=mygVivVQxTDVgfTam9xpDbr0E1Q+eZW9uQ2s6cdqJmHu4/f6tyrMRrjDvC1U2YVOGGbd4jZ8kWSIE4nn/MHBjJR++LRa+2GMzP9aPdU5YzqEnjffILjdnF7DuNCHb/345gSXXSS8FrpA2qgyBsQXrEUug3+PTHGpzFvSvoyzx6E= Received: from MN0P223CA0005.NAMP223.PROD.OUTLOOK.COM (2603:10b6:208:52b::22) by SA1PR19MB6622.namprd19.prod.outlook.com (2603:10b6:806:255::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.20; Sat, 25 Jan 2025 17:44:02 +0000 Received: from BL02EPF0002992C.namprd02.prod.outlook.com (2603:10b6:208:52b:cafe::3d) by MN0P223CA0005.outlook.office365.com (2603:10b6:208:52b::22) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8377.21 via Frontend Transport; Sat, 25 Jan 2025 17:44:02 +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 BL02EPF0002992C.mail.protection.outlook.com (10.167.249.57) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8377.8 via Frontend Transport; Sat, 25 Jan 2025 17:44:02 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 2E78D58; Sat, 25 Jan 2025 17:44:01 +0000 (UTC) From: Bernd Schubert Date: Sat, 25 Jan 2025 18:43:56 +0100 Subject: [PATCH v2 1/7] fuse: Access fuse_req under lock in fuse_uring_req_end Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250125-optimize-fuse-uring-req-timeouts-v2-1-7771a2300343@ddn.com> References: <20250125-optimize-fuse-uring-req-timeouts-v2-0-7771a2300343@ddn.com> In-Reply-To: <20250125-optimize-fuse-uring-req-timeouts-v2-0-7771a2300343@ddn.com> To: Miklos Szeredi , Pavel Begunkov , Luis Henriques Cc: linux-fsdevel@vger.kernel.org, Joanne Koong , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1737827039; l=1546; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=9pIH8SQN7l30Y0x3YkGM4lsHwYA/oWC7Cwq+mNoGsO4=; b=NW2w8z8qZC9zbO1RrJagoqknn1z2ixwQm+DugVAOUW9MSpwP7EmblP3o+pnAfuXaDITzMeTKu fbIS6/Wxi9GA4MEO6Vyuf4xK9UYydfjSG+q9pbSw2SYx1KfPVqQl1BS X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0002992C:EE_|SA1PR19MB6622:EE_ X-MS-Office365-Filtering-Correlation-Id: c71344bd-f1a0-4cec-207b-08dd3d67db31 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?8lwH2z6FGbYCFjOleCY+0qC4W2vfRaN?= =?utf-8?q?Y+ThQlROcshPlmQHV9cWZS0fmD4Jd6acxGfkyKiJMB14YZW6J323V2NQG7VEbMUFL?= =?utf-8?q?vVdQAkqdCq1KKRCafcUMgzv7sTPfbJU964lOIeLP+v/GD42bMhtg0NO1hu/LOGzfK?= =?utf-8?q?WGayfbimtScPgxJpj2lJbC2/Ox3+lOtkhT0lCSZ7+YxhcGdOpQ4MTiq4b6mOmG7ul?= =?utf-8?q?6KCeWQRqGgXeocMFrl3wesE6uOaRJT65BHruNc3v+mVJZ7+Gc/gqzBgp61lUVXiAa?= =?utf-8?q?lF9RQDmu4niU0LsHT+GpoVxOWSOLyjVtembI3EsifsjsU+sAla98eGdvHPMF8T4mj?= =?utf-8?q?sFfDXh1dcTYWHBIK8xX0jSRYMw4qfUPxBwiUf8FEva3mRxvwGH8w+CCWXrlv3mYIW?= =?utf-8?q?SPzXkkSlVDS28ZSfX8tyQaa5mLteR4rsy/HGErkZD8UkekCRgcy9z9U3OElVpEBGS?= =?utf-8?q?eJxHqGeUmv87+T+NpzJe1VsWH3xDgvGvEOJ4HlB0zsEpHmkquFL+DJxraUPwX6Hgi?= =?utf-8?q?VId1lDqh3PLN7+v4qWRss/rD8dvbqnA0tnpSwFB3xu/UFeOdbXYHLjjGjnRZd9D5E?= =?utf-8?q?AN5NcdDiI8wnuDV+tVRUELHe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G:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(376014)(1800799024)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: aFhUhhAjnWs+yXBU6tMbndUPRHTPhQjRMYwjP5ySASQ7EJ7bW6Q92WnZO90WCvpntE7uCGjIngUVDWsddjOYBnNZShPlzsYpMW3qQe/Rq4JA7JdVahJ8yYw52yMRsSK09/GPBisqRBzOQqLiqdrRx+Rgm8OvZCMyBs3tKNfFEP8ysN3DwkpUicmZiAETXl8/gKRYROVc7ZQ/bGkyCvhKMLoOZ+g8X3YCXyfDzP6T6zYh1uP0nY6U10gXwVR3+Pe0bXJ0aOTHPB57JykdM0HBIPOP4LjNRmHS2RlXdkbYlP+i93ixvOJY+/6HFWilnARtmUIoxA3xP84kHC5oVAaJPLDpc5ukzBnwbuw1K6d7vZRJrEzEL7QxQmzhcIL+RLq3FlpIsSAVy77QklKxwwIZP5LPp5Bri62WBfrRWQVO+xM3JzJwAaxVenfX5o0zGrm6k8V3krCdqEQCzh7CwISyXGTioTapQlKwcE3QtxETF8pDxLQdlns3jdZTCHWWxEF5X+hi+Ch6bs+ogpE+0yLEESW0q/UV/jm9VzrZayhnBgveDt4MxH7X0qVFLCPnkpoehvOyagXEJD/mywTMT4H5edpjdSayNIiNsSDboNOqC3befznDJgG5ISicVS+QQ0E/pf5cQmNSurASbYFEysxpYw== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2025 17:44:02.2646 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c71344bd-f1a0-4cec-207b-08dd3d67db31 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: BL02EPF0002992C.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR19MB6622 X-BESS-ID: 1737827046-102262-13353-247966-1 X-BESS-VER: 2019.1_20250123.1616 X-BESS-Apparent-Source-IP: 104.47.56.40 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoamBoZAVgZQ0MIkKdEyxSDFyM TEwtTIONHUJMUk2cQw2Tg1Odks0chIqTYWANel82ZBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.262052 [from cloudscan14-221.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 We should better read and set ent->fuse_req while holding a lock, at it can be accessed from other threads, for example during teardown. This was part of a patch from Joanne for timeout optimizations and I had split it out. Fixes: a4bdb3d786c0 ("fuse: enable fuse-over-io-uring") Signed-off-by: Bernd Schubert Reviewed-by: Joanne Koong --- fs/fuse/dev_uring.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index 5c9b5a5fb7f7539149840378e224eb640cf8ef08..2477bbdfcbab7cd27a513bbcf9b6ed69e90d2e72 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -78,12 +78,14 @@ static void fuse_uring_flush_bg(struct fuse_ring_queue *queue) static void fuse_uring_req_end(struct fuse_ring_ent *ent, int error) { struct fuse_ring_queue *queue = ent->queue; - struct fuse_req *req = ent->fuse_req; + struct fuse_req *req; struct fuse_ring *ring = queue->ring; struct fuse_conn *fc = ring->fc; lockdep_assert_not_held(&queue->lock); spin_lock(&queue->lock); + req = ent->fuse_req; + ent->fuse_req = NULL; if (test_bit(FR_BACKGROUND, &req->flags)) { queue->active_background--; spin_lock(&fc->bg_lock); @@ -97,8 +99,7 @@ static void fuse_uring_req_end(struct fuse_ring_ent *ent, int error) req->out.h.error = error; clear_bit(FR_SENT, &req->flags); - fuse_request_end(ent->fuse_req); - ent->fuse_req = NULL; + fuse_request_end(req); } /* Abort all list queued request on the given ring queue */ From patchwork Sat Jan 25 17:43:57 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13950474 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 B76D043AA9 for ; Sat, 25 Jan 2025 17:44:15 +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=1737827066; cv=fail; b=WS/+sD8LR6RzCMHs0/cR6SKHGrY9P6UfIrYt6afU8c98mXS5+PWOxUigODX0tOotKCY0neg8/yF9JnPJxnFcKEnrdIhzv9ciYvCjR9GAODjsuXoTLS1zf1ao99uk364KI7AlqWihvKltz8RbjNUXTOXwZ2PhudpL1ZNvvds+GW8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737827066; c=relaxed/simple; bh=z+LkpxfZfeVxDdWJUNaYf2XD9eZE50Kw6bFrhhmhmSQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EJ/8QEa1ePmgVNYTfo3pWLipRMbw2XkkV0aKS93JbuQ5iwiHFNkcf+Yr8EBQSe1y4qaAogV2UKQ4t5U10f9sn/DHG4Z7Q6sNv/uFMoyOBs6Cay2gk60gMpW4/Wbw/W3JIDYGekOsWDyoslXGXIoIIrd84FUl8vKgxIWsYHDTPI8= 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=X8IdVMAL; 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="X8IdVMAL" Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2169.outbound.protection.outlook.com [104.47.55.169]) by mx-outbound-ea22-15.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 25 Jan 2025 17:44:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wMmhmUABUkXzlXj+vxXyXwEj/Al44KsJCVyddup/ID2ahljglGNL1i4GTJQxoW4kq+MGY1BK35s+ZZvlN88i2HdY9p9NxeM5v3c82rTq1MSwk4mF8UeVsLo4XE0gwo7eyyVJy918UIp/biLU5B7XvArorvyGOwZ5CZYgdgU2xy1WQzlqAjDpUvxMvviSEhPIg94wkEVuG4OxeORuCTEpmlwObsGGjn3br/HFuISPm/ZlZuyYc5hdrIxLX5jqF306fMOq7v11jOnzcRBpWw3/65xA3qYczzXfX7Y4mYSkh0EAMBsnmKwlqs19MKoRalky1j+vFenpvmxwcKVcIoe/0w== 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=9/2npZ9T/cU2JxXXXk8BqzZwsh/bxSF8L1abf9EV3A8=; b=DCmAr/qMHbysyFrRWWRu04wROq03ojhrONs/CCMEhbWS7hbJ9WmhjIOyIIjjYVQvZnEhg4+z0vJmsQlMQR3vEfYEs8AUOOpb6ieAaOZZVgWCYXtCSqj+O4Qb93pR8EcS4sYM3qvOlGpwT7mENx5nU+pm74bP+NF7XX/WKm3frtGQM68jpJzb3SUrqCHZt7LKXaU48oRR0s1+wmENrhdpsljS1DE8eb8QS++VJchTP6Etj7O9qgxgltmJ18kvJcz5V1PFKGFl2GZnok8T+kktDXo7vCyyfsBPtYsipKfXMpuXRqfnCi4eC6zH/yqmyvjfxpmx6t8DQ59e8cDzyW4T+w== 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=9/2npZ9T/cU2JxXXXk8BqzZwsh/bxSF8L1abf9EV3A8=; b=X8IdVMALyeTeF77BhhCLkMxGPxWLFCOT36TUozdBJTmm4n+D1q8fYqasr5Fxd6nIWncqLQtFsUPiTNSRX5HQH5i/FIt1175gHz3B+yCx5EfmIlH8o+1HblryCJ0FF7zNpC1p0PKYQOpRFAz4+kEXCXoC7kYfmGzWOSl0rnUkeJE= Received: from BN9P220CA0002.NAMP220.PROD.OUTLOOK.COM (2603:10b6:408:13e::7) by SJ0PR19MB4764.namprd19.prod.outlook.com (2603:10b6:a03:2ec::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8377.17; Sat, 25 Jan 2025 17:44:03 +0000 Received: from BN3PEPF0000B06F.namprd21.prod.outlook.com (2603:10b6:408:13e:cafe::65) by BN9P220CA0002.outlook.office365.com (2603:10b6:408:13e::7) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8356.22 via Frontend Transport; Sat, 25 Jan 2025 17:44:03 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by BN3PEPF0000B06F.mail.protection.outlook.com (10.167.243.74) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8398.0 via Frontend Transport; Sat, 25 Jan 2025 17:44:03 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 27C5380; Sat, 25 Jan 2025 17:44:02 +0000 (UTC) From: Bernd Schubert Date: Sat, 25 Jan 2025 18:43:57 +0100 Subject: [PATCH v2 2/7] fuse: Use the existing fuse_req in fuse_uring_commit Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250125-optimize-fuse-uring-req-timeouts-v2-2-7771a2300343@ddn.com> References: <20250125-optimize-fuse-uring-req-timeouts-v2-0-7771a2300343@ddn.com> In-Reply-To: <20250125-optimize-fuse-uring-req-timeouts-v2-0-7771a2300343@ddn.com> To: Miklos Szeredi , Pavel Begunkov , Luis Henriques Cc: linux-fsdevel@vger.kernel.org, Joanne Koong , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1737827039; l=1548; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=z+LkpxfZfeVxDdWJUNaYf2XD9eZE50Kw6bFrhhmhmSQ=; b=sKwcbSQN9Ek/OdQo9jOOUp0lnEne6txPC542All/wtI1fX5ie2pVk/mbRCIuJTpOjYVWvcJJo 1ySnwxnyPMTAGnlX+4cdTA8097Q4CI52rglCqAHf/1QHZz61Okh5a0G X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B06F:EE_|SJ0PR19MB4764:EE_ X-MS-Office365-Filtering-Correlation-Id: 5c73cc26-c89f-4746-f65e-08dd3d67dbb3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?q?u0kRKCF023fHDrBt167RG4oTYARAy71?= =?utf-8?q?vvTUwV7JHgreavdI2oszhIW9lClNMTfzN+OhKa7ZlPBAaP7uoA0zIWo0MvmA6tlW0?= =?utf-8?q?j7aB5M+q8hJKQYRnpqeljzXeKzsTV+EHGVJJFVDIri2MEeaNHzVfJ/yONKxbH1NCD?= =?utf-8?q?FhnGjInnPuM8I0Zt3nS0/Ne8OYPwKNLewTIu9enz3yJLdvgxhgx+iKIPV2NXHjKWE?= =?utf-8?q?O2UR4LNVEgB8O19UAu5hApUF5Ky1ScNkeEJjgc0e/LImzu70HHwhYuDcVwzjM8fd4?= =?utf-8?q?aG3Nr6j4J2snRNviuX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/8CIY+0OuQeYSBOAYV5BYStnpVtv8vEA43E82vboej7q3Vp?= =?utf-8?q?P2+oUdR4RoxwYo3CUwzIEz5POijrrPBZZ0jHLt5DP9le/ie9KznlPzXkCQQrWNYkU?= =?utf-8?q?UZ1z6q5b7dVYOgL5cOgka9aozGtci38pzNisiGkCaaXHWuz7vsTyFvvyEjDbrFw/2?= =?utf-8?q?fnMiCLIKpbtYLFJNoY0Di6BTOQwlY2dlCYsIlzX4pJ+UjA9AjLtaWEVtKTxLL+3Z+?= =?utf-8?q?MV4oj9rPNYM82UwhDHfRF0od3PinDUJ9AF6vOPXeHfPJleBCTW615U=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(376014)(82310400026)(36860700013);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: OPymsK0zC7IT5aXJEV+x5FeX/NJndttfErIknTmKzmE/O82myXB7IgDICMWax0HgGBSeJElFs3fJ337ecltzFM5zeQKLs6itUlwtKGV+SB8hxCZv+lyWsNwCWm9EPak/RsXPjUdSjApjx/LZSdsU9G1Ebhx9NoPRcDk2BRjokAmUNSLfOpV+tcQUlFIFi7I4pN0hXjy/uIaYWT4OG/gc7HaYmmLePnyqmT8QeQGjUDib0kybnkPbak3qaTCiVwXrAdDKP43fTj4ffIUNHd3HURdEKIMevpoo1TgQip96ghL/Tj+ljyFQztpxiZemvB5pFrzc++gDFG2AVnpZ+vDLH1iavWRoLiQJemjk1Ko/Nx1pHf3svjZAJo29FFWL6dtG7cXm/rH81ADAzcAsX2KAUx8UH+NKtssldrpejFSKum3lPCB8vR57NRM8nST+cxCF8RZ7xKE8FfOkxgPqwqzf3J1hD7BBTKkqAXWU/g8SGifW46oN/osoYlwlUnHlvXQazBQrRbqm7u4LdvvgOfIOlLfWPmGshM9aYfrbRlHVu7Q2+nh17K8zUROuKg6qliMoIy+6ek+7heFQHlmKlDYUcIg/GuFHE1lae7D7CUsQ8KCc7C5ci7UPGWLUbSi9fd45AJsDknN/Y1ZmppxjR78gFQ== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2025 17:44:03.2002 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5c73cc26-c89f-4746-f65e-08dd3d67dbb3 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: BN3PEPF0000B06F.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR19MB4764 X-BESS-ID: 1737827045-105647-32589-1675-1 X-BESS-VER: 2019.3_20250123.1615 X-BESS-Apparent-Source-IP: 104.47.55.169 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoamhgZAVgZQMCXRJDEp0TjJJC XZ0CgxydjIKDXN3NgwzcA8ySDZ2DJJqTYWANdKaR9BAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.262052 [from cloudscan21-33.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 fuse_uring_commit_fetch() has obtained a fuse_req and while holding a lock - we can use that for fuse_uring_commit. Fixes: 2981fcfd7af1 ("fuse: Add io-uring sqe commit and fetch support") Signed-off-by: Bernd Schubert Reviewed-by: Joanne Koong --- fs/fuse/dev_uring.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index 2477bbdfcbab7cd27a513bbcf9b6ed69e90d2e72..3f2aef702694444cb3b817fd2f58b898a0af86bd 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -796,12 +796,11 @@ static bool fuse_uring_ent_assign_req(struct fuse_ring_ent *ent) * This is comparible with handling of classical write(/dev/fuse). * Also make the ring request available again for new fuse requests. */ -static void fuse_uring_commit(struct fuse_ring_ent *ent, +static void fuse_uring_commit(struct fuse_ring_ent *ent, struct fuse_req *req, unsigned int issue_flags) { struct fuse_ring *ring = ent->queue->ring; struct fuse_conn *fc = ring->fc; - struct fuse_req *req = ent->fuse_req; ssize_t err = 0; err = copy_from_user(&req->out.h, &ent->headers->in_out, @@ -923,7 +922,7 @@ static int fuse_uring_commit_fetch(struct io_uring_cmd *cmd, int issue_flags, /* without the queue lock, as other locks are taken */ fuse_uring_prepare_cancel(cmd, issue_flags, ent); - fuse_uring_commit(ent, issue_flags); + fuse_uring_commit(ent, req, issue_flags); /* * Fetching the next request is absolutely required as queued From patchwork Sat Jan 25 17:43:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13950472 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 B7C8D70803 for ; Sat, 25 Jan 2025 17:44:15 +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=1737827064; cv=fail; b=cqgZFNCH5lbP8BYd0+xpucG+GnO1OHOIeuADwkSfqXArT6xxNDRedt3EByYCpbQm2VMcCqdoxodHRlEtnzSNqvYnWF9tR0YJBkoWGwQer/cH8Hd93OX+o7P0e8CT84y+50thMq/ZF21VmmMnWTO5wlW1l25hRJ7DpIY8+JbQRfs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737827064; c=relaxed/simple; bh=xKmi7hZFPY4y51ArjrYHaE6HqhuZiZuSOyDuRlOKVIY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GErUQKG5KoJ86OGZdprA+nw8i2k/3oGNhZ9Dmp1ZKPkzhbxRwdKMhETCcijwJDXvEaf06yIVlYy3FFBm3/R/sx6Y8h7meR+1iZ2dE2BPbB7B4OMyHCeBwEUKXjIrt+5+b59PttuD57n3Kn1Cb5YxTXPRGSaCrcqE7JgEPItBW7c= 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=wKc6XPrk; 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="wKc6XPrk" Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2042.outbound.protection.outlook.com [104.47.66.42]) by mx-outbound17-96.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 25 Jan 2025 17:44:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=VBSHRBmtr3RmU34t8L4/3PTadMCmigIska4hihadiRH+t21kTyZ+aapuAB5WZS/Ya1rb+pPsimAf1gLKeBT5VsCnCe5Q1YSv/vnBFtlLeVShayLl0lUWZ5Upag4MP+R9ZZMZqERrNhDLfMQsjWt5+Fq7tC/un05VbaQWT9mv5Ku7Emr7tJz2rYLCq8TrbrHg9PgHklB0iHE3LWbHHsf5etCWWgNa7NKda2T2eNGWdhdY09e0FILnu4jB9oGtyj3X2J54f5aUhMesF14m9L1GnBO2yvkqC5wxLiR1O1oiTsv1W/aAKFSth2dzFke4IO09pccsBnhwhIKjepaW48eWEQ== 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=CbdeyY+3unnhvj87n4IYQxvetBxhM/bINF4A5vx6Y8c=; b=YSBTyLHpexnmJz8OOwfZczxo+bXN74/zbMb7cvKK0UhyVz+WdEEuNx2N7F6Ecld5MSd5tHLB4TYwS5xUy2poAiH150g8C1sOG1wwvdfSX789ppKf82rKtBh7HHmBCb614k1SsB9jIFMpRR+AO5m1/G7MHfD4sy9+YDM12XgLb3LCcBVjQgP2Oyr9sRWcNxjQQU4PBjT4wsHO5NRJFUekKum8zv/UKNw4JumtSuiv/62poZ4I+TjKZ4lJ0guJa+vZtyO2TtGE908u3CPtK26YFzqVEeo/r/uD9efbTfz7w23wXhfhk3A9LROhBFv4dUbBUQouQzZxjQn5vGNGpVDYjg== 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=CbdeyY+3unnhvj87n4IYQxvetBxhM/bINF4A5vx6Y8c=; b=wKc6XPrk2HQs+7/8KvbSxUWpzlNFykMmlblKbfcBr5lmoHaG3rp6NQHIiKcJmV0rql56TODJ2DxOAMKS5kPsmuzWPJS+DRt7YdOVElzvel0MNA16uJ/e8xOxg+asOMlXy39bLo6UlG91HgHmnA2wWxYnb7RAUj4vWNsKk2eDU2Y= Received: from MN2PR03CA0023.namprd03.prod.outlook.com (2603:10b6:208:23a::28) by CY5PR19MB6446.namprd19.prod.outlook.com (2603:10b6:930:3e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.22; Sat, 25 Jan 2025 17:44:04 +0000 Received: from BL6PEPF0001AB77.namprd02.prod.outlook.com (2603:10b6:208:23a:cafe::91) by MN2PR03CA0023.outlook.office365.com (2603:10b6:208:23a::28) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8377.20 via Frontend Transport; Sat, 25 Jan 2025 17:44:04 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by BL6PEPF0001AB77.mail.protection.outlook.com (10.167.242.170) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8377.8 via Frontend Transport; Sat, 25 Jan 2025 17:44:04 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 23C8734; Sat, 25 Jan 2025 17:44:03 +0000 (UTC) From: Bernd Schubert Date: Sat, 25 Jan 2025 18:43:58 +0100 Subject: [PATCH v2 3/7] fuse: {uring} Add struct fuse_req parameter to several functions Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250125-optimize-fuse-uring-req-timeouts-v2-3-7771a2300343@ddn.com> References: <20250125-optimize-fuse-uring-req-timeouts-v2-0-7771a2300343@ddn.com> In-Reply-To: <20250125-optimize-fuse-uring-req-timeouts-v2-0-7771a2300343@ddn.com> To: Miklos Szeredi , Pavel Begunkov , Luis Henriques Cc: linux-fsdevel@vger.kernel.org, Joanne Koong , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1737827039; l=2034; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=xKmi7hZFPY4y51ArjrYHaE6HqhuZiZuSOyDuRlOKVIY=; b=JMKB8KNlUOCi+FWg6oEVRUjgColFMtY0TZVQ0zjzRvtP5suKLNFtuMS21Qat5zqd9H1Hg75tJ ovHAjCLOgM1DQZkeSQGgK4kYyEc0NZg4KNW9JfFNQd87hx1PwThfga9 X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB77:EE_|CY5PR19MB6446:EE_ X-MS-Office365-Filtering-Correlation-Id: c32ce68c-e6e8-49ce-18ce-08dd3d67dc51 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?h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16S7m15YNOsNWKermgjCs4pRodkuWoo0lKESc2fk?= =?utf-8?q?EOn1/vZV+/erbG3RUcYlqPFpzkmVe+muy75GrKPWtqS8Th7OxGPa+neRo6803qwGO?= =?utf-8?q?icQHBjtwH2F5wxGj4WDoLRQamZrFy26DcaQT27/3RzhjXjx0IA9vokNZnsp25fH9h?= =?utf-8?q?25bprLN3UV+OqaESlIyQB6zU4LK4zJXFjxjRT9foKM9J8IpXjhmUMp0kg4sAWx+e9?= =?utf-8?q?k92R9GNW1yL0gjPfT1f35hSXGhgC0SW9uBX0Dz9ndmgbeuL0AC78KEfUOy9AtOgha?= =?utf-8?q?MLzh+Q61mrWLuJgmhdUQ2YCQsXZ8X6ZZjsWzELDEF3YGlwXvXBh7MamI57piGjOKz?= =?utf-8?q?/DMgC30w49IPnbhIxYwJfIfZ1hXtXOkzpkgR9Ae0ruSr4KuJLRBjUYjerEMSD1zbJ?= =?utf-8?q?74K5+r6CoKwPzr6YnjKuCufptsLsjjqnnEaT2mho+7JN3cM/iwTuOTnTdoa3orxcH?= =?utf-8?q?UAmMrNnMSMhapU8OU/YFD06C1Nwg8gaV1nAJCSSGKA4BHsTjfqPSNYUaEFZR0jQn0?= =?utf-8?q?F2WZvk67GFTw4D37Wu0s0E3ReyHqLJMWu8AbzKu/6eypMpIv8NbF8I=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(36860700013)(1800799024)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 0OXbLBFT5Oi9qGrw07NJ0LSIpPO4h71r8iXqAw3fc+Nwu0/yIm5Gjf7Sq0zah5E4Tserv5VJkA1AvE+O2ep/HBhzkHg8dLZzzfsyvscvWTA35Ie69Jg2voRea5ZNdddDA6xBKjOwgaBqE/+PT5yXYUNWhMwewu71fynCeMjpFHR4S3yzdI5iHQo2eUb1WlFtY97a4jyU+pPQSJ8MXrUtMjqP0Xg4+2IpHLlAZWcBoAib5Yu1LqjGNQQSNEUOCSFa01H3UV8V7j7Or/LKQ15gSNl8VWMyQyvi/yYovtmv9RDhKtJsaUXujqojIGTCFiXun0coSA/REvrCkYxtTA9DQfh/HVZL0RgY1ZP8T4EKjVMctOvbHubQcW62BS2a9CSTbYrg/38ezh/Ue2zclU6VqSO8+qUH1SNJYDDHbASamzATOGDauT6/wphrwpCtxvAzusVQOpPYVZJidKYPPEp3YuXnk5qUj5BqdwyDaiOjlH62nZ96lhYGpTijz7pDd/DxOw63yxyCB+7ziWTpNlm3RKYFGv/dXGhr8l9aDaEkYvXCHrh2WUk8L8r6TERWKo7m1V9kVLm8pYpf/silbwNuqah9yfIrVQ5tzoVwJl6NKtrxR3JUIW/7B+4Ys07KfOTxIic8PSyE980DXMwOm+MRRQ== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2025 17:44:04.2300 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c32ce68c-e6e8-49ce-18ce-08dd3d67dc51 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: BL6PEPF0001AB77.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR19MB6446 X-BESS-ID: 1737827046-104448-13352-1007-1 X-BESS-VER: 2019.1_20250123.1616 X-BESS-Apparent-Source-IP: 104.47.66.42 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoaW5gZAVgZQ0Nww0cTM2NgyMS 01KSnR1Ng41STFINHAJDU11STN0DJZqTYWAGtxKCRBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.262052 [from cloudscan21-118.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 This is just a preparation for the follow up commit and adds 'struct fuse_req *' as parameter these functions fuse_uring_prepare_send fuse_uring_send_next_to_ring Signed-off-by: Bernd Schubert --- fs/fuse/dev_uring.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index 3f2aef702694444cb3b817fd2f58b898a0af86bd..62a063fda3951d29c27f95c1941a06f38f7b8248 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -675,9 +675,9 @@ static int fuse_uring_copy_to_ring(struct fuse_ring_ent *ent, return 0; } -static int fuse_uring_prepare_send(struct fuse_ring_ent *ent) +static int fuse_uring_prepare_send(struct fuse_ring_ent *ent, + struct fuse_req *req) { - struct fuse_req *req = ent->fuse_req; int err; err = fuse_uring_copy_to_ring(ent, req); @@ -695,13 +695,14 @@ static int fuse_uring_prepare_send(struct fuse_ring_ent *ent) * This is comparable with classical read(/dev/fuse) */ static int fuse_uring_send_next_to_ring(struct fuse_ring_ent *ent, + struct fuse_req *req, unsigned int issue_flags) { struct fuse_ring_queue *queue = ent->queue; int err; struct io_uring_cmd *cmd; - err = fuse_uring_prepare_send(ent); + err = fuse_uring_prepare_send(ent, req); if (err) return err; @@ -838,7 +839,8 @@ static void fuse_uring_next_fuse_req(struct fuse_ring_ent *ent, spin_unlock(&queue->lock); if (has_next) { - err = fuse_uring_send_next_to_ring(ent, issue_flags); + err = fuse_uring_send_next_to_ring(ent, ent->fuse_req, + issue_flags); if (err) goto retry; } @@ -1205,7 +1207,7 @@ static void fuse_uring_send_in_task(struct io_uring_cmd *cmd, int err; if (!(issue_flags & IO_URING_F_TASK_DEAD)) { - err = fuse_uring_prepare_send(ent); + err = fuse_uring_prepare_send(ent, ent->fuse_req); if (err) { fuse_uring_next_fuse_req(ent, queue, issue_flags); return; From patchwork Sat Jan 25 17:43:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13950479 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 A280A2AE86 for ; Sat, 25 Jan 2025 17:45:25 +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=1737827144; cv=fail; b=WZP6i+XIUuAGmV4uwkZ4R7Fcho9YWmPs6BqPMJLgfhAZL78LyPQsJspV6u4YP7IVWpqdFXVgg7uKW+e0BbXV5Ef+suuKSQGKnLkoGu4hFzrNyr7MQ9tOTiwf6ZT/5cvZ+vgJmwOp9neWFim2ofYcNqcJGoHPuPtT+tc3YeAy2cM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737827144; c=relaxed/simple; bh=ctbR5MK2s+2sDgFg5uCpeyiveee91aPO1daL47kkIt0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YJDsVoLbl6nRGL1EKmMKmeNX1/nKDZw3ov4JxK+KNCBHhATgHVjVBlCVrGLLlLdLL8NsSSn8ciQoBbTpksjtLCQwD2j/cJYuyqXJhsZGlCWWaDjtvcS42SDKGQ/wG7CSoRFAh6J4A5XEeQcPI6zeGvl691U5+xy6zfBeSr3aUgY= 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=G5C5lLFb; 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="G5C5lLFb" Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2171.outbound.protection.outlook.com [104.47.59.171]) by mx-outbound42-127.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 25 Jan 2025 17:44:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=jH3o/7CFcz7W6SHYCRSiIJCF+gKX4aicg9a8fgBeKImm9l6RVRN5R+CSZC5jElXM9UUGRXuOXPUsNVtqfGVM75FJ5JPU9cGzun3u+J+BnL4QLoycB4j/iQChzkvkkVEtxPJy81oK8+r0kDBX6BXVNovbON8QRDhjj7kzMa0/nN/n8wWbDUae9NM1Q9h6ocMtSBBeUvhs+9P8pQJfKWcmb+BsV6IkTknUCew0cI2FTsrHwq+A0Jim6GWmtT4rOfG5t5md6TY7kBSt5/gPoHA6H80m5kRcfv+8je5Pnl6sghGXmwXv1Dx3ecaLLy20wka/PO6XFiu3SrcFrIHGjAqy+A== 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=FrDggoueKzxiTosXg4AJ+xH8WtnrlP5FRNkwnazvUfY=; b=rkoNPgFwUNpbmlgVq4Y1xKG2gZjHCOBHKd9dGmuW/dy/13Bkq5zn3r+5FnGL4KJuVwg6AzaS2d/C4o0ANCLqHOqHc5trXCUDtGwXCJjqUl9zCx5kt8RkxTzj39maknd6T0fdDN/EuFAKqVgQK1nOw+VmN6btK+qIduTun5yY3t2gbH/wZp7URnZSahM5dT0uG2M55zuupf/u+zpoxLaG+F9U3NXFbY4MsNGTUIqfv6ShiBv0Yh1jf8QNnjeLSuuq0gmTglKRk+aYs8I7HfknKQ3AIYWEzwdbAVdJuhYtBP5pgpUjIRCmlNMx/FQVgZBUBfjQ5ju1P5W244J0BP8LZg== 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=FrDggoueKzxiTosXg4AJ+xH8WtnrlP5FRNkwnazvUfY=; b=G5C5lLFb2E5YvCHDcL8ep1y98Ahk5Mq1fpu4+AtRod2WMaD5Hq7J4PcRScRCWPLGNrs3/Kw+2Uil0p+BadPOfNKjt0KucvX4yRFaz+Yxm27ymiV23bWadatoC3nwAAlrFmc25kMKPH+OFlqAPtDFtz8O/zEBXYZZM8hMcb4gRls= Received: from BL0PR1501CA0013.namprd15.prod.outlook.com (2603:10b6:207:17::26) by PH7PR19MB6806.namprd19.prod.outlook.com (2603:10b6:510:1b8::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8377.18; Sat, 25 Jan 2025 17:44:05 +0000 Received: from BL6PEPF0001AB73.namprd02.prod.outlook.com (2603:10b6:207:17:cafe::74) by BL0PR1501CA0013.outlook.office365.com (2603:10b6:207:17::26) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8356.20 via Frontend Transport; Sat, 25 Jan 2025 17:44:05 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by BL6PEPF0001AB73.mail.protection.outlook.com (10.167.242.166) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8377.8 via Frontend Transport; Sat, 25 Jan 2025 17:44:05 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 2076358; Sat, 25 Jan 2025 17:44:04 +0000 (UTC) From: Bernd Schubert Date: Sat, 25 Jan 2025 18:43:59 +0100 Subject: [PATCH v2 4/7] fuse: Use READ_ONCE in fuse_uring_send_in_task Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250125-optimize-fuse-uring-req-timeouts-v2-4-7771a2300343@ddn.com> References: <20250125-optimize-fuse-uring-req-timeouts-v2-0-7771a2300343@ddn.com> In-Reply-To: <20250125-optimize-fuse-uring-req-timeouts-v2-0-7771a2300343@ddn.com> To: Miklos Szeredi , Pavel Begunkov , Luis Henriques Cc: linux-fsdevel@vger.kernel.org, Joanne Koong , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1737827039; l=1123; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=ctbR5MK2s+2sDgFg5uCpeyiveee91aPO1daL47kkIt0=; b=fYLTGDCK9YQTj0USubejzgs1Ifb0v/ekZMXNipAMzTV8fwot317ny5gac64KUsknspPAFsfKH Pj6iv0i1vD7BSA5MxAaSBierZLaBB14C+7FBPHieV+dTVr8HNBXTFZY X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB73:EE_|PH7PR19MB6806:EE_ X-MS-Office365-Filtering-Correlation-Id: ac9da2ad-c4da-4972-4408-08dd3d67dcd6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|82310400026|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?VqnKkxYoKNnHbAnqpG5I7xKnn6mJFMZ?= =?utf-8?q?pkvpTorFEHCwsgMvB8MazzRnwD2oAebt89fIIBpUO4LEFtWrjlm+hGWOuKfsdmfhC?= =?utf-8?q?wnBdPtxIXej6zvUyRIg2anKMFv0vDLRVHTd9kUDQ4n64fLTmE/1TeUpQ+uiPuuExL?= =?utf-8?q?0wIfLYK1ad3VtEZJsfSB7MrmCpev1l78yF8hZvFT7SwlLE5iY2GktIWEFP5Hjgcnt?= =?utf-8?q?hJX7mOi8gO+jciROMtACVgXDGJ0YkhNqh5V3z1VT+/ty0blsir71sdfugVhJjoS7J?= =?utf-8?q?6t/B0+iMB1xpcNE+lgGRU5lkn86RTZQa7LFNiXiHKizI5jtFhb5AB8z4ddnhAc5di?= =?utf-8?q?e9qBZKB9bIGWxxYnB83yCIvEyu8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LJC9plIWtu22s95drJxd47KWfCgJnn?= =?utf-8?q?plWfW/AzSFR/fzc/GCPT4iAaDQ6/CLRQJ/WRXvMZuO9/9weJi5OH2HiCJU8+IlwLs?= =?utf-8?q?xB58415TI1GNQ59JKmSfHT9KyaTLEZdWQOoeq8yUlDpTxDkmaH0TmwiPR2reP710q?= =?utf-8?q?vipIAywekk/myG7dVRHdR/7w+kuQdfCXUrEaF6ldfCnHskIP9JY0wo=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(36860700013)(82310400026)(376014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: yzeWjRVyka+BKb97LQuexGG67ITwXTAXOQOdicNuANnowC2uVHEsM/KZjArVg6vlwp6PkYd7hJtaJekg2hwjSeg2GklEoXt4qUHjMa4m4aRaOt/A5h8czLX5zY/CooQHcoqSGmuacLsu2jxM3abMfKRI6ZP/8q1PrFwKkXwy4MiWquYn0RMUcHgFvQ/WcU6coUkHzw0KrjA/+tbOiwTQSgr6zOEPhMK30+/CNwde7DEW7my4F/lDZOOGRG5yNkP4bPdhm8ilIese/jsL5LbtmtqyQEjjnUUTivin/7Mhu3qoOpuDDWusY8+FQFCQn5H/JbxjaM3hm3NrByWgMvw0IT4cHJKzXmDBVwPGVULQk/9gSZxgE9lVDtTY8beBVaOEyc6tIQVKxDg2Dt+oMDskFqeIUdhfGXQrem4JF5AzwTNJN8Zo68yYxFhZiwqS2xtGDbU78Gm5BFt99B32BMx8ZieDpmtvdxyfeMJ0dpbxgmjyH/8XjQOW6jZaf2L1hjtg5qwMdFX1CNNE4rgQx61klBE29d+IhU4LoUwG5SiVic5DvQSMfj0PZsWuxkkJQl9KDnEeQQknNS53XbhubOmBZ8TaMKQuuYgSPGJUCFHdO2MyIxt6niyKwGXsw7PqOdPtpHIa+Qnig6IpCaXS9izzpQ== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2025 17:44:05.1027 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ac9da2ad-c4da-4972-4408-08dd3d67dcd6 X-MS-Exchange-CrossTenant-Id: 753b6e26-6fd3-43e6-8248-3f1735d59bb4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=753b6e26-6fd3-43e6-8248-3f1735d59bb4;Ip=[50.222.100.11];Helo=[uww-mrp-01.datadirectnet.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF0001AB73.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR19MB6806 X-BESS-ID: 1737827053-110879-13387-489-1 X-BESS-VER: 2019.1_20250123.1616 X-BESS-Apparent-Source-IP: 104.47.59.171 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoYGlsZAVgZQ0Nwg1dIyxdI0zc Tc0jjV3DLNyNzcNMUw2djCzDgpLc1QqTYWAKVaOgZBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.262052 [from cloudscan17-107.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 The value is read from another task without, while the task that had set the value was holding queue->lock. Better use READ_ONCE to ensure the compiler cannot optimize the read. Fixes: 284985711dc5 ("fuse: Allow to queue fg requests through io-uring") Signed-off-by: Bernd Schubert --- fs/fuse/dev_uring.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index 62a063fda3951d29c27f95c1941a06f38f7b8248..80bb7396a8410022bbef1efa0522974bda77c81a 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -1204,10 +1204,12 @@ static void fuse_uring_send_in_task(struct io_uring_cmd *cmd, { struct fuse_ring_ent *ent = uring_cmd_to_ring_ent(cmd); struct fuse_ring_queue *queue = ent->queue; + struct fuse_req *req; int err; if (!(issue_flags & IO_URING_F_TASK_DEAD)) { - err = fuse_uring_prepare_send(ent, ent->fuse_req); + req = READ_ONCE(ent->fuse_req); + err = fuse_uring_prepare_send(ent, req); if (err) { fuse_uring_next_fuse_req(ent, queue, issue_flags); return; From patchwork Sat Jan 25 17:44:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13950475 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 D544C7346F for ; Sat, 25 Jan 2025 17:44:17 +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=1737827066; cv=fail; b=W91/qxaq2yTFfQsTF4TV5qRU5XsRa2TSyl/oO6fMPnWdBKX/ZvNJbFC8Zjvq6KtuRIFeuIFGP5ViMA0T0f5evhtd9fuzOlPZZ+cPNE2zF0xQ7RMBU/Swt2GYqzk0m5biTiVq1h6WrJtXsqACRivSGaAKaJ6IMIK2ZpU7LHbrV3s= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737827066; c=relaxed/simple; bh=8ViY751sXI0roqKjjWjbzj1DUuxSYU/09ekd/2WhF8Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LtCmR79pYQC729m9nbrVBgRVqFjNdGeZU2s5uwnih7GjCaFWzc4O0TV69bsCe4soG/OVQjck3lpS3n09brk+RjphHfawqtLtXXfclrnjzWlx7fC6lPCB5okJKOyexmQ4p5+twpSzRPH88RtLhe3sRrryKqXlSHPSfzLzA4tnAo8= 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=Ew3k9b4d; 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="Ew3k9b4d" Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2175.outbound.protection.outlook.com [104.47.58.175]) by mx-outbound17-96.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 25 Jan 2025 17:44:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=TiCLUE9qsf6YQ/ENzvncao7EEhcPiai6csZFJDGgnjEGta2N59ZOOSqj9JbiC8GZS/ANEtzM9+aq/mod7ZAITmCUru/u1hfWhRrWVAN/kbKi61RhcZUb3BtV6ftsdFqLQnaaBrxX7miKyMSrDOFcxv3oke3LrlmquKqqNoD6yAqFSLxSXSraALiVahLRm+U3aWH5pa9OqymZY087Y9ftXoB+3sqhkCzloKMO6lukhlDmwPK8aZKLxUARm3wS0VvSskDW3jv4LD8unrmmE4c4Zr7PJQSkx5F+Q8Am4+voFt6+fOdNwKZt++BrsxdL/pIgteHSOFT55i4fpVMwCdYfew== 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=WxUuYZgtPj62MR57a4H9xDcQAms7H/7ePxsxw+gPzEs=; b=XMaQ0zb9CCyX3mHK/e5VbS/gLIaCQuBGgVkL//Ft2eSoYwWSHypsWxeOWcEOPcPSMCRFamlPHZ/In2ynFubqtYM/yCyNZbO+0z6R6CqJjYBWcLDv5yruToUKK0nrhg8QqEk/SrNaUpQzf+Q7Xp9JAh4AdWvHMcvk8l3lNG7SZyOJBqVu196T76rGIDc6lAU6eXcHX90Mdr8CKoTgh21SvCUZWi8jSzelP2THaj2ThrxXVMaBNnNsrz7Y3ZqE1JawkF+Wp9/0m3kjdqTJZ1cSzRd13hjUfUV704A7lGhtYl+OZE+aVBmT2ygMhOFwP4coT8l5nnmMs7tm+Hu/ovhOnw== 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=WxUuYZgtPj62MR57a4H9xDcQAms7H/7ePxsxw+gPzEs=; b=Ew3k9b4dvgp9VdhgC4oSn9UtI6MTDZ8SIy4rw/2v/z5sLnoWgcSOYwPlxTooyjTh2qVchV8ahk0bwGevz/8bPtLTyJilCDv0pGSFOmMEjOlUeTOmvxKnwJUhyKXBw0F4ve5Ln9dknOVhqSKQ0x6BtKTW+Zh5PUVlByYJ5y953Bg= Received: from BN9P220CA0025.NAMP220.PROD.OUTLOOK.COM (2603:10b6:408:13e::30) by DM4PR19MB7971.namprd19.prod.outlook.com (2603:10b6:8:185::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8377.20; Sat, 25 Jan 2025 17:44:06 +0000 Received: from BN3PEPF0000B06F.namprd21.prod.outlook.com (2603:10b6:408:13e:cafe::2a) by BN9P220CA0025.outlook.office365.com (2603:10b6:408:13e::30) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8377.21 via Frontend Transport; Sat, 25 Jan 2025 17:44:06 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by BN3PEPF0000B06F.mail.protection.outlook.com (10.167.243.74) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8398.0 via Frontend Transport; Sat, 25 Jan 2025 17:44:06 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 1D38F34; Sat, 25 Jan 2025 17:44:05 +0000 (UTC) From: Bernd Schubert Date: Sat, 25 Jan 2025 18:44:00 +0100 Subject: [PATCH v2 5/7] fuse: use locked req consistently in fuse_uring_next_fuse_req() Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250125-optimize-fuse-uring-req-timeouts-v2-5-7771a2300343@ddn.com> References: <20250125-optimize-fuse-uring-req-timeouts-v2-0-7771a2300343@ddn.com> In-Reply-To: <20250125-optimize-fuse-uring-req-timeouts-v2-0-7771a2300343@ddn.com> To: Miklos Szeredi , Pavel Begunkov , Luis Henriques Cc: linux-fsdevel@vger.kernel.org, Joanne Koong , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1737827039; l=3287; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=8ViY751sXI0roqKjjWjbzj1DUuxSYU/09ekd/2WhF8Q=; b=1E48PmMbqqoXbKq6KFTj5yMo++1ll3fUR0g7haN57ozyJbEWQqdKWw7m0kGg9z4UjBX63u7aJ 9JB4ThLErPWBL2W/CWRvRk3k9yAAyQCLpCE8S1tmAhILQPSdw7Ue5JJ X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B06F:EE_|DM4PR19MB7971:EE_ X-MS-Office365-Filtering-Correlation-Id: fab79d5e-6712-4d00-2ff2-08dd3d67dd74 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?utf-8?q?JupQkCHziG+Pqet7nFXY9cYWStsOJiK?= =?utf-8?q?KXUAxbd1oQy6HKR0mvWe8uV5Q+ii1yQeSWDw7T1kVPcbnFmoTTy02Z8qCvdyOIWbY?= =?utf-8?q?m9/W2+Y2Nne1EJ9S2+fjIW9IrEujLL16Xy94V+2QaAjNlqHhQyUFIUdGGrZd8pJyO?= =?utf-8?q?4KgMzpSJw/XbrV4/b4BrL1eZy0yJf0Itqwvco5Ort2THP30axX8/9O383/dF6/G1j?= =?utf-8?q?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?EeZVdQeSq3yPNtB4gC2mv7xK30uUzC/OvFcHtRcjMJYMK5zCaUSxXtRDNO+qSLoVC?= =?utf-8?q?aA5X1P5kdylTQgb8trTZ8Zal1o7ErKfAAlWmK9Jue29mLf2+gIM9BSh4TMH1t3/0i?= =?utf-8?q?j+DrW8dl74kswdk+iQlU9sk8KXV0JCOOMmKUNA8E+RV160IBGiYU+lQ/UtUhbRpEy?= =?utf-8?q?hCoTBN0MyslR/BJN+hFUa+4ETiE6CcTj03WTR9elX8Ilm+4zmKQnYQ13Bk13rocps?= =?utf-8?q?c0ABJ9X0lGcvYU0Wh6efJRpHJpvx8KN3EnwLFK4ni8fyYrG1faJKrNEjz4Bv50Zrp?= =?utf-8?q?OVu/dOrzIqBlfiRT0QmQphbUpx1BDW0G1OQIZ86cV5kmfiYrVJxWSg=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(376014)(82310400026)(1800799024);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: tJkGKFAKOUowDeRjkcK4yCt5gk3xXd362faY2NT2SI8XZpsIIREyg75BvojAcWs2dVWLM+BYFpNInxy2SWSSAXJ+1kf9S4dJf0Yi3c2NhoJw00KwXbr/2wZ1HuO1xK9TNRoEAhBCshztOJVJjzKuAj28rCQwm4GchejgiTeftcoXf/D56Lr5brmzx/Mk6QLt0JIE66kyjLexfSkKcQwxg5xpknG4ac0KcoBR+nyblEkaL2BQ68FfjN6KU9zBEXV4JuGnaQHTxlqYO67Lw+v9XYnJOHWMQhsjByV9lCwHWyTzRgqQ5kwYZTeXK/B63+ALMSxXQK0TuzuDRnzsCh7Ta6yfWxUNYShk9iyFp/GgMLmduYx/dArUk81IpGLt+qkqA8vsAkpsXusN9cI9hHhp8cOZ6JV872DHnPUY4lwN52ptFkL2xnaJjHUCxAyOkXrPHku96ZSIGGiPbZjr4GRcBdRSvJjOsTmP4jP0i+5/vJXoASn/s+JLXLHCqWnqEEMyvm8rez5HWw8nclpWHdGfGnxTh7ZPwlXv+AOJDwTzY8LntwI8j7g4A1f8XvdfvpMVMYXQGOGq1gw4LEFIHbPd/Zvejj0HbbENeSQs+E3m/pl9jr4rILityP0dqafFd0vOkEp2yV2+SH1KWhLd8GgAVw== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2025 17:44:06.1220 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fab79d5e-6712-4d00-2ff2-08dd3d67dd74 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: BN3PEPF0000B06F.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR19MB7971 X-BESS-ID: 1737827050-104448-13353-1019-1 X-BESS-VER: 2019.1_20250123.1616 X-BESS-Apparent-Source-IP: 104.47.58.175 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVsaG5pZAVgZQ0NDQwDjFINHCwi jZOM3MwjTRLNHQzCLN1MLIwNjc3NxQqTYWAOoP0QtBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.262052 [from cloudscan21-118.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 This changes fuse_uring_next_fuse_req() and subfunctions to use req obtained with a lock to avoid possible issues by compiler induced re-ordering. Also fix a function comment, that was missed during previous code refactoring. Fixes: a4bdb3d786c0 ("fuse: enable fuse-over-io-uring") Signed-off-by: Bernd Schubert Reviewed-by: Joanne Koong --- fs/fuse/dev_uring.c | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index 80bb7396a8410022bbef1efa0522974bda77c81a..e90dd4ae5b2133e427855f1b0e60b73f008f7bc9 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -75,16 +75,15 @@ static void fuse_uring_flush_bg(struct fuse_ring_queue *queue) } } -static void fuse_uring_req_end(struct fuse_ring_ent *ent, int error) +static void fuse_uring_req_end(struct fuse_ring_ent *ent, struct fuse_req *req, + int error) { struct fuse_ring_queue *queue = ent->queue; - struct fuse_req *req; struct fuse_ring *ring = queue->ring; struct fuse_conn *fc = ring->fc; lockdep_assert_not_held(&queue->lock); spin_lock(&queue->lock); - req = ent->fuse_req; ent->fuse_req = NULL; if (test_bit(FR_BACKGROUND, &req->flags)) { queue->active_background--; @@ -684,7 +683,7 @@ static int fuse_uring_prepare_send(struct fuse_ring_ent *ent, if (!err) set_bit(FR_SENT, &req->flags); else - fuse_uring_req_end(ent, err); + fuse_uring_req_end(ent, req, err); return err; } @@ -768,12 +767,8 @@ static void fuse_uring_add_req_to_ring_ent(struct fuse_ring_ent *ent, fuse_uring_add_to_pq(ent, req); } -/* - * Release the ring entry and fetch the next fuse request if available - * - * @return true if a new request has been fetched - */ -static bool fuse_uring_ent_assign_req(struct fuse_ring_ent *ent) +/* Fetch the next fuse request if available */ +static struct fuse_req *fuse_uring_ent_assign_req(struct fuse_ring_ent *ent) __must_hold(&queue->lock) { struct fuse_req *req; @@ -784,12 +779,10 @@ static bool fuse_uring_ent_assign_req(struct fuse_ring_ent *ent) /* get and assign the next entry while it is still holding the lock */ req = list_first_entry_or_null(req_queue, struct fuse_req, list); - if (req) { + if (req) fuse_uring_add_req_to_ring_ent(ent, req); - return true; - } - return false; + return req; } /* @@ -819,7 +812,7 @@ static void fuse_uring_commit(struct fuse_ring_ent *ent, struct fuse_req *req, err = fuse_uring_copy_from_ring(ring, req, ent); out: - fuse_uring_req_end(ent, err); + fuse_uring_req_end(ent, req, err); } /* @@ -830,17 +823,16 @@ static void fuse_uring_next_fuse_req(struct fuse_ring_ent *ent, unsigned int issue_flags) { int err; - bool has_next; + struct fuse_req *req; retry: spin_lock(&queue->lock); fuse_uring_ent_avail(ent, queue); - has_next = fuse_uring_ent_assign_req(ent); + req = fuse_uring_ent_assign_req(ent); spin_unlock(&queue->lock); - if (has_next) { - err = fuse_uring_send_next_to_ring(ent, ent->fuse_req, - issue_flags); + if (req) { + err = fuse_uring_send_next_to_ring(ent, req, issue_flags); if (err) goto retry; } From patchwork Sat Jan 25 17:44:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13950473 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 BC9A07082F for ; Sat, 25 Jan 2025 17:44:16 +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=1737827065; cv=fail; b=BK9MC7Go7rY1MyVdRyaCLBCx51lKXLJ7pou8/u55gPhrQC4vJHRBjO72rFuA9gEVofkfzGv/+2Qop05VGvcx+0wrGlKiZ4DtPgxFIh95f7QC+JQhfApD9u6ucqSkFgTPUFPmSFb7ADjJTmEXvNhIxWjKiMCbGmpUoAhG3DF4HYs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737827065; c=relaxed/simple; bh=tVUEcAgMZB2KHZMgoGJo9tEYrFy7s08vwiMoOJ7MChY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=b+euejlvWc2zW+X3hCXHH59yTXvx7rh8ub1VDWdUx5zJ8IkMsYOLHg0qOKh1LpBaWr3mkZLDDQidNP3Ux111eWP1h5HQoKE6Onu0WOgKEVpVk/OQP/i3aEyScnFbQZSwtvYfIdCTJ+tcPFROBGBs1NM0PRqCkpRGOPeP+WIlb4Q= 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=jHw3cfcv; 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="jHw3cfcv" Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2048.outbound.protection.outlook.com [104.47.66.48]) by mx-outbound22-74.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 25 Jan 2025 17:44:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=k/J5i5NIrOjKrB5TDkB0XVcHjZsAuJEl+o3fHyDJrG3/Ar2AbtopXU9kAu067NfwQXsBatRUutZjBciJW2Dc00nrp2qFcis8R/2yhKBXjBvLvHHHUeQGo2PL/UsC6vTZxm24aZaniN3ZIySq4+UJBpWAzNQK4KGhlD0YLiqlblJcPfkt+Z+V1ORjDywFu/6nNVyr/8nOtyLp4/EKmJGUste6pOEOd2X7WA5RcqhhHFOtlCvoddx6bDQwXMbLdl6Yd2jxTv7SA4F8PQg3CG3NKMBr4PXWNcN/kmcDagZIVhc6mzDJSEDH/zW4O3pgsFEUeNSQuiiJPfskcvclR5YREw== 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=b/iXpWnfn0Z6SpnLTP32PQZC1OJh8QXNfKeYypUO30E=; b=dyuOXWymd22Szcftjk8zj1qvNl2wGS4egLxtJyuGnA8eqFfwQJAkV3I9P8KZVEf24whUZhTCqby76zLK0086uR87htNKU7sN05rcydTVZk7bNr+neOWuRSoa5bY8lBolEhh/UfT78efpxb7nmafTtNJhSaVn7GGFIFN7C3AiR40ctJzFgHsWwikXdjzdGzTfB9UvgRBoCY+bpHIeo6fYq25p7mELeEDRskU/s1ddY1/YGxP1Jlkeh2CcijCdCcTAvKtkL7/xPuz4lRq2cu6R/z9w+ZXTOHwM/5sLDUmcrBmBs/a+ot4/9lT/AJRAY5iwVcEdsoDU/rGFg9IsW60uxA== 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=b/iXpWnfn0Z6SpnLTP32PQZC1OJh8QXNfKeYypUO30E=; b=jHw3cfcv9YyAT1IoKrNK5irhq3sFlZyXD2VlcAJ4wDKB55u+T5dtPsVbf4etk3vz9Rilold4Aptp8iQyinO7Uj4HdlLOLHYuzEtK8X8xEyk/wDBT89XpJWuXT81iKLvjJmIxYwDRZKcjizSGv9TYoO+SIhqVMgNATrVXO5sFOuE= Received: from BN9P220CA0016.NAMP220.PROD.OUTLOOK.COM (2603:10b6:408:13e::21) by IA1PR19MB7661.namprd19.prod.outlook.com (2603:10b6:208:3f2::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8377.17; Sat, 25 Jan 2025 17:44:07 +0000 Received: from BN3PEPF0000B06F.namprd21.prod.outlook.com (2603:10b6:408:13e:cafe::d9) by BN9P220CA0016.outlook.office365.com (2603:10b6:408:13e::21) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8377.20 via Frontend Transport; Sat, 25 Jan 2025 17:44:07 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by BN3PEPF0000B06F.mail.protection.outlook.com (10.167.243.74) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8398.0 via Frontend Transport; Sat, 25 Jan 2025 17:44:07 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 1621658; Sat, 25 Jan 2025 17:44:05 +0000 (UTC) From: Bernd Schubert Date: Sat, 25 Jan 2025 18:44:01 +0100 Subject: [PATCH v2 6/7] fuse: Access entries with queue lock in fuse_uring_entry_teardown Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250125-optimize-fuse-uring-req-timeouts-v2-6-7771a2300343@ddn.com> References: <20250125-optimize-fuse-uring-req-timeouts-v2-0-7771a2300343@ddn.com> In-Reply-To: <20250125-optimize-fuse-uring-req-timeouts-v2-0-7771a2300343@ddn.com> To: Miklos Szeredi , Pavel Begunkov , Luis Henriques Cc: linux-fsdevel@vger.kernel.org, Joanne Koong , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1737827039; l=2456; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=tVUEcAgMZB2KHZMgoGJo9tEYrFy7s08vwiMoOJ7MChY=; b=ubCRTsAI1ghuEtn9sCbw50Nz5PoxuQrJSzVW962pvVzInlwyhg1QD5NXXQw7B1i3EgClYdaKg QkrJqsKxksKBMxAwH3Bsn9neBGRgx+gBn9m733OLyyfQsgcuk/kq9Vx X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B06F:EE_|IA1PR19MB7661:EE_ X-MS-Office365-Filtering-Correlation-Id: 21d709f3-11e7-4e9a-3cb4-08dd3d67de03 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?b+b2LsvM5IKuoGli8eHkT2GnAWPlYoZ?= =?utf-8?q?P/BP/hFuU0CtH/zZI+QrF02WqAuMwe4yPQjEZ2155sJTUbSeGC62wLHVyFbyWOd1I?= =?utf-8?q?hWh2DqiLaktmeUHwp0bSnLfDcjJ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m7aQtsSBk09PJLa8FI84331I99WbzEEFSkwZi?= =?utf-8?q?RcHR2p+r4iEryLoaCYbFVNmi05tN4BA2IdkB2ncynfelZUjcWzB1v9vQeY70ck8xJ?= =?utf-8?q?1TiaLQrlLT6N4fAoePBFyh7pLL6Ehur0Y4VPRjMzmvLHD0UGTlFPkhMkpEiO3vJcg?= =?utf-8?q?0y6nT5dkbonhsYJxXxjxb+93aUqnZCtunRO71fIQ0A5n1gaRNb4EnBOM2X3YNhGMF?= =?utf-8?q?fstgtfgaxZ+GElAJWtr4KqZ0c+z2WU3U3Cmt0IAlSDf46uxGgT8A717PQZhIynB/N?= =?utf-8?q?BsdK69j7hRR4XTE9FRODBK6YBI0Zn+XCR7X03N5pQOSTcunKZZrr9u6ky33pCCtYt?= =?utf-8?q?10tQ+SX9as+VKqPt75/QBQcMNyALJ8E2NChUUIsOrl0aX8Z/3fi1PSDTOIzguLns6?= =?utf-8?q?3OIioKTqHmvwg6Lee2egiFRHto28uZIRvd5PMNI4mOYvgjVmBTvctw=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(376014)(1800799024)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: iXepg/g3rBJUd70mmq5pR+fJgZAwwVN+Jsukl8KHFatgmdWQyhsUwx67/5SnllTIewCIJnIRlhDh9usniCJQocy6S3gju+kR5YZTj+mqDjnrK0ooKsMs0lW9Q2CXJWsNSM+SMxJjQzPBrkSHJfu6m6zgbxbjWafW8BXCEHbWmLdr6Iov3cRfinFP49helmU17eUaV+31E/xL48xkBHflo2BJcsrexyLEg0YXUKwWqdGXnCsvB6U49e/S07wqc10CQo5JtIJLnBrPNAHXxCKBSqzjBGwURHeMXFqPdD3t2OMELT8J9/3XHdyoIqDHBacej5ecIVreLWBR/m4wlOB4GWGMxC18ibiyf505Ea4igrP8dTODlw45Va8BSNpjDYGAHIYx9I08RvfpHYwTbCuy2aOZM11OQD3FZAKQ5B5RGb+DReE0h7VscfWPDd3vIYwBwclnpCvZ1Lyed9wMdsdQSI8vSjrnYxhOXRyzqyfftUEI19LVPFmJ1qA3uwkZ1gdYQAao0knpYskmIClRA6NspKYWKmLNM/BzTFrym0CCzyimOgwPOo9NphynMupNRktiN0QlKwj/XZPI/j1zUU4ZNSpHoA2yDaxACw+t54VgkSW14+ziz9GtDfoshEsk4X4zHLMLjiaxP86LqD7ZNTO27A== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2025 17:44:07.0595 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 21d709f3-11e7-4e9a-3cb4-08dd3d67de03 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: BN3PEPF0000B06F.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR19MB7661 X-BESS-ID: 1737827048-105706-8216-1021-1 X-BESS-VER: 2019.1_20250123.1616 X-BESS-Apparent-Source-IP: 104.47.66.48 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVkbGFoZAVgZQ0DTR0Cg1zSTVJM 3EJDklycTcwsI81TIp1TwtzSI51cxAqTYWAOMGsExBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.262052 [from cloudscan21-81.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 This ensures that ent->cmd and ent->fuse_req are accessed in fuse_uring_entry_teardown while holding the queue lock. Fixes: a4bdb3d786c0 ("fuse: enable fuse-over-io-uring") Signed-off-by: Bernd Schubert Reviewed-by: Joanne Koong --- fs/fuse/dev_uring.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index e90dd4ae5b2133e427855f1b0e60b73f008f7bc9..9af5314f63d54cb1158e9372f4472759f5151ac3 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -298,13 +298,8 @@ static struct fuse_ring_queue *fuse_uring_create_queue(struct fuse_ring *ring, return queue; } -static void fuse_uring_stop_fuse_req_end(struct fuse_ring_ent *ent) +static void fuse_uring_stop_fuse_req_end(struct fuse_req *req) { - 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); @@ -315,14 +310,20 @@ static void fuse_uring_stop_fuse_req_end(struct fuse_ring_ent *ent) */ static void fuse_uring_entry_teardown(struct fuse_ring_ent *ent) { - struct fuse_ring_queue *queue = ent->queue; - if (ent->cmd) { - io_uring_cmd_done(ent->cmd, -ENOTCONN, 0, IO_URING_F_UNLOCKED); - ent->cmd = NULL; - } + struct fuse_req *req; + struct io_uring_cmd *cmd; - if (ent->fuse_req) - fuse_uring_stop_fuse_req_end(ent); + struct fuse_ring_queue *queue = ent->queue; + + spin_lock(&queue->lock); + cmd = ent->cmd; + ent->cmd = NULL; + req = ent->fuse_req; + ent->fuse_req = NULL; + if (req) { + /* remove entry from queue->fpq->processing */ + list_del_init(&req->list); + } /* * The entry must not be freed immediately, due to access of direct @@ -330,10 +331,15 @@ static void fuse_uring_entry_teardown(struct fuse_ring_ent *ent) * 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); + + if (cmd) + io_uring_cmd_done(cmd, -ENOTCONN, 0, IO_URING_F_UNLOCKED); + + if (req) + fuse_uring_stop_fuse_req_end(req); } static void fuse_uring_stop_list_entries(struct list_head *head, From patchwork Sat Jan 25 17:44:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13950477 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 10D7D78F2F for ; Sat, 25 Jan 2025 17:44:19 +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=1737827068; cv=fail; b=umNgtBSNa2DX3uMGLaTzRMOk9BGTgfTBeh3jc4y+B67t4JSCOiz/9JyOf1Jo6jxK7EPPlMA0rBqKqJqR6Kqx8zBFy6tH+sC/llVzDJvMpi2UG/isldL61uWB5wvidUMvKtJhEVstb7/P1XnNQlS4ZZUvCnKOaqC0UQUsUCjlZLQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737827068; c=relaxed/simple; bh=yUJ9fXw+s7PSlnZC/eBwvb7lEDcN1GM+kxlmJV+H/ow=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mmdrE890uAjhLTVV9vozb+gCEbu9VKXSsW65cap/qAM2GeqTW3l1bn7IJ8iIzyPFv7FoxjUa8mWxjaGJw7G9Rs0yWj+w2FnccHPgTAsSIUWfIarpzSiKlAdFzWz4+6uJTUDDkAxulFBu4scoO93hb4DCMUESxSHmzLNWIs0LMUQ= 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=qtjob2Oo; 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="qtjob2Oo" Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11lp2176.outbound.protection.outlook.com [104.47.56.176]) by mx-outbound14-217.us-east-2a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 25 Jan 2025 17:44:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wM8V1gyUz3tA8nQmiTsb2Y+kv5j+vQNaz1iVEIGUIZ2mgwqSJkhRO8MefE+Vn4krAFIwvbySDZOd2UfkAvcwGQ+UbNF1aYjlp1VFAt76qTBAqDSNmJHsP5qzksp9aKh8AS2hhl1o3IibG29w/mSO5KBU9gq9wFiMFZXnVrDVZwdrkmZwIxWg6ffJ1Fbgh+6TCmR+pPZh7iby+FTww8jFEadMwlAXZ3wx3/VtuytpfvIiXI8qqNDBk6lSYabH3L42B80TlXg4+SJDzvURmsovNluW7t7fawFF03O8/Gs4w5b9B6ypX8EGaI0viYI9fmib/ShxIrtC5qb4fl7WzdSz9A== 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=dAfioqXjLs4pfelmWFqDTo02xoS2SmdmMM5Z0wKOsrA=; b=SZ6wQziWtppYvIy3mQuAjOx1AXmEp1MasePcoZDcB0Kjfw6jOo1S8A0EIHnXOx9lCxwGL+yxT7lltZt/mgs+fo3KHhXECMHpUNU62yLCiftlKmO1zmIrXN0jR8HbgCpnRRchL4CH5hbkZx6Etq2e6ZwVJDP8+F9gxP1BqwdlyYV5CJazqRuPou3M790MboDJ9bzoNmzauPSvz1BS8CocodVWeyEAH+Gbz4gDgoflvPOkk+FgpVmuxwb5U9DZQZQaZd0/s0n+nFCtrDfkDJ1gn4RrRVBfazk5jsCB0RYm/eiaAbwtUEqsrvP3QYIUjjy4HWTO7k9IipOmnxRkmYp3yA== 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=dAfioqXjLs4pfelmWFqDTo02xoS2SmdmMM5Z0wKOsrA=; b=qtjob2OoorRdJ8dqE0mfnPwGAGu4RU/UDJ5lkwPGOAPVE5GVJc81bygVumJ4h0oTdTFHes5g7AusmOGzwmNS1ZaPydsiH2Ai3UCAY10L8NayMuk/Mum7D9kNBCdotZ0TKYveWX51CTrpBAF11pb7jFS5+ARRsW5/wZnx5MmdJAA= Received: from CY5PR19CA0069.namprd19.prod.outlook.com (2603:10b6:930:69::15) by PH7PR19MB5634.namprd19.prod.outlook.com (2603:10b6:510:13d::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.21; Sat, 25 Jan 2025 17:44:08 +0000 Received: from CY4PEPF0000FCC3.namprd03.prod.outlook.com (2603:10b6:930:69:cafe::8a) by CY5PR19CA0069.outlook.office365.com (2603:10b6:930:69::15) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8377.21 via Frontend Transport; Sat, 25 Jan 2025 17:44:08 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by CY4PEPF0000FCC3.mail.protection.outlook.com (10.167.242.105) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8377.8 via Frontend Transport; Sat, 25 Jan 2025 17:44:07 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 0F00334; Sat, 25 Jan 2025 17:44:06 +0000 (UTC) From: Bernd Schubert Date: Sat, 25 Jan 2025 18:44:02 +0100 Subject: [PATCH v2 7/7] fuse: {io-uring} Use {WRITE,READ}_ONCE for pdu->ent Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250125-optimize-fuse-uring-req-timeouts-v2-7-7771a2300343@ddn.com> References: <20250125-optimize-fuse-uring-req-timeouts-v2-0-7771a2300343@ddn.com> In-Reply-To: <20250125-optimize-fuse-uring-req-timeouts-v2-0-7771a2300343@ddn.com> To: Miklos Szeredi , Pavel Begunkov , Luis Henriques Cc: linux-fsdevel@vger.kernel.org, Joanne Koong , Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1737827039; l=1124; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=yUJ9fXw+s7PSlnZC/eBwvb7lEDcN1GM+kxlmJV+H/ow=; b=5N7hGYGIhYFnH9uzcIP+Zc+0k//B6d9DAp7f+EAH8nXuwxvDB5sA+6izrQx09tl3VxUEsOU56 1yzkI+Qb1eTChKE/SGlOn2zHbr7/WvmeAIOB0qdayOpqFvhCwO9mNy9 X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000FCC3:EE_|PH7PR19MB5634:EE_ X-MS-Office365-Filtering-Correlation-Id: eea8e6ca-3d24-4df4-ffe2-08dd3d67de56 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|82310400026|376014|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?q?eKHNg06LAalEKiaAdW2bnt/VruNLazT?= =?utf-8?q?hBVmG9zSa+D80Xq3aYRwTJNu1lWjcLP43IMaLkjRzBSLVtco03v2lirzwDCosxii+?= =?utf-8?q?a/w4cDiJLC7xPQhoeqgzGaJHn7mEicMw6r8A7sLBkTmQT4rcTmhrQZi3P6m5XjU4f?= =?utf-8?q?E/X2a0m5w/k55GiA8SsyrO3beuC3MWqNsmR9VVJhnS3yddD5HgQpXJufeOr32jUtu?= =?utf-8?q?ERGWrRmuT77TsZMCvJlGHI4ADcHkQ/dpU25/aF4Ia/vHq4bpSHSPNE7apt5SIhLz5?= =?utf-8?q?0vLV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3fzkrAyucMKnpv96LPX97t6DgbcCvblxQ4H+QOjSJR1rC5Ee?= =?utf-8?q?rK4wvhj1Nsb+GbJGUxVre7UmZA1uYKI2yF+Gh50ceGYsg0/flJelCFYAYK5MnGdHy?= =?utf-8?q?Ma2QyO/HJ3CkuRCeW+2zK9grUWp0vUT9dqSMgG/HrmgHRF2nx9klRzZhwcDtS5H/1?= =?utf-8?q?M02RCut43OrOERH8XQUr09I0fAuyaNBAKHzuAhpIT+fSNdpq1vqSY+SoE8Y9yqxHY?= =?utf-8?q?o8xta2gAXhmyRt1hV2nzpwt0aliha+EwVedLABLVCSCBRt+nq8X1eo=3D?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(82310400026)(376014)(36860700013);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: SzfupL+zwg18E/QjOEZ4oVWV/fbzWB8k92boE9pSUeW5pY34Y0ZpyqXlec27aXxHa+QJOqnKbhfw0DMpwMmLDUALeenJQABA45I0BB/6dFhYWdwVmT7iUABHTMOoYEEmELqeeMpuu+ZBMORkIaEohTjb5gQdc/0avJiwMzCn5+Xct5AgP1d2NyhJmgx4IU+3W1llZk9xIQy/Wr3b8qJsOa5WSJLrD4Gj0SxhBAoLJG2YusADl1z54UzKFUnNEoez3hKau6Wge8/1FHCGdjUyUMDxJhek0v7s4fgAHU4oQOuxhaSmsD3MBJm3Q/Ykj18EF02XdlGxFCh5xLpDgFwlbOD+iFN484qezgAv++yZUK+GO2jnbbOy3WVTHKpAlaartQXLA8nhrUyyaejUtqOaVWB4cNmEOjlzwGVBTX/xHSkPJV+CWSig1YENDNRwKfr/BC5NrWCbom+YmaI0fkq9DHjEH5I9Tdlchab3cgqjtdtJj6lJsM+4f6zVwmGIFP+0Rp8Ct2DBRy+EVRmnG++WswudWiSEmrCghettQ8B4tV83rN4BpINW2K/q5klBXzoH3p8gM58GIqqa15xs8VMF1oMtxDx49QLQCdgLeApp89s54p4CC681qoTnAd4jYKZVlXsJUOpFPSyFoegK9uKVtg== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2025 17:44:07.6866 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: eea8e6ca-3d24-4df4-ffe2-08dd3d67de56 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: CY4PEPF0000FCC3.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR19MB5634 X-BESS-ID: 1737827051-103801-13471-3784-1 X-BESS-VER: 2019.1_20250123.1616 X-BESS-Apparent-Source-IP: 104.47.56.176 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoYGloZAVgZQ0DLR3CA1ydA0EQ hMzIxMTS0t05JSTC0MDMzMjVIsUpVqYwGzPM/4QQAAAA== X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.262052 [from cloudscan9-132.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 is set and read by different threads, we better use _ONCE. Fixes: 284985711dc5 ("fuse: Allow to queue fg requests through io-uring") Signed-off-by: Bernd Schubert --- fs/fuse/dev_uring.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index 9af5314f63d54cb1158e9372f4472759f5151ac3..257ee375e79a369c18088664781dd29d538078ac 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -36,7 +36,7 @@ static void uring_cmd_set_ring_ent(struct io_uring_cmd *cmd, struct fuse_uring_pdu *pdu = io_uring_cmd_to_pdu(cmd, struct fuse_uring_pdu); - pdu->ent = ring_ent; + WRITE_ONCE(pdu->ent, ring_ent); } static struct fuse_ring_ent *uring_cmd_to_ring_ent(struct io_uring_cmd *cmd) @@ -44,7 +44,7 @@ static struct fuse_ring_ent *uring_cmd_to_ring_ent(struct io_uring_cmd *cmd) struct fuse_uring_pdu *pdu = io_uring_cmd_to_pdu(cmd, struct fuse_uring_pdu); - return pdu->ent; + return READ_ONCE(pdu->ent); } static void fuse_uring_flush_bg(struct fuse_ring_queue *queue)