Skip to content

Trivial backport of #18645 (freebsd: set mnt_time on the rootfs at mountroot time)#18702

Open
kevans91 wants to merge 3 commits into
openzfs:zfs-2.4.4-stagingfrom
kevans91:ke/mnt_backport
Open

Trivial backport of #18645 (freebsd: set mnt_time on the rootfs at mountroot time)#18702
kevans91 wants to merge 3 commits into
openzfs:zfs-2.4.4-stagingfrom
kevans91:ke/mnt_backport

Conversation

@kevans91

Copy link
Copy Markdown
Contributor

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_time has been in FreeBSD's struct mount for ~31 years, so this should build everywhere without a problem.

kevans91 added 3 commits June 24, 2026 18:25
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 behlendorf added the Status: Accepted Ready to integrate (reviewed, tested) label Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Accepted Ready to integrate (reviewed, tested)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants