]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd/cache/pwl/ssd/WriteLog: decrement m_bytes_allocated when retiring
authorIlya Dryomov <idryomov@gmail.com>
Wed, 28 Apr 2021 12:27:12 +0000 (14:27 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Thu, 29 Apr 2021 20:09:16 +0000 (22:09 +0200)
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 <idryomov@gmail.com>
src/librbd/cache/pwl/ssd/WriteLog.cc

index 3933c2b293cf20666eb6ae7ce9788e73ce3fdff8..b6e8c20994085c73c5f3c7f65631f47522168c77 100644 (file)
@@ -708,6 +708,8 @@ bool WriteLog<I>::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<I>::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;