Skip to content

rbd: getRBDSnapID and ProcessMetadata issues in snapshot metadata path #6206

@kaovilai

Description

@kaovilai

Problem

Several issues exist in the RBD snapshot metadata code path (ProcessMetadata / getRBDSnapID) that would cause incorrect behavior for certain snapshot configurations:

1. getRBDSnapID uses GetParent() which fails for non-clone snapshots

GetParent() only works for clone-based snapshots with a parent relationship. For regular RBD snapshots or flattened clones, GetParent() returns ErrNotFound. Should use GetSnapshotNames() which reliably lists all snapshots on the image regardless of clone/parent relationships.

2. SnapInfo field name mismatch: Id vs ID

The go-ceph SnapInfo struct uses the field name Id, not ID.

3. ProcessMetadata opens wrong image

ProcessMetadata opens the source volume via rbdSnap.open() (which uses RbdImageName = source volume name), but getRBDSnapID() returns the snapshot ID from the clone image (via toVolume()). This mismatch means SetSnapByID() applies a clone's snapshot ID to the source volume, resulting in either an error or iterating over wrong/empty data.

Context

These issues were discovered during investigation of empty GetMetadataAllocated streams. While the original symptom turned out to be a test-side device path mismatch (details), the code issues identified above are real bugs that should be fixed.

Note

Responses generated with Claude

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions