Page MenuHomeFreeBSD

mountroot: Run statfs after mounting devfs
ClosedPublic

Authored by kp on Oct 4 2019, 5:18 PM.
Tags
None
Referenced Files
F167676124: D21897.id63155.diff
Sun, Aug 23, 5:22 PM
F167582785: D21897.id63155.diff
Sat, Aug 22, 9:11 PM
F167582742: D21897.id62907.diff
Sat, Aug 22, 9:11 PM
F167582647: D21897.diff
Sat, Aug 22, 9:10 PM
Unknown Object (File)
Mon, Aug 17, 11:55 PM
Unknown Object (File)
Thu, Aug 13, 1:57 PM
Unknown Object (File)
Mon, Aug 10, 2:22 PM
Unknown Object (File)
Jul 22 2026, 11:09 PM
Subscribers
None

Details

Summary

The usual flow for mounting a file system is to VFS_MOUNT() and then
immediately VFS_STATFS().

That's not done in vfs_mountroot_devfs(), which means the
mp->mnt_stat.f_iosize field is not correctly populated, which in turn
causes us to mark valid aio operations as unsafe (because the io size is
set to 0), ultimately causing the aio_test:md_waitcomplete test to fail.

Sponsored by: Axiado

Test Plan

Run /usr/tests/sys/aio tests (without devd running).

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

I think this is OK. But since it's only /dev that's being mounted here, is the reported problem with aio on raw devices?

This happens on a riscv machine, running from an mdroot (although I'm not sure if that's relevant to trigger it), not running devd during the aio_test:md_waitcomplete regression test.
That test opens /dev/mdX and tries to perform an aio write on it, which ends up failing. I'm not sure I fully understand the intent behind the test, but it revealed that the aio code considered that to be an unsafe. The safety check code thinks that mp->mnt_stat.f_iosize is relevant, and because of the lack of VFS_STATFS call that was still set to 0 for devfs.

It's a fairly convoluted scenario to actually trigger this, but we happened to run into it, and this does make the code more consistent about always following VFS_MOUNT with VFS_STATFS.

I concur that VFS_STATFS should be done here.

This revision is now accepted and ready to land.Oct 11 2019, 4:30 AM
This revision was automatically updated to reflect the committed changes.