Skip to content

CephFS CG: VRG deletion skips RGS cleanup, leaving orphaned volumesnapshot-in-group-protection finalizer and blocking namespace deletion #2980

Description

@raghavendra-talur

Summary

VRG deletion can leave an orphaned VolumeSnapshot with the snapshot.storage.kubernetes.io/volumesnapshot-in-group-protection finalizer, which blocks workload namespace deletion indefinitely (namespace stuck in Terminating). This was hit by the appset-deploy-cephfs regional-DR e2e test.

The trigger is a CephFS consistency-group (CG) snapshot that never became ready (Quiesce operation is in progress) being torn down while still in flight.

Environment / where seen

What happened

Timeline (dr1):

Time (UTC) Event
07:36:02 Relocate back to dr1 completes; VRG test-appset-deploy-cephfs/appset-deploy-cephfs is primary, workload healthy
07:34–07:37 Ramen's CephFS CG ReplicationGroupSource test-appset-deploy-cephfs-rook-cephfs-fs1-dr1-1 keeps creating VolumeGroupSnapshots. CephFS CSI CreateGroupSnapshot fails repeatedly with rpc error: code = Internal desc = Quiesce operation is in progress. VGS stays readyToUse: false.
07:37:01 RGS tries to restore the VGS → can't restore volume group snapshot: volume group snapshot is not ready to be used
07:37:02 Unprotect: DRPC deleted, VRG deletion starts. VRG deletes member VolumeSnapshot snapshot-eed7… and deletes the RGS. RGS controller logs VRG is deleted, skipping RGS reconciliation.
07:37:05 VGS (controller-owned by the RGS) is garbage-collected; snapshot-controller deletes the VGS and issues DELETE for the member snapshot
07:41:05 snapshot-controller retries member snapshot: still Completed: false; group content already not found → finalizer never cleared
07:42:32 Namespace deletion times out

Evidence

Workload namespace is stuck:

# dr1/cluster/namespaces/test-appset-deploy-cephfs.yaml
status:
  phase: Terminating
  conditions:
  - message: 'Some resources are remaining: volumesnapshots.snapshot.storage.k8s.io has 1 resource instances'
    reason: SomeResourcesRemain
    type: NamespaceContentRemaining
  - message: 'Some content in the namespace has finalizers remaining:
      snapshot.storage.kubernetes.io/volumesnapshot-in-group-protection in 1 resource instances'
    reason: SomeFinalizersRemain
    type: NamespaceFinalizersRemaining

The leftover object:

# dr1/namespaces/test-appset-deploy-cephfs/snapshot.storage.k8s.io/volumesnapshots/snapshot-eed7….yaml
kind: VolumeSnapshot
metadata:
  deletionTimestamp: "2026-11-18T07:37:02Z"
  finalizers:
  - snapshot.storage.kubernetes.io/volumesnapshot-in-group-protection
  ownerReferences:
  - apiVersion: groupsnapshot.storage.k8s.io/v1
    kind: VolumeGroupSnapshot
    name: test-appset-deploy-cephfs-rook-cephfs-fs1-dr1-1
status:
  readyToUse: false
  boundVolumeSnapshotContentName: snapcontent-eed7…

CephFS CSI (csi-snapshotter) repeatedly:

createGroupSnapshotWrapper: CreateGroupSnapshot for groupSnapshotContent groupsnapcontent-f162ba88-… returned error:
  rpc error: code = Internal desc = Quiesce operation is in progress

snapshot-controller deleting the VGS / member snapshot:

processGroupSnapshotWithDeletionTimestamp[...]: Delete individual snapshots that are part of the group snapshot
...
Removed protection finalizer from volume group snapshot ...
group snapshot ... deleted
deleteGroupSnapshot: scheduling sync of group snapshot content groupsnapcontent-f162ba88-…
deletion of group snapshot content "groupsnapcontent-f162ba88-…" was already processed
...
synchronizing VolumeSnapshot[snapshot-eed7…]: bound to: "snapcontent-eed7…", Completed: false

Ramen operator:

rgs ... Failed to restore volume group snapshot: can't restore volume group snapshot: volume group snapshot is not ready to be used
rgs ... VRG is deleted, skipping RGS reconciliation
vrg ... Deleted VolumeSnapshot name=snapshot-eed7…

Root cause

  1. ReplicationGroupSource (RGS) is set as controller owner of the VolumeGroupSnapshot (cephfscg/volumegroupsourcehandler.go, CreateOrUpdateVolumeGroupSnapshot → ctrl.SetControllerReference(owner, volumeGroupSnapshot, ...)). Deleting the RGS cascades to the VGS and its member VolumeSnapshot.
  2. On VRG deletion, vrg_volsync.go:doCleanupResources deletes the RGS via cephfscg.DeleteRGS, but does not run the RGS cleanup/CleanVolumeGroupSnapshot path or wait for the VGS/member snapshots to be fully removed before finalizing the VRG.
  3. ReplicationGroupSourceReconciler.getRGSConfig early-returns when the owning VRG is deleted:
    if util.ResourceIsDeleted(vrg) {
        logger.Info("VRG is deleted, skipping RGS reconciliation", ...)
        return nil, nil, nil, true, nil
    }
    This skips ReplicationGroupSourceMachine.Cleanup() → CleanVolumeGroupSnapshot(). Cleanup is therefore left entirely to Kubernetes GC + external-snapshotter.
  4. The group snapshot never completed (readyToUse: false). When the VGS/group content was deleted, external-snapshotter could not finish cleaning the member VolumeSnapshot, so the volumesnapshot-in-group-protection finalizer was orphaned. The namespace can no longer be deleted.

Impact

  • Any CephFS CG workload whose VRG is unprotected/deleted while a group snapshot is in flight (not ready) can leave the workload namespace stuck in Terminating.
  • This can make DR relocation/failover followed by unprotect/undeploy hang, as seen in e2e.

Suggested fixes

  • On VRG deletion, do not skip the RGS cleanup solely because the VRG is being deleted. Explicitly delete the VolumeGroupSnapshot (and member snapshots/restored PVCs) and wait for their finalizers to clear before completing VRG finalization.
  • Ensure CleanVolumeGroupSnapshot handles the "VGS not ready" case and member-snapshot finalizers, rather than relying on cascade GC.
  • Guard against creating/updating a new VGS once the VRG/RGS is being deleted.
  • Back off/avoid overlapping VGS create attempts when CSI reports Quiesce operation is in progress.
  • Add an e2e/regression test: CephFS CG + failover/relocate + unprotect while a group snapshot is in progress; assert the namespace deletes.

Notes

  • The e2e failure is a race (VGS created 07:37:01, teardown started 07:37:02) and may pass on retry, but the cleanup gap is real.
  • Must-gather evidence is in the run artifact above (test/gather.rdr/dr1, e2e/dr.log).

Activity

  1. added
    bug
    discovered-by-test
    on Nov 18, 2026
  2. added theissue type on Nov 19, 2026
  3. removed
    bug
    on Nov 19, 2026
  4. self-assigned this
    on Nov 19, 2026
  5. added 13 commits that reference this issue on Nov 19, 2026
    e561ad8
    d418cce
    c753766
    2c824c8
    fcfd86c
    b6d07e9
    b8bd501
    39b835f
    18fa118
    1653ca3
    3d71faa
    2f430ca
    5ae6a76
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

discovered-by-test

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions