Repository navigation
Fix failed-mount teardown and CI regressions - #101
Merged
Merged
Conversation
Since 6.7, simplefs_kill_sb() dereferenced sb->s_fs_info to release the external journal device, but the VFS calls kill_sb even when fill_super failed, where that pointer is NULL or already freed. It also released the device before put_super had finished using it. Release the journal device in simplefs_put_super() after the journal is torn down, which is where 5.10 to 6.5 already did it, and reduce kill_sb to kill_block_super(). Clear s_fs_info when fill_super frees sbi. Also fix error paths hit on the same route: a NULL journal returned as success, a double iput after d_make_root() failure, a double brelse, leaked or prematurely dropped path references, and a bogus return value from option parsing. Co-authored-by: ChinYikMing <yikming2222@gmail.com>
simplefs_write() clamped len to zero once pos reached the maximum file size and returned 0. A caller that retries zero-byte writes, such as uutils dd shipped with recent Ubuntu, then spins forever, which hung the CI test for six hours. Return -EFBIG instead, as write(2) specifies, and make the test report a write over the limit that succeeds.
The coding_style CI job flags a compound literal brace and two comment indents that predate this branch. Reformat them so the job passes.
jserv
force-pushed
the
fix/failed-mount-teardown
branch
from
November 4, 2026 01:51
5231170 to
13e42e8
Compare
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.
Since 6.7, simplefs_kill_sb() read sb->s_fs_info to release the external journal device, but the VFS calls kill_sb even when fill_super failed, where that pointer is NULL (or already freed by fill_super's error path). This is the unmount crash described at sysprog21/rv32emu#827 (comment). kill_sb also dropped the journal device before put_super had finished using it. The journal device is now released at the end of simplefs_put_super(), as 5.10 to 6.5 already did, and kill_sb is just kill_block_super(); fill_super clears s_fs_info when it frees sbi.
The same route also had a handful of error-path bugs, fixed here: simplefs_get_dev_journal() returned NULL where the caller checks IS_ERR(), a double iput() after d_make_root() failure, a double brelse() of the superblock buffer, path references leaked or read after path_put(), and a bogus return value from option parsing.
The branch also carries the two fixes needed to get CI green, which were already failing on master. simplefs_write() returned 0 once the write position hit the maximum file size, and a caller that retries zero-byte writes spins forever; the CI image now ships uutils dd, which does, so test_too_large_file hung until the 6 hour job limit. It now returns -EFBIG as write(2) specifies and the test expects the failure. The coding_style job also flagged three clang-format deviations in mkfs.c and inode.c that predate this branch, reformatted in their own commit.
The teardown change was verified only by compiling fs.c and super.c against the 6.17 kernel headers in Lima; the module was not loaded or mounted and make check was not run. The 7.3+ branch (fs_bdev_file_release() in put_super) and the kernels below 6.17 were not built. Reviewed independently by Codex, Agy and Claude. Not addressed: mounting read-only should fail up front instead of surfacing later write errors, and journal_path pointing at a non-block file is still silently ignored.