Re: [PATCH] tracefs: Fix tracefs_dynevent_destroy_all()

Metin Kaya <[email protected]> Fri, 24 Apr 2026 09:06:01 +0100
Newsgroups org.kernel.vger.linux-trace-devel
Message-ID <[email protected]>
On 23/04/2026 9:20 pm, Steven Rostedt wrote:
> From: Steven Rostedt <[email protected]>
> 
> There was a regression with tracefs_dynevent_destroy_all() where removing
> kprobes (or other dynamic events) if it checks another event that doesn't
> exist, it returns zero and not the current count. Then the "all" clearing
> thinks it didn't find any events and returns without doing anything.
> 
> Have get_dynevent() return the current counter if it doesn't find events and
> even if the tested for event file doesn't exist. As that tested file may not
> be the dynamic event we are interested in.
> 
> Reported-by: Metin Kaya <[email protected]>
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=221395
> Fixes: 78d8d2e277af2 ("libtracefs: Have tracefs_dynevent_get_all() find kprobes and uprobes properly")
> Signed-off-by: Steven Rostedt <[email protected]>
> ---
>   src/tracefs-dynevents.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/tracefs-dynevents.c b/src/tracefs-dynevents.c
> index 5fdb723b6825..ad879ecbbc68 100644
> --- a/src/tracefs-dynevents.c
> +++ b/src/tracefs-dynevents.c
> @@ -499,12 +499,12 @@ static int get_dynevent(enum tracefs_dynevent_type type, const char *system,
>   		return -1;
>   
>   	if (!tracefs_file_exists(NULL, desc->file))
> -		return -1;
> +		return count;
>   
>   	content = tracefs_instance_file_read(NULL, desc->file, NULL);
>   	/* File exists, but may be empty */
>   	if (!content)
> -		return 0;
> +		return count;
>   
>   	if (ret_all)
>   		all = *ret_all;

Hi Steven,

The test cases I mentioned in the Bugzilla pass with this patch.

Thanks,

Tested-by: Metin Kaya <[email protected]>