debugfs_use_file_start (9) - Linux Manuals
debugfs_use_file_start: mark the beginning of file data access
debugfs_use_file_start - mark the beginning of file data access
int debugfs_use_file_start(const struct dentry
* dentry, int * srcu_idx);
- the dentry object whose data is being accessed.
- a pointer to some memory to store a SRCU index in.
Up to a matching call to debugfs_use_file_finish, any successive call into the file removing functions debugfs_remove and debugfs_remove_recursive will block. Since associated private file data may only get freed after a successful return of any of the removal functions, you may safely access it after a successful call to debugfs_use_file_start without worrying about lifetime issues.
If -EIO is returned, the file has already been removed and thus, it is not safe to access any of its data. If, on the other hand, it is allowed to access the file data, zero is returned.