From: Marcel Lauhoff Date: Tue, 3 Mar 2026 20:24:57 +0000 (+0100) Subject: common/web_cache: Fix _sieve_hand dangling pointer X-Git-Tag: v21.0.1~14^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3518aaf27bb5469e795c87d65442fd1dab2d5cb2;p=ceph.git common/web_cache: Fix _sieve_hand dangling pointer sieve_expire_erase_unmutexed did not update the sieve hand passed as advertised. Make it return the updated hand and use that to update the global _sieve_hand in expire_erase Signed-off-by: Marcel Lauhoff On-behalf-of: SAP marcel.lauhoff@sap.com --- diff --git a/src/common/web_cache.h b/src/common/web_cache.h index f123e6b9746..97c2e9dfb74 100644 --- a/src/common/web_cache.h +++ b/src/common/web_cache.h @@ -138,8 +138,8 @@ class WebCache { // sieve_expire_erase_unmutexed removes all expired nodes from the // sieve_queue in place. It writes the expired nodes to out_expired. - // Updates the sieve hand - static void sieve_expire_erase_unmutexed( + // Returns the updated sieve hand. + static Node* sieve_expire_erase_unmutexed( SieveQueue& sieve_queue, Node* sieve_hand, ceph::real_time eviction_cutoff, SieveQueue& out_expired); @@ -511,7 +511,7 @@ WebCache::lookup(const Key& key) { } template -void WebCache::sieve_expire_erase_unmutexed( +typename WebCache::Node* WebCache::sieve_expire_erase_unmutexed( SieveQueue& sieve_queue, Node* sieve_hand, ceph::real_time eviction_cutoff, SieveQueue& out_expired) { // The sieve queue is ordered by ascending insertion time which @@ -532,6 +532,7 @@ void WebCache::sieve_expire_erase_unmutexed( ++it; } } + return sieve_hand; } template @@ -540,7 +541,7 @@ size_t WebCache::expire_erase() { const auto expiration_cutoff = ceph::real_clock::now(); const auto lookup_size_before = _lookup.size(); SieveQueue expired; - sieve_expire_erase_unmutexed( + _sieve_hand = sieve_expire_erase_unmutexed( _sieve_queue, _sieve_hand, expiration_cutoff, expired); const auto expired_size = expired.size(); expired.clear_and_dispose(