freebsd-nq/sys
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
..
alpha SMP Lock struct file, filedesc and the global file list. 2002-01-13 11:58:06 +00:00
amd64 Clear the single-step flag for signal handlers. This fixes bogus trace 2002-01-10 11:49:55 +00:00
arm We need machine/{signal,ucontext}.h to build a cross GCC compiler. 2001-12-09 19:39:49 +00:00
boot Make the alpha boot1 work on filesystems that have a block size 2002-01-11 16:14:34 +00:00
cam Define the kern.cam sysctl in the cam layer, rather than multiply in several 2002-01-09 03:39:04 +00:00
coda Staticise the coda vfsop pointer. 2002-01-08 19:33:51 +00:00
compat SMP Lock struct file, filedesc and the global file list. 2002-01-13 11:58:06 +00:00
conf Drop <bsd.man.mk> support from <bsd.kmod.mk>. 2002-01-11 15:49:02 +00:00
contrib Import this patch to address user concerns. 2002-01-04 12:32:34 +00:00
crypto fixed the cast128 calculation with a short cipher key length. 2001-11-27 14:11:47 +00:00
ddb Implement a "kill" DDB command which is an interface to psignal() that 2001-11-27 19:56:28 +00:00
dev SMP Lock struct file, filedesc and the global file list. 2002-01-13 11:58:06 +00:00
fs SMP Lock struct file, filedesc and the global file list. 2002-01-13 11:58:06 +00:00
geom Reduce kernel stack usage of ccdinit() by MAXPATHLEN by using MALLOC(9). 2001-12-30 17:34:19 +00:00
gnu Update to C99, s/__FUNCTION__/__func__/, 2001-12-10 08:09:49 +00:00
i4b Fix some places where the macro L0IFPIUNIT was used instead of the correct 2002-01-02 12:55:04 +00:00
i386 SMP Lock struct file, filedesc and the global file list. 2002-01-13 11:58:06 +00:00
ia64 Convert a bunch of 1 << PCPU_GET(cpuid) to PCPU_GET(cpumask). 2002-01-05 09:41:37 +00:00
isa Use the new resource_list_print_type() function. 2001-12-21 21:54:56 +00:00
isofs/cd9660 Fix mounting root from a ISO9660 filesystem on a SCSI CDROM. 2001-11-27 03:55:43 +00:00
kern SMP Lock struct file, filedesc and the global file list. 2002-01-13 11:58:06 +00:00
libkern rcsid[]->__FBSDID 2001-11-07 19:55:16 +00:00
modules Export "ng_ether_enaddr_type" because the ng_bridge type uses it. 2002-01-12 17:31:25 +00:00
net It turns out that when a broadcast packet is looped back, the checksums 2002-01-11 16:04:47 +00:00
netatalk Give struct socket structures a ref counting interface similar to 2001-11-17 03:07:11 +00:00
netatm Initialise the intrq_present fields at runtime, not link time. This allows 2002-01-08 10:34:03 +00:00
netgraph SMP Lock struct file, filedesc and the global file list. 2002-01-13 11:58:06 +00:00
netinet Fix a panic condition in icmp_reflect() introduced in rev. 1.61. 2002-01-11 12:13:57 +00:00
netinet6 Initialise the intrq_present fields at runtime, not link time. This allows 2002-01-08 10:34:03 +00:00
netipx Initialise the intrq_present fields at runtime, not link time. This allows 2002-01-08 10:34:03 +00:00
netkey Newer SA is prefered for a out-bound packet than old one 2001-12-05 05:40:49 +00:00
netnatm Initialise the intrq_present fields at runtime, not link time. This allows 2002-01-08 10:34:03 +00:00
netncp Update to C99, s/__FUNCTION__/__func__/, 2001-12-10 08:09:49 +00:00
netns Initialise the intrq_present fields at runtime, not link time. This allows 2002-01-08 10:34:03 +00:00
netsmb SMP Lock struct file, filedesc and the global file list. 2002-01-13 11:58:06 +00:00
nfs When the old nfsm_adv() macro was moved to nfsm_adv_xx(), a '>=' 2001-12-31 06:56:31 +00:00
nfsclient Terminate requests in nfs_sigintr() if the filesystem is in the 2002-01-10 02:15:35 +00:00
nfsserver It is required by VOP_CREATE, VOP_MKNOD, VOP_SYMLINK and VOP_MKDIR 2002-01-13 05:36:05 +00:00
pc98 Clear the single-step flag for signal handlers. This fixes bogus trace 2002-01-10 11:49:55 +00:00
pccard Avoid doubly defining machdep.pccard 2002-01-08 19:35:27 +00:00
pci Add support for newer integrated SiS 900 controllers on the 635 and 735 2002-01-12 21:12:17 +00:00
posix4 KSE Milestone 2 2001-09-12 08:38:13 +00:00
powerpc Modify the critical section API as follows: 2001-12-18 00:27:18 +00:00
rpc
security/lomac s/sonewconn3/sonewconn/ forgotten by the modifier. 2001-12-26 18:31:22 +00:00
sparc64 Add upa.h, which I had previously forgotten, to unbreak the sparc64 2002-01-08 16:25:51 +00:00
svr4
sys SMP Lock struct file, filedesc and the global file list. 2002-01-13 11:58:06 +00:00
tools Throw the $FreeBSD$s back in, properly escaping them. 2002-01-04 05:27:47 +00:00
ufs SMP Lock struct file, filedesc and the global file list. 2002-01-13 11:58:06 +00:00
vm SMP Lock struct file, filedesc and the global file list. 2002-01-13 11:58:06 +00:00
Makefile