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: v17.1.0~2096^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e2bbf4167fc8816d329ceae5c07c9e61599d9a17;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(). Fixes: https://tracker.ceph.com/issues/50560 Signed-off-by: Ilya Dryomov --- diff --git a/src/librbd/cache/pwl/ssd/WriteLog.cc b/src/librbd/cache/pwl/ssd/WriteLog.cc index 3933c2b293cf..b6e8c2099408 100644 --- a/src/librbd/cache/pwl/ssd/WriteLog.cc +++ b/src/librbd/cache/pwl/ssd/WriteLog.cc @@ -708,6 +708,8 @@ bool WriteLog::retire_entries(const unsigned long int frees_per_tx) { 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; @@ -717,7 +719,7 @@ bool WriteLog::retire_entries(const unsigned long int frees_per_tx) { << m_first_valid_entry << "," << "release space = " << allocated_bytes << "," << "m_bytes_allocated=" << m_bytes_allocated << "," << "release cached space=" - << allocated_bytes << "," << "m_bytes_cached=" + << cached_bytes << "," << "m_bytes_cached=" << this->m_bytes_cached << dendl; this->m_alloc_failed_since_retire = false;