From patchwork Thu Aug 8 18:33:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Oliveira X-Patchwork-Id: 13758052 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76A81C52D7B for ; Thu, 8 Aug 2024 18:33:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 01E546B0096; Thu, 8 Aug 2024 14:33:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F0F106B0098; Thu, 8 Aug 2024 14:33:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D3BFA6B0099; Thu, 8 Aug 2024 14:33:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id B44D06B0096 for ; Thu, 8 Aug 2024 14:33:58 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 134A4A1601 for ; Thu, 8 Aug 2024 18:33:58 +0000 (UTC) X-FDA: 82429927356.18.866FF83 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2102.outbound.protection.outlook.com [40.107.96.102]) by imf08.hostedemail.com (Postfix) with ESMTP id 3F616160019 for ; Thu, 8 Aug 2024 18:33:54 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=eideticcom.onmicrosoft.com header.s=selector2-eideticcom-onmicrosoft-com header.b="pCt6/GQM"; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf08.hostedemail.com: domain of Martin.Oliveira@eideticom.com designates 40.107.96.102 as permitted sender) smtp.mailfrom=Martin.Oliveira@eideticom.com; dmarc=none ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1723141968; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=EQhK3ka/BH1jfrlP7Pg1JtnFuCDr3tWdul7G2/wv3bQ=; b=POnSUMC9z1wmNXwcHbm6xDizxtYXx6u8XZX/7MMyBN8z1u2S32xGQTsDFyinxA207l9K+S UwhZ8ysA/HBapJvACi4jlV7jR/eNCmEENEa2Mx73trEUfAWtJfEpUEiF4YstJwIaInsfn/ h1WEWTzCeuQS0nd5yRvbyMPFdKVu5j4= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1723141968; a=rsa-sha256; cv=pass; b=m8xB3A2+8pH/5iCo9RLjK4iuXBvYWxvc12OSA2nZyT3U9FxNSFsKKoataJGC1fu/3GNpAO DdLHlucUxpXQjbXpyX887BXc8HaFWmNJBG9EYHd3iFnUlfxdRk6fCjkJhdCZusDSMjue0C mrxYVVyIRV3KNx4D+JLSVMgZu/JjsG8= ARC-Authentication-Results: i=2; imf08.hostedemail.com; dkim=pass header.d=eideticcom.onmicrosoft.com header.s=selector2-eideticcom-onmicrosoft-com header.b="pCt6/GQM"; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf08.hostedemail.com: domain of Martin.Oliveira@eideticom.com designates 40.107.96.102 as permitted sender) smtp.mailfrom=Martin.Oliveira@eideticom.com; dmarc=none ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ujKbGVM/axt7s2s03Kq0Dx2ivf1QCazH56D+jlb1s/edim5b0r+zROzuq4EvRz2JH4NnsL9tL4TQju5iWEZsMPC2F86AL25Ph8BenIyR8BWvyAoKiB1Wu/Dle6UiwkXihtWes9RWpQ1Fa0jLTKTucu5wVCYT4lA3DW2ju02nFf3d7vt4zwJtBE6WEFR0gurW9Rz+sliK1TGcK76lLlhBc4JoulsnGRFHhBBA1QKlU0g7/kwaStFrZMYTk63y8VErAjUBX9Qs6Cz7oL4oMEg0k7silWB2UZ3NLw4/iFzro/6wYo3Wq7xlqCaZF6RJjJaGzzjpbJ7VtC+aXYbDZpc5pw== 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=EQhK3ka/BH1jfrlP7Pg1JtnFuCDr3tWdul7G2/wv3bQ=; b=RzQgEDzw2wzQsXciaxIfsLzqXrFbq/ptQSy0LvYOBAQ5jiFBupM85qoXqoT1MXAFFnn7/R8gjx0UHnlUmpEN+/drpA+vjiA38jNPa3ulqHJtdbMxLKE1uITz7qUQJIrZyW/Xh49C3Qxp9fEobWyDtFfxJT/I+nKeCVATDaYniwV7azmnG1x5DeqkftqiIVIL9nMyYTIIqrJJAwCTxBI23CaBvV6sgUo5Q70FmqpCorKHXuViN9xxtz+VcP36RVw+4zfxGM+OGH5YnxCljYRzfgiR+QxtgvNkGvR1YQxXeeLKvJWlVUZHNTRTZa9pncThfF0eaLoPFYdL0QcYauJ0FQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=eideticom.com; dmarc=pass action=none header.from=eideticom.com; dkim=pass header.d=eideticom.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eideticcom.onmicrosoft.com; s=selector2-eideticcom-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EQhK3ka/BH1jfrlP7Pg1JtnFuCDr3tWdul7G2/wv3bQ=; b=pCt6/GQMCb9KY3IQvgT3Zjn3GZqxZa9WNtmMOz8ofyX+7K219UKQq9fWoOF+gihMoScigvn0LwnGWqbD8emKuu7PUlQL+zjwEteou+E622CcNRSQpLIxaI88HS65W9gimlimr19Qn2ECIinNXufzMj4N91hLwtTymj1DVzBNWo4= Received: from PH7PR19MB6828.namprd19.prod.outlook.com (2603:10b6:510:1ba::20) by IA1PR19MB6348.namprd19.prod.outlook.com (2603:10b6:208:3e4::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.14; Thu, 8 Aug 2024 18:33:51 +0000 Received: from PH7PR19MB6828.namprd19.prod.outlook.com ([fe80::69c8:bdb9:b882:b849]) by PH7PR19MB6828.namprd19.prod.outlook.com ([fe80::69c8:bdb9:b882:b849%3]) with mapi id 15.20.7828.023; Thu, 8 Aug 2024 18:33:51 +0000 From: Martin Oliveira To: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Andrew Morton , Artemy Kovalyov , Greg Kroah-Hartman , Jason Gunthorpe , Leon Romanovsky , Logan Gunthorpe , Michael Guralnik , Mike Marciniszyn , Shiraz Saleem , Tejun Heo , John Hubbard , Dan Williams , David Sloan , Martin Oliveira Subject: [PATCH v5 1/4] kernfs: add a WARN_ON_ONCE if ->close is set Date: Thu, 8 Aug 2024 12:33:37 -0600 Message-ID: <20240808183340.483468-2-martin.oliveira@eideticom.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240808183340.483468-1-martin.oliveira@eideticom.com> References: <20240808183340.483468-1-martin.oliveira@eideticom.com> X-ClientProxiedBy: MW4PR04CA0072.namprd04.prod.outlook.com (2603:10b6:303:6b::17) To PH7PR19MB6828.namprd19.prod.outlook.com (2603:10b6:510:1ba::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH7PR19MB6828:EE_|IA1PR19MB6348:EE_ X-MS-Office365-Filtering-Correlation-Id: bda6de14-1593-4c29-67bb-08dcb7d8a682 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|52116014|7416014|38350700014; X-Microsoft-Antispam-Message-Info: CEhCZS9sMTJ1esH9bk0rVDVeNdGLF9TSe5mwNJL8zjXfcW5r9KSzbLUWM+yva0tPV4rSXrGvJK6xYv3SEqoBffMN3Z7swGR2JaZAvJ3p/deqKhvQOIlZ/2ToRK9EDV8aEqA7L6PNwd29R3IBahJmix90TnmlxhSZ+ZC44RC5er8V95gYRfaC3cdv+H7t0eay2NRFPsYinbcJLBzdsiJ8Os3NTbq0X5XRrLhglWQ+GUdXG8YXlGeT+6ANGvhBDGO7zFu7K4jo4jLk76WvadXbq85S0SfMmAjGVgLDggMrRPt+n1pHwU9CewrmFu7AxX4BtMbBYjw0F40JEWM/BUpFanexI4fRRfEYOUsEgQvV87884mTQA+zHr+NCbXGcon2sZtWeekwk6niKzihS30sBkvMr0r297TmcBK+XgVommeJMMd7l8sdb6iUM9NetvAqgWihGwYZq7BjgoJoU+e1Zc8H56nEaS/K74UFrq6ZqYZnk2+toexRT6qSEV3//IyYIPuVfg68QZFmY1c0uaZytiTp/j8YAhzCevSXLaaxsWd6tMcBUkD3SoKHYnXyxl18+/dMscKKdSdm6l56zzrkVyh6JJBh0F1mAfPano0zsNr8Ikr8BhQby5q2X92/pcrxv8GESGB9aLkbDZC5laRSPmrII0QpmKjXxvj3Rs53hTmclaGCP/gTVxf9ihXyFQHUK3KBh1GHLFmyXhMcK4OJkeb7rSyCSsx5K1m5gQnwFysHA9hujuslXlmh1FT2Gkn5ouDfK5o275/1qmoQ0Bwcon74Kbjo6JQtTKhPscBYcLbVcQG4rH9b41wew/CsurNullwVl4JJA92nkvd61rpurSfGhBOxGOjrWgvn0PT0UUX4slmrL5aJx920j4YoGRWwSMJCPkxd/5QObEUNvamk1H8yGjAt7D1X/q5yQIPBO5qDcN+bPe2s/1cIkJdKvdoo18NICRewq14homDHKY2vjosXLFTvPW1bTLIhatmAAURnfs6+yThiSsQ/6knxI/AZR2bSv86+hHQ3/pnaheU1J49pBCfSTkjDJPZ0oOLHO2db++A4DdX06OXDhDYd5ipReuAvnmghxTOscZ+ZouWUkwkItW66qIJBVTiuzKvsP0Ea+hT2SKzhGyIyLsiefxAEdZ7hkRp2GAHWKi8hXSxhV6rHTFodvIbUyWbM+HfJODSyVv1vrlleHoAXBGnijJ3wrXf7ttIAK3WjS/at+Dl+TL/DsTE6YR988+iW/TU6Qwv+emJtEZoRIOPjbxVJnszq+uCfEAMSl+zpnF7zHI9TOliuBjif9cQuVMh8oepDnchjd/DkbHtMLWsfHC2WjxTLQrmDaslnwecNYvyft5LJrso48es47RETd6RVYoRjT0mK3Bk2saIpVCBLhnlOlHhvUUW+t5uXBrF8aGLbDovOU0A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH7PR19MB6828.namprd19.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(376014)(52116014)(7416014)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Fi/gFOVZMYxQh1NqESXyi2ZuokP7jcoRykqQh+XKoIUWxoxkQiSP8u44FfgVDr+LMFJcQ4vlqiHM4Ww34ITkmsgOHXpxremA3f/GB8e4ds5EwNxvlKpRdZRQPHYCx7Dv9rESbJZC45B8ArdgngvQDKcNBatLR9jwybzKOix6AZHGrdwi5+YJpr9iU4HkdBCjK7CMhEYfKvV2NCZWxyJ4nF8CWMzbaD5UBOt3F3zZC43qXlG5YSZQmOyyxNs8v45L3Ma+01ubKnahmS0gQTSf7wbY9Jg2DGSVSS6qcISEnFzU6YvXf+/8QUcpGsTk8ziUZ99AaO3CVuI9P97HTaHBq2zuGpNybAIyYC2LVIrInDDy+oSG1BZygGGVjTYnA6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gWkGwzMmMBHGUFLlOovQGjqJz+2TSdM4DVH+6bNrdXqN9hiV7/AzB3rYpc/n+9v9GO6fimIBM6xaEvUcAR9J6bWdhTyROWDNiJpVC8iCu01tYj5P9rwApLVT2vllkCa4l57uUgJqzp+C1SrHjbKegtZkhcyRTuXL770qktM= X-OriginatorOrg: eideticom.com X-MS-Exchange-CrossTenant-Network-Message-Id: bda6de14-1593-4c29-67bb-08dcb7d8a682 X-MS-Exchange-CrossTenant-AuthSource: PH7PR19MB6828.namprd19.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2024 18:33:51.6167 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3490cd4b-0360-4377-abb1-15f8c5af8fc2 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 2XB5/nzF0dz+IwSzCdRb7Um9IuYaSHhy+VBs0E8fwLwC7IjC6enFdTxHKYEWlEyLxVxurt5xZ5DBz0Ro4TFqzqob/KF+zJYEtI0pmJf0HuU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR19MB6348 X-Stat-Signature: amhm669qq4yya4myqnpicsdrnypp8jgb X-Rspamd-Queue-Id: 3F616160019 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1723142034-783911 X-HE-Meta: U2FsdGVkX1/vrrulZdmiZS5oqLGGdGUxQ2Cb97470XjyPZuvFLDFCrmrpteVQD4NnjWq5SYVKL8SkdwChfIb/oiSszBiq2W20vo3ufzm/xl13xiNuKyBOH5STuQFt0LNBYirpXM04jU0dVSwxFC2/vookFaTqCFyUzIsadk/ZSNwSlZymXCb7+Ahs9Lxv8bbYmtHYzU3OIZSWvwJJK2MEAl8+EbH9FYj1nYZcdMxA3VfCg1vrslwS9fQcONu0tnAUv/ZYBW0pppIu6mgmxSEXnjk7QZYTpVoTux+BR4G7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hGo85RHk0LQfYC12PSTCI8fn2eUFdw9xwYlI= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: The next patch is going to remove .page_mkwrite from kernfs and will WARN if an mmap implementation sets .page_mkwrite. In preparation for that change, and to make it consistent, add a WARN to the ->close check. Co-developed-by: Logan Gunthorpe Signed-off-by: Logan Gunthorpe Signed-off-by: Martin Oliveira Reviewed-by: Christoph Hellwig --- fs/kernfs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/kernfs/file.c b/fs/kernfs/file.c index 8502ef68459b..72cc51dcf870 100644 --- a/fs/kernfs/file.c +++ b/fs/kernfs/file.c @@ -479,7 +479,7 @@ static int kernfs_fop_mmap(struct file *file, struct vm_area_struct *vma) * It is not possible to successfully wrap close. * So error if someone is trying to use close. */ - if (vma->vm_ops && vma->vm_ops->close) + if (WARN_ON_ONCE(vma->vm_ops && vma->vm_ops->close)) goto out_put; rc = 0;