freebsd kernel with SKQ
Go to file
kib df9f3d2faa Fix locking for f_offset, vn_read() and vn_write() cases only, for now.
It seems that intended locking protocol for struct file f_offset field
was as follows: f_offset should always be changed under the vnode lock
(except fcntl(2) and lseek(2) did not followed the rules). Since
read(2) uses shared vnode lock, FOFFSET_LOCKED block is additionally
taken to serialize shared vnode lock owners.

This was broken first by enabling shared lock on writes, then by
fadvise changes, which moved f_offset assigned from under vnode lock,
and last by vn_io_fault() doing chunked i/o. More, due to uio_offset
not yet valid in vn_io_fault(), the range lock for reads was taken on
the wrong region.

Change the locking for f_offset to always use FOFFSET_LOCKED block,
which is placed before rangelocks in the lock order.

Extract foffset_lock() and foffset_unlock() functions which implements
FOFFSET_LOCKED lock, and consistently lock f_offset with it in the
vn_io_fault() both for reads and writes, even if MNTK_NO_IOPF flag is
not set for the vnode mount. Indicate that f_offset is already valid
for vn_read() and vn_write() calls from vn_io_fault() with FOF_OFFSET
flag, and assert that all callers of vn_read() and vn_write() follow
this protocol.

Extract get_advice() function to calculate the POSIX_FADV_XXX value
for the i/o region, and use it were appropriate.

Reviewed by:	jhb
Tested by:	pho
MFC after:	2 weeks
2012-06-21 09:19:41 +00:00
bin Polish previous revision: if the fts_* routines have lstat()'ed the 2012-06-20 21:10:38 +00:00
cddl Do not remount ZFS dataset if changing canmount property to "on" and 2012-06-15 07:38:21 +00:00
contrib Remove end of line whitespace. 2012-06-17 11:36:28 +00:00
crypto Update the previous openssl fix. [12:01] 2012-05-30 12:01:28 +00:00
etc Only output a list of file systems that need to be dumped if the system 2012-06-20 20:01:51 +00:00
games Partial revert of previous commit as some of the changes were not 2012-05-10 12:46:12 +00:00
gnu Turn on TLS support for arm on here as it is supported since r231618/ 2012-06-14 20:27:28 +00:00
include Install filemon.h into /usr/include for userland consumption. 2012-06-20 00:09:47 +00:00
kerberos5 Centralize the specification of the krb5 build tools. 2012-06-01 21:26:28 +00:00
lib Don't close an uninitialized descriptor. [1] 2012-06-20 06:38:41 +00:00
libexec Eliminate the static buffer used to read the first page of the mapped 2012-06-14 11:20:22 +00:00
release Remove dead code. 2012-06-12 15:32:14 +00:00
rescue Disable jail support in ifconfig when either building a rescue 2012-02-14 07:14:42 +00:00
sbin Add progress.c and progress.h, missed in the previous commit to camcontrol. 2012-06-20 04:11:34 +00:00
secure Update the previous openssl fix. [12:01] 2012-05-30 12:01:28 +00:00
share Now that there is an est(4) man page, reference it here in cpufreq(4). 2012-06-20 17:26:22 +00:00
sys Fix locking for f_offset, vn_read() and vn_write() cases only, for now. 2012-06-21 09:19:41 +00:00
tools Provide a mechanism to not clear out the work and output dirs when 2012-06-20 21:38:16 +00:00
usr.bin Currently the code uses gzFile * for a zlib file descriptor, which 2012-06-20 23:53:36 +00:00
usr.sbin Fix ARM compilation issue. 2012-06-20 17:20:25 +00:00
COPYRIGHT Happy 2012 to FreeBSD users in Samoa. 2011-12-31 04:38:04 +00:00
LOCKS
MAINTAINERS Add man page and update a few other files in preparation for committing full isci driver. 2012-01-23 22:30:09 +00:00
Makefile Assume a big-endian default on MIPS and drop the "eb" suffix from MACHINE_ARCH. 2012-03-29 02:54:35 +00:00
Makefile.inc1 Minor wording change. The previous commit message should have included: 2012-06-15 19:42:49 +00:00
ObsoleteFiles.inc Also remove /usr/share/examples/etc/auth.conf, which I didn't even 2012-06-13 16:40:47 +00:00
README Add the cddl/ directory. 2010-11-14 11:32:56 +00:00
UPDATING Introduce "feature flags" for ZFS pools (bump SPA version to 5000). 2012-06-11 11:35:22 +00:00

This is the top level of the FreeBSD source directory.  This file
was last revised on:
$FreeBSD$

For copyright information, please see the file COPYRIGHT in this
directory (additional copyright information also exists for some
sources in this tree - please see the specific source directories for
more information).

The Makefile in this directory supports a number of targets for
building components (or all) of the FreeBSD source tree, the most
commonly used one being ``world'', which rebuilds and installs
everything in the FreeBSD system from the source tree except the
kernel, the kernel-modules and the contents of /etc.  The ``world''
target should only be used in cases where the source tree has not
changed from the currently running version.  See:
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html
for more information, including setting make(1) variables.

The ``buildkernel'' and ``installkernel'' targets build and install
the kernel and the modules (see below).  Please see the top of
the Makefile in this directory for more information on the
standard build targets and compile-time flags.

Building a kernel is a somewhat more involved process, documentation
for which can be found at:
   http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig.html
And in the config(8) man page.
Note: If you want to build and install the kernel with the
``buildkernel'' and ``installkernel'' targets, you might need to build
world before.  More information is available in the handbook.

The sample kernel configuration files reside in the sys/<arch>/conf
sub-directory (assuming that you've installed the kernel sources), the
file named GENERIC being the one used to build your initial installation
kernel.  The file NOTES contains entries and documentation for all possible
devices, not just those commonly used.  It is the successor of the ancient
LINT file, but in contrast to LINT, it is not buildable as a kernel but a
pure reference and documentation file.


Source Roadmap:
---------------
bin		System/user commands.

cddl		Various commands and libraries under the Common Development
		and Distribution License.

contrib		Packages contributed by 3rd parties.

crypto		Cryptography stuff (see crypto/README).

etc		Template files for /etc.

games		Amusements.

gnu		Various commands and libraries under the GNU Public License.
		Please see gnu/COPYING* for more information.

include		System include files.

kerberos5	Kerberos5 (Heimdal) package.

lib		System libraries.

libexec		System daemons.

release		Release building Makefile & associated tools.

rescue		Build system for statically linked /rescue utilities.

sbin		System commands.

secure		Cryptographic libraries and commands.

share		Shared resources.

sys		Kernel sources.

tools		Utilities for regression testing and miscellaneous tasks.

usr.bin		User commands.

usr.sbin	System administration commands.


For information on synchronizing your source tree with one or more of
the FreeBSD Project's development branches, please see:

  http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/synching.html