Skip to content

Commit 4763d63

Browse files
committed
eventfs: Use GFP_NOFS for allocation when eventfs_mutex is held
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 <mhiramat@kernel.org> Cc: Andrew Morton <akpm@linux-foundation.org> Fixes: 28e12c0 ("eventfs: Save ownership and mode") Fixes: 5790b1f ("eventfs: Remove eventfs_file and just use eventfs_inode") Reported-by: Mark Rutland <mark.rutland@arm.com> Reviewed-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 parent 71cade8 commit 4763d63

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/tracefs/event_inode.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ static int eventfs_set_attr(struct mnt_idmap *idmap, struct dentry *dentry,
9595
if (!(dentry->d_inode->i_mode & S_IFDIR)) {
9696
if (!ei->entry_attrs) {
9797
ei->entry_attrs = kzalloc(sizeof(*ei->entry_attrs) * ei->nr_entries,
98-
GFP_KERNEL);
98+
GFP_NOFS);
9999
if (!ei->entry_attrs) {
100100
ret = -ENOMEM;
101101
goto out;
@@ -627,7 +627,7 @@ static int add_dentries(struct dentry ***dentries, struct dentry *d, int cnt)
627627
{
628628
struct dentry **tmp;
629629

630-
tmp = krealloc(*dentries, sizeof(d) * (cnt + 2), GFP_KERNEL);
630+
tmp = krealloc(*dentries, sizeof(d) * (cnt + 2), GFP_NOFS);
631631
if (!tmp)
632632
return -1;
633633
tmp[cnt] = d;

0 commit comments

Comments
 (0)