freebsd-dev/sys
Konstantin Belousov 94f4ac214c An inode block must not be blockingly read while cg block is owned.
The order is inode buffer lock -> snaplk -> cg buffer lock, reversing
the order causes deadlocks.

Inode block must not be written while cg block buffer is owned. The
FFS copy on write needs to allocate a block to copy the content of the
inode block, and the cylinder group selected for the allocation might
be the same as the owned cg block.  The reserved block detection code
in the ffs_copyonwrite() and ffs_bp_snapblk() is unable to detect the
situation, because the locked cg buffer is not exposed to it.

In order to maintain the dependency between initialized inode block
and the cg_initediblk pointer, look up the inode buffer in
non-blocking mode. If succeeded, brelse cg block, initialize the inode
block and write it.  After the write is finished, reread cg block and
update the cg_initediblk.

If inode block is already locked by another thread, let the another
thread initialize it.  If another thread raced with us after we
started writing inode block, the situation is detected by an update of
cg_initediblk.  Note that double-initialization of the inode block is
harmless, the block cannot be used until cg_initediblk is incremented.

Sponsored by:	The FreeBSD Foundation
In collaboration with:	pho
Reviewed by:	mckusick
MFC after:	1 month
X-MFC-note:	after r246877
2013-02-27 07:31:23 +00:00
..
amd64 Convert machine/elf.h, machine/frame.h, machine/sigframe.h, 2013-02-20 17:39:52 +00:00
arm Merge from vmc-playground branch: 2013-02-26 23:35:27 +00:00
boot Adjust the arm kernel entry point address properly regardless of whether the 2013-02-26 03:24:45 +00:00
bsm Style. 2013-02-11 23:14:54 +00:00
cam Hide SEMB port of the SiI3826 Port Multiplier by default to avoid extra 2013-02-22 19:53:12 +00:00
cddl Be more verbose on ZFS deadman I/O panic 2013-02-26 20:41:27 +00:00
compat Reduce duplication between i386/linux/linux.h and amd64/linux32/linux.h 2013-01-29 18:41:30 +00:00
conf cxgbe(4): Update firmware to 1.8.4.0. 2013-02-26 00:10:28 +00:00
contrib Merge ACPICA 20130214. 2013-02-15 20:36:28 +00:00
crypto When porting XTS-related code from OpenBSD I forgot to update copyright (only 2013-02-20 22:59:53 +00:00
ddb Small textdump enhancements. 2012-11-01 04:07:08 +00:00
dev RX checksum offloading on old Yukon controllers seem to cause more 2013-02-27 05:03:35 +00:00
fs Eliminate a duplicate #include. 2013-02-26 07:00:24 +00:00
gdb
geom Add barrier write capability to the VFS buffer interface. A barrier 2013-02-16 14:51:30 +00:00
gnu/fs r16312 is not any longer real since many years (likely since when VFS 2012-11-19 22:43:45 +00:00
i386 Locking for todr got pushed down into inittodr and the client 2013-02-21 07:16:40 +00:00
ia64 kernacc() expects all KVAs to be covered in the kernel map. With the 2013-02-25 02:41:38 +00:00
isa
kern Add support for good old 8192Hz profiling clock to software PMC. 2013-02-26 18:13:42 +00:00
kgssapi Piete.Brooks at cl.cam.ac.uk reported via email a crash which was 2012-12-18 00:25:48 +00:00
libkern Add __aeabi_ulcmp to allow building of the LINT kernel. 2013-01-23 09:18:18 +00:00
mips Merge from vmobj-rwlock branch: 2013-02-26 01:00:11 +00:00
modules cxgbe(4): Update firmware to 1.8.4.0. 2013-02-26 00:10:28 +00:00
net Finish the r244185. This fixes ever growing counter of pfsync bad 2013-02-15 09:03:56 +00:00
net80211 Disable this variable; the code using it is also disabled. 2013-02-18 01:37:55 +00:00
netatalk Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
netgraph Fix compilation warning. 2013-02-15 07:58:51 +00:00
netinet Fix tcp_lro_rx_ipv4() for drivers that do not set CSUM_IP_CHECKED. 2013-02-21 17:00:35 +00:00
netinet6 Generate lle_event in the IPv6 neighbor discovery code too. 2013-01-26 00:05:22 +00:00
netipsec Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
netipx Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
netnatm Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
netncp Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
netpfil Finish the r244185. This fixes ever growing counter of pfsync bad 2013-02-15 09:03:56 +00:00
netsmb Mechanically substitute flags from historic mbuf allocator with 2012-12-05 08:04:20 +00:00
nfs Remove the unused nfs_curusec(). 2013-01-17 19:03:24 +00:00
nfsclient Further refine the handling of stop signals in the NFS client. The 2013-02-21 19:02:50 +00:00
nfsserver Use vfs_timestamp() to set file timestamps rather than invoking 2013-01-18 18:43:38 +00:00
nlm Remove the support for using non-mpsafe filesystem modules. 2012-10-22 17:50:54 +00:00
ofed Fix LINT build on amd64. 2013-02-09 04:13:45 +00:00
opencrypto When porting XTS-related code from OpenBSD I forgot to update copyright (only 2013-02-20 22:59:53 +00:00
pc98 Remove support for plip from the GENERIC kernel as no systems in the 2013-02-01 20:17:11 +00:00
pci Fix build. 2013-02-21 12:52:18 +00:00
powerpc Merge from vmc-playground branch: 2013-02-26 23:35:27 +00:00
rpc Add support for backchannels to the kernel RPC. Backchannels 2012-12-08 00:29:16 +00:00
security Remove redundant check. 2013-02-17 11:57:47 +00:00
sparc64 Merge from vmobj-rwlock branch: 2013-02-26 01:00:11 +00:00
sys Revert r247300 for now. I'll post a new changeset for review. 2013-02-26 19:46:59 +00:00
teken
tools Further refine the handling of stop signals in the NFS client. The 2013-02-21 19:02:50 +00:00
ufs An inode block must not be blockingly read while cg block is owned. 2013-02-27 07:31:23 +00:00
vm Merge from vmc-playground branch: 2013-02-26 23:35:27 +00:00
x86 Use critical_enter/critical_exit around the time sensitive part of 2013-02-21 15:35:48 +00:00
xdr
xen Move the corresponding MTX_SYSINIT() next to their struct mtx declaration 2012-10-26 17:31:35 +00:00
Makefile Run cscope with the -v parameter to make it more user-friendly. 2012-12-02 20:51:24 +00:00