]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: execute PurgeQueue on_error handler in finisher 29064/head
authorYan, Zheng <zyan@redhat.com>
Tue, 16 Jul 2019 07:38:28 +0000 (15:38 +0800)
committerYan, Zheng <zyan@redhat.com>
Fri, 26 Jul 2019 01:36:53 +0000 (09:36 +0800)
Fix: https://tracker.ceph.com/issues/40695
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
src/mds/MDSRank.cc
src/mds/PurgeQueue.cc

index 76fe4ce3d88a335df7eee6b457cc295e9208c3b7..48121b1fa467adb3a5d470e25a3a3db04ca8646c 100644 (file)
@@ -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),
index aa9c7f7e104bcf52e7cf147e8d5b9bfd25be5f24..372666b1aa3f315077c63601027c801dc1b47d0e 100644 (file)
@@ -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));