Trivial backport of #18645 (freebsd: set mnt_time on the rootfs at mountroot time)#18702
Open
kevans91 wants to merge 3 commits into
Open
Trivial backport of #18645 (freebsd: set mnt_time on the rootfs at mountroot time)#18702kevans91 wants to merge 3 commits into
kevans91 wants to merge 3 commits into
Conversation
These don't modify the db, so just constify them while we're in the area. Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Chris Longros <chris.longros@gmail.com> Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
Returns 0 if the database is empty, otherwise it returns the highest value of the minutely db. dbrrd_add() will already enforce the property that these are monotonically increasing, so we won't try to second-guess it. Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Chris Longros <chris.longros@gmail.com> Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
FreeBSD's vfs_mountroot() will collect `mnt_time` from every filesystem that we mounted and use the highest timestamp as a source for the system time if we didn't get anything from an attached RTC. Use the rrd mechanism added to gather up a notion of the latest time and set it on mnt_time. If the timestamp db is empty, we just fallback to the uberblock timestamp and hope that that is in the right ballpark. Relevant: FreeBSD PR254058[0] reporting the problem downstream [0] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=254058 Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Chris Longros <chris.longros@gmail.com> Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
behlendorf
approved these changes
Jun 25, 2026
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.
The appliance that motivated the change is based on FreeBSD 15.x, so it'd be quite useful to get this back into ZFS 2.4.4 / FreeBSD 15.2 (late 2026 / early 2027). No conflicts in backporting and FreeBSD's
mnt_timehas been in FreeBSD'sstruct mountfor ~31 years, so this should build everywhere without a problem.