eventfs: Implement removal of meta data from eventfs
authorAjay Kaher <akaher@vmware.com>
Fri, 28 Jul 2023 18:20:50 +0000 (23:50 +0530)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Sun, 30 Jul 2023 22:13:34 +0000 (18:13 -0400)
commit5bdcd5f5331a276a3ddf1fba8605986d0d15298a
tree906f55618d9e0c8cedd5d3be8a666bab3c412162
parenta3760079177765b7f1782419f1c3e12facaf1e9d
eventfs: Implement removal of meta data from eventfs

When events are removed from tracefs, the eventfs must be aware of this.
The eventfs_remove() removes the meta data from eventfs so that it will no
longer create the files associated with that event.

When an instance is removed from tracefs, eventfs_remove_events_dir() will
remove and clean up the entire "events" directory.

The helper function eventfs_remove_rec() is used to clean up and free the
associated data from eventfs for both of the added functions. SRCU is used
to protect the lists of meta data stored in the eventfs. The eventfs_mutex
is used to protect the content of the items in the list.

As lookups may be happening as deletions of events are made, the freeing
of dentry/inodes and relative information is done after the SRCU grace
period has passed.

Link: https://lkml.kernel.org/r/1690568452-46553-9-git-send-email-akaher@vmware.com
Signed-off-by: Ajay Kaher <akaher@vmware.com>
Co-developed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Tested-by: Ching-lin Yu <chinglinyu@google.com>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202305030611.Kas747Ev-lkp@intel.com/
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
fs/tracefs/event_inode.c
include/linux/tracefs.h