Skip to content

mds: clear batch_op_map when the batch op is released - #71274

Merged
vshankar merged 1 commit into
ceph:mainfrom
MaxKellermann:mds__clear__batch_op_map
Sep 8, 2026
Merged

vshankar merged 1 commit into
ceph:mainfrom
MaxKellermann:mds__clear__batch_op_map

Conversation

@MaxKellermann

@MaxKellermann MaxKellermann commented Aug 24, 2026 •

Copy link
Copy Markdown
Member

The a non-nullptr value in MDRequestImpl::batch_op_map signals "I own batch_ops[mask]" (via is_batch_head()), but it was only ever cleared in Batch_Getattr_Lookup::find_new_head(), when ownership is handed over to a follower. Neither place that erases the entry cleared it: release_batch_op() and the killed-batch-head block in MDCache::request_cleanup().

A request whose entry had already been erased therefore kept claiming to be the batch head, and the next visitor did find(mask) on a map that no longer has that key. Nothing checks the iterator, so it was dereference and erase(end()) was called, which could easily lead to a crash with assertion failure:

/usr/include/c++/11/bits/stl_tree.h:1206: [...] Assertion '__position != end()' failed.

Client eviction is an easy way to hit this: journal_close_session() kills every request of the session. find_new_head() drops killed followers, which makes the "no new head, erase the entry" case the common one during an eviction.

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

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.

@github-actions github-actions Bot added the cephfs Ceph File System label Aug 24, 2026
@dvanders
dvanders requested a review from xiubli August 25, 2026 14:14

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

Please create a tracker issue so that this issue can be tracked for backporting.

Then, please annotate the commit which fixes/resolves a Ceph tracker issue with:

Fixes: http://tracker.ceph.com/issues/...

This is essential when examining the history of the repository (this commit fixes what) and helps merge scripts identify issues that have been resolved by a merge. See this article on GitHub on how to amend commits and update your pull request.

@xiubli

xiubli commented Aug 26, 2026

Copy link
Copy Markdown
Member

LGTM, and waiting the tracker.

The a non-nullptr value in `MDRequestImpl::batch_op_map` signals "I
own batch_ops[mask]" (via is_batch_head()), but it was only ever
cleared in Batch_Getattr_Lookup::find_new_head(), when ownership is
handed over to a follower.  Neither place that erases the entry
cleared it: release_batch_op() and the killed-batch-head block in
MDCache::request_cleanup().

A request whose entry had already been erased therefore kept claiming to
be the batch head, and the next visitor did find(mask) on a map that no
longer has that key.  Nothing checks the iterator, so it was
dereference and erase(end()) was called, which could easily lead to a
crash with assertion failure:

 /usr/include/c++/11/bits/stl_tree.h:1206: [...] Assertion '__position != end()' failed.

Client eviction is an easy way to hit this: journal_close_session()
kills every request of the session.  find_new_head() drops killed
followers, which makes the "no new head, erase the entry" case the
common one during an eviction.

Fixes: https://tracker.ceph.com/issues/79951
Signed-off-by: Max Kellermann <[email protected]>
@MaxKellermann
MaxKellermann force-pushed the mds__clear__batch_op_map branch from 2555caa to c77995d Compare August 26, 2026 20:20
@MaxKellermann

Copy link
Copy Markdown
Member Author

@batrick, ticket added

@xiubli

xiubli commented Aug 27, 2026

Copy link
Copy Markdown
Member

jenkins test api

@vshankar

vshankar commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

This PR has been added to main integration testing by vshankar started 2026-09-02-13:52.

@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 165146c into ceph:main Sep 8, 2026
9 checks passed
@MaxKellermann
MaxKellermann deleted the mds__clear__batch_op_map branch September 8, 2026 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cephfs Ceph File System needs-qa

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants