Page MenuHomeFreeBSD

mountroot: Run statfs after mounting devfs

Authored by kp on Fri, Oct 4, 5:18 PM.



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

rS FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

kp created this revision.Fri, Oct 4, 5:18 PM
imp added a comment.Fri, Oct 4, 5:24 PM

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?

kp added a comment.Fri, Oct 4, 7:16 PM

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.

mckusick accepted this revision.Fri, Oct 11, 4:30 AM

I concur that VFS_STATFS should be done here.

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