talos/internal
Andrey Smirnov 82553b2a1a
fix: mount volume mount/unmount race
The fix enforces the order `VolumeMountStatus` resources are locked via
finalizers: the order follows the definition in the service, which
follows the order parent -> child. Previous parallel implementation
could put a finalizer on the child before parent, which might lead to a
deadlock.

Example flow:

* there are two mount requests `/var/lib` and `/var/lib/audit` (having
  `/var/lib` as parent)
* service requests mounts, puts finalizers, runs
* service stops, releases volume mount requests, and restart
* at the same time concurrently controller might decide to unmount
  `/var/lib` which will be blocked on child `/var/lib/audit` being
  mounted
* starting service might put a finalizer on `/var/lib/audit` as it's not
  tearing down yet
* the finalizer on a child `/var/lib/audit` will prevent `/var/lib` from
  being unmounted ever.

Also remove mount requests generation hack.

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
(cherry picked from commit 536541afe497d5f61cfcd0c01cf580ab5b3be164)
2025-12-19 18:49:51 +04:00
..
2025-12-19 18:49:51 +04:00
2025-12-15 09:55:40 +01:00