Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email firstname.lastname@example.org
From: Artur Grabowski (art_at_cvs.openbsd.org)
Date: Fri Jul 12 2002 - 09:02:23 CDT
Module name: src
Changes by: artcvs.openbsd.org 2002/07/12 08:02:23
sys/kern : vfs_subr.c vfs_syscalls.c
sys/sys : mount.h
sys/ufs/ffs : ffs_softdep.c
sys/ufs/lfs : lfs_bio.c
sys/ufs/mfs : mfs_vfsops.c
sys/nfs : nfs_syscalls.c
Change the locking on the mountpoint slightly. Instead of using mnt_lock
to get shared locks for lookup and get the exclusive lock only with
LK_DRAIN on unmount and do the real exclusive locking with flags in
mnt_flags, we now use shared locks for lookup and an exclusive lock for
This is accomplished by slightly changing the semantics of vfs_busy.
Old vfs_busy behavior:
- with LK_NOWAIT set in flags, a shared lock was obtained if the
mountpoint wasn't being unmounted, otherwise we just returned an error.
- with no flags, a shared lock was obtained if the mountpoint was being
unmounted, otherwise we slept until the unmount was done and returned
LK_NOWAIT was used for sync(2) and some statistics code where it isn't really
critical that we get the correct results.
0 was used in fchdir and lookup where it's critical that we get the right
directory vnode for the filesystem root.
After this change vfs_busy keeps the same behavior for no flags and LK_NOWAIT.
But if some other flags are passed into it, they are passed directly
into lockmgr (actually LK_SLEEPFAIL is always added to those flags because
if we sleep for the lock, that means someone was holding the exclusive lock
and the exclusive lock is only held when the filesystem is being unmounted.
dounmount must now be called with the exclusive lock held. (before this
the caller was supposed to hold the vfs_busy lock, but that wasn't always
Zap some (now) unused mount flags.
And the highlight of this change:
Add some vfs_busy calls to match some vfs_unbusy calls, especially in
sys_mount. (lockmgr doesn't detect the case where we release a lock noone
holds (it will do that soon)).
If you've seen hangs on reboot with mfs this should solve it (I repeat this
for the fourth time now, but this time I spent two months fixing and
redesigning this and reading the code so this time I must have gotten