freebsd-dev/sys
Julian Elischer e9271f5376 Take out the single-threading code in fork.
After discussions with jeff, alc, (various Ironport people), david Xu,
and mostly Alfred (who found the problem) it has been demonstrated that this
is not needed for our implementations of threads and represents a real
(as in we've seen it happen a lot) deadlock danger.

Several points:
 Since forking multiple threads is not allowed, and posix states that
 any mutexes owned by othre threads wilol be owned in the child by
 phantom threads, and therads shouldn't ba accessing shared structures without
 protection, It can be proved that if this leads to the child process accessing
 inconsistent data, it's a programming error.

 The mode of thread_single() being used in fork() is the wrong one.
 It is using SINGLE_NO_EXIT when it should be using SINGLE_BOUNDARY.

 Even if this we used, System processes have no need to do it as they have
 no userland to get inconsistent.

  This commmit first fixes the above bugs to get tehm correct in CVS.
  then removes them with #ifdef.
  This is so that history contains the corrected version should it
  be needed in the future.
  This code may be needed if we implement the forkall() syscall from
  Solaris. It may be needed for other non-posix thread libraries
  at some time in the future, so let the code sit for a short while
  while I do some work on it anyhow.

This removes a reproducible lockup in NFS.
It may be argued that maybe doing a fork while holding a vnode lock may
not be the best idea in th efirst place but it shouldn't cause a deadlock.
The removal has been running under soak test for several days now.

This removal should be seriously considered for 7.0 and RELENG_6.

Note. There is code in the core-dumping code that may have a similar problem
with coredumping threaded processes

MFC After: 4 days
2007-10-23 17:54:15 +00:00
..
amd64 Switch over to ULE as the default scheduler for amd64 and i386 2007-10-19 12:30:33 +00:00
arm correct guard variable names. 2007-10-18 05:43:44 +00:00
boot Optimize for size on pc98. It enables to boot a kernel again. 2007-10-15 14:20:24 +00:00
bsm Merge OpenBSM 1.0 alpha 15 changes to src/sys/bsm: 2007-07-22 12:28:13 +00:00
cam Rename the kthread_xxx (e.g. kthread_create()) calls 2007-10-20 23:23:23 +00:00
cddl Rename the kthread_xxx (e.g. kthread_create()) calls 2007-10-20 23:23:23 +00:00
compat Rename the kthread_xxx (e.g. kthread_create()) calls 2007-10-20 23:23:23 +00:00
conf Backout sensors framework. 2007-10-15 20:00:24 +00:00
contrib Rename the kthread_xxx (e.g. kthread_create()) calls 2007-10-20 23:23:23 +00:00
crypto Commit the change from FAST_IPSEC to IPSEC. The FAST_IPSEC 2007-07-03 12:13:45 +00:00
ddb Print the stack bounds of the thread. 2007-10-16 17:52:59 +00:00
dev - Use pci_enable_busmaster() to turn on busmaster. 2007-10-23 04:25:43 +00:00
fs Fixes to msdosfs dirtyflag related stuff: 2007-10-22 17:43:43 +00:00
gdb Add kdb_cpu_sync_icache(), intended to synchronize instruction 2007-06-09 21:55:17 +00:00
geom Add the freebsd-zfs alias. Both APM and GPT have ZFS partition 2007-10-21 20:02:57 +00:00
gnu Get rid of qaddr_t. 2007-10-16 10:54:55 +00:00
i4b Spelling fix for interupt -> interrupt 2007-10-12 06:03:46 +00:00
i386 Rename the kthread_xxx (e.g. kthread_create()) calls 2007-10-20 23:23:23 +00:00
ia64 Set PTE_ACCESSED in the PTE and before inserting it in the VHPT. 2007-10-16 03:20:32 +00:00
isa It seems that some i386 mothermoards either do not implement the 2007-07-27 09:34:42 +00:00
kern Take out the single-threading code in fork. 2007-10-23 17:54:15 +00:00
libkern Do not use __XSCALE__ to detect if clz is available, use _ARM_ARCH_5 instead. 2007-10-13 12:05:36 +00:00
modules Add Winchiphead (or Nanjin QinHeng Electronics) USB Serial converter driver. 2007-10-18 10:51:06 +00:00
net Close a race when trying to lookup a gateway route in rt_check(). 2007-10-22 19:01:26 +00:00
net80211 invalidate ic_prevchan when constructing a new channel list 2007-09-18 21:54:27 +00:00
netatalk Mark wire data structures in netatalk as __packed so that they are 2007-06-28 12:54:58 +00:00
netatm Disconnect netatm from the build as it is not MPSAFE and relies on 2007-07-14 21:49:24 +00:00
netgraph Fix build with NETGRAPH_DEBUG. 2007-10-19 20:09:58 +00:00
netinet Rename the kthread_xxx (e.g. kthread_create()) calls 2007-10-20 23:23:23 +00:00
netinet6 Close a race when trying to lookup a gateway route in rt_check(). 2007-10-22 19:01:26 +00:00
netipsec Fix for an infinite loop in processing ESP, IPv6 packets. 2007-09-12 05:54:53 +00:00
netipx Make tcpstates[] static, and make sure TCPSTATES is defined before 2007-07-30 11:06:42 +00:00
netnatm s/destory/destroy/ (except for the code in contrib/). 2007-04-16 12:31:35 +00:00
netncp Commit 14/14 of sched_lock decomposition. 2007-06-05 00:00:57 +00:00
netsmb Rename the kthread_xxx (e.g. kthread_create()) calls 2007-10-20 23:23:23 +00:00
nfs
nfs4client Rename the kthread_xxx (e.g. kthread_create()) calls 2007-10-20 23:23:23 +00:00
nfsclient Rename the kthread_xxx (e.g. kthread_create()) calls 2007-10-20 23:23:23 +00:00
nfsserver Add a -z flag to nfsstat which zeros the NFS statistics after displaying 2007-10-18 16:38:07 +00:00
opencrypto Rename the kthread_xxx (e.g. kthread_create()) calls 2007-10-20 23:23:23 +00:00
pc98 Spelling fix for interupt -> interrupt 2007-10-12 06:03:46 +00:00
pccard
pci Oops, convert a tsleep() to a msleep() that was missed when adding locking 2007-10-15 16:18:20 +00:00
powerpc Cut over to ULE on PowerPC 2007-10-23 00:52:25 +00:00
rpc Remove the now-unused NET_{LOCK,UNLOCK,ASSERT}_GIANT() macros, which 2007-08-06 14:26:03 +00:00
security Bump MAC_VERSION to 4 and add an 8.x line in the version table. Version 4 2007-10-23 14:12:16 +00:00
sparc64 - Fix the handling of R_SPARC_OLO10, which is a bit of a special case 2007-10-16 19:17:48 +00:00
sun4v Rename the kthread_xxx (e.g. kthread_create()) calls 2007-10-20 23:23:23 +00:00
sys Add the full module path name to the kld_file_stat structure 2007-10-22 04:12:57 +00:00
tools Catch up with ACPI-CA 20070320 import. 2007-03-22 18:16:43 +00:00
ufs Rename the kthread_xxx (e.g. kthread_create()) calls 2007-10-20 23:23:23 +00:00
vm Correct an error of omission in the reimplementation of the page 2007-10-22 06:23:46 +00:00
Makefile Complete repo-copy and move of Coda from src/sys/coda to src/sys/fs/coda 2007-07-12 21:04:58 +00:00