Re: [PATCH v3 07/13] rv: Add automatic cleanup handlers for per-task HA monitors

From: Nam Cao

Date: Mon Jun 01 2026 - 03:47:03 EST


Gabriele Monaco <gmonaco@xxxxxxxxxx> writes:
> @@ -123,12 +144,15 @@ static int ha_monitor_init(void)
>
> ha_mon_initializing = true;
> ret = da_monitor_init();
> + if (ret == 0)
> + ha_monitor_enable_hook();
> ha_mon_initializing = false;
> return ret;
> }

What if between da_monitor_init() and ha_monitor_enable_hook(), a task
exits while a timer is still active, and then the timer callback is invoked?

Extremely rare, but I think it can be fixed easily by reordering the two functions.

> static void ha_monitor_destroy(void)
> {
> + ha_monitor_disable_hook();
> da_monitor_destroy();
> }

Same here, there is small window between the two function calls.

Nam