On Mon, 27 Apr 2026 21:09:58 +0900
"Masami Hiramatsu (Google)" <[email protected]> wrote:

> +/**
> + * unregister_fprobe_sync() - Unregister fprobe synchronously with RCU grace 
> period.
> + * @fp: A fprobe data structure to be unregistered.
> + *
> + * Unregister fprobe (and remove ftrace hooks from the function entries) and
> + * wait for the RCU grace period to finish. This is useful for preventing
> + * the fprobe from being used after it is unregistered.
> + *
> + * Return 0 if @fp is unregistered successfully, -errno if not.
> + */
> +int unregister_fprobe_sync(struct fprobe *fp)
> +{
> +     int ret;
> +
> +     guard(mutex)(&fprobe_mutex);
> +     if (!fp || !fprobe_registered(fp))
> +             return -EINVAL;
> +
> +     ret = unregister_fprobe_nolock(fp);
> +     if (ret)
> +             return ret;
> +
> +     synchronize_rcu();

Hmm, do we really need to hold the fprobe_mutex when doing the
synchronize_rcu()? This could cause other updates to have to wait longer
too.

-- Steve


> +     return 0;
> +}
> +EXPORT_SYMBOL_GPL(unregister_fprobe_sync);

Reply via email to