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>
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;
// 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();