From patchwork Wed Nov 27 13:40:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13887030 Received: from outbound-ip168a.ess.barracuda.com (outbound-ip168a.ess.barracuda.com [209.222.82.36]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 807021FCFCC; Wed, 27 Nov 2024 13:41:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=209.222.82.36 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732714865; cv=fail; b=gK6dhKiA1NO+fE+bt5644Cp/xJnVlMPG89sVFLCS7E2NiyGJ1CydyA2oHOoX2Uopp/tCUDg0rYFqmgw9+VXnJh9IhNNZlEHXpePbKhxQBJPhQZCLuruc7DK+0elOHCWnaQ8QcntPjWySCnTUxePBJVMxmDnZJFD+BYUnbNFmnhU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732714865; c=relaxed/simple; bh=0lzjX4/7JNaE+LdkRqg0ZnQVuZyH8t1LjuQhvpCVxF4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tKlF8aOEAOrVtoHb8vgkCndkxpFXD449M/LACfLcv/7bhCpGSk5j/ooH26b6/3yuVfj83t26t98T3tfjAYfneZTgfNnkg3jIfd5OoRyoVj2N8Phpa4WUJ9AIGVQlVGVrJMlAviUPq9Qlg563hErOcsfiYAf54cCyHZQCZjiJ3FA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com; spf=pass smtp.mailfrom=ddn.com; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b=1p5uREsv; arc=fail smtp.client-ip=209.222.82.36 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ddn.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b="1p5uREsv" Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2170.outbound.protection.outlook.com [104.47.59.170]) by mx-outbound14-13.us-east-2a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 27 Nov 2024 13:40:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yOLNIwyaocoC53j1/PsAu7k+eMx77Hhk+cRnTZrzTq0mXHWK8HqOSRHK9syQ30F767wGOO/mG7231bYgwtvGy2agu43KoiS7Z8nBFvHNb4xfVbR/XjA7ZWNNd1BYrROtK9wQSDK8fvzvM4ymNEos1dK9bWQiC6IO+5erwik+M3m4iJu0duBWuy5conXWOKde1cxwKLXJHjb/b/67hzO1iT42RqlgX9diCJFK4qDB22WeM5lut05kdiCCcWYT3pYH061oawB3DWPCCD4a8XA7/nSrCW6szg0Xpv9ZTmpgH0FuOkPClLVl4pZvE7xNz7qnPkuUJVR3ZHt/3fzWoviIkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=09hcynU61oTWlT8A9fGNN0G6i5QxrdJeCbrCrG4GLKk=; b=w/5Crs9vSLBw0d/zqGQtD8OFCcI5s9BBQn56lqHrz7sCyfvd+BFZbBVnhcR1j/CHOgHm2dTLGMUJ8bKwYyNTLL58msTqGSOfIkRvbcf9tJXZ2DXqPzMMT98tZ543jatybZhCWbhBmZgdANVVJv0Mc2gugiaLnlFKEjD9Cbylub00LciDB6t4SuE5fbm4V8N8WvaGT/aRq0ImfDHA0AoeaEWO/lAfDZzFnGrQPLMTUr1rYKa5BBYtTRPLJY4dX4wyrmTTws7smXASWw2E1b575xzYDc+s7JUiIZ3btmX2cpug672q63eZWYLFTb57bL8qsY8R2L2zWs0E8gQPAvakbA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=bsbernd.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=09hcynU61oTWlT8A9fGNN0G6i5QxrdJeCbrCrG4GLKk=; b=1p5uREsvrgTmt6O45YtzoBGZ+F+7YX/ebqgUEAdlHAjxfJzumWPt4+1/pXAN7ACNAEq0PKTZOWc+WdvzJFVog1F3hMfkhcCm4DqeDOuiAr2i8EhuLbN/Z+Bfr8Xx78pGTv9f9cKTb42+MXWg5v6LpbPymCIYUtqDX7BE2M7Qhbk= Received: from CH0PR03CA0251.namprd03.prod.outlook.com (2603:10b6:610:e5::16) by CY8PR19MB6987.namprd19.prod.outlook.com (2603:10b6:930:5c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.13; Wed, 27 Nov 2024 13:40:54 +0000 Received: from CH3PEPF00000013.namprd21.prod.outlook.com (2603:10b6:610:e5:cafe::ae) by CH0PR03CA0251.outlook.office365.com (2603:10b6:610:e5::16) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8182.21 via Frontend Transport; Wed, 27 Nov 2024 13:40:53 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by CH3PEPF00000013.mail.protection.outlook.com (10.167.244.118) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.0 via Frontend Transport; Wed, 27 Nov 2024 13:40:53 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id E131D32; Wed, 27 Nov 2024 13:40:52 +0000 (UTC) From: Bernd Schubert Date: Wed, 27 Nov 2024 14:40:31 +0100 Subject: [PATCH RFC v7 14/16] fuse: {uring} Handle IO_URING_F_TASK_DEAD Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241127-fuse-uring-for-6-10-rfc4-v7-14-934b3a69baca@ddn.com> References: <20241127-fuse-uring-for-6-10-rfc4-v7-0-934b3a69baca@ddn.com> In-Reply-To: <20241127-fuse-uring-for-6-10-rfc4-v7-0-934b3a69baca@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1732714838; l=1124; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=0lzjX4/7JNaE+LdkRqg0ZnQVuZyH8t1LjuQhvpCVxF4=; b=p8UC7auYob1Zdxd+w41lDdIpSKMOHpDDn2MT7N633Of4s14XOiPUGNJXw8qWc/1Mcirk6Xp8f fMP3w0SgueDD6BzeGVnU9DF70funlQUGbmg9ESpuUw1TWbP3g2dnDZY X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PEPF00000013:EE_|CY8PR19MB6987:EE_ X-MS-Office365-Filtering-Correlation-Id: a4685903-1e51-46c7-f72c-08dd0ee91d45 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|82310400026|36860700013|376014|7416014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?3JyhFTj3I03M7y2ObQvvEe1n6icQ4Is?= =?utf-8?q?4nPQf367wFlrmdyx4u90xxUxpSbsPvvJC/fva3WmQEYyfXMnbvNvh2E/5O/CyqSgX?= =?utf-8?q?a9NK2xpVyPIzimUJ9gVNl5CEDkvWGZhrA9XLMo/AfOY0tv3zviOXsnzP4YaescBEo?= =?utf-8?q?J6ECkqBJempI7NdMeFiXrBfgqMIt95K+DbEU03klZwFCIX44dJ0kiBYifSfeTqQBZ?= =?utf-8?q?WoGhaktZQbjstIXz4ErCXgr514C66hxm61E2Mkxgfh5t7E9sqn2H2jfBkCSMf5jGF?= =?utf-8?q?vsDJee1UV0uplQF6HnrjZ+qVEh4JBoXp7fQWSIuQ+meIqI+KJSAJQ85tZf5r8U0t+?= =?utf-8?q?CHR2+o9sGjHQdskDtM8EZMxEJIO8Du430NZUxQ1O3vrVEmmSh1SvOO/oLZ0KjUYJ0?= =?utf-8?q?OYNfwwX284HiQ3BmRcyz7/3ZKdtEU3eoTnHMxyECoKZHKz/qTK0jIBqYJVt9EsZgq?= =?utf-8?q?887W/QVwLgIuuomTZ+xex1TlzRxs79ybJhOryt8OzBYfYcTR4B8sWbLyo6tuearfi?= =?utf-8?q?GaeXnrYvSL087HbkX5SCbX7aMvvOVdm85iCzxlrQPWRKc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ANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(82310400026)(36860700013)(376014)(7416014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: XwrpNgSwfPSYv1EpgxmiFbVkgRnFe17a1FuTscUf1xIhx914ows2kIzn8HwBVJ5yfv3icxwH0bimH4PoTaIY7GYyLp8pxh5Ejxe+nyo33eqtdqSbAaZcyxjanDBe5xW4CObiHfgzlnQf9QZYOYE+Aw4y0PCjl0EhhrvOwQYFEcRrfzVqt0ita+BNFbX30GFtYznnPHNPxtZcCZCtw9PLK1BRx2RwL3LgQ2QJBL9+pgfFXFekG4cbWvSTazuFCVxmQt2gQ1bfJ+3rYomNuevKboOlttWa9fQ285YAn/WB2zHML6yqN87IiuCixBaXB/TG+GMZnfks7wfs7OwC+NgCFhdRiTYqXA07Emi0zSX2VmBC6ImROe4gwND3O/puXqmVqFs+wJAAQiOeTf36UvodVCCLceI1ZD3S4Pgx0zvU6AV3UTLVV4uzdnDWecvDFveIEHvdvC+hdB5u6AySoGnbpawekJngMBNwGIySgKfv7kv/ylJ5S/ljGTNmfozQwIv3RaiCnvL4AmQ13aPVPCMZ3bnFYcoCVtTKe81iSnAngLE9SHVYueaAGvhx48baW+PJXbSwPyrmvjpID9pV2KGj3FSOLwJRthlR3thOfuaFlgbevbZQu3WI5Q7JpgnyAW+2qAVbfEFtBRxspLkcMX0ycQ== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2024 13:40:53.6834 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a4685903-1e51-46c7-f72c-08dd0ee91d45 X-MS-Exchange-CrossTenant-Id: 753b6e26-6fd3-43e6-8248-3f1735d59bb4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=753b6e26-6fd3-43e6-8248-3f1735d59bb4;Ip=[50.222.100.11];Helo=[uww-mrp-01.datadirectnet.com] X-MS-Exchange-CrossTenant-AuthSource: CH3PEPF00000013.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR19MB6987 X-BESS-ID: 1732714856-103597-13475-2202-1 X-BESS-VER: 2019.1_20241126.2220 X-BESS-Apparent-Source-IP: 104.47.59.170 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoYGFqZAVgZQ0CzFPCUxNckgJc 3SMM080dTAONHU2DLV0NjY1MLcNNlIqTYWANaAcZhBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260718 [from cloudscan14-190.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 The ring task is terminating, it not safe to still access its resources. Also no need for further actions. Signed-off-by: Bernd Schubert --- fs/fuse/dev_uring.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c index 66addb5d00c36d84a0d8d1f470f5ae10d8ee3f6f..94dc3f56d4ab604eb4b87d3b9731567e3a214b0a 100644 --- a/fs/fuse/dev_uring.c +++ b/fs/fuse/dev_uring.c @@ -1056,16 +1056,22 @@ fuse_uring_send_req_in_task(struct io_uring_cmd *cmd, BUILD_BUG_ON(sizeof(pdu) > sizeof(cmd->pdu)); + if (unlikely(issue_flags & IO_URING_F_TASK_DEAD)) { + err = -ECANCELED; + goto terminating; + } + err = fuse_uring_prepare_send(ring_ent); if (err) goto err; - io_uring_cmd_done(cmd, 0, 0, issue_flags); - +terminating: spin_lock(&queue->lock); ring_ent->state = FRRS_USERSPACE; list_move(&ring_ent->list, &queue->ent_in_userspace); spin_unlock(&queue->lock); + io_uring_cmd_done(cmd, err, 0, issue_flags); + return; err: fuse_uring_next_fuse_req(ring_ent, queue);