Skip to content

Fix cached_clines counter leak on invalidation with waiters#937

Merged
robertbaldyga merged 2 commits intoOpen-CAS:masterfrom
robertbaldyga:fix-cache-line-accounting-on-inv
Mar 11, 2026
Merged

Fix cached_clines counter leak on invalidation with waiters#937
robertbaldyga merged 2 commits intoOpen-CAS:masterfrom
robertbaldyga:fix-cache-line-accounting-on-inv

Conversation

@robertbaldyga
Copy link
Member

No description provided.

@robertbaldyga robertbaldyga force-pushed the fix-cache-line-accounting-on-inv branch from 96ee842 to f694366 Compare March 11, 2026 00:07
Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Robert Baldyga <robert.baldyga@unvertical.com>
When a cache line becomes fully invalid but has waiters
__set_cache_line_invalid() returns early without decrementing
cached_clines. The new owner that gets the lock may then increment
the counter again, causing a permanent leak.

Fix by decrementing the occupancy counter before the waiter check, since
the counter must reflect the actual valid state of the line regardless
of whether there are waiters.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Robert Baldyga <robert.baldyga@unvertical.com>
@robertbaldyga robertbaldyga force-pushed the fix-cache-line-accounting-on-inv branch from f694366 to dbf16af Compare March 11, 2026 10:00
@robertbaldyga robertbaldyga merged commit 508597b into Open-CAS:master Mar 11, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant