From 6e9e3757be3d9ad1f40ca082144f41c24629ea72 Mon Sep 17 00:00:00 2001 From: "Yan, Zheng" Date: Tue, 16 Jul 2019 15:38:28 +0800 Subject: [PATCH] mds: execute PurgeQueue on_error handler in finisher Fix: https://tracker.ceph.com/issues/40695 Signed-off-by: "Yan, Zheng" --- src/mds/MDSRank.cc | 15 ++++----------- src/mds/PurgeQueue.cc | 5 +++-- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index 76fe4ce3d88..48121b1fa46 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -499,17 +499,10 @@ MDSRank::MDSRank( cluster_degraded(false), stopping(false), purge_queue(g_ceph_context, whoami_, mdsmap_->get_metadata_pool(), objecter, - new FunctionContext( - [this](int r){ - // Purge Queue operates inside mds_lock when we're calling into - // it, and outside when in background, so must handle both cases. - if (mds_lock.is_locked_by_me()) { - handle_write_error(r); - } else { - std::lock_guard l(mds_lock); - handle_write_error(r); - } - } + new FunctionContext([this](int r) { + std::lock_guard l(mds_lock); + handle_write_error(r); + } ) ), progress_thread(this), dispatch_depth(0), diff --git a/src/mds/PurgeQueue.cc b/src/mds/PurgeQueue.cc index aa9c7f7e104..372666b1aa3 100644 --- a/src/mds/PurgeQueue.cc +++ b/src/mds/PurgeQueue.cc @@ -404,7 +404,7 @@ void PurgeQueue::_go_readonly(int r) if (readonly) return; dout(1) << "going readonly because internal IO failed: " << strerror(-r) << dendl; readonly = true; - on_error->complete(r); + finisher.queue(on_error, r); on_error = nullptr; journaler.set_readonly(); finish_contexts(g_ceph_context, waiting_for_recovery, r); @@ -570,7 +570,8 @@ void PurgeQueue::_execute_item( // Also do this periodically even if not idle, so that the persisted // expire_pos doesn't fall too far behind our progress when consuming // a very long queue. - if (in_flight.empty() || journaler.write_head_needed()) { + if (!readonly && + (in_flight.empty() || journaler.write_head_needed())) { journaler.write_head(nullptr); } }), &finisher)); -- 2.39.5