]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: reimplement/rename _sync -> _flush_all
authorSage Weil <sage@redhat.com>
Wed, 8 Mar 2017 20:01:28 +0000 (15:01 -0500)
committerSage Weil <sage@redhat.com>
Tue, 21 Mar 2017 18:56:28 +0000 (13:56 -0500)
The old implementation is racy and doesn't actually work.  Instead, rely
on a list of all OpSequencers and drain them all.

Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h

index d726469ad649fad29c25461e87deba8e282f2227..04ca35354cc80b2dee673c8db86bbcb1c5f2d356 100644 (file)
@@ -4814,7 +4814,7 @@ int BlueStore::umount()
   assert(mounted);
   dout(1) << __func__ << dendl;
 
-  _sync();
+  _osr_drain_all();
 
   mempool_thread.shutdown();
 
@@ -5408,23 +5408,6 @@ int BlueStore::fsck(bool deep)
   return errors;
 }
 
-void BlueStore::_sync()
-{
-  dout(10) << __func__ << dendl;
-
-  // flush aios in flight
-  bdev->flush();
-
-  std::unique_lock<std::mutex> l(kv_lock);
-  while (!kv_committing.empty() ||
-        !kv_queue.empty()) {
-    dout(20) << " waiting for kv to commit" << dendl;
-    kv_sync_cond.wait(l);
-  }
-
-  dout(10) << __func__ << " done" << dendl;
-}
-
 int BlueStore::statfs(struct store_statfs_t *buf)
 {
   buf->reset();
@@ -7512,6 +7495,26 @@ void BlueStore::_txc_release_alloc(TransContext *txc)
   txc->released.clear();
 }
 
+void BlueStore::_osr_drain_all()
+{
+  dout(10) << __func__ << dendl;
+
+  // WARNING: we make a (somewhat sloppy) assumption here that
+  // no OpSequencers will be created or destroyed for the duration
+  // of this method.
+  set<OpSequencer*> s;
+  {
+    std::lock_guard<std::mutex> l(osr_lock);
+    s = osr_set;
+  }
+  for (auto osr : s) {
+    dout(20) << __func__ << " flush " << osr << dendl;
+    osr->drain();
+  }
+
+  dout(10) << __func__ << " done" << dendl;
+}
+
 void BlueStore::_kv_sync_thread()
 {
   dout(10) << __func__ << " start" << dendl;
index d419e4b14d6dbf0838ef53d17ea37c5fa2fa3de5..6bd3b20c25be9b37b3ed1dec39250b57273653e3 100644 (file)
@@ -1889,6 +1889,7 @@ private:
   void _txc_release_alloc(TransContext *txc);
 
   void _osr_reap_done(OpSequencer *osr);
+  void _osr_drain_all();
 
   void _kv_sync_thread();
   void _kv_stop() {
@@ -1974,7 +1975,6 @@ public:
 
   int mount() override;
   int umount() override;
-  void _sync();
 
   int fsck(bool deep) override;