Fix incorrect timestamp assignment when writing inode#92
Open
EricKim27 wants to merge 1 commit into
Open
Conversation
jserv
requested changes
Jul 21, 2026
jserv
left a comment
Collaborator
There was a problem hiding this comment.
Improve git commit messages per https://cbea.ms/git-commit/
Contributor
Author
|
@jserv Modified the commit message as requested. Thanks for your feedback. |
Collaborator
Check https://cbea.ms/git-commit/ carefully and improve git commit messages to address motivations and considerations. |
Contributor
Author
I read the article you provided to me and improved the messages that would address my motivations and considerations. Thanks for the feedback. |
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.
fix simplefs_write_inode to write the access time into disk_inode->i_atime and the modification time into disk_inode->i_mtime correctly.
After an inode has been modified or created, simplefs_write_inode(assigned to write_inode in simplefs_super_ops) is called to write the contents in the vfs inode to the relevant raw inode on disk. Because of a typo in simplefs_write_inode, i_atime gets assigned twice; once for writing access time, and again for writing modification time to it.
As a result, the raw inode metadata contains modification time on its access time field, and the modification time is never updated. Upon calling system calls like stat(), it returns modification time as access time, and an incorrect modification time(since it is never updated, and all bytes are zeroed out at mkfs, it defaults to 0, January 1st, 1970 in unix time).
Fix the assignments so access time is written to i_atime field and modification time is written to i_mtime field on on-disk inode structure.
Summary by cubic
Fixes mtime not updating by correcting a typo in super.c: write to i_mtime instead of i_atime in simplefs_write_inode for kernel >= 6.7. Files now record and show the correct modification time instead of 1970-01-01.
Written for commit 94e6f18. Summary will update on new commits.