Skip to content

mds: prevent CDir omap commit with empty updates/removals/header - #68793

Merged
vshankar merged 1 commit into
ceph:mainfrom
vshankar:wip-76455
Jun 8, 2026
Merged

vshankar merged 1 commit into
ceph:mainfrom
vshankar:wip-76455

Conversation

@vshankar

@vshankar vshankar commented May 7, 2026 •

Copy link
Copy Markdown
Contributor

Empty stales and to_remove causes size to be initialized with sizeof(fnode_t). If the encoded inode size (plus fnode_t size) exceeds max_dir_commit_size, commit_one() is called as a non-header update with empty _set and _rm sets causing the MDS to assert.

While this patch prevents the assert, it is unknown at this point as to why the encoded inode size is so large. We have seen it before once, but there is lack of debug information to dig into. This fix will prevent the assert, however, the MDS would go read-only due to the large rados operation size, but at least we will have a live system to debug at that point.

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

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.

@vshankar
vshankar requested a review from a team May 7, 2026 10:00
@vshankar vshankar added the cephfs Ceph File System label May 7, 2026

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

The fix looks reasonable

it prevents a crash by checking for empty operations before committing. This is better than crashing.

Summary

The bug happens when:

  1. Both stales and to_remove lists are empty
  2. An inode is very large (bigger than max_dir_commit_size)
  3. The code calls commit_one() with empty _set and _rm sets
  4. This triggers the assertion at line 2448 and crashes the MDS

The fix adds a check to skip the commit when there is nothing to commit.

Suggestions

  1. Add debug logging: Consider adding a dout() warning when we hit this edge case. This will help find why the inode size is so large when it happens again.

    dout(5) << "skipping empty commit, inode size exceeded max_dir_commit_size" << dendl;

@vshankar

Copy link
Copy Markdown
Contributor Author

This PR has been added to wip-vshankar-testing-20260513.092143.

@vshankar

Copy link
Copy Markdown
Contributor Author

The fix looks reasonable

it prevents a crash by checking for empty operations before committing. This is better than crashing.

Summary

The bug happens when:

  1. Both stales and to_remove lists are empty
  2. An inode is very large (bigger than max_dir_commit_size)
  3. The code calls commit_one() with empty _set and _rm sets
  4. This triggers the assertion at line 2448 and crashes the MDS

The fix adds a check to skip the commit when there is nothing to commit.

Suggestions

  1. Add debug logging: Consider adding a dout() warning when we hit this edge case. This will help find why the inode size is so large when it happens again.
    dout(5) << "skipping empty commit, inode size exceeded max_dir_commit_size" << dendl;

Thanks for the suggestion. Agreed - I will push in the additional change.

Empty `stales` and `to_remove` causes `size` to be initialized with
sizeof(fnode_t). If the encoded inode size (plus fnode_t size) exceeds
max_dir_commit_size, commit_one() is called as a non-header update
with empty `_set` and `_rm` sets causing the MDS to assert.

While this patch prevents the assert, it is unknown at this point as
to why the encoded inode size is so large. We have seen it before
once, but there is lack of debug information to dig into. This fix
will prevent the assert, however, the MDS would go read-only due to
the large rados operation size, but at least we will have a live
system to debug at that point.

Fixes: http://tracker.ceph.com/issues/76455
Signed-off-by: Venky Shankar <[email protected]>
@vshankar

Copy link
Copy Markdown
Contributor Author

Suggestions

  1. Add debug logging: Consider adding a dout() warning when we hit this edge case. This will help find why the inode size is so large when it happens again.

Done. Please check @salieri11

@vshankar

Copy link
Copy Markdown
Contributor Author

Changes with latest push:

  • dout() when we hit this edge case.

@vshankar vshankar left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@vshankar

vshankar commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@vshankar
vshankar merged commit 197d453 into ceph:main Jun 8, 2026
16 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cephfs Ceph File System

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants