From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
<gregkh@linuxfoundation.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Andrew Morton <akpm@linux-foundation.org>,
Ajay Kaher <akaher@vmware.com>
Subject: [v6.6][PATCH 2/5] eventfs: Remove "is_freed" union with rcu head
Date: Sun, 05 Nov 2023 10:56:32 -0500 [thread overview]
Message-ID: <20231105160139.498444992@goodmis.org> (raw)
In-Reply-To: 20231105155630.925114107@goodmis.org
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
commit f2f496370afcbc5227d7002da28c74b91fed12ff upstream
The eventfs_inode->is_freed was a union with the rcu_head with the
assumption that when it was on the srcu list the head would contain a
pointer which would make "is_freed" true. But that was a wrong assumption
as the rcu head is a single link list where the last element is NULL.
Instead, split the nr_entries integer so that "is_freed" is one bit and
the nr_entries is the next 31 bits. As there shouldn't be more than 10
(currently there's at most 5 to 7 depending on the config), this should
not be a problem.
Link: https://lkml.kernel.org/r/20231101172649.049758712@goodmis.org
Cc: stable@vger.kernel.org
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Ajay Kaher <akaher@vmware.com>
Fixes: 63940449555e7 ("eventfs: Implement eventfs lookup, read, open functions")
Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
fs/tracefs/event_inode.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c
index 8c8d64e76103..a64d8fa39e54 100644
--- a/fs/tracefs/event_inode.c
+++ b/fs/tracefs/event_inode.c
@@ -38,6 +38,7 @@ struct eventfs_inode {
* @fop: file_operations for file or directory
* @iop: inode_operations for file or directory
* @data: something that the caller will want to get to later on
+ * @is_freed: Flag set if the eventfs is on its way to be freed
* @mode: the permission that the file or directory should have
*/
struct eventfs_file {
@@ -52,15 +53,14 @@ struct eventfs_file {
* Union - used for deletion
* @del_list: list of eventfs_file to delete
* @rcu: eventfs_file to delete in RCU
- * @is_freed: node is freed if one of the above is set
*/
union {
struct list_head del_list;
struct rcu_head rcu;
- unsigned long is_freed;
};
void *data;
- umode_t mode;
+ unsigned int is_freed:1;
+ unsigned int mode:31;
};
static DEFINE_MUTEX(eventfs_mutex);
@@ -814,6 +814,8 @@ static void eventfs_remove_rec(struct eventfs_file *ef, struct list_head *head,
}
}
+ ef->is_freed = 1;
+
list_del_rcu(&ef->list);
list_add_tail(&ef->del_list, head);
}
--
2.42.0
next prev parent reply other threads:[~2023-11-05 16:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-05 15:56 [v6.6][PATCH 0/5] tracing: Backport of eventfs fixes for v6.6 Steven Rostedt
2023-11-05 15:56 ` [v6.6][PATCH 1/5] tracing: Have trace_event_file have ref counters Steven Rostedt
2023-11-05 15:56 ` Steven Rostedt [this message]
2023-11-05 15:56 ` [v6.6][PATCH 3/5] eventfs: Save ownership and mode Steven Rostedt
2023-11-12 10:41 ` NULL pointer dereference regression when running `chmod -R root:tracing /sys/kernel/debug/tracing` Milian Wolff
2023-11-12 12:14 ` Steven Rostedt
2023-11-12 14:26 ` Steven Rostedt
2023-11-14 13:38 ` Linux regression tracking #adding (Thorsten Leemhuis)
2023-11-14 13:55 ` Steven Rostedt
2023-11-14 15:06 ` Thorsten Leemhuis
2023-11-05 15:56 ` [v6.6][PATCH 4/5] eventfs: Delete eventfs_inode when the last dentry is freed Steven Rostedt
2023-11-05 15:56 ` [v6.6][PATCH 5/5] eventfs: Use simple_recursive_removal() to clean up dentries Steven Rostedt
2023-11-06 11:40 ` [v6.6][PATCH 0/5] tracing: Backport of eventfs fixes for v6.6 Greg KH
2023-11-06 20:12 ` Steven Rostedt
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=20231105160139.498444992@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akaher@vmware.com \
--cc=akpm@linux-foundation.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mhiramat@kernel.org \
--cc=stable@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.