From patchwork Thu Nov 21 23:43:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13882472 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 9015810F1 for ; Fri, 22 Nov 2024 00:16:23 +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=1732234585; cv=fail; b=LGYR/MayivJyWptuQXFBHxkNr7rKruL3Pt0DmurG1vPrrLhUxLYDmcxE019jNy0gTVG04oTjQ5Cl+UkHt1lJ8JdD88YkWle1tYOuT//6xRbFKJtUVINN2qSCESo04tyMt+8kUXlLWJ6rGUil1N33KBBm4DMWFBtV4+Ua5zExM14= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732234585; c=relaxed/simple; bh=tie4NxDKix394rRPWJuOycw76UDfRN09D0r3BvuIHOQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=loPctPPOsOnqrNgXPn61NrWfC7vN0DxO7zKcg/fgt5vMtoOgrO2hG3dtMQxYHS8FQ660G7nlUcSJnGoVp5m1ZSf2XgzqLXtwTJzyWhXhvnBaBWYdDCY3VxXuKmm1fsfbEfX8kP8MHPAUK9wH/CXGxtR0sSscJ7sTQOHhM8xW/KI= 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=up+IvFbB; 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="up+IvFbB" Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2172.outbound.protection.outlook.com [104.47.58.172]) by mx-outbound47-71.us-east-2c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 22 Nov 2024 00:16:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wrXaI3RCIreWQtNyv9H8T1M5bUBR+O3gr7zckK8bVQGtoJ9httUiYN34UVUanJTEER3Lk12WbYFmGcPBYic4KOtzzc7sl9WG71I2XZcaiS3wZaoGLvn0kn9urQdZCgXwza7AZW+rOmPJG1MO1CgErvXwL7Z/oviF90gSoLSr36B18W3KYFUl8m14vellkUDgVTGS41bR6ZfBWtGCUmLGCZScZaC2L6cx2mOm61SICVDabNjEVsaQAvY9dICCF8NyIt//KPjHjTDdIuAd4h2ChrVxns7H3vZ/nIfWz44nT9kGELRbQByr3bnMuMP+9a+wXsGoj4iBfwHgXaR/otYJ5g== 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=d0AtFXclGgSjW8xzix/Sf7JMTbM7+vqZyQi1Ti3SUdg=; b=meE3fmIQSjIr8cfeW0+rdW2BcXiJ65OiCyHCiT7/c3oF2/guhlpVVuKsROX6ol9yuswG6u5Na0KC5lGEOY+imCc7gtf7V3pMPobc+ra76Ey43d5o17wOmVCso9sU6aHNeflngXnBhUf22QkC374tGI3IQBl6r9dWQiLlS5MNKc1yPG3frnfVl/jfSxp+uZbKCv8b1YXWyZrKpbqe+rRk7XQWHJpO7mlRAP9uxJ2GhGVygAY3ecrOSx4GHFHqYHWMYID2izYf7rGjjmkFArzGhKPOFseY8CHdhZELcToOrW54HdK4DFlbpmRkzN9kbSZCNMJ3NfCqqp2J2g0H4MIBtQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=bsbernd.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=d0AtFXclGgSjW8xzix/Sf7JMTbM7+vqZyQi1Ti3SUdg=; b=up+IvFbBpUW1rX6x+8v/fxr2VkXWhKDDHzfOgMJeeo1PA8Gn04rdDxuZm4zdOCw6ec8UZHJsZuePenp0OAN8J7GkmB6iPpg/P+s8E21+z+kI+V2wLvjWQk2SPXgK6Vp0F7mFOBrEtl9FyrB+FkFV+uI3Rms6cVaerJdhu296Xug= Received: from BN8PR03CA0034.namprd03.prod.outlook.com (2603:10b6:408:94::47) by PH0PR19MB4822.namprd19.prod.outlook.com (2603:10b6:510:25::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8182.17; Thu, 21 Nov 2024 23:44:04 +0000 Received: from BL02EPF0002992A.namprd02.prod.outlook.com (2603:10b6:408:94:cafe::5c) by BN8PR03CA0034.outlook.office365.com (2603:10b6:408:94::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.24 via Frontend Transport; Thu, 21 Nov 2024 23: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 BL02EPF0002992A.mail.protection.outlook.com (10.167.249.55) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8182.16 via Frontend Transport; Thu, 21 Nov 2024 23:44:04 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id 8927032; Thu, 21 Nov 2024 23:44:03 +0000 (UTC) From: Bernd Schubert Date: Fri, 22 Nov 2024 00:43:30 +0100 Subject: [PATCH RFC v6 14/16] fuse: {uring} Handle IO_URING_F_TASK_DEAD Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241122-fuse-uring-for-6-10-rfc4-v6-14-28e6cdd0e914@ddn.com> References: <20241122-fuse-uring-for-6-10-rfc4-v6-0-28e6cdd0e914@ddn.com> In-Reply-To: <20241122-fuse-uring-for-6-10-rfc4-v6-0-28e6cdd0e914@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1732232629; l=1124; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=tie4NxDKix394rRPWJuOycw76UDfRN09D0r3BvuIHOQ=; b=OnypkaFUeK8VHtC5GUHuUBc3I1jB1gpNXXZ6FGc9Dgo5c4bt2UtHgJG1p199WZ+ic8nY2sDJH nUY+dujSkZuAm3LglFb1nz9ruIetL0VclnKnWB2FZ9+4kWXKLx0+aO+ X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0002992A:EE_|PH0PR19MB4822:EE_ X-MS-Office365-Filtering-Correlation-Id: 6d9275c8-5462-4c98-7cc7-08dd0a866248 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|82310400026|7416014|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?gseYRHU2preXWW4H+Ym4XoXzxCtiwYB?= =?utf-8?q?SqoAhetrBvaDUc7JcAWH9R3pQz5P8+T68jZys1AHZP25WnIoOGsd5cXJWaQ2dtFH/?= =?utf-8?q?TwPtpfdUxuQwh1OFdnW+/dcvtCdu0xExUSIJ29kLgp/UAy7PTkdIiTVcZxqWNZKJr?= =?utf-8?q?Lkz9aMZsrrrOA17AhmnnwOe6vGlcU5Mmor1q5cstl8WmFtrraqv8ym4q+hfc/U87s?= =?utf-8?q?aXDJRF0wgb2af/LUAiIPFUG0iUG+3rN8e1hv8x0asW+ZZr+jPCwxoqbm/4GAfxNCw?= =?utf-8?q?AppkiLZLedTc32K/4VnsLFzq6OQ0GHeqITuwWcQHcArtLmV696xxvpDKLLxXoP28l?= =?utf-8?q?yaZcH2Q81ko1KO43Qw9Chi/0yXygJL/WlUAujm9hyHuLIX1zKGXJ8cCOHq8ejX/tn?= =?utf-8?q?9tB51yNIj7pXoDYpk05NrDoGfb6XDT9d5mGOA3ph8bMeZ5MpNV8bW1f3wy4zrxORI?= =?utf-8?q?BNhG8vsOpsA9H8HJvNTayShlRR5wlfITsbG9dSOPh/fRzpAw/MeX9LUaaINmMR+KX?= =?utf-8?q?VFyxDtOiy97pdnRx/ON4xzgZ9S3LTvbzH7SSyW5ufCc+0uy38GPlTfzXjFP9RceYs?= =?utf-8?q?Kqqprvg9z+rLRYxSze6P3XeNfhvBt5VEED1/w4Vx58rz0X2Am8ge0PsWH4UzapRSw?= =?utf-8?q?VjscTjv1H//0uwYaFTFrdAm8N3oQIsLkpGQtj2R10xQn5hq//ueyP82W8/IzdIsdO?= =?utf-8?q?7n0ES04Ry8UisrPYYt5j64diJTvD87BC+XA7ojsFZpHP4wysAQR9Jk2RgwDCrexC+?= =?utf-8?q?fixRdGf2yDZZduirM1j4mNYB7b6PzPtqAzAyWdkwfEIDEIIQ7DcsIRRs4jbwDyctt?= =?utf-8?q?o8V+YbPBbqS/snBfRFWLKt9Ih832WPpaOo9OXTKhnNYDc38W+XDtjkiOuJcGD+wRf?= =?utf-8?q?QN3w/8z25co2hqM1MdcLJv1waqZJ2RC+DcsegTZit2d3/QBmTckf3dqMN7b/26mhl?= =?utf-8?q?x/HBSd+9fiiopEwATFW9mx+CMEdjrkPWY6gn+kZ06Y4uaJK2DJleaRMH6F1ULkXty?= =?utf-8?q?QVfMZuPyujsladwyuveHIPMRg8oj3XtnS9hSMAqtqCtZ6ma+QH1wcwefVIlT1U8n7?= =?utf-8?q?uVvoQQuu956fkqltlTWqQSWEyyEUrniMdqja6HVINCf3Bl8uM6+5S/8pdp264SnnS?= =?utf-8?q?HZCvf1kvM3LhNshVm15k8LxVxprPU+g+II+7ireN3w6qj4I6Hhhir2dk9ZedArQZN?= =?utf-8?q?oDudTfQboTUbWvFlIw1y+gcNsrSG3MYwhZZqZLD5pob7qcHrNh9/jTYUe7sgjbqFK?= =?utf-8?q?1vvk3yP6/ql7VRpTYoAAsT6SITr/4TfPIqOo/w2CQUQQx1yRfE1fk9Et4oHtSRLEI?= =?utf-8?q?zXebDhHfGemkT1BGLMHdaLnvnut/Cs2yVQ=3D=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)(7416014)(376014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: ytEPAm7OHtYk/Gqrd1yPOpi4d+ZzKvJfzdUfYHxXsC4yl2bb9I4uI3QVF+PpGV8Cd2xHxS3ZD0bCbH/woWjl5okQW1v6EMC2q9KgHwM0Yu2QsF/N2ID8Kwajdk7D7OHydZ7AQVltiKPIBiPBL/NtiWKpdw2MKJWAw2gBrSLi5cRczdGC7SGFJjRH56wox7H0RmKZLke8IuXMYmezvBzu9vDSjH9ccrqwRftzNthIZOw/n5psYvGByyCCXNrudkJZOWz8Ut8ofMP912FcShFkcsPkpmxF78TEXqayniK6U3JfCsDMufw+BTLkGW9WnCFMFdvAgv/wajKLiKRYDNkSdMNF6WGJSckERDzBKBHTJ27o1qAsVbDvdUwyaUJF/x3a+N3ASLhqkfzHVj1xybstLZondYnb/B3NJYEnDGjh6adIjVeCoDycO82iEu41wxCaRZpxo1AdvaDGdi5XR23WBBueA/b4hBIOP9nT124Y7shoxa8p+l/N4GaGEOVcKx7IBdLr3h3J+TfbMmQ7RQckbYvZl0NLuhWMcf7syVACMtTr4SjET4+uW3CUQcxsPl0EnllgpbMI5xtbgnVIpH992EQI87jJw9WY0NdXKogS/b/RMdcq7rsFM3t2ANXfsLryThkLhMD0OinPOkqjj8RIFg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Nov 2024 23:44:04.5885 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6d9275c8-5462-4c98-7cc7-08dd0a866248 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: BL02EPF0002992A.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR19MB4822 X-OriginatorOrg: ddn.com X-BESS-ID: 1732234581-112103-13737-60706-1 X-BESS-VER: 2019.1_20241121.1615 X-BESS-Apparent-Source-IP: 104.47.58.172 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoYGFqZAVgZQ0CjFLNXYMNnUxM zIKDk52dg4JcnYwMw8zSzJzCLN0tJCqTYWAKE8JYBBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260588 [from cloudscan-ea17-231.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_SC0_MISMATCH_TO META: Envelope rcpt doesn't match header 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_SC0_MISMATCH_TO, BSF_RULE7568M, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 The ring task is terminating, it not safe to still access its resources. Also no need for further actions. Signed-off-by: Bernd Schubert --- fs/fuse/dev_uring.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index 36ff1df1633880d66c23b13b425f70c6796c1c2c..d0f8f0932e1715babebbc715c1846a5052419eb9 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -1124,16 +1124,22 @@ fuse_uring_send_req_in_task(struct io_uring_cmd *cmd, BUILD_BUG_ON(sizeof(pdu) > sizeof(cmd->pdu)); + if (unlikely(issue_flags & IO_URING_F_TASK_DEAD)) { + err = -ECANCELED; + goto terminating; + } + err = fuse_uring_prepare_send(ring_ent); if (err) goto err; - io_uring_cmd_done(cmd, 0, 0, issue_flags); - +terminating: spin_lock(&queue->lock); ring_ent->state = FRRS_USERSPACE; list_move(&ring_ent->list, &queue->ent_in_userspace); spin_unlock(&queue->lock); + io_uring_cmd_done(cmd, err, 0, issue_flags); + return; err: fuse_uring_next_fuse_req(ring_ent, queue);