Skip to content

mds: fix data race on subvolume_metrics_map in MetricsHandler - #67878

Merged
vshankar merged 1 commit into
ceph:mainfrom
salieri11:igolikov-fix-subvolume-map-75343-new
Apr 21, 2026
Merged

vshankar merged 1 commit into
ceph:mainfrom
salieri11:igolikov-fix-subvolume-map-75343-new

Conversation

@salieri11

Copy link
Copy Markdown
Contributor

The UnlockGuard in handle_payload() and update_rank0() had function-wide scope, causing subvolume_metrics_map to be read and written without the metrics lock held. This race between the ms_dispatch thread (handle_payload) and the mds-metrics thread (update_rank0) led to heap corruption under concurrent client subvolume I/O.

Narrow the UnlockGuard scope to only the sections that need the lock dropped (path resolution and rbytes fetch), ensuring subvolume_metrics_map is always accessed under lock.

Confirmed with TSAN: 8 data races before fix, 0 after.

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

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.

The UnlockGuard in handle_payload() and update_rank0() had
function-wide scope, causing subvolume_metrics_map to be read
and written without the metrics lock held. This race between the
ms_dispatch thread (handle_payload) and the mds-metrics thread
(update_rank0) led to heap corruption under concurrent client
subvolume I/O.

Narrow the UnlockGuard scope to only the sections that need the
lock dropped (path resolution and rbytes fetch), ensuring
subvolume_metrics_map is always accessed under lock.

Confirmed with TSAN: 8 data races before fix, 0 after.

Fixes: https://tracker.ceph.com/issues/75343
Signed-off-by: Igor Golikov <[email protected]>
@github-actions github-actions Bot added the cephfs Ceph File System label Mar 18, 2026
@salieri11
salieri11 requested a review from vshankar March 18, 2026 17:35
@salieri11

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@salieri11

Copy link
Copy Markdown
Contributor Author

jenkins test windows

@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

Copy link
Copy Markdown
Contributor

vshankar added a commit to vshankar/ceph that referenced this pull request Mar 24, 2026
* refs/pull/67878/head:

Reviewed-by: Venky Shankar <[email protected]>
vshankar added a commit to vshankar/ceph that referenced this pull request Apr 20, 2026
* refs/pull/67878/head:
	mds: fix data race on subvolume_metrics_map in MetricsHandler

Reviewed-by: Venky Shankar <[email protected]>
@salieri11

Copy link
Copy Markdown
Contributor Author

This one can be merged I guess?

@vshankar

Copy link
Copy Markdown
Contributor

This one can be merged I guess?

Yeh. Just waiting on me to update the run wiki.

@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 cf17416 into ceph:main Apr 21, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants