From patchwork Tue Feb 6 12:09:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 197430 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1503378dyb; Tue, 6 Feb 2024 04:31:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IFGvpJYJUgvVgaL0vJ3GVBE8IbJ8QW1HQ4bZOJ6YG1JfriBl25+ZycvStgVNS06ujW9GAjn X-Received: by 2002:a17:90b:812:b0:296:7b91:7c9b with SMTP id bk18-20020a17090b081200b002967b917c9bmr2156094pjb.46.1707222667351; Tue, 06 Feb 2024 04:31:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707222667; cv=pass; d=google.com; s=arc-20160816; b=u4tQilB95QsZDdsN8yH9Sor2M4N3u03c+9l7aOa8IO3W0sKGvcC5GVZ1ma/761GfV+ PPHn1HulSKtu7UNBLtGv3pedr36g+ShbfxXNkp37jaSjFTDdRTVQX8U2ZhzopbR5ScoU AMHPCqc+9TLNETRt4mmczeiax6xPXyfTVZ69BwKvaoMnQJjh6blFsDUf9X3okJycxy32 Unj6RyeBKbW4o6u1/GL/zawvpZG0RiN9RBMErneBZ4DPLkdQKhRokjl5u6I3ZLjnPNx0 5VW5dFkDRml4S2ltTezPtn6E3zOsnxEksNg241CGXBo40m5Ae6wKKcI0x353plX9N9pk ldEA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:subject:cc:to:from:date:user-agent:message-id; bh=pbHJHLjnoGTC1dZnAABIDPzt9Jk6VeoJxlGjdgVm16I=; fh=8CJ6IreVAPBzr2vnXT9kbR4Nm7C0GohYrIi8tC8KkwQ=; b=hcpKjGFYK3DXSq2wGTHW3LYBcnmPERX4iNIkwAuUMYUCY+PfOhYcoemThvW7eBdl5w 8+5jCC/Haf36WV5Xx35Yprvif3tUW4TxE/VZTkZuTkuFyiV4XQPGXMrwMeVDQ05nM9VO fPbWUWVlz4Wdh9m6cLtktnlgkzMHyni+rts7o4T1G0SThL6G3eP4F0JLxjMXPd8bhxUT zd9BXgs2d+j0AFhRzVMP42xoIn0g3ywaKeMBD0T/Q9yMhv51eubs6zN55Ct/V9Qiw3t7 DXlZ27iYMli6D5uYlbWvfUI1fUMse+bGKwBzw129W5scFDf1tW/EGBca1vdOg4gL7Vak 7tbg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-54900-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54900-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCUNlTyXK2rfl4/E6+PCJ2isffhXbdGy1UDxVOnhyo1rX8um/XMJmLeXkuBCKqqUo4/g3oEh26z4q0nnCm/Nl+uJiIPfNw== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id f21-20020a17090ace1500b0029512f4aa0dsi1056184pju.184.2024.02.06.04.31.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 04:31:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54900-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-54900-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54900-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 66D9DB275E0 for ; Tue, 6 Feb 2024 12:22:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6A9F5145358; Tue, 6 Feb 2024 12:09:32 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 63376137C50; Tue, 6 Feb 2024 12:09:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707221362; cv=none; b=tVK6AdJ3G/zmj3OJL2IPFPsXOnFykIxBix/c9qbm6gaMiiq/MLr6H+pNaEcn548dnObYaq2SD+A/58ipWjAFOeaZKIa+kAwNwAyxkZJB/vWMBrCDzCLKKADsJQA2igWUBqFPQTLgMcwJlxBjd0S+w1Cm6sGOfSU8IHjcDGdGSEM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707221362; c=relaxed/simple; bh=hnDief3HS3NBM6ZKYIfuGnDzLR4JMdJjWA5KdzPNiEA=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=ZuGZOJ6BGESYHJOJEkRPGwZA/WW6WkeR+RyOkmGKx+udkrpJpKaLl9GEy+kq321qqrnRMbIabVRegGpT1lQrFgpg525PZHm79zHs9AymxEfMezITI5K7pHBLJl/EX6MRGukRJiD5oNr3mFLEhJ7D7a/jGFJ7+xj5ZOUICwdsODk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51081C43390; Tue, 6 Feb 2024 12:09:22 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1rXKGs-00000006bEL-39Zw; Tue, 06 Feb 2024 07:09:50 -0500 Message-ID: <20240206120950.611237633@rostedt.homelinux.com> User-Agent: quilt/0.67 Date: Tue, 06 Feb 2024 07:09:31 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Linus Torvalds , Greg Kroah-Hartman , Sasha Levin , Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Josef Bacik Subject: [v6.6][PATCH 26/57] eventfs: Use GFP_NOFS for allocation when eventfs_mutex is held References: <20240206120905.570408983@rostedt.homelinux.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790152715881382087 X-GMAIL-MSGID: 1790152715881382087 From: "Steven Rostedt (Google)" If memory reclaim happens, it can reclaim file system pages. The file system pages from eventfs may take the eventfs_mutex on reclaim. This means that allocation while holding the eventfs_mutex must not call into filesystem reclaim. A lockdep splat uncovered this. Link: https://lkml.kernel.org/r/20231121231112.373501894@goodmis.org Cc: Masami Hiramatsu Cc: Andrew Morton Fixes: 28e12c09f5aa0 ("eventfs: Save ownership and mode") Fixes: 5790b1fb3d672 ("eventfs: Remove eventfs_file and just use eventfs_inode") Reported-by: Mark Rutland Reviewed-by: Josef Bacik Signed-off-by: Steven Rostedt (Google) (cherry picked from commit 4763d635c907baed212664dc579dde1663bb2676) --- fs/tracefs/event_inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c index 3eb6c622a74d..56d192f0ead8 100644 --- a/fs/tracefs/event_inode.c +++ b/fs/tracefs/event_inode.c @@ -95,7 +95,7 @@ static int eventfs_set_attr(struct mnt_idmap *idmap, struct dentry *dentry, if (!(dentry->d_inode->i_mode & S_IFDIR)) { if (!ei->entry_attrs) { ei->entry_attrs = kzalloc(sizeof(*ei->entry_attrs) * ei->nr_entries, - GFP_KERNEL); + GFP_NOFS); if (!ei->entry_attrs) { ret = -ENOMEM; goto out; @@ -627,7 +627,7 @@ static int add_dentries(struct dentry ***dentries, struct dentry *d, int cnt) { struct dentry **tmp; - tmp = krealloc(*dentries, sizeof(d) * (cnt + 2), GFP_KERNEL); + tmp = krealloc(*dentries, sizeof(d) * (cnt + 2), GFP_NOFS); if (!tmp) return -1; tmp[cnt] = d;