Skip to content

fix: stale read issue when probing#148

Merged
talos-bot merged 1 commit intosiderolabs:v2from
smira:fix/stale-read
Mar 10, 2026
Merged

fix: stale read issue when probing#148
talos-bot merged 1 commit intosiderolabs:v2from
smira:fix/stale-read

Conversation

@smira
Copy link
Copy Markdown
Member

@smira smira commented Mar 10, 2026

An utility used to format the partition (e.g. cryptsetup) might open the block device with O_DIRECT, so the next read done by the probing code might be hitting the buffer cache, and it doesn't see the writes done by cryptsetup (the cache is not coherent).

We can't use O_DIRECT for I/O, as it has tight requirements for aligning the reads and writes, so instead ask Linux to invalidate the cache before probing.

We only probe on blockdevice changes, so it shouldn't cause performance issues.

An utility used to format the partition (e.g. cryptsetup) might open the
block device with `O_DIRECT`, so the next read done by the probing code
might be hitting the buffer cache, and it doesn't see the writes done by
`cryptsetup` (the cache is not coherent).

We can't use `O_DIRECT` for I/O, as it has tight requirements for
aligning the reads and writes, so instead ask Linux to invalidate the
cache before probing.

We only probe on blockdevice changes, so it shouldn't cause performance
issues.

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
@github-project-automation github-project-automation bot moved this to To Do in Planning Mar 10, 2026
@talos-bot talos-bot moved this from To Do to In Review in Planning Mar 10, 2026
@github-project-automation github-project-automation bot moved this from In Review to Approved in Planning Mar 10, 2026
@smira
Copy link
Copy Markdown
Member Author

smira commented Mar 10, 2026

/m

@talos-bot talos-bot merged commit c9eb826 into siderolabs:v2 Mar 10, 2026
15 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in Planning Mar 10, 2026
smira added a commit to smira/talos that referenced this pull request Mar 10, 2026
This pulls in a fix siderolabs/go-blockdevice#148

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
smira added a commit to smira/talos that referenced this pull request Mar 11, 2026
This pulls in a fix siderolabs/go-blockdevice#148

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
smira added a commit to smira/talos that referenced this pull request Mar 18, 2026
This pulls in a fix siderolabs/go-blockdevice#148

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
(cherry picked from commit ad3c59a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants