From: Ilya Dryomov Date: Wed, 28 Apr 2021 12:27:12 +0000 (+0200) Subject: librbd/cache/pwl/ssd/WriteLog: decrement m_bytes_allocated when retiring X-Git-Tag: v16.2.7~50^2~59 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3d5d56d2c1d916ec75eb1f6a58fafd89f0af95d3;p=ceph.git librbd/cache/pwl/ssd/WriteLog: decrement m_bytes_allocated when retiring Currently if ssd cache is filled to capacity, all future I/O hangs indefinitely because even though the cache eventually becomes clean and retires enough entries to get back under RETIRE_HIGH_WATER, this isn't communicated to AbstractWriteLog::check_allocation(). trivial fix: indentation https://www.diffchecker.com/9Vg9hgdl Fixes: https://tracker.ceph.com/issues/50560 Signed-off-by: Ilya Dryomov (cherry picked from commit e2bbf4167fc8816d329ceae5c07c9e61599d9a17) --- diff --git a/src/librbd/cache/pwl/ssd/WriteLog.cc b/src/librbd/cache/pwl/ssd/WriteLog.cc index b72e71fc09e..7b8a1968762 100644 --- a/src/librbd/cache/pwl/ssd/WriteLog.cc +++ b/src/librbd/cache/pwl/ssd/WriteLog.cc @@ -700,29 +700,31 @@ bool WriteLog::retire_entries(const unsigned long int frees_per_tx) { //space for userdata allocated_bytes += entry->get_aligned_data_size(); } - } - { - std::lock_guard locker(m_lock); - m_first_valid_entry = first_valid_entry; - ceph_assert(m_first_valid_entry % MIN_WRITE_ALLOC_SSD_SIZE == 0); - this->m_free_log_entries += retiring_entries.size(); - ceph_assert(this->m_bytes_cached >= cached_bytes); - this->m_bytes_cached -= cached_bytes; - - ldout(m_image_ctx.cct, 20) - << "Finished root update: " << "initial_first_valid_entry=" - << initial_first_valid_entry << ", " << "m_first_valid_entry=" - << m_first_valid_entry << "," << "release space = " - << allocated_bytes << "," << "m_bytes_allocated=" - << m_bytes_allocated << "," << "release cached space=" - << allocated_bytes << "," << "m_bytes_cached=" - << this->m_bytes_cached << dendl; - - this->m_alloc_failed_since_retire = false; - this->wake_up(); - m_async_update_superblock--; - this->m_async_op_tracker.finish_op(); - } + } + { + std::lock_guard locker(m_lock); + m_first_valid_entry = first_valid_entry; + ceph_assert(m_first_valid_entry % MIN_WRITE_ALLOC_SSD_SIZE == 0); + this->m_free_log_entries += retiring_entries.size(); + ceph_assert(this->m_bytes_allocated >= allocated_bytes); + this->m_bytes_allocated -= allocated_bytes; + ceph_assert(this->m_bytes_cached >= cached_bytes); + this->m_bytes_cached -= cached_bytes; + + ldout(m_image_ctx.cct, 20) + << "Finished root update: " << "initial_first_valid_entry=" + << initial_first_valid_entry << ", " << "m_first_valid_entry=" + << m_first_valid_entry << "," << "release space = " + << allocated_bytes << "," << "m_bytes_allocated=" + << m_bytes_allocated << "," << "release cached space=" + << cached_bytes << "," << "m_bytes_cached=" + << this->m_bytes_cached << dendl; + + this->m_alloc_failed_since_retire = false; + this->wake_up(); + m_async_update_superblock--; + this->m_async_op_tracker.finish_op(); + } this->dispatch_deferred_writes(); this->process_writeback_dirty_entries();