]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
os/bluestore/BlueFS: clean up log_writer aios from compaction
authorSage Weil <sage@redhat.com>
Thu, 29 Jun 2017 14:32:20 +0000 (10:32 -0400)
committerSage Weil <sage@redhat.com>
Thu, 29 Jun 2017 14:32:20 +0000 (10:32 -0400)
Normally any time we wait for aios and flush the device we go through
_flush_bdev_safely(), which takes the completed aios off of the IOContext
and discards them, releasing memory.  However, compaction does not use
that method because it does not (currently) drop the lock while doing the
flush, which means we slowly leak memory after each internal log
compaction.

Fix by explicitly releasing these aios, similar to _flush_bdev_safely().

Fixes: http://tracker.ceph.com/issues/20454
Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/BlueFS.cc

index f73e27cf6030c2ef346c486d20de1a924932ed02..883dbf94410af23c675f0139651484b56d14bed2 100644 (file)
@@ -1138,6 +1138,11 @@ void BlueFS::_compact_log_sync()
   assert(r == 0);
   wait_for_aio(log_writer);
 
+  list<aio_t> completed_ios;
+  _claim_completed_aios(log_writer, &completed_ios);
+  flush_bdev();
+  completed_ios.clear();
+
   dout(10) << __func__ << " writing super" << dendl;
   super.log_fnode = log_file->fnode;
   ++super.version;
@@ -1238,7 +1243,11 @@ void BlueFS::_compact_log_async(std::unique_lock<std::mutex>& l)
   // 4. wait
   dout(10) << __func__ << " waiting for compacted log to sync" << dendl;
   wait_for_aio(new_log_writer);
+
+  list<aio_t> completed_ios;
+  _claim_completed_aios(new_log_writer, &completed_ios);
   flush_bdev();
+  completed_ios.clear();
 
   // 5. retake lock
   lock.lock();