]> 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)
committerDeepika Upadhyay <dupadhya@redhat.com>
Tue, 2 Nov 2021 11:41:42 +0000 (17:11 +0530)
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 <idryomov@gmail.com>
(cherry picked from commit e2bbf4167fc8816d329ceae5c07c9e61599d9a17)

src/librbd/cache/pwl/ssd/WriteLog.cc

index b72e71fc09e5cde7990e50f4bff065966b64d794..7b8a1968762e9a1d50f8f5a186f212edfecc086c 100644 (file)
@@ -700,29 +700,31 @@ bool WriteLog<I>::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();