From b6ba30ba573023aa46416bad7da465e614d21491 Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Wed, 10 May 2017 16:56:06 -0400 Subject: [PATCH] mds: delay export until dir is stable This catches an assertion failure due to exports on unjournaled directories: 2017-05-10 12:45:18.193640 7eff65a04700 7 mds.0.migrator export_dir [dir 10000000003 /a/ [2,head] auth pv=3 v=1 cv=0/0 ap=1+2+2 state=1073742082|complete f()->f(v0 m2017-05-10 12:45:14.977151 1=0+1) n()->n(v0 rc2017-05-10 12:45:14.977151 1=0+1) hs=0+1,ss=0+0 | child=1 authpin=1 0x55ef655de000] to 1 2017-05-10 12:45:18.193654 7eff65a04700 15 mds.0.18 hit export target 10 @ 2017-05-10 12:45:18.193653 2017-05-10 12:45:18.193661 7eff65a04700 10 mds.0.cache.dir(10000000003) auth_pin by 0x55ef650cc130 on [dir 10000000003 /a/ [2,head] auth pv=3 v=1 cv=0/0 ap=2+2+2 state=1073742082|complete f()->f(v0 m2017-05-10 12:45:14.977151 1=0+1) n()->n(v0 rc2017-05-10 12:45:14.977151 1=0+1) hs=0+1,ss=0+0 | child=1 authpin=1 0x55ef655de000] count now 2 + 2 2017-05-10 12:45:18.193701 7eff65a04700 7 mds.0.cache request_start_internal request(mds.0:4) op 5377 2017-05-10 12:45:18.193708 7eff65a04700 7 mds.0.migrator dispatch_export_dir request(mds.0:4) 2017-05-10 12:45:18.198281 7eff66205700 20 mgrc operator() 234 counters, of which 0 new 2017-05-10 12:45:18.198294 7eff66205700 20 mgrc send_report encoded 2006 bytes 2017-05-10 12:45:18.198298 7eff66205700 1 -- 127.0.0.1:6825/693985647 --> 127.0.0.1:6826/1025 -- mgrreport(+0-0 packed 2006) v2 -- 0x55ef655abe00 con 0 2017-05-10 12:45:18.198364 7eff6a9ab700 10 _calc_signature seq 14 front_crc_ = 2388339344 middle_crc = 0 data_crc = 0 sig = 5026349537430007662 2017-05-10 12:45:18.198376 7eff6a9ab700 20 Putting signature in client message(seq # 14): sig = 5026349537430007662 2017-05-10 12:45:18.198411 7eff65a04700 -1 /home/pdonnell/ceph/src/mds/MDCache.cc: In function 'void MDCache::make_trace(std::vector&, CInode*)' thread 7eff65a04700 time 2017-05-10 12:45:18.194136 /home/pdonnell/ceph/src/mds/MDCache.cc: 8225: FAILED assert(parent) ceph version 12.0.1-2198-ge757c02 (e757c025fa3270b12fb2fca17cf159fa1bd72747) 1: (ceph::__ceph_assert_fail(char const*, char const*, int, char const*)+0x102) [0x55ef5b780f02] 2: (MDCache::make_trace(std::vector >&, CInode*)+0x1cb) [0x55ef5b4fa12b] 3: (Migrator::get_export_lock_set(CDir*, std::set, std::allocator >&)+0x55) [0x55ef5b5e8215] 4: (Migrator::dispatch_export_dir(boost::intrusive_ptr&, int)+0xa74) [0x55ef5b5f72d4] 5: (Migrator::export_dir(CDir*, int)+0x9ca) [0x55ef5b5ea75a] 6: (MDBalancer::handle_export_pins()+0x7b4) [0x55ef5b61ab24] 7: (MDBalancer::tick()+0x1e8) [0x55ef5b61b748] 8: (MDSRankDispatcher::tick()+0x5f1) [0x55ef5b44bdb1] 9: (Context::complete(int)+0x9) [0x55ef5b43bcc9] 10: (SafeTimer::timer_thread()+0x452) [0x55ef5b77dd52] 11: (SafeTimerThread::entry()+0xd) [0x55ef5b77f15d] 12: (()+0x76ba) [0x7eff6d4bb6ba] 13: (clone()+0x6d) [0x7eff6c52782d] Signed-off-by: Patrick Donnelly --- src/mds/Migrator.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mds/Migrator.cc b/src/mds/Migrator.cc index 4e8934751d162..140a615925451 100644 --- a/src/mds/Migrator.cc +++ b/src/mds/Migrator.cc @@ -890,6 +890,12 @@ void Migrator::dispatch_export_dir(MDRequestRef& mdr, int count) return; } + if (!dir->inode->get_parent_dn()) { + dout(7) << "waiting for dir to become stable before export: " << *dir << dendl; + dir->add_waiter(CDir::WAIT_CREATED, new C_M_ExportTargetWait(this, mdr, 1)); + return; + } + if (mdr->aborted || dir->is_frozen() || dir->is_freezing()) { dout(7) << "wouldblock|freezing|frozen, canceling export" << dendl; export_try_cancel(dir); -- 2.39.5