Skip to content

os/bluestore: keep at least one cache age bin - #73673

Open
ming1 wants to merge 2 commits into
ceph:mainfrom
ming1:wip-82941-zero-age-bins
Open

ming1 wants to merge 2 commits into
ceph:mainfrom
ming1:wip-82941-zero-age-bins

Conversation

@ming1

@ming1 ming1 commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Zeros in bluestore_cache_age_bins_* are documented as "no items at that priority", so an all-zero list means everything at the lowest priority. It also makes import_bins() call set_bin_count(0): circular_buffer::set_capacity(0) frees the ring, shift_bins() then inserts nothing, and the next insert dereferences age_bins.front() of an empty ring. The OSD segfaults within a second of mount, for the data, meta and both rocksdb caches. An empty or malformed string parses to no bins and crashes the same way.

Clamp the ring to one bin in both set_bin_count() implementations. Valid lists are unchanged. The added store test sets all four lists to zeros, remounts and reads; it segfaulted before the fix and passes with it.

Fixes: https://tracker.ceph.com/issues/82941

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)

ming1 added 2 commits November 9, 2026 03:40
An all-zero bluestore_cache_age_bins_* string (zeros are documented as
"no items at that priority"), or an empty one, makes import_bins() call
set_bin_count(0): circular_buffer::set_capacity(0) frees the ring,
shift_bins() then inserts nothing, and the next insert into that cache
dereferences age_bins.front() of an empty ring. The OSD segfaults within
a second of mount, for the data, meta and both rocksdb caches.
Clamp the ring to one bin in both set_bin_count() implementations.

Fixes: https://tracker.ceph.com/issues/82941
Signed-off-by: Ming Lei <[email protected]>
Set all four age-bin lists to zeros with a 0.1 s bin interval, write,
remount, and read after the mempool thread has imported the bins. The
test segfaulted before the fix.

Fixes: https://tracker.ceph.com/issues/82941
Signed-off-by: Ming Lei <[email protected]>
@aclamk

aclamk commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Please explain value of this PR.
Granted, "0 0 0 0 0 0 0 0" cause problems in Priority Caches. Do you need such configuration?

@ming1

ming1 commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

Please explain value of this PR. Granted, "0 0 0 0 0 0 0 0" cause problems in Priority Caches. Do you need such configuration?

An all-zero list means everything at the lowest priority, so it isn't wrong from interface viewpoint. And it is one segment fault, which is supposed to avoid in such situation.

@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants