Skip to content

mds: update lock for snap MD ops to support multi-MDS scenario - #70905

Merged
vshankar merged 1 commit into
ceph:mainfrom
rishabh-d-dave:snap-md-op-multimds
Sep 1, 2026
Merged

vshankar merged 1 commit into
ceph:mainfrom
rishabh-d-dave:snap-md-op-multimds

Conversation

@rishabh-d-dave

Copy link
Copy Markdown
Contributor

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

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.

@rishabh-d-dave
rishabh-d-dave requested review from a team and vshankar August 7, 2026 07:09
Comment thread qa/tasks/cephfs/test_snapshots.py Resolved
Comment thread src/mds/Server.cc
@@ -11935,7 +11931,7 @@ void Server::handle_client_snap_md_op(const MDRequestRef& mdr)
{
const cref_t<MClientRequest> &req = mdr->client_request;

CInode* diri = rdlock_path_pin_ref(mdr, false, true);
CInode* diri = rdlock_path_pin_ref(mdr, true, false);

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.

Nice catch, I guess this code projects inode and journals inode changes and that's an auth mds work? BTW no_want_auth is set false in func declaration. Keeping the uniformity with other calls -- explicit false can be dropped now.

@rishabh-d-dave
rishabh-d-dave force-pushed the snap-md-op-multimds branch 3 times, most recently from fc48171 to 5d19add Compare August 10, 2026 08:09
@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

jenkins test api

@vshankar

Copy link
Copy Markdown
Contributor

@rishabh-d-dave - this bug is easy to reproduce. I did this in a vstart cluster.

ceph fs set a max_mds 2
ceph config set mds mds_bal_replicate_threshold 1
ceph config set client client_use_random_mds true

then ran a sample test:

./bin/ceph_test_libcephfs --gtest_filter=LibCephFS.SnapMdCreateAdds

MDS crash backrtace

    -1> 2026-08-10T20:32:22.953+0530 ffff8512bd80 -1 /home/vshankar/ceph/src/mds/MDCache.cc: In function 'void MDCache::predirty_journal_parents(MutationRef, EMetaBlob*, CInode*, CDir*, int, int, snapid_t)' thread ffff8512bd80 time 2026-08-10T20:32:22.961819+0530
/home/vshankar/ceph/src/mds/MDCache.cc: 2258: FAILED ceph_assert(parent->is_auth())

 ceph version 21.3.0-1850-g962ed66b141 (962ed66b141d39d96ab6b1552226f55e7235f9a6) umbrella (dev - Debug)
 1: (ceph::__ceph_assert_fail(char const*, char const*, int, char const*)+0x11c) [0xffff8ad6a284]
 2: (ceph::__ceph_assert_fail(ceph::assert_data const&)+0x1c) [0xffff8ad6a560]
 3: /home/vshankar/ceph/build/bin/ceph-mds(+0x4884d0) [0xaaaadcab84d0]
 4: (MDCache::predirty_journal_parents(boost::intrusive_ptr<MutationImpl>, EMetaBlob*, CInode*, CDir*, int, int, snapid_t)+0x2ec) [0xaaaadcac8130]
 5: (Server::handle_client_snap_md_op(boost::intrusive_ptr<MDRequestImpl> const&)+0x96c) [0xaaaadca60d2c]
 6: (Server::dispatch_client_request(boost::intrusive_ptr<MDRequestImpl> const&)+0xaa0) [0xaaaadca7538c]
 7: (MDCache::dispatch_request(boost::intrusive_ptr<MDRequestImpl> const&)+0x1c4) [0xaaaadcb1a5dc]
 8: (C_MDS_RetryRequest::finish(int)+0x3c) [0xaaaadcb1a8d8]
 9: (Context::complete(int)+0x1c) [0xaaaadc984d10]
 10: (MDSContext::complete(int)+0x7c) [0xaaaadcc96ae8]
 11: (MDSTableClient::handle_request(boost::intrusive_ptr<MMDSTableRequest const> const&)+0x3fc) [0xaaaadcc530e0]
 12: (MDSRank::handle_message(boost::intrusive_ptr<Message const> const&)+0x9b4) [0xaaaadc992ee0]
 13: (MDSRank::_dispatch(boost::intrusive_ptr<Message const> const&, bool)+0x224) [0xaaaadc994878]
 14: (MDSRankDispatcher::ms_dispatch(boost::intrusive_ptr<Message const> const&)+0x214) [0xaaaadc99519c]
 15: (MDSDaemon::ms_dispatch2(boost::intrusive_ptr<Message> const&)+0x274) [0xaaaadc983ba4]
 16: (Messenger::ms_deliver_dispatch(boost::intrusive_ptr<Message> const&)+0x7c) [0xffff8aeb08c4]
 17: (DispatchQueue::entry()+0x3f8) [0xffff8aeacf34]
 18: (DispatchQueue::DispatchThread::entry()+0x10) [0xffff8af66878]
 19: (Thread::entry_wrapper()+0x48) [0xffff8ad4439c]
 20: (Thread::_entry_func(void*)+0xc) [0xffff8ad443bc]
 21: /lib64/libc.so.6(+0x89ea8) [0xffff89aa9ea8]
 22: /lib64/libc.so.6(+0xf360c) [0xffff89b1360c]

So, w.r.t. change, the duplication of test code is somewhat which is can be improved. I suggest we do that as a separate effort as per #70905 (comment)

For this fix, I will test it out locally and merged. Does that sound good?

@rishabh-d-dave

rishabh-d-dave commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor Author

ceph config set mds mds_bal_replicate_threshold 1
ceph config set client client_use_random_mds true

Yeah, we can reproduce it without these two configs as well. @vshankar

So, w.r.t. change, the duplication of test code is somewhat which is can be improved. I suggest we do that as a separate effort as per #70905 (comment)

Yeah, I went with duplication instead of other alternatives to save time. In a later PR, I'll get rid of duplication in favour of a better alternative.

For this fix, I will test it out locally and merged. Does that sound good?

Cool.

@vshankar

Copy link
Copy Markdown
Contributor

Yeah, I went with duplication instead of other alternatives to save time. In a later PR, I'll get rid of duplication in favour of a better alternative.

Sure. But for this PR, let's just keep the MDS fix.

@rishabh-d-dave

Copy link
Copy Markdown
Contributor Author

Yeah, I went with duplication instead of other alternatives to save time. In a later PR, I'll get rid of duplication in favour of a better alternative.

Sure. But for this PR, let's just keep the MDS fix.

Done

@rishabh-d-dave

rishabh-d-dave commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor Author

FYI: The bug could be reproduced with teuthology and without manual pining, client random MDS config and mds balance threshold config - https://pulpito.ceph.com/rishabh-2026-08-10_16:25:31-fs:functional-snap-md-op-multimds-bug-testing-default-trial/452618

QA run was successful for this PR - #70905 (comment)

@vshankar

Copy link
Copy Markdown
Contributor

I have tested this change locally and it looks good and is good to merge. However, while testing I found a bug in the MDS where lookupsnap would return ESTALE. I am going to file for it. To reproduce it, run a snapshot related test from src/test/libcephfs/test.cc for 100 iterations (e.g.: ./bin/ceph_test_libcephfs --gtest_filter=LibCephFS.SnapInfo --gtest_repeat=100) and you hit an error in a random iteration:

Note: Google Test filter = LibCephFS.SnapInfo
[==========] Running 1 test from 1 test suite.
[----------] 1 test from LibCephFS
[ RUN      ] LibCephFS.SnapInfo
/home/vshankar/ceph/src/test/libcephfs/test.cc:2775: Failure
Expected equality of these values:
  0
  ceph_mksnap(cmount, dir_path, snap_name, 0755, snap_meta, std::size(snap_meta))
    Which is: -116

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

I have tested this locally and the tests pass.

@vshankar

Copy link
Copy Markdown
Contributor

jenkins test api

@vshankar

Copy link
Copy Markdown
Contributor

This PR has been added to main integration testing by vshankar started 2026-08-13-12:44.

@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 938ff51 into ceph:main Sep 1, 2026
7 checks passed
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

This is an automated message by src/script/redmine-upkeep.py.

I found one or more Fixes: tags in the commit messages in

git log 938ff51ff0baccc1160b0317f41fb8d5c13791aa^..938ff51ff0baccc1160b0317f41fb8d5c13791aa

The referenced tickets are:

Those tickets do not reference this merged Pull Request. If this Pull Request merge resolves any of those tickets, please update the "Pull Request ID" field on each ticket. A future run of this script will appropriately update them.

Update Log: https://github.com/ceph/ceph/actions/runs/33482131048

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.

3 participants