FreeBSD src
Go to file
Andriy Gapon f79bc17233 zfs: honour and make use of vfs vnode locking protocol
ZFS POSIX Layer is originally written for Solaris VFS which is very
different from FreeBSD VFS.  Most importantly many things that FreeBSD VFS
manages on behalf of all filesystems are implemented in ZPL in a different
way.
Thus, ZPL contains code that is redundant on FreeBSD or duplicates VFS
functionality or, in the worst cases, badly interacts / interferes
with VFS.

The most prominent problem is a deadlock caused by the lock order reversal
of vnode locks that may happen with concurrent zfs_rename() and lookup().
The deadlock is a result of zfs_rename() not observing the vnode locking
contract expected by VFS.

This commit removes all ZPL internal locking that protects parent-child
relationships of filesystem nodes.  These relationships are protected
by vnode locks and the code is changed to take advantage of that fact
and to properly interact with VFS.

Removal of the internal locking allowed all ZPL dmu_tx_assign calls to
use TXG_WAIT mode.

Another victim, disputable perhaps, is ZFS support for filesystems with
mixed case sensitivity.  That support is not provided by the OS anyway,
so in ZFS it was a buch of dead code.

To do:
- replace ZFS_ENTER mechanism with VFS managed / visible mechanism
- replace zfs_zget with zfs_vget[f] as much as possible
- get rid of not really useful now zfs_freebsd_* adapters
- more cleanups of unneeded / unused code
- fix / replace .zfs support

PR:		209158
Reported by:	many
Tested by:	many (thank you all!)
MFC after:	5 days
Sponsored by:	HybridCluster / ClusterHQ
Differential Revision: https://reviews.freebsd.org/D6533
2016-08-05 06:23:06 +00:00
bin uuid_to_string(3) is allocating memory and can fail on that. 2016-08-03 18:04:08 +00:00
cddl Cast result from third parameter to int instead of promoting it to size_t 2016-07-31 06:03:27 +00:00
contrib Fix a style(9) bug. 2016-08-03 20:21:58 +00:00
crypto Remove DSA from default cipher list and disable SSH1. 2016-08-03 16:08:21 +00:00
etc Disable DSA again. 2016-08-03 16:34:20 +00:00
gnu rename ARM's libunwind.S to to avoid conflict with llvm libunwind 2016-07-27 16:34:19 +00:00
include tools/build looks for _WITH_GETLINE in /usr/include/stdio.h to see if 2016-08-02 21:55:23 +00:00
kerberos5 DIRDEPS_BUILD: Update dependencies 2016-06-14 16:55:05 +00:00
lib Grammar fixes. 2016-08-04 11:38:53 +00:00
libexec Fix dlsym(RTLD_NEXT) handling to only return the next library in last library cases. 2016-07-15 19:07:00 +00:00
release Create a /usr/home -> /home symlink for the arm images to 2016-07-20 22:49:33 +00:00
rescue DIRDEPS_BUILD: Fix and hookup rescue/rescue to the build. 2016-05-26 23:20:40 +00:00
sbin Fix a regression in pf.conf while parsing the 'interval' keyword. 2016-08-05 02:19:03 +00:00
secure Revert r301551, which added blacklistd(8) to sshd(8). 2016-06-24 23:22:42 +00:00
share Grammar fixes. 2016-08-04 11:38:53 +00:00
sys zfs: honour and make use of vfs vnode locking protocol 2016-08-05 06:23:06 +00:00
targets Add clang-format under WITH_CLANG_EXTRAS. 2016-06-17 16:46:58 +00:00
tests Fix locking issues with aio_fsync(). 2016-07-29 18:26:15 +00:00
tools Remove calls to die added for associated bugs 2016-07-31 06:28:40 +00:00
usr.bin indent(1): Use bsearch() for looking up type keywords. 2016-08-04 15:27:09 +00:00
usr.sbin kgzip.8: note that it is deprecated and clarify BUGS section 2016-08-02 21:48:26 +00:00
.arcconfig Remove project.name which is a product of a bygone era. 2016-04-21 04:33:07 +00:00
.arclint phabricator related changes: 2015-04-20 20:33:22 +00:00
COPYRIGHT Bump copyright year. 2015-12-31 11:21:45 +00:00
LOCKS
MAINTAINERS Remove myself from kern_timeout.c yeah! 2016-07-27 20:37:32 +00:00
Makefile SYSTEM_COMPILER: Rework the logic to allow a 'make test-system-compiler'. 2016-07-24 18:05:05 +00:00
Makefile.inc1 Add libprocstat prebuild library dependencies. 2016-07-30 03:43:55 +00:00
Makefile.libcompat Don't disable binutils/elftoolchain bootstrapping with external compiler. 2016-07-24 18:50:11 +00:00
ObsoleteFiles.inc Add tblgen to ObsoleteFiles.inc, as it was renamed to llvm-tblgen. 2016-07-28 18:40:43 +00:00
README README: remove nonexistent 'games' directory. 2016-05-18 10:43:13 +00:00
UPDATING Minor wording improvements to the note about pipe(2) removal. 2016-07-20 18:00: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.  See build(7)
and 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.  See build(7), config(8),
and http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig.html
for more information.

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 kernel configuration files reside in the sys/<arch>/conf
sub-directory.  GENERIC is the default configuration used in release builds.
NOTES contains entries and documentation for all possible
devices, not just those commonly used.


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.

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.

tests		Regression tests which can be run by Kyua.  See tests/README
		for additional information.

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