mount/kldload race
Jamie Gritton
jamie at FreeBSD.org
Wed Feb 20 03:59:18 UTC 2013
Perhaps most people don't try to mount a bunch of filesystems at the
same time, at least not those that depend on kernel modules. But it
turns out that's going to be a pretty common situation with jails and
nullfs. And I found that when attempting such a feat will cause most of
these simultaneous mounts to fail with ENODEV.
It turns out that the problem is a race in vfs_byname_kld(). First it'll
see if the fstype is loaded, and if it isn't then it will load the
module. But if the module is loaded by a different process between those
two points, the resulting EEXIST from kern_kldload() will make
vfs_byname_kld() error out.
The fix is pretty simple: don't treat EEXIST as an error. By going on,
and rechecking for the fstype, the filesystem can be mounted while still
allowing any "real" error to be caught. I'm including a small patch that
will accomplish this, and I'd appreciate a quick look by anyone who's
familiar with this part of things before I commit it.
- Jamie
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: vfs_init.diff
URL: <http://lists.freebsd.org/pipermail/freebsd-fs/attachments/20130219/8ad803bf/attachment.ksh>
More information about the freebsd-fs
mailing list