freebsd-src/sys/fs
Alfred Perlstein 426da3bcfb SMP Lock struct file, filedesc and the global file list.
Seigo Tanimura (tanimura) posted the initial delta.

I've polished it quite a bit reducing the need for locking and
adapting it for KSE.

Locks:

1 mutex in each filedesc
   protects all the fields.
   protects "struct file" initialization, while a struct file
     is being changed from &badfileops -> &pipeops or something
     the filedesc should be locked.

1 mutex in each struct file
   protects the refcount fields.
   doesn't protect anything else.
   the flags used for garbage collection have been moved to
     f_gcflag which was the FILLER short, this doesn't need
     locking because the garbage collection is a single threaded
     container.
  could likely be made to use a pool mutex.

1 sx lock for the global filelist.

struct file *	fhold(struct file *fp);
        /* increments reference count on a file */

struct file *	fhold_locked(struct file *fp);
        /* like fhold but expects file to locked */

struct file *	ffind_hold(struct thread *, int fd);
        /* finds the struct file in thread, adds one reference and
                returns it unlocked */

struct file *	ffind_lock(struct thread *, int fd);
        /* ffind_hold, but returns file locked */

I still have to smp-safe the fget cruft, I'll get to that asap.
2002-01-13 11:58:06 +00:00
..
cd9660 Fix mounting root from a ISO9660 filesystem on a SCSI CDROM. 2001-11-27 03:55:43 +00:00
coda Staticise the coda vfsop pointer. 2002-01-08 19:33:51 +00:00
deadfs Undo part of the tangle of having sys/lock.h and sys/mutex.h included in 2001-05-01 08:13:21 +00:00
devfs Add a new sysinit SI_SUB_DEVFS. Devfs hooks into the kernel at SI_ORDER_FIRST, 2002-01-09 04:58:49 +00:00
fdescfs SMP Lock struct file, filedesc and the global file list. 2002-01-13 11:58:06 +00:00
fifofs SMP Lock struct file, filedesc and the global file list. 2002-01-13 11:58:06 +00:00
hpfs Fix a BUF_TIMELOCK race against BUF_LOCK and fix a deadlock in vget() 2001-12-20 22:42:27 +00:00
msdosfs Fix a BUF_TIMELOCK race against BUF_LOCK and fix a deadlock in vget() 2001-12-20 22:42:27 +00:00
ntfs Fix a BUF_TIMELOCK race against BUF_LOCK and fix a deadlock in vget() 2001-12-20 22:42:27 +00:00
nullfs KSE Milestone 2 2001-09-12 08:38:13 +00:00
nwfs Fix a BUF_TIMELOCK race against BUF_LOCK and fix a deadlock in vget() 2001-12-20 22:42:27 +00:00
portalfs SMP Lock struct file, filedesc and the global file list. 2002-01-13 11:58:06 +00:00
procfs Remove an obsolete prototype for procfs_kmemaccess(). 2001-12-11 19:07:10 +00:00
pseudofs Staticise pfs_vncache, it's not used anywhere else. 2002-01-08 11:15:57 +00:00
smbfs Fix a BUF_TIMELOCK race against BUF_LOCK and fix a deadlock in vget() 2001-12-20 22:42:27 +00:00
specfs Change the kernel's ucred API as follows: 2001-10-11 23:38:17 +00:00
umapfs Assert that a ucred is unshared before we remap its ids. 2001-10-20 03:30:34 +00:00
unionfs SMP Lock struct file, filedesc and the global file list. 2002-01-13 11:58:06 +00:00