fix(fs-lib): append root fstab entry only when missing - #2600
Open
prabhakarpujeri wants to merge 1 commit into
Open
fix(fs-lib): append root fstab entry only when missing#2600prabhakarpujeri wants to merge 1 commit into
prabhakarpujeri wants to merge 1 commit into
Conversation
Collaborator
|
CC @mwilck |
devkontrol
approved these changes
Aug 17, 2026
prabhakarpujeri
force-pushed
the
fix/fs-lib-write-fs-tab
branch
from
August 19, 2026 03:52
285ac77 to
fd3b72d
Compare
Commit b12f818 ("feat(nbd): support ipv6 link local nbds") changed the previously unconditional append in write_fs_tab() into a conditional to avoid duplicate entries, but inverted the test: the /sysroot entry is appended only when it is already present (creating duplicates), and the function returns early in the normal case where it is absent, so the entry is never written. Callers in the iscsi and nbd modules rely on write_fs_tab() to record the root filesystem in the initramfs fstab with the resolved rootfstype/rootflags and to trigger daemon-reload and initrd-root-fs.target. Negate the grep test so the entry is appended exactly when it is missing, preserving the intended de-duplication. Verified in a sandboxed harness running the extracted function: with an empty fstab the old code writes nothing while the new code appends one correct entry; with a pre-existing entry the old code duplicates it while the new code keeps exactly one. Fixes: b12f818 ("feat(nbd): support ipv6 link local nbds")
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.
Problem
Commit b12f818 ("feat(nbd): support ipv6 link local nbds") changed the previously unconditional append in
write_fs_tab()into a conditional — to avoid duplicate entries — but inverted the test:As a result:
/sysrootentry is never added to the initramfs fstab.Callers in the iscsi and nbd modules (
iscsiroot.sh,parse-iscsiroot.sh,nbdroot.sh) rely onwrite_fs_tab()to record the root filesystem with the resolved rootfstype/rootflags and to triggerdaemon-reload+initrd-root-fs.target.Fix
Negate the test so the entry is appended exactly when it is missing, and drop the now-pointless
else return. This preserves the original de-duplication intent of b12f818.Testing
Sandboxed harness executing the real
write_fs_tab()(old fromgit show HEAD:, new from the working tree), with/etc/fstabrepointed to a scratch file:auto ro,x-initrd.mount 0 0)rwon cmdlinero,x-initrd.mount,rwshellcheck modules.d/70fs-lib/fs-lib.shclean.Fixes: b12f818 ("feat(nbd): support ipv6 link local nbds")