extend-filesystems: Fix race condition by not using lsblk#132
Merged
chewi merged 1 commit intoflatcar-masterfrom Jun 12, 2025
Merged
extend-filesystems: Fix race condition by not using lsblk#132chewi merged 1 commit intoflatcar-masterfrom
chewi merged 1 commit intoflatcar-masterfrom
Conversation
jepio
approved these changes
Jun 12, 2025
lsblk relies on udev, which is inherently racy, especially when the filesystem has just been mounted. It has been observed that the FSTYPE field is sometimes not populated, preventing the filesystem from being resized, and causing tests involving the dev container (which is large) to fail. Use findmnt instead, which gets its information directly from the kernel. It also natively supports filtering by filesystem type and mount option. It doesn't fetch PARTTYPE, but we can safely get that from cgpt. Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
557815c to
0397383
Compare
chewi
added a commit
to flatcar/scripts
that referenced
this pull request
Jun 12, 2025
An associated Kola fix is included. Closes: flatcar/init#132 Closes: flatcar/Flatcar#296 Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
Merged
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
extend-filesystems: Fix race condition by not using lsblk
lsblk relies on udev, which is inherently racy, especially when the filesystem has just been mounted. It has been observed that the
FSTYPEfield is sometimes not populated, preventing the filesystem from being resized, and causing tests involving the dev container (which is large) to fail.Use findmnt instead, which gets its information directly from the kernel. It also natively supports filtering by filesystem type and mount option. It doesn't fetch
PARTTYPE, but we can safely get that from cgpt.This could be quite an important fix. We have only seen test failures so far, and maybe that's because it only triggers when the system is under load, but I see no reason why it wouldn't happen in production. Perhaps this only started breaking recently following an update to the kernel or udev or something.
How to use
Check that the extend-filesystems.service unit works successfully and that / is actually resized.
Testing done
CI has passed. I previously forced the test to fail so that it would retry and I could see the output. Once I had applied the fix, it would successfully resize every time, whereas before it would fail most of the time.