Skip to content

Commit 75fe475

Browse files
committed
fix: stop attaching to tearing down mount parents
This bug showed up as a random deadlock on kubelet restart (might be any other service though). With a chain of mount requests, like `/var/log` -> `/var/log/containers`, there was a chance that a new generation of mount requests might try to pick up a tearing down parent of the previous generation leading to a deadlock when the mount can't proceed for the parent. Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
1 parent c93a9c6 commit 75fe475

File tree

1 file changed

+1
-1
lines changed
  • internal/app/machined/pkg/controllers/block

1 file changed

+1
-1
lines changed

internal/app/machined/pkg/controllers/block/mount.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ func (ctrl *MountController) Run(ctx context.Context, r controller.Runtime, logg
198198
}
199199
}
200200

201-
if mountHasParent && !mountParentStatus.Metadata().Finalizers().Has(parentFinalizerName) {
201+
if mountHasParent && !mountParentStatus.Metadata().Finalizers().Has(parentFinalizerName) && mountParentStatus.Metadata().Phase() == resource.PhaseRunning {
202202
if err = r.AddFinalizer(ctx, mountParentStatus.Metadata(), parentFinalizerName); err != nil {
203203
return fmt.Errorf("failed to add finalizer to parent mount status %q: %w", mountParentStatus.Metadata().ID(), err)
204204
}

0 commit comments

Comments
 (0)