Repository navigation
mds: Fix deadlock in file_blockdiff - #67969
Conversation
|
jenkins test make check |
|
jenkins test make check arm64 |
|
This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days. |
2236bc4 to
6302a29
Compare
6302a29 to
037ea07
Compare
037ea07 to
8d760c7
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
src/mds/MDCache.cc:14710
- The existing blockdiff tests exercise result correctness, but they do not force all Objecter callbacks to complete before
gather_ctx.activate(), which is the timing required to reproduce this deadlock. Add a regression test that covers both pre-activation and post-activation completion so the deadlock fix does not regress or break the ordinary asynchronous path.
// Defer the MDSIOContext finisher to mds->finisher so gather activate() does
// not call MDSIOContext::complete() inline while mds_lock is held.
// See https://tracker.ceph.com/issues/75676
MDSGatherBuilder gather_ctx(g_ceph_context,
new C_MDS_OnFinisher(mds, on_finish, mds->finisher));
The MDCache::file_blockdiff can deadlock
itself with the mds_lock.
The MDSDaemon::ms_dispatch2 takes the mds_lock
and MDCache::file_blockdiff tries to acquire
same lock while finishing it's context synchronously
at gather_ctx.activate()
The fix is to wrap the finisher in C_OnFinisher and
use C_GatherBuilder so completion is queued on
mds->finisher instead.
Following is the traceback
-----------------------------
(gdb) bt
0 0x0000ffff7da4656c in __futex_abstimed_wait_cancelable64 () from /lib64/libc.so.6
1 0x0000ffff7da48ff0 [PAC] in pthread_cond_wait@@GLIBC_2.17 () from /lib64/libc.so.6
2 0x0000ffff7efe0380 [PAC] in ceph::condition_variable_debug::wait (this=this@entry=0xaaaace348018, lock=...) at /lsandbox/upstream/ceph/src/common/mutex_debug.h:153
3 0x0000aaaaaf698b70 in ceph::condition_variable_debug::wait<ceph::fair_mutex::lock()::{lambda()#1}>(std::unique_lock<ceph::mutex_debug_detail::mutex_debug_impl<false> >&, ceph::fair_mutex::lock()::{lambda()#1}) (
this=0xaaaace348018, lock=..., pred=...) at /lsandbox/upstream/ceph/src/common/condition_variable_debug.h:34
4 ceph::fair_mutex::lock (this=this@entry=0xaaaace348010) at /lsandbox/upstream/ceph/src/common/fair_mutex.h:28
5 0x0000aaaaaf9d71a0 in std::lock_guard<ceph::fair_mutex>::lock_guard (this=0xffff786cb760, __m=...) at /usr/include/c++/14/bits/std_mutex.h:250
6 MDSIOContextBase::complete (this=0xaaaadd1f3800, r=0) at /lsandbox/upstream/ceph/src/mds/MDSContext.cc:102
7 0x0000aaaaaf6f00a0 in C_GatherBase<MDSContext, C_MDSInternalNoop>::delete_me (this=this@entry=0xaaaadd167450) at /lsandbox/upstream/ceph/src/include/Context.h:351
8 0x0000aaaaaf6f0114 in C_GatherBase<MDSContext, C_MDSInternalNoop>::activate (this=0xaaaadd167450) at /lsandbox/upstream/ceph/src/include/Context.h:401
9 0x0000aaaaaf6f016c in C_GatherBuilderBase<MDSContext, C_GatherBase<MDSContext, C_MDSInternalNoop> >::activate (this=this@entry=0xffff786cb898) at /lsandbox/upstream/ceph/src/include/Context.h:490
10 0x0000aaaaaf83ac5c in MDCache::file_blockdiff (this=0xaaaace3f4000, in1=in1@entry=0xaaaadcc12680, in2=in2@entry=0xaaaad386cc00, block_diff=block_diff@entry=0xaaaadf0b0a30, max_objects=<optimized out>,
max_objects@entry=16, ctx=ctx@entry=0xaaaadf0b0a10) at /lsandbox/upstream/ceph/src/mds/MDCache.cc:14933
11 0x0000aaaaaf78afa0 in Server::handle_client_file_blockdiff (this=this@entry=0xaaaad30f9d40, mdr=...) at /lsandbox/upstream/ceph/src/mds/Server.cc:12619
12 0x0000aaaaaf79ed08 in Server::dispatch_client_request (this=this@entry=0xaaaad30f9d40, mdr=...) at /lsandbox/upstream/ceph/src/mds/Server.cc:2942
13 0x0000aaaaaf79fbc4 in Server::handle_client_request (this=this@entry=0xaaaad30f9d40, req=...) at /lsandbox/upstream/ceph/src/mds/Server.cc:2713
14 0x0000aaaaaf7a2d60 in Server::dispatch (this=0xaaaad30f9d40, m=...) at /lsandbox/upstream/ceph/src/mds/Server.cc:403
15 0x0000aaaaaf6b4674 in MDSRank::handle_message (this=this@entry=0xaaaace374008, m=...) at /lsandbox/upstream/ceph/src/mds/MDSRank.cc:1252
16 0x0000aaaaaf6b6548 in MDSRank::_dispatch (this=this@entry=0xaaaace374008, m=..., new_msg=new_msg@entry=true) at /lsandbox/upstream/ceph/src/mds/MDSRank.cc:1075
17 0x0000aaaaaf6b6e6c in MDSRankDispatcher::ms_dispatch (this=this@entry=0xaaaace374000, m=...) at /lsandbox/upstream/ceph/src/mds/MDSRank.cc:1049
18 0x0000aaaaaf6a44f4 in MDSDaemon::ms_dispatch2 (this=0xaaaace348000, m=...) at /lsandbox/upstream/ceph/src/common/RefCountedObj.h:57
19 0x0000ffff7f089a88 in Messenger::ms_deliver_dispatch (this=0xaaaad30b8000, m=...) at /lsandbox/upstream/ceph/src/msg/Messenger.h:748
20 0x0000ffff7f0860b8 in DispatchQueue::entry (this=0xaaaad30b83d8) at /lsandbox/upstream/ceph/src/msg/DispatchQueue.cc:203
21 0x0000ffff7f1411c0 in DispatchQueue::DispatchThread::entry (this=<optimized out>) at /lsandbox/upstream/ceph/src/msg/DispatchQueue.h:102
22 0x0000ffff7ef211b8 in Thread::entry_wrapper (this=0xaaaad30b8540) at /lsandbox/upstream/ceph/src/common/Thread.cc:88
23 0x0000ffff7ef211d8 in Thread::_entry_func (arg=<optimized out>) at /lsandbox/upstream/ceph/src/common/Thread.cc:75
24 0x0000ffff7da49b68 in start_thread () from /lib64/libc.so.6
25 0x0000ffff7dab350c [PAC] in thread_start () from /lib64/libc.so.6
---------------
Check the tracker for more details
Fixes: https://tracker.ceph.com/issues/75676
Signed-off-by: Kotresh HR <[email protected]>
8d760c7 to
2e842da
Compare
|
@vshankar ptal |
|
This PR has been added to main integration testing by vshankar started 2026-08-05-16:27. |
The MDCache::file_blockdiff can deadlock
itself with the mds_lock.
The MDSDaemon::ms_dispatch2 takes the mds_lock
and MDCache::file_blockdiff tries to acquire
same lock while finishing it's context synchronously
at gather_ctx.activate()
The fix is to call finish() directly in synchronous case and
use a noop gather finisher only to tear down the gather.
Following is the traceback
Check the tracker for more details
Fixes: https://tracker.ceph.com/issues/75676
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
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.