Re: [PATCH v8 04/14] rv: Disarm HA timers on the storage free path

From: Karl Mehltretter

Date: Tue Dec 01 2026 - 20:14:13 EST


On Tue, Dec 01, 2026 at 08:30:03AM +0100, Gabriele Monaco wrote:
> > da_monitor_destroy() also needs rcu_barrier() after this loop so
> > in-flight da_kfree_cb() callbacks finish before teardown returns.
>
> In theory, yes, but I believe that's only relevant for RV monitors as kernel
> modules, since after return they can be removed at any time.
>
> Currently, we do not support that.
> It doesn't hurt to rcu_barrier() unconditionally here, but I'd say we can have
> some cleaner and common solution once we support monitors built as modules.
>
> Or am I missing something else here?
>

I was thinking about disable followed by re-enable.

Storages already unlinked by da_destroy_storage() are no longer in
da_monitor_ht, and synchronize_rcu() does not wait for their da_kfree_cb()
callbacks to run.

If a timer is still armed on one of those storages, re-enabling clears
ha_mon_destroying before da_kfree_cb() cancels it, so the old timer can fire
and report a violation in the new session.

I reproduced this with nomiss using rcu_nocbs=all and delays in
da_destroy_storage() and da_kfree_cb().

A timer from before disable fired after re-enable, and rcu_barrier() in
da_monitor_destroy() stopped it.

Your dead flag would have prevented that. But with init-once timers and
unconditional cancel on free, da_monitor_destroy() still needs rcu_barrier().

Thanks,
Karl