]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
MFC r303763,303791,303869: zfs: honour and make use of vfs vnode locking protocol
authoravg <avg@FreeBSD.org>
Thu, 11 Aug 2016 20:48:03 +0000 (20:48 +0000)
committeravg <avg@FreeBSD.org>
Thu, 11 Aug 2016 20:48:03 +0000 (20:48 +0000)
commit07c8f0654ee0b98f45b11e7fec38bc6f4e0b4ec6
treeccac0752d618b0e7e0122d2964662552812698ff
parentbc904e4d3ae9971c7f4e82ca35c3b6940ba60a19
MFC r303763,303791,303869: 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
Approved by: re (gjb)
sys/cddl/compat/opensolaris/sys/vnode.h
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_dir.h
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_sa.c
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c