Revert "eventfs/tracing: Add callback for release of an eventfs_inode"

This reverts commit 14aa4f3efc which is
commit b63db58e2f upstream.

It breaks the Android kernel abi and can be brought back in the future
in an abi-safe way if it is really needed.

Bug: 161946584
Change-Id: I40755014c220cd615b1145f50ba32d8712b07d90
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Greg Kroah-Hartman 2024-06-15 08:49:49 +00:00
parent 5302e964f3
commit 117f556b94
3 changed files with 2 additions and 36 deletions

View File

@ -83,17 +83,10 @@ enum {
static void release_ei(struct kref *ref)
{
struct eventfs_inode *ei = container_of(ref, struct eventfs_inode, kref);
const struct eventfs_entry *entry;
struct eventfs_root_inode *rei;
WARN_ON_ONCE(!ei->is_freed);
for (int i = 0; i < ei->nr_entries; i++) {
entry = &ei->entries[i];
if (entry->release)
entry->release(entry->name, ei->data);
}
kfree(ei->entry_attrs);
kfree_const(ei->name);
if (ei->is_events) {
@ -118,18 +111,6 @@ static inline void free_ei(struct eventfs_inode *ei)
}
}
/*
* Called when creation of an ei fails, do not call release() functions.
*/
static inline void cleanup_ei(struct eventfs_inode *ei)
{
if (ei) {
/* Set nr_entries to 0 to prevent release() function being called */
ei->nr_entries = 0;
free_ei(ei);
}
}
static inline struct eventfs_inode *get_ei(struct eventfs_inode *ei)
{
if (ei)
@ -756,7 +737,7 @@ struct eventfs_inode *eventfs_create_dir(const char *name, struct eventfs_inode
/* Was the parent freed? */
if (list_empty(&ei->list)) {
cleanup_ei(ei);
free_ei(ei);
ei = NULL;
}
return ei;
@ -849,7 +830,7 @@ struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentry
return ei;
fail:
cleanup_ei(ei);
free_ei(ei);
tracefs_failed_creating(dentry);
return ERR_PTR(-ENOMEM);
}

View File

@ -62,8 +62,6 @@ struct eventfs_file;
typedef int (*eventfs_callback)(const char *name, umode_t *mode, void **data,
const struct file_operations **fops);
typedef void (*eventfs_release)(const char *name, void *data);
/**
* struct eventfs_entry - dynamically created eventfs file call back handler
* @name: Then name of the dynamic file in an eventfs directory
@ -74,7 +72,6 @@ typedef void (*eventfs_release)(const char *name, void *data);
struct eventfs_entry {
const char *name;
eventfs_callback callback;
eventfs_release release;
};
struct eventfs_inode;

View File

@ -2518,14 +2518,6 @@ static int event_callback(const char *name, umode_t *mode, void **data,
return 0;
}
/* The file is incremented on creation and freeing the enable file decrements it */
static void event_release(const char *name, void *data)
{
struct trace_event_file *file = data;
event_file_put(file);
}
static int
event_create_dir(struct eventfs_inode *parent, struct trace_event_file *file)
{
@ -2540,7 +2532,6 @@ event_create_dir(struct eventfs_inode *parent, struct trace_event_file *file)
{
.name = "enable",
.callback = event_callback,
.release = event_release,
},
{
.name = "filter",
@ -2609,9 +2600,6 @@ event_create_dir(struct eventfs_inode *parent, struct trace_event_file *file)
return ret;
}
/* Gets decremented on freeing of the "enable" file */
event_file_get(file);
return 0;
}