Page MenuHomeFreeBSD

mountroot: Run statfs after mounting devfs
ClosedPublic

Authored by kp on Oct 4 2019, 5:18 PM.
Tags
None
Referenced Files
Unknown Object (File)
Jan 3 2024, 8:14 PM
Unknown Object (File)
Dec 22 2023, 10:15 PM
Unknown Object (File)
Dec 14 2023, 11:46 PM
Unknown Object (File)
Dec 6 2023, 12:08 AM
Unknown Object (File)
Oct 26 2023, 8:02 PM
Unknown Object (File)
Sep 25 2023, 5:09 PM
Unknown Object (File)
Sep 7 2023, 4:48 AM
Unknown Object (File)
Sep 7 2023, 4:48 AM
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 Skipped
Unit
Tests Skipped
Build Status
Buildable 26866

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.