On Tue, 28 Apr 2026 14:27:36 -0400
Steven Rostedt <[email protected]> wrote:

> 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.

Good catch! Indeed, there is no need to hold the mutex.
OK, let me update it.

Thanks,

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


-- 
Masami Hiramatsu (Google) <[email protected]>

Reply via email to