linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Linux Trace Kernel <linux-trace-kernel@vger.kernel.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>
Subject: Re: [PATCH] eventfs: Fix WARN_ON() in create_file_dentry()
Date: Thu, 26 Oct 2023 20:29:13 +0900	[thread overview]
Message-ID: <20231026202913.be6afa452f9839a826c4b8ed@kernel.org> (raw)
In-Reply-To: <20231024123628.62b88755@gandalf.local.home>

On Tue, 24 Oct 2023 12:36:28 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
> 
> As the comment right above a WARN_ON() in create_file_dentry() states:
> 
>   * Note, with the mutex held, the e_dentry cannot have content
>   * and the ei->is_freed be true at the same time.
> 
> But the WARN_ON() only has:
> 
>   WARN_ON_ONCE(ei->is_free);
> 
> Where to match the comment (and what it should actually do) is:
> 
>   dentry = *e_dentry;
>   WARN_ON_ONCE(dentry && ei->is_free)
> 
> Also in that case, set dentry to NULL (although it should never happen).

Looks good to me.

Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>

Thanks!

> 
> Fixes: 5790b1fb3d672 ("eventfs: Remove eventfs_file and just use eventfs_inode")
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> ---
>  fs/tracefs/event_inode.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c
> index 09ab93357957..4d2da7480e5f 100644
> --- a/fs/tracefs/event_inode.c
> +++ b/fs/tracefs/event_inode.c
> @@ -264,8 +264,9 @@ create_file_dentry(struct eventfs_inode *ei, struct dentry **e_dentry,
>  		 * Note, with the mutex held, the e_dentry cannot have content
>  		 * and the ei->is_freed be true at the same time.
>  		 */
> -		WARN_ON_ONCE(ei->is_freed);
>  		dentry = *e_dentry;
> +		if (WARN_ON_ONCE(dentry && ei->is_freed))
> +			dentry = NULL;
>  		/* The lookup does not need to up the dentry refcount */
>  		if (dentry && !lookup)
>  			dget(dentry);
> -- 
> 2.42.0
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

      reply	other threads:[~2023-10-26 11:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-24 16:36 [PATCH] eventfs: Fix WARN_ON() in create_file_dentry() Steven Rostedt
2023-10-26 11:29 ` Masami Hiramatsu [this message]

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=20231026202913.be6afa452f9839a826c4b8ed@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=rostedt@goodmis.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;
as well as URLs for NNTP newsgroup(s).