ad 42d0626726 PR kern/38141 lookup/vfs_busy acquire rwlock recursively
Simplify the mount locking. Remove all the crud to deal with recursion on
the mount lock, and crud to deal with unmount as another weirdo lock.

Hopefully this will once and for all fix the deadlocks with this. With this
commit there are two locks on each mount:

- krwlock_t mnt_unmounting. This is used to prevent unmount across critical
  sections like getnewvnode(). It's only ever read locked with rw_tryenter(),
  and is only ever write locked in dounmount(). A write hold can't be taken
  on this lock if the current LWP could hold a vnode lock.

- kmutex_t mnt_updating. This is taken by threads updating the mount, for
  example when going r/o -> r/w, and is only present to serialize updates.
  In order to take this lock, a read hold must first be taken on
  mnt_unmounting, and the two need to be held across the operation.

One effect of this change: previously if an unmount failed, we would make a
half hearted attempt to back out of it gracefully, but that was unlikely to
work in a lot of cases. Now while an unmount that will be aborted is in
progress, new file operations within the mount will fail instead of being
delayed. That is unlikely to be a problem though, because if the admin
requests unmount of a file system then s(he) has made a decision to deny
access to the resource.
2008-05-06 18:43:44 +00:00
..

	$NetBSD: README.dirs,v 1.3 2007/08/16 19:56:22 pooka Exp $

    Runnable Userspace Meta Programs

Quick rundown of the current directory structure:

/librump - kernel runtime emulation
  /rumpkern - portion compiled with -D_KERNEL, uses kernel headers
  /rumpuser - userspace namespace support for previous, *NO* -D_KERNEL
	      provides e.g. malloc() and some syscalls

/include
  /machine - headers meant to be used for rump compilation when the MD
	     ones cause too much trouble, e.g. curlwp which is different
	     from arch to arch

/fs - file system rumps
  /lib - libraries used by fs rumps
    /lib$fs  - kernel file system code compiled out of /sys with -D_KERNEL
    /libp2k  - puffs-to-vfs adaption layer, userspace namespace
    /libukfs - user kernel file system, a library to access file system
	       images (or devices) directly in userspace without going
	       through a system call and puffs
  /bin - rumps themselves.  fsconsole uses ukfs directly.  the rest are
	 file system specific rumps and use puffs