Skip to content

metadata: Prevent read hoisting in hash bucket lock#950

Merged
robertbaldyga merged 1 commit intoOpen-CAS:masterfrom
robertbaldyga:hb-lock-entry-read-atomic
Apr 1, 2026
Merged

metadata: Prevent read hoisting in hash bucket lock#950
robertbaldyga merged 1 commit intoOpen-CAS:masterfrom
robertbaldyga:hb-lock-entry-read-atomic

Conversation

@robertbaldyga
Copy link
Copy Markdown
Member

@robertbaldyga robertbaldyga commented Mar 31, 2026

Replace plain read with atomic read to prevent compiler from read hoisting the entry value. So far the loop indirectly relied on OCF_COND_RESCHED_DEFAULT() acting as a opaque barrier, which does not need to be the case, especially in environments where OCF_COND_RESCHED_DEFAULT() is implemented as no-op.

Fixes #948

Replace plain read with atomic read to prevent compiler from
read hoisting the entry value. So far the loop indirectly relied
on OCF_COND_RESCHED_DEFAULT() acting as a opaque barrier, which
does not need to be the case, especially in environments where
OCF_COND_RESCHED_DEFAULT() is implemented as no-op.

Signed-off-by: Robert Baldyga <robert.baldyga@unvertical.com>
@robertbaldyga robertbaldyga merged commit d8ced0f into Open-CAS:master Apr 1, 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.

Deadlock during multithread IO in SPDK.

1 participant