From: Steven Rostedt <rostedt@goodmis.org>
To: Naresh Kamboju <naresh.kamboju@linaro.org>
Cc: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org,
mhiramat@kernel.org, mark.rutland@arm.com, lkft@linaro.org
Subject: Re: selftests: ftrace: WARNING: __list_del_entry_valid_or_report (lib/list_debug.c:62 (discriminator 1))
Date: Mon, 20 Nov 2023 15:36:23 -0500 [thread overview]
Message-ID: <20231120153623.49c5119b@gandalf.local.home> (raw)
In-Reply-To: <20231116123016.140576-1-naresh.kamboju@linaro.org>
On Thu, 16 Nov 2023 18:00:16 +0530
Naresh Kamboju <naresh.kamboju@linaro.org> wrote:
> Following kernel crash noticed while running selftests: ftrace on arm64 Juno-r2
> device running stable-rc linux-6.6.y kernel.
>
> This kernel crash is hard to reproduce.
>
Can you test this patch.
Note, there's a similar bug on 6.7-rc1 which I'll fix first. And when
that's accepted, I'll push this one for v6.6. This may be two patches as
one if the d_invalidate() issue, and another is a memory leak fix.
-- Steve
diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c
index 5fcfb634fec2..b60048469df1 100644
--- a/fs/tracefs/event_inode.c
+++ b/fs/tracefs/event_inode.c
@@ -289,6 +289,8 @@ void eventfs_set_ef_status_free(struct tracefs_inode *ti, struct dentry *dentry)
ef = dentry->d_fsdata;
if (ef)
free_ef(ef);
+ else
+ kfree(ei);
return;
}
@@ -342,7 +344,6 @@ static void eventfs_post_create_dir(struct eventfs_file *ef)
static struct dentry *
create_dentry(struct eventfs_file *ef, struct dentry *parent, bool lookup)
{
- bool invalidate = false;
struct dentry *dentry;
mutex_lock(&eventfs_mutex);
@@ -387,23 +388,24 @@ create_dentry(struct eventfs_file *ef, struct dentry *parent, bool lookup)
eventfs_post_create_dir(ef);
dentry->d_fsdata = ef;
} else {
- /* A race here, should try again (unless freed) */
- invalidate = true;
-
/*
+ * If we are here then the directory is being freed.
+ * The simple_recursive_removal() will get rid of the dentry
+ * here.
+ */
+ dentry = NULL;
+ /*
* Should never happen unless we get here due to being freed.
* Otherwise it means two dentries exist with the same name.
*/
WARN_ON_ONCE(!ef->is_freed);
}
mutex_unlock(&eventfs_mutex);
- if (invalidate)
- d_invalidate(dentry);
- if (lookup || invalidate)
+ if (lookup)
dput(dentry);
- return invalidate ? NULL : dentry;
+ return dentry;
}
static bool match_event_file(struct eventfs_file *ef, const char *name)
--
2.42.0
next prev parent reply other threads:[~2023-11-20 20:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-16 12:30 Naresh Kamboju
2023-11-20 20:36 ` Steven Rostedt [this message]
2023-11-22 14:19 ` Naresh Kamboju
2023-11-22 15:12 ` Steven Rostedt
2023-11-23 17:50 ` Mark Rutland
2023-11-24 8:54 ` Naresh Kamboju
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231120153623.49c5119b@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=lkft@linaro.org \
--cc=mark.rutland@arm.com \
--cc=mhiramat@kernel.org \
--cc=naresh.kamboju@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®