Skip to content

mds: fix stale used_bytes in subvolume metrics when quota is disabled - #69805

Merged
vshankar merged 2 commits into
mainfrom
igolikov-subvol-metrics-fix-zero-quota
Aug 5, 2026
Merged

vshankar merged 2 commits into
mainfrom
igolikov-subvol-metrics-fix-zero-quota

Conversation

@salieri11

@salieri11 salieri11 commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Fix mds_subvolume_metrics used_bytes freezing after a subvolume quota is reset to 0 (unlimited)
  • Add a vstart regression test covering quota reset and subsequent IO

Problem

When subvolume quota is reset to unlimited via ceph fs subvolume resize ... inf or setfattr ceph.quota.max_bytes=0, used_bytes in ceph tell mds counter dump → mds_subvolume_metrics stops updating after further IO. ceph fs subvolume info bytes_used remains correct.

Root cause

aggregate_subvolume_metrics() preferred cached used_bytes from subvolume_quota over freshly fetched rbytes from get_inode_rbytes(). The fallback to live data only ran when res.used_bytes == 0.

When quota is disabled, MDCache::broadcast_quota_to_client() stops calling maybe_update_subvolume_quota() on rstat changes, so the cache keeps a stale non-zero used_bytes until eviction.

Fix

Always prefer live rbytes for used_bytes in aggregate_subvolume_metrics(). Keep quota_bytes from the cache and use cached used_bytes only as a fallback when the live fetch is unavailable.

Test

Added TestSubvolumeMetrics.test_subvolume_used_bytes_updates_after_quota_reset_to_zero:

  1. Create subvolume with 2G quota, write 100 MiB, verify metrics
  2. Reset quota to unlimited, write more data, assert used_bytes grows past the phase-1 value
  3. Set quota to 3G, write again, assert used_bytes still updates

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

Igor Golikov added 2 commits June 29, 2026 09:57
When a subvolume quota is reset to 0 (unlimited),broadcast_quota_to_client() stops updating the cached used_bytes in subvolume_quota.
aggregate_subvolume_metrics() preferred that stale cache over freshly fetched rbytes, so used_bytes froze until the quota entry was evicted.
Always prefer live rbytes from get_inode_rbytes() for used_bytes and only fall back to the cache when the live value is unavailable.

Signed-off-by: Igor Golikov <[email protected]>
Fixes: https://tracker.ceph.com/issues/77768
Add a regression test that:
1. creates a subvolume with a 2G quota and writes data
2. resets quota to unlimited, writes more data, and asserts used_bytes grows
3. sets a non-zero quota again and verifies used_bytes still updates
Covers the case where mds_subvolume_metrics used_bytes stayed frozen at the pre-reset value while ceph fs subvolume info bytes_used was correct.

Signed-off-by: Igor Golikov <[email protected]>
Fixes: https://tracker.ceph.com/issues/77768
@github-actions github-actions Bot added cephfs Ceph File System tests labels Jun 29, 2026
@vshankar
vshankar requested review from a team, kotreshhr and rishabh-d-dave July 6, 2026 12:48
@vshankar

vshankar commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

@kotreshhr @rishabh-d-dave PTAL

@vshankar

Copy link
Copy Markdown
Contributor

This PR has been added to main integration testing by vshankar started 2026-07-21-10:48.

@vshankar vshankar 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.

@vshankar
vshankar merged commit 5d37322 into main Aug 5, 2026
20 of 21 checks passed
@vshankar
vshankar deleted the igolikov-subvol-metrics-fix-zero-quota branch August 5, 2026 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cephfs Ceph File System tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants