Page MenuHomeFreeBSD

mountroot: Run statfs after mounting devfs
ClosedPublic

Authored by kp on Oct 4 2019, 5:18 PM.
Tags
None
Referenced Files
F103243373: D21897.diff
Fri, Nov 22, 1:56 PM
Unknown Object (File)
Fri, Nov 8, 4:46 AM
Unknown Object (File)
Fri, Nov 8, 4:45 AM
Unknown Object (File)
Thu, Nov 7, 7:15 AM
Unknown Object (File)
Thu, Oct 24, 4:11 PM
Unknown Object (File)
Thu, Oct 24, 4:10 PM
Unknown Object (File)
Thu, Oct 24, 4:10 PM
Unknown Object (File)
Thu, Oct 24, 3:48 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.