mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-25 15:24:17 +08:00
4bb123ce29
commitf2f496370a
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:6394044955
("eventfs: Implement eventfs lookup, read, open functions") Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
66 lines
2.1 KiB
C
66 lines
2.1 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _TRACEFS_INTERNAL_H
|
|
#define _TRACEFS_INTERNAL_H
|
|
|
|
enum {
|
|
TRACEFS_EVENT_INODE = BIT(1),
|
|
TRACEFS_EVENT_TOP_INODE = BIT(2),
|
|
};
|
|
|
|
struct tracefs_inode {
|
|
unsigned long flags;
|
|
void *private;
|
|
struct inode vfs_inode;
|
|
};
|
|
|
|
/*
|
|
* struct eventfs_inode - hold the properties of the eventfs directories.
|
|
* @list: link list into the parent directory
|
|
* @entries: the array of entries representing the files in the directory
|
|
* @name: the name of the directory to create
|
|
* @children: link list into the child eventfs_inode
|
|
* @dentry: the dentry of the directory
|
|
* @d_parent: pointer to the parent's dentry
|
|
* @d_children: The array of dentries to represent the files when created
|
|
* @data: The private data to pass to the callbacks
|
|
* @is_freed: Flag set if the eventfs is on its way to be freed
|
|
* @nr_entries: The number of items in @entries
|
|
*/
|
|
struct eventfs_inode {
|
|
struct list_head list;
|
|
const struct eventfs_entry *entries;
|
|
const char *name;
|
|
struct list_head children;
|
|
struct dentry *dentry;
|
|
struct dentry *d_parent;
|
|
struct dentry **d_children;
|
|
void *data;
|
|
/*
|
|
* Union - used for deletion
|
|
* @del_list: list of eventfs_inode to delete
|
|
* @rcu: eventfs_inode to delete in RCU
|
|
*/
|
|
union {
|
|
struct list_head del_list;
|
|
struct rcu_head rcu;
|
|
};
|
|
unsigned int is_freed:1;
|
|
unsigned int nr_entries:31;
|
|
};
|
|
|
|
static inline struct tracefs_inode *get_tracefs(const struct inode *inode)
|
|
{
|
|
return container_of(inode, struct tracefs_inode, vfs_inode);
|
|
}
|
|
|
|
struct dentry *tracefs_start_creating(const char *name, struct dentry *parent);
|
|
struct dentry *tracefs_end_creating(struct dentry *dentry);
|
|
struct dentry *tracefs_failed_creating(struct dentry *dentry);
|
|
struct inode *tracefs_get_inode(struct super_block *sb);
|
|
struct dentry *eventfs_start_creating(const char *name, struct dentry *parent);
|
|
struct dentry *eventfs_failed_creating(struct dentry *dentry);
|
|
struct dentry *eventfs_end_creating(struct dentry *dentry);
|
|
void eventfs_set_ei_status_free(struct tracefs_inode *ti, struct dentry *dentry);
|
|
|
|
#endif /* _TRACEFS_INTERNAL_H */
|