From 727aef4db8e9fb0ca41d0b72118aefa5df9ff436 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 29 Jun 2017 10:32:20 -0400 Subject: [PATCH] os/bluestore/BlueFS: clean up log_writer aios from compaction 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 --- src/os/bluestore/BlueFS.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index f73e27cf603..883dbf94410 100644 --- a/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc @@ -1138,6 +1138,11 @@ void BlueFS::_compact_log_sync() assert(r == 0); wait_for_aio(log_writer); + list 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& l) // 4. wait dout(10) << __func__ << " waiting for compacted log to sync" << dendl; wait_for_aio(new_log_writer); + + list completed_ios; + _claim_completed_aios(new_log_writer, &completed_ios); flush_bdev(); + completed_ios.clear(); // 5. retake lock lock.lock(); -- 2.39.5