Skip to content

rbd: open image once in setAllMetadata/unsetAllMetadata - #6509

Merged
mergify[bot] merged 1 commit into
ceph:develfrom
YiteGu:optimize-set-all-metadata
Aug 27, 2026
Merged

mergify[bot] merged 1 commit into
ceph:develfrom
YiteGu:optimize-set-all-metadata

Conversation

@YiteGu

@YiteGu YiteGu commented Aug 27, 2026

Copy link
Copy Markdown
Member

setAllMetadata called rbdImage.SetMetadata once per key, and each call opened and closed the RBD image on its own. On the CreateVolume path this meant the image was opened at least three times (the parameters map plus the clusterName and mounter keys), which is wasteful.

Open the image once at the start of setAllMetadata and issue all SetMetadata calls against that single handle, closing it via defer.

Apply the same change to the symmetric unsetAllMetadata, which had the identical open-per-key pattern.

Behaviour is unchanged: the same keys are set/unset, the same error messages are returned, and unsetAllMetadata still tolerates ErrNotExist.

Describe what this PR does

Provide some context for the reviewer

Is there anything that requires special attention

Do you have any questions?

Is the change backward compatible?

Are there concerns around backward compatibility?

Provide any external context for the change, if any.

For example:

  • Kubernetes links that explain why the change is required
  • CSI spec related changes/catch-up that necessitates this patch
  • golang related practices that necessitates this change

Related issues

Mention any github issues relevant to this PR. Adding below line
will help to auto close the issue once the PR is merged.

Fixes: #issue_number

Future concerns

List items that are not part of the PR and do not impact it's
functionality, but are work items that can be taken up subsequently.

Checklist:

  • Commit Message Formatting: Commit titles and messages follow
    guidelines in the developer
    guide
    .
  • Reviewed the developer guide on Submitting a Pull
    Request
  • Pending release
    notes

    updated with breaking and/or notable changes for the next major release.
  • Documentation has been updated, if necessary.
  • Unit tests have been added, if necessary.
  • Integration tests have been added, if necessary.

Show available bot commands

These commands are normally not required, but in case of issues, leave any of
the following bot commands in an otherwise empty comment in this PR:

  • /retest ci/centos/<job-name>: retest the <job-name> after unrelated
    failure (please report the failure too!)

@YiteGu
YiteGu requested review from a team as code owners August 27, 2026 08:18
@mergify mergify Bot added the component/rbd Issues related to RBD label Aug 27, 2026
@YiteGu
YiteGu force-pushed the optimize-set-all-metadata branch from 1310233 to 8245a71 Compare August 27, 2026 08:25

@nixpanic nixpanic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, looks like a simple and beneficial performance improvement

@nixpanic
nixpanic requested a review from a team August 27, 2026 09:29

@iPraveenParihar iPraveenParihar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@nixpanic

Copy link
Copy Markdown
Member

/queue

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

@Mergifyio rebase

@mergify

mergify Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

rebase

🛑 The pull request rule doesn't match anymore

Details

This action has been cancelled.

setAllMetadata called rbdImage.SetMetadata once per key, and each call
opened and closed the RBD image on its own. On the CreateVolume path
this meant the image was opened at least three times (the parameters
map plus the clusterName and mounter keys), which is wasteful.

Open the image once at the start of setAllMetadata and issue all
SetMetadata calls against that single handle, closing it via defer.

Apply the same change to the symmetric unsetAllMetadata, which had the
identical open-per-key pattern.

Behaviour is unchanged: the same keys are set/unset, the same error
messages are returned, and unsetAllMetadata still tolerates ErrNotExist.

Signed-off-by: Yite Gu <[email protected]>
@ceph-csi-bot
ceph-csi-bot force-pushed the optimize-set-all-metadata branch from 8245a71 to c0006b1 Compare August 27, 2026 10:21
@ceph-csi-bot ceph-csi-bot added ok-to-test Label to trigger E2E tests and removed queued/rebase labels Aug 27, 2026
@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

/test ci/centos/k8s-e2e-external-storage/1.34

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

/test ci/centos/k8s-e2e-external-storage/1.36

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

/test ci/centos/mini-e2e-helm/k8s-1.34

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

/test ci/centos/mini-e2e-helm/k8s-1.36

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

/test ci/centos/upgrade-tests-cephfs

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

/test ci/centos/mini-e2e/k8s-1.34

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

/test ci/centos/k8s-e2e-external-storage/1.35

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

/test ci/centos/mini-e2e/k8s-1.36

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

/test ci/centos/upgrade-tests-rbd

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

/test ci/centos/mini-e2e-helm/k8s-1.35

@ceph-csi-bot

Copy link
Copy Markdown
Collaborator

/test ci/centos/mini-e2e/k8s-1.35

@ceph-csi-bot ceph-csi-bot added ci/in-progress/e2e This label acts like a guard and prevents Mergify from adding the `ok-to-test` label again. and removed ok-to-test Label to trigger E2E tests labels Aug 27, 2026
@mergify mergify Bot removed the ci/in-progress/e2e This label acts like a guard and prevents Mergify from adding the `ok-to-test` label again. label Aug 27, 2026
@nixpanic

Copy link
Copy Markdown
Member

/retest ci/centos/mini-e2e/k8s-1.35

@nixpanic

Copy link
Copy Markdown
Member

/test ci/centos/mini-e2e-helm/k8s-1.35

@nixpanic

Copy link
Copy Markdown
Member

/test ci/centos/mini-e2e-helm/k8s-1.34

@nixpanic

Copy link
Copy Markdown
Member

/retest ci/centos/mini-e2e/k8s-1.35

Failed with NFS:

  [FAIL] nfs Test NFS CSI [It] create a PVC-PVC clone and bind it to an app [acceptance]

@nixpanic

Copy link
Copy Markdown
Member

/test ci/centos/mini-e2e-helm/k8s-1.35
/test ci/centos/mini-e2e-helm/k8s-1.34

CephFS deployment issue:

  [FAIL] cephfs [BeforeEach] Test CephFS CSI checking provisioner and nodeplugin are running [acceptance]

@mergify

mergify Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Deprecation notice: This pull request comes from a fork and was queued with update_method=rebase and update_bot_account impersonation. This capability will be removed on July 1, 2026. After this date, the merge queue will no longer be able to rebase fork pull requests with this configuration. To avoid disruption, switch to update_method=merge in your queue rule.

@mergify

mergify Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-08-27 15:36 UTC · Rule: default · triggered by merge protections
  • ✅ Checks skipped · PR is already up-to-date
  • ✅ Merged — 2026-08-27 15:36 UTC · at c0006b13646d2e449750736e807e2cac5c85326c · rebase

This pull request spent 8 seconds in the queue, including 1 second running CI.

Required conditions to merge

@mergify
mergify Bot merged commit 142d2e2 into ceph:devel Aug 27, 2026
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/rbd Issues related to RBD

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants